update tag v1.2.201->v1.3.231 from github

Signed-off-by: andrew0229 <zhangzhao62@huawei.com>
This commit is contained in:
andrew0229 2023-03-03 06:16:01 +00:00
parent f377c0c144
commit 62046e31a8
49 changed files with 144074 additions and 76838 deletions

32
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Is this issue appropriate for the repository?**
Vulkan-Headers exists as a publishing mechanism for headers and related material sourced from multiple other repositories. If you have a problem with that material, it should *not* be reported here, but in the appropriate repository:
- https://github.com/KhronosGroup/Vulkan-Docs - C headers, XML, validusage.json, and generation scripts
- https://github.com/KhronosGroup/Vulkan-Hpp - C++ headers
- This repository - Repository structure, management, and build system *only*
See the repository README for more details.
**Describe the bug**
A clear and concise description of what the bug is. Please refer to specific files that are only in this repository, not copied from Vulkan-Docs or Vulkan-Hpp.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

View File

@ -17,24 +17,31 @@ import("//build_overrides/vulkan_headers.gni")
config("vulkan_headers_config") {
include_dirs = [ "include" ]
defines = []
if (is_win) {
defines = [ "VK_USE_PLATFORM_WIN32_KHR" ]
defines += [ "VK_USE_PLATFORM_WIN32_KHR" ]
}
if (defined(vulkan_use_x11) && vulkan_use_x11) {
defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
defines += [ "VK_USE_PLATFORM_XCB_KHR" ]
}
if (defined(vulkan_use_wayland) && vulkan_use_wayland) {
defines += [ "VK_USE_PLATFORM_WAYLAND_KHR" ]
if (defined(vulkan_wayland_include_dirs)) {
include_dirs += vulkan_wayland_include_dirs
}
}
if (is_android) {
defines = [ "VK_USE_PLATFORM_ANDROID_KHR" ]
defines += [ "VK_USE_PLATFORM_ANDROID_KHR" ]
}
if (is_fuchsia) {
defines = [ "VK_USE_PLATFORM_FUCHSIA" ]
defines += [ "VK_USE_PLATFORM_FUCHSIA" ]
}
if (is_mac) {
defines = [ "VK_USE_PLATFORM_METAL_EXT" ]
defines += [ "VK_USE_PLATFORM_METAL_EXT" ]
}
if (defined(is_ggp) && is_ggp) {
defines = [ "VK_USE_PLATFORM_GGP" ]
defines += [ "VK_USE_PLATFORM_GGP" ]
}
}

View File

@ -25,12 +25,13 @@ Files in this repository originate from:
### Specification repository (https://github.com/KhronosGroup/Vulkan-Docs)
* registry/cgenerator.py
* registry/conventions.py
* registry/spec_tools/conventions.py
* registry/generator.py
* registry/genvk.py
* registry/reg.py
* registry/spec_tools/util.py
* registry/validusage.json
* registry/video.xml
* registry/vk.xml
* registry/vkconventions.py
* All files under include/vulkan/ which are *not* listed explicitly as originating from another repository.

View File

@ -1,79 +1,82 @@
#ifndef VULKAN_VIDEO_CODEC_H264STD_H_
#define VULKAN_VIDEO_CODEC_H264STD_H_ 1
/*
** Copyright (c) 2019-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#ifndef VULKAN_VIDEO_CODEC_H264STD_H_
#define VULKAN_VIDEO_CODEC_H264STD_H_ 1
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "vk_video/vulkan_video_codecs_common.h"
// Vulkan 0.9 provisional Vulkan video H.264 encode and decode std specification version number
#define VK_STD_VULKAN_VIDEO_CODEC_H264_API_VERSION_0_9_5 VK_MAKE_VIDEO_STD_VERSION(0, 9, 5) // Patch version should always be set to 0
// Format must be in the form XX.XX where the first two digits are the major and the second two, the minor.
#define VK_STD_VULKAN_VIDEO_CODEC_H264_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_API_VERSION_0_9_5
#define VK_STD_VULKAN_VIDEO_CODEC_H264_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264"
// *************************************************
// Video H.264 common definitions:
// *************************************************
#define vulkan_video_codec_h264std 1
#include <stdint.h>
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS 2
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS 6
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS 64
#define STD_VIDEO_H264_MAX_NUM_LIST_REF 32
#define STD_VIDEO_H264_MAX_CHROMA_PLANES 2
typedef enum StdVideoH264ChromaFormatIdc {
STD_VIDEO_H264_CHROMA_FORMAT_IDC_MONOCHROME = 0,
STD_VIDEO_H264_CHROMA_FORMAT_IDC_420 = 1,
STD_VIDEO_H264_CHROMA_FORMAT_IDC_422 = 2,
STD_VIDEO_H264_CHROMA_FORMAT_IDC_444 = 3,
STD_VIDEO_H264_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264ChromaFormatIdc;
typedef enum StdVideoH264ProfileIdc {
STD_VIDEO_H264_PROFILE_IDC_BASELINE = 66, /* Only constrained baseline is supported */
STD_VIDEO_H264_PROFILE_IDC_BASELINE = 66,
STD_VIDEO_H264_PROFILE_IDC_MAIN = 77,
STD_VIDEO_H264_PROFILE_IDC_HIGH = 100,
STD_VIDEO_H264_PROFILE_IDC_HIGH_444_PREDICTIVE = 244,
STD_VIDEO_H264_PROFILE_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_PROFILE_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264ProfileIdc;
typedef enum StdVideoH264Level {
STD_VIDEO_H264_LEVEL_1_0 = 0,
STD_VIDEO_H264_LEVEL_1_1 = 1,
STD_VIDEO_H264_LEVEL_1_2 = 2,
STD_VIDEO_H264_LEVEL_1_3 = 3,
STD_VIDEO_H264_LEVEL_2_0 = 4,
STD_VIDEO_H264_LEVEL_2_1 = 5,
STD_VIDEO_H264_LEVEL_2_2 = 6,
STD_VIDEO_H264_LEVEL_3_0 = 7,
STD_VIDEO_H264_LEVEL_3_1 = 8,
STD_VIDEO_H264_LEVEL_3_2 = 9,
STD_VIDEO_H264_LEVEL_4_0 = 10,
STD_VIDEO_H264_LEVEL_4_1 = 11,
STD_VIDEO_H264_LEVEL_4_2 = 12,
STD_VIDEO_H264_LEVEL_5_0 = 13,
STD_VIDEO_H264_LEVEL_5_1 = 14,
STD_VIDEO_H264_LEVEL_5_2 = 15,
STD_VIDEO_H264_LEVEL_6_0 = 16,
STD_VIDEO_H264_LEVEL_6_1 = 17,
STD_VIDEO_H264_LEVEL_6_2 = 18,
STD_VIDEO_H264_LEVEL_INVALID = 0x7FFFFFFF
} StdVideoH264Level;
typedef enum StdVideoH264LevelIdc {
STD_VIDEO_H264_LEVEL_IDC_1_0 = 0,
STD_VIDEO_H264_LEVEL_IDC_1_1 = 1,
STD_VIDEO_H264_LEVEL_IDC_1_2 = 2,
STD_VIDEO_H264_LEVEL_IDC_1_3 = 3,
STD_VIDEO_H264_LEVEL_IDC_2_0 = 4,
STD_VIDEO_H264_LEVEL_IDC_2_1 = 5,
STD_VIDEO_H264_LEVEL_IDC_2_2 = 6,
STD_VIDEO_H264_LEVEL_IDC_3_0 = 7,
STD_VIDEO_H264_LEVEL_IDC_3_1 = 8,
STD_VIDEO_H264_LEVEL_IDC_3_2 = 9,
STD_VIDEO_H264_LEVEL_IDC_4_0 = 10,
STD_VIDEO_H264_LEVEL_IDC_4_1 = 11,
STD_VIDEO_H264_LEVEL_IDC_4_2 = 12,
STD_VIDEO_H264_LEVEL_IDC_5_0 = 13,
STD_VIDEO_H264_LEVEL_IDC_5_1 = 14,
STD_VIDEO_H264_LEVEL_IDC_5_2 = 15,
STD_VIDEO_H264_LEVEL_IDC_6_0 = 16,
STD_VIDEO_H264_LEVEL_IDC_6_1 = 17,
STD_VIDEO_H264_LEVEL_IDC_6_2 = 18,
STD_VIDEO_H264_LEVEL_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264LevelIdc;
typedef enum StdVideoH264PocType {
STD_VIDEO_H264_POC_TYPE_0 = 0,
STD_VIDEO_H264_POC_TYPE_1 = 1,
STD_VIDEO_H264_POC_TYPE_2 = 2,
STD_VIDEO_H264_POC_TYPE_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_POC_TYPE_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_POC_TYPE_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264PocType;
typedef enum StdVideoH264AspectRatioIdc {
@ -95,14 +98,16 @@ typedef enum StdVideoH264AspectRatioIdc {
STD_VIDEO_H264_ASPECT_RATIO_IDC_3_2 = 15,
STD_VIDEO_H264_ASPECT_RATIO_IDC_2_1 = 16,
STD_VIDEO_H264_ASPECT_RATIO_IDC_EXTENDED_SAR = 255,
STD_VIDEO_H264_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264AspectRatioIdc;
typedef enum StdVideoH264WeightedBipredIdc {
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_DEFAULT = 0,
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_EXPLICIT = 1,
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_IMPLICIT = 2,
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264WeightedBipredIdc;
typedef enum StdVideoH264ModificationOfPicNumsIdc {
@ -110,7 +115,8 @@ typedef enum StdVideoH264ModificationOfPicNumsIdc {
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_ADD = 1,
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_LONG_TERM = 2,
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_END = 3,
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264ModificationOfPicNumsIdc;
typedef enum StdVideoH264MemMgmtControlOp {
@ -121,40 +127,41 @@ typedef enum StdVideoH264MemMgmtControlOp {
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_SET_MAX_LONG_TERM_INDEX = 4,
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_ALL = 5,
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_CURRENT_AS_LONG_TERM = 6,
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264MemMgmtControlOp;
typedef enum StdVideoH264CabacInitIdc {
STD_VIDEO_H264_CABAC_INIT_IDC_0 = 0,
STD_VIDEO_H264_CABAC_INIT_IDC_1 = 1,
STD_VIDEO_H264_CABAC_INIT_IDC_2 = 2,
STD_VIDEO_H264_CABAC_INIT_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_CABAC_INIT_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_CABAC_INIT_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264CabacInitIdc;
typedef enum StdVideoH264DisableDeblockingFilterIdc {
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_DISABLED = 0,
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_ENABLED = 1,
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_PARTIAL = 2,
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264DisableDeblockingFilterIdc;
typedef enum StdVideoH264SliceType {
STD_VIDEO_H264_SLICE_TYPE_P = 0,
STD_VIDEO_H264_SLICE_TYPE_B = 1,
STD_VIDEO_H264_SLICE_TYPE_I = 2,
// reserved STD_VIDEO_H264_SLICE_TYPE_SP = 3,
// reserved STD_VIDEO_H264_SLICE_TYPE_SI = 4,
STD_VIDEO_H264_SLICE_TYPE_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_SLICE_TYPE_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264SliceType;
typedef enum StdVideoH264PictureType {
STD_VIDEO_H264_PICTURE_TYPE_P = 0,
STD_VIDEO_H264_PICTURE_TYPE_B = 1,
STD_VIDEO_H264_PICTURE_TYPE_I = 2,
// reserved STD_VIDEO_H264_PICTURE_TYPE_SP = 3,
// reserved STD_VIDEO_H264_PICTURE_TYPE_SI = 4,
STD_VIDEO_H264_PICTURE_TYPE_IDR = 5,
STD_VIDEO_H264_PICTURE_TYPE_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_PICTURE_TYPE_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264PictureType;
typedef enum StdVideoH264NonVclNaluType {
@ -165,9 +172,9 @@ typedef enum StdVideoH264NonVclNaluType {
STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_SEQUENCE = 4,
STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_STREAM = 5,
STD_VIDEO_H264_NON_VCL_NALU_TYPE_PRECODED = 6,
STD_VIDEO_H264_NON_VCL_NALU_TYPE_INVALID = 0x7FFFFFFF
STD_VIDEO_H264_NON_VCL_NALU_TYPE_INVALID = 0x7FFFFFFF,
STD_VIDEO_H264_NON_VCL_NALU_TYPE_MAX_ENUM = 0x7FFFFFFF
} StdVideoH264NonVclNaluType;
typedef struct StdVideoH264SpsVuiFlags {
uint32_t aspect_ratio_info_present_flag : 1;
uint32_t overscan_info_present_flag : 1;
@ -183,13 +190,14 @@ typedef struct StdVideoH264SpsVuiFlags {
uint32_t vcl_hrd_parameters_present_flag : 1;
} StdVideoH264SpsVuiFlags;
typedef struct StdVideoH264HrdParameters { // hrd_parameters
typedef struct StdVideoH264HrdParameters {
uint8_t cpb_cnt_minus1;
uint8_t bit_rate_scale;
uint8_t cpb_size_scale;
uint32_t bit_rate_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; // cpb_cnt_minus1 number of valid elements
uint32_t cpb_size_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; // cpb_cnt_minus1 number of valid elements
uint8_t cbr_flag[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; // cpb_cnt_minus1 number of valid elements
uint8_t reserved1;
uint32_t bit_rate_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
uint32_t cpb_size_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
uint8_t cbr_flag[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
uint32_t initial_cpb_removal_delay_length_minus1;
uint32_t cpb_removal_delay_length_minus1;
uint32_t dpb_output_delay_length_minus1;
@ -197,19 +205,22 @@ typedef struct StdVideoH264HrdParameters { // hrd_parameters
} StdVideoH264HrdParameters;
typedef struct StdVideoH264SequenceParameterSetVui {
StdVideoH264SpsVuiFlags flags;
StdVideoH264AspectRatioIdc aspect_ratio_idc;
uint16_t sar_width;
uint16_t sar_height;
uint8_t video_format;
uint8_t color_primaries;
uint8_t colour_primaries;
uint8_t transfer_characteristics;
uint8_t matrix_coefficients;
uint32_t num_units_in_tick;
uint32_t time_scale;
StdVideoH264HrdParameters* pHrdParameters; // must be a valid ptr to hrd_parameters, if nal_hrd_parameters_present_flag or vcl_hrd_parameters_present_flag are set
uint8_t max_num_reorder_frames;
uint8_t max_dec_frame_buffering;
StdVideoH264SpsVuiFlags flags;
uint8_t chroma_sample_loc_type_top_field;
uint8_t chroma_sample_loc_type_bottom_field;
uint32_t reserved1;
const StdVideoH264HrdParameters* pHrdParameters;
} StdVideoH264SequenceParameterSetVui;
typedef struct StdVideoH264SpsFlags {
@ -231,51 +242,39 @@ typedef struct StdVideoH264SpsFlags {
uint32_t vui_parameters_present_flag : 1;
} StdVideoH264SpsFlags;
typedef struct StdVideoH264ScalingLists
{
// scaling_list_present_mask has one bit for each
// seq_scaling_list_present_flag[i] for SPS OR
// pic_scaling_list_present_flag[i] for PPS,
// bit 0 - 5 are for each entry of ScalingList4x4
// bit 6 - 7 are for each entry plus 6 for ScalingList8x8
uint8_t scaling_list_present_mask;
// use_default_scaling_matrix_mask has one bit for each
// UseDefaultScalingMatrix4x4Flag[ i ] and
// UseDefaultScalingMatrix8x8Flag[ i - 6 ] for SPS OR PPS
// bit 0 - 5 are for each entry of ScalingList4x4
// bit 6 - 7 are for each entry plus 6 for ScalingList8x8
uint8_t use_default_scaling_matrix_mask;
typedef struct StdVideoH264ScalingLists {
uint16_t scaling_list_present_mask;
uint16_t use_default_scaling_matrix_mask;
uint8_t ScalingList4x4[STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS];
uint8_t ScalingList8x8[STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS];
} StdVideoH264ScalingLists;
typedef struct StdVideoH264SequenceParameterSet
{
typedef struct StdVideoH264SequenceParameterSet {
StdVideoH264SpsFlags flags;
StdVideoH264ProfileIdc profile_idc;
StdVideoH264Level level_idc;
uint8_t seq_parameter_set_id;
StdVideoH264LevelIdc level_idc;
StdVideoH264ChromaFormatIdc chroma_format_idc;
uint8_t seq_parameter_set_id;
uint8_t bit_depth_luma_minus8;
uint8_t bit_depth_chroma_minus8;
uint8_t log2_max_frame_num_minus4;
StdVideoH264PocType pic_order_cnt_type;
uint8_t log2_max_pic_order_cnt_lsb_minus4;
int32_t offset_for_non_ref_pic;
int32_t offset_for_top_to_bottom_field;
uint8_t log2_max_pic_order_cnt_lsb_minus4;
uint8_t num_ref_frames_in_pic_order_cnt_cycle;
uint8_t max_num_ref_frames;
uint8_t reserved1;
uint32_t pic_width_in_mbs_minus1;
uint32_t pic_height_in_map_units_minus1;
uint32_t frame_crop_left_offset;
uint32_t frame_crop_right_offset;
uint32_t frame_crop_top_offset;
uint32_t frame_crop_bottom_offset;
StdVideoH264SpsFlags flags;
// pOffsetForRefFrame is a pointer representing the offset_for_ref_frame array with num_ref_frames_in_pic_order_cnt_cycle number of elements
// If pOffsetForRefFrame has nullptr value, then num_ref_frames_in_pic_order_cnt_cycle must also be "0".
int32_t* pOffsetForRefFrame;
StdVideoH264ScalingLists* pScalingLists; // Must be a valid pointer if seq_scaling_matrix_present_flag is set
StdVideoH264SequenceParameterSetVui* pSequenceParameterSetVui; // Must be a valid pointer if StdVideoH264SpsFlags:vui_parameters_present_flag is set
uint32_t reserved2;
const int32_t* pOffsetForRefFrame;
const StdVideoH264ScalingLists* pScalingLists;
const StdVideoH264SequenceParameterSetVui* pSequenceParameterSetVui;
} StdVideoH264SequenceParameterSet;
typedef struct StdVideoH264PpsFlags {
@ -283,15 +282,14 @@ typedef struct StdVideoH264PpsFlags {
uint32_t redundant_pic_cnt_present_flag : 1;
uint32_t constrained_intra_pred_flag : 1;
uint32_t deblocking_filter_control_present_flag : 1;
uint32_t weighted_bipred_idc_flag : 1;
uint32_t weighted_pred_flag : 1;
uint32_t pic_order_present_flag : 1;
uint32_t bottom_field_pic_order_in_frame_present_flag : 1;
uint32_t entropy_coding_mode_flag : 1;
uint32_t pic_scaling_matrix_present_flag : 1;
} StdVideoH264PpsFlags;
typedef struct StdVideoH264PictureParameterSet
{
typedef struct StdVideoH264PictureParameterSet {
StdVideoH264PpsFlags flags;
uint8_t seq_parameter_set_id;
uint8_t pic_parameter_set_id;
uint8_t num_ref_idx_l0_default_active_minus1;
@ -301,12 +299,12 @@ typedef struct StdVideoH264PictureParameterSet
int8_t pic_init_qs_minus26;
int8_t chroma_qp_index_offset;
int8_t second_chroma_qp_index_offset;
StdVideoH264PpsFlags flags;
StdVideoH264ScalingLists* pScalingLists; // Must be a valid pointer if StdVideoH264PpsFlags::pic_scaling_matrix_present_flag is set.
const StdVideoH264ScalingLists* pScalingLists;
} StdVideoH264PictureParameterSet;
#ifdef __cplusplus
}
#endif
#endif // VULKAN_VIDEO_CODEC_H264STD_H_
#endif

View File

@ -1,97 +1,75 @@
#ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_
#define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1
/*
** Copyright (c) 2019-2020 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_
#define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "vk_video/vulkan_video_codec_h264std.h"
// *************************************************
// Video H.264 Decode related parameters:
// *************************************************
#define STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE 15
#define vulkan_video_codec_h264std_decode 1
// Vulkan 0.9 provisional Vulkan video H.264 decode std specification version number
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_0_9_8 VK_MAKE_VIDEO_STD_VERSION(0, 9, 8) // Patch version should always be set to 0
#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_0_9_8
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode"
typedef enum StdVideoDecodeH264FieldOrderCount {
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0,
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1,
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE = 2,
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF
} StdVideoDecodeH264FieldOrderCnt;
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF,
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_MAX_ENUM = 0x7FFFFFFF
} StdVideoDecodeH264FieldOrderCount;
typedef struct StdVideoDecodeH264PictureInfoFlags {
uint32_t field_pic_flag : 1; // Is field picture
uint32_t is_intra : 1; // Is intra picture
uint32_t IdrPicFlag : 1; // instantaneous decoding refresh (IDR) picture
uint32_t bottom_field_flag : 1; // bottom (true) or top (false) field if field_pic_flag is set.
uint32_t is_reference : 1; // This only applies to picture info, and not to the DPB lists.
uint32_t complementary_field_pair : 1; // complementary field pair, complementary non-reference field pair, complementary reference field pair
uint32_t field_pic_flag : 1;
uint32_t is_intra : 1;
uint32_t IdrPicFlag : 1;
uint32_t bottom_field_flag : 1;
uint32_t is_reference : 1;
uint32_t complementary_field_pair : 1;
} StdVideoDecodeH264PictureInfoFlags;
typedef struct StdVideoDecodeH264PictureInfo {
uint8_t seq_parameter_set_id; // Selecting SPS from the Picture Parameters
uint8_t pic_parameter_set_id; // Selecting PPS from the Picture Parameters and the SPS
uint16_t reserved; // for structure members 32-bit packing/alignment
uint16_t frame_num; // 7.4.3 Slice header semantics
uint16_t idr_pic_id; // 7.4.3 Slice header semantics
// PicOrderCnt is based on TopFieldOrderCnt and BottomFieldOrderCnt. See 8.2.1 Decoding process for picture order count type 0 - 2
int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; // TopFieldOrderCnt and BottomFieldOrderCnt fields.
StdVideoDecodeH264PictureInfoFlags flags;
uint8_t seq_parameter_set_id;
uint8_t pic_parameter_set_id;
uint8_t reserved1;
uint8_t reserved2;
uint16_t frame_num;
uint16_t idr_pic_id;
int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE];
} StdVideoDecodeH264PictureInfo;
typedef struct StdVideoDecodeH264ReferenceInfoFlags {
uint32_t top_field_flag : 1; // Reference is used for top field reference.
uint32_t bottom_field_flag : 1; // Reference is used for bottom field reference.
uint32_t is_long_term : 1; // this is a long term reference
uint32_t is_non_existing : 1; // Must be handled in accordance with 8.2.5.2: Decoding process for gaps in frame_num
uint32_t top_field_flag : 1;
uint32_t bottom_field_flag : 1;
uint32_t used_for_long_term_reference : 1;
uint32_t is_non_existing : 1;
} StdVideoDecodeH264ReferenceInfoFlags;
typedef struct StdVideoDecodeH264ReferenceInfo {
// FrameNum = is_long_term ? long_term_frame_idx : frame_num
uint16_t FrameNum; // 7.4.3.3 Decoded reference picture marking semantics
uint16_t reserved; // for structure members 32-bit packing/alignment
int32_t PicOrderCnt[2]; // TopFieldOrderCnt and BottomFieldOrderCnt fields.
StdVideoDecodeH264ReferenceInfoFlags flags;
uint16_t FrameNum;
uint16_t reserved;
int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE];
} StdVideoDecodeH264ReferenceInfo;
typedef struct StdVideoDecodeH264MvcElementFlags {
uint32_t non_idr : 1;
uint32_t anchor_pic : 1;
uint32_t inter_view : 1;
} StdVideoDecodeH264MvcElementFlags;
typedef struct StdVideoDecodeH264MvcElement {
StdVideoDecodeH264MvcElementFlags flags;
uint16_t viewOrderIndex;
uint16_t viewId;
uint16_t temporalId; // move out?
uint16_t priorityId; // move out?
uint16_t numOfAnchorRefsInL0;
uint16_t viewIdOfAnchorRefsInL0[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE];
uint16_t numOfAnchorRefsInL1;
uint16_t viewIdOfAnchorRefsInL1[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE];
uint16_t numOfNonAnchorRefsInL0;
uint16_t viewIdOfNonAnchorRefsInL0[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE];
uint16_t numOfNonAnchorRefsInL1;
uint16_t viewIdOfNonAnchorRefsInL1[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE];
} StdVideoDecodeH264MvcElement;
typedef struct StdVideoDecodeH264Mvc {
uint32_t viewId0;
uint32_t mvcElementCount;
StdVideoDecodeH264MvcElement* pMvcElements;
} StdVideoDecodeH264Mvc;
#ifdef __cplusplus
}
#endif
#endif // VULKAN_VIDEO_CODEC_H264STD_DECODE_H_
#endif

View File

@ -1,28 +1,55 @@
#ifndef VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_
#define VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ 1
/*
** Copyright (c) 2019-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#ifndef VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_
#define VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ 1
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "vk_video/vulkan_video_codec_h264std.h"
// *************************************************
// Video H.264 Encode related parameters:
// *************************************************
#define vulkan_video_codec_h264std_encode 1
// Vulkan 0.9 provisional Vulkan video H.264 encode std specification version number
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_0_9_8 VK_MAKE_VIDEO_STD_VERSION(0, 9, 8) // Patch version should always be set to 0
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_0_9_8
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_encode"
typedef struct StdVideoEncodeH264WeightTableFlags {
uint32_t luma_weight_l0_flag;
uint32_t chroma_weight_l0_flag;
uint32_t luma_weight_l1_flag;
uint32_t chroma_weight_l1_flag;
} StdVideoEncodeH264WeightTableFlags;
typedef struct StdVideoEncodeH264WeightTable {
StdVideoEncodeH264WeightTableFlags flags;
uint8_t luma_log2_weight_denom;
uint8_t chroma_log2_weight_denom;
int8_t luma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
int8_t luma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
int8_t chroma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
int8_t chroma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
int8_t luma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
int8_t luma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
int8_t chroma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
int8_t chroma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
} StdVideoEncodeH264WeightTable;
typedef struct StdVideoEncodeH264SliceHeaderFlags {
uint32_t idr_flag : 1;
uint32_t is_reference_flag : 1;
uint32_t direct_spatial_mv_pred_flag : 1;
uint32_t num_ref_idx_active_override_flag : 1;
uint32_t no_output_of_prior_pics_flag : 1;
uint32_t long_term_reference_flag : 1;
uint32_t adaptive_ref_pic_marking_mode_flag : 1;
uint32_t no_prior_references_available_flag : 1;
} StdVideoEncodeH264SliceHeaderFlags;
@ -30,9 +57,13 @@ typedef struct StdVideoEncodeH264SliceHeaderFlags {
typedef struct StdVideoEncodeH264PictureInfoFlags {
uint32_t idr_flag : 1;
uint32_t is_reference_flag : 1;
uint32_t long_term_reference_flag : 1;
uint32_t used_for_long_term_reference : 1;
} StdVideoEncodeH264PictureInfoFlags;
typedef struct StdVideoEncodeH264ReferenceInfoFlags {
uint32_t used_for_long_term_reference : 1;
} StdVideoEncodeH264ReferenceInfoFlags;
typedef struct StdVideoEncodeH264RefMgmtFlags {
uint32_t ref_pic_list_modification_l0_flag : 1;
uint32_t ref_pic_list_modification_l1_flag : 1;
@ -55,27 +86,34 @@ typedef struct StdVideoEncodeH264RefPicMarkingEntry {
typedef struct StdVideoEncodeH264RefMemMgmtCtrlOperations {
StdVideoEncodeH264RefMgmtFlags flags;
uint8_t refList0ModOpCount;
StdVideoEncodeH264RefListModEntry* pRefList0ModOperations;
const StdVideoEncodeH264RefListModEntry* pRefList0ModOperations;
uint8_t refList1ModOpCount;
StdVideoEncodeH264RefListModEntry* pRefList1ModOperations;
const StdVideoEncodeH264RefListModEntry* pRefList1ModOperations;
uint8_t refPicMarkingOpCount;
StdVideoEncodeH264RefPicMarkingEntry* pRefPicMarkingOperations;
const StdVideoEncodeH264RefPicMarkingEntry* pRefPicMarkingOperations;
} StdVideoEncodeH264RefMemMgmtCtrlOperations;
typedef struct StdVideoEncodeH264PictureInfo {
StdVideoEncodeH264PictureInfoFlags flags;
uint8_t seq_parameter_set_id;
uint8_t pic_parameter_set_id;
StdVideoH264PictureType pictureType;
uint32_t frameNum;
uint32_t pictureOrderCount;
uint32_t frame_num;
int32_t PicOrderCnt;
} StdVideoEncodeH264PictureInfo;
typedef struct StdVideoEncodeH264ReferenceInfo {
StdVideoEncodeH264ReferenceInfoFlags flags;
uint32_t FrameNum;
int32_t PicOrderCnt;
uint16_t long_term_pic_num;
uint16_t long_term_frame_idx;
} StdVideoEncodeH264PictureInfo;
} StdVideoEncodeH264ReferenceInfo;
typedef struct StdVideoEncodeH264SliceHeader {
StdVideoEncodeH264SliceHeaderFlags flags;
uint32_t first_mb_in_slice;
StdVideoH264SliceType slice_type;
uint8_t seq_parameter_set_id;
uint8_t pic_parameter_set_id;
uint16_t idr_pic_id;
uint8_t num_ref_idx_l0_active_minus1;
uint8_t num_ref_idx_l1_active_minus1;
@ -83,7 +121,7 @@ typedef struct StdVideoEncodeH264SliceHeader {
StdVideoH264DisableDeblockingFilterIdc disable_deblocking_filter_idc;
int8_t slice_alpha_c0_offset_div2;
int8_t slice_beta_offset_div2;
StdVideoEncodeH264RefMemMgmtCtrlOperations* pMemMgmtCtrlOperations;
const StdVideoEncodeH264WeightTable* pWeightTable;
} StdVideoEncodeH264SliceHeader;
@ -91,4 +129,4 @@ typedef struct StdVideoEncodeH264SliceHeader {
}
#endif
#endif // VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_
#endif

View File

@ -1,27 +1,27 @@
#ifndef VULKAN_VIDEO_CODEC_H265STD_H_
#define VULKAN_VIDEO_CODEC_H265STD_H_ 1
/*
** Copyright (c) 2019-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#ifndef VULKAN_VIDEO_CODEC_H265STD_H_
#define VULKAN_VIDEO_CODEC_H265STD_H_ 1
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "vk_video/vulkan_video_codecs_common.h"
// Vulkan 0.5 version number WIP
#define VK_STD_VULKAN_VIDEO_CODEC_H265_API_VERSION_0_9_5 VK_MAKE_VIDEO_STD_VERSION(0, 9, 5) // Patch version should always be set to 0
// Format must be in the form XX.XX where the first two digits are the major and the second two, the minor.
#define VK_STD_VULKAN_VIDEO_CODEC_H265_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_API_VERSION_0_9_5
#define VK_STD_VULKAN_VIDEO_CODEC_H265_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265"
#define vulkan_video_codec_h265std 1
#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7
#define STD_VIDEO_H265_CPB_CNT_LIST_SIZE 32
#define STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE 7
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS 6
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS 16
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS 6
@ -30,18 +30,26 @@ extern "C" {
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS 64
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS 2
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS 64
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128
#define STD_VIDEO_H265_MAX_DPB_SIZE 16
#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE 6
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE 19
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE 21
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128
#define STD_VIDEO_H265_MAX_NUM_LIST_REF 15
#define STD_VIDEO_H265_MAX_CHROMA_PLANES 2
#define STD_VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS 64
#define STD_VIDEO_H265_MAX_LONG_TERM_PICS 16
#define STD_VIDEO_H265_MAX_DELTA_POC 48
typedef enum StdVideoH265ChromaFormatIdc {
STD_VIDEO_H265_CHROMA_FORMAT_IDC_MONOCHROME = 0,
STD_VIDEO_H265_CHROMA_FORMAT_IDC_420 = 1,
STD_VIDEO_H265_CHROMA_FORMAT_IDC_422 = 2,
STD_VIDEO_H265_CHROMA_FORMAT_IDC_444 = 3,
STD_VIDEO_H265_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H265_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H265_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH265ChromaFormatIdc;
typedef enum StdVideoH265ProfileIdc {
@ -50,31 +58,34 @@ typedef enum StdVideoH265ProfileIdc {
STD_VIDEO_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3,
STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS = 4,
STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS = 9,
STD_VIDEO_H265_PROFILE_IDC_INVALID = 0x7FFFFFFF
STD_VIDEO_H265_PROFILE_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H265_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH265ProfileIdc;
typedef enum StdVideoH265Level {
STD_VIDEO_H265_LEVEL_1_0 = 0,
STD_VIDEO_H265_LEVEL_2_0 = 1,
STD_VIDEO_H265_LEVEL_2_1 = 2,
STD_VIDEO_H265_LEVEL_3_0 = 3,
STD_VIDEO_H265_LEVEL_3_1 = 4,
STD_VIDEO_H265_LEVEL_4_0 = 5,
STD_VIDEO_H265_LEVEL_4_1 = 6,
STD_VIDEO_H265_LEVEL_5_0 = 7,
STD_VIDEO_H265_LEVEL_5_1 = 8,
STD_VIDEO_H265_LEVEL_5_2 = 9,
STD_VIDEO_H265_LEVEL_6_0 = 10,
STD_VIDEO_H265_LEVEL_6_1 = 11,
STD_VIDEO_H265_LEVEL_6_2 = 12,
STD_VIDEO_H265_LEVEL_INVALID = 0x7FFFFFFF
} StdVideoH265Level;
typedef enum StdVideoH265LevelIdc {
STD_VIDEO_H265_LEVEL_IDC_1_0 = 0,
STD_VIDEO_H265_LEVEL_IDC_2_0 = 1,
STD_VIDEO_H265_LEVEL_IDC_2_1 = 2,
STD_VIDEO_H265_LEVEL_IDC_3_0 = 3,
STD_VIDEO_H265_LEVEL_IDC_3_1 = 4,
STD_VIDEO_H265_LEVEL_IDC_4_0 = 5,
STD_VIDEO_H265_LEVEL_IDC_4_1 = 6,
STD_VIDEO_H265_LEVEL_IDC_5_0 = 7,
STD_VIDEO_H265_LEVEL_IDC_5_1 = 8,
STD_VIDEO_H265_LEVEL_IDC_5_2 = 9,
STD_VIDEO_H265_LEVEL_IDC_6_0 = 10,
STD_VIDEO_H265_LEVEL_IDC_6_1 = 11,
STD_VIDEO_H265_LEVEL_IDC_6_2 = 12,
STD_VIDEO_H265_LEVEL_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H265_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH265LevelIdc;
typedef enum StdVideoH265SliceType {
STD_VIDEO_H265_SLICE_TYPE_B = 0,
STD_VIDEO_H265_SLICE_TYPE_P = 1,
STD_VIDEO_H265_SLICE_TYPE_I = 2,
STD_VIDEO_H265_SLICE_TYPE_INVALID = 0x7FFFFFFF
STD_VIDEO_H265_SLICE_TYPE_INVALID = 0x7FFFFFFF,
STD_VIDEO_H265_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF
} StdVideoH265SliceType;
typedef enum StdVideoH265PictureType {
@ -82,22 +93,44 @@ typedef enum StdVideoH265PictureType {
STD_VIDEO_H265_PICTURE_TYPE_B = 1,
STD_VIDEO_H265_PICTURE_TYPE_I = 2,
STD_VIDEO_H265_PICTURE_TYPE_IDR = 3,
STD_VIDEO_H265_PICTURE_TYPE_INVALID = 0x7FFFFFFF
STD_VIDEO_H265_PICTURE_TYPE_INVALID = 0x7FFFFFFF,
STD_VIDEO_H265_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
} StdVideoH265PictureType;
typedef struct StdVideoH265DecPicBufMgr
{
uint32_t max_latency_increase_plus1[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
uint8_t max_dec_pic_buffering_minus1[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
uint8_t max_num_reorder_pics[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
typedef enum StdVideoH265AspectRatioIdc {
STD_VIDEO_H265_ASPECT_RATIO_IDC_UNSPECIFIED = 0,
STD_VIDEO_H265_ASPECT_RATIO_IDC_SQUARE = 1,
STD_VIDEO_H265_ASPECT_RATIO_IDC_12_11 = 2,
STD_VIDEO_H265_ASPECT_RATIO_IDC_10_11 = 3,
STD_VIDEO_H265_ASPECT_RATIO_IDC_16_11 = 4,
STD_VIDEO_H265_ASPECT_RATIO_IDC_40_33 = 5,
STD_VIDEO_H265_ASPECT_RATIO_IDC_24_11 = 6,
STD_VIDEO_H265_ASPECT_RATIO_IDC_20_11 = 7,
STD_VIDEO_H265_ASPECT_RATIO_IDC_32_11 = 8,
STD_VIDEO_H265_ASPECT_RATIO_IDC_80_33 = 9,
STD_VIDEO_H265_ASPECT_RATIO_IDC_18_11 = 10,
STD_VIDEO_H265_ASPECT_RATIO_IDC_15_11 = 11,
STD_VIDEO_H265_ASPECT_RATIO_IDC_64_33 = 12,
STD_VIDEO_H265_ASPECT_RATIO_IDC_160_99 = 13,
STD_VIDEO_H265_ASPECT_RATIO_IDC_4_3 = 14,
STD_VIDEO_H265_ASPECT_RATIO_IDC_3_2 = 15,
STD_VIDEO_H265_ASPECT_RATIO_IDC_2_1 = 16,
STD_VIDEO_H265_ASPECT_RATIO_IDC_EXTENDED_SAR = 255,
STD_VIDEO_H265_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF,
STD_VIDEO_H265_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF
} StdVideoH265AspectRatioIdc;
typedef struct StdVideoH265DecPicBufMgr {
uint32_t max_latency_increase_plus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
uint8_t max_dec_pic_buffering_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
uint8_t max_num_reorder_pics[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
} StdVideoH265DecPicBufMgr;
typedef struct StdVideoH265SubLayerHrdParameters { // sub_layer_hrd_parameters
typedef struct StdVideoH265SubLayerHrdParameters {
uint32_t bit_rate_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
uint32_t cpb_size_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
uint32_t cpb_size_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
uint32_t bit_rate_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
uint32_t cbr_flag; // each bit represents a range of CpbCounts (bit 0 - cpb_cnt_minus1) per sub-layer
uint32_t cbr_flag;
} StdVideoH265SubLayerHrdParameters;
typedef struct StdVideoH265HrdFlags {
@ -105,12 +138,13 @@ typedef struct StdVideoH265HrdFlags {
uint32_t vcl_hrd_parameters_present_flag : 1;
uint32_t sub_pic_hrd_params_present_flag : 1;
uint32_t sub_pic_cpb_params_in_pic_timing_sei_flag : 1;
uint32_t fixed_pic_rate_general_flag : 8; // each bit represents a sublayer, bit 0 - vps_max_sub_layers_minus1
uint32_t fixed_pic_rate_within_cvs_flag : 8; // each bit represents a sublayer, bit 0 - vps_max_sub_layers_minus1
uint32_t low_delay_hrd_flag : 8; // each bit represents a sublayer, bit 0 - vps_max_sub_layers_minus1
uint32_t fixed_pic_rate_general_flag : 8;
uint32_t fixed_pic_rate_within_cvs_flag : 8;
uint32_t low_delay_hrd_flag : 8;
} StdVideoH265HrdFlags;
typedef struct StdVideoH265HrdParameters {
StdVideoH265HrdFlags flags;
uint8_t tick_divisor_minus2;
uint8_t du_cpb_removal_delay_increment_length_minus1;
uint8_t dpb_output_delay_du_length_minus1;
@ -120,11 +154,11 @@ typedef struct StdVideoH265HrdParameters {
uint8_t initial_cpb_removal_delay_length_minus1;
uint8_t au_cpb_removal_delay_length_minus1;
uint8_t dpb_output_delay_length_minus1;
uint8_t cpb_cnt_minus1[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
uint16_t elemental_duration_in_tc_minus1[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersNal[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE]; // NAL per layer ptr to sub_layer_hrd_parameters
StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersVcl[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE]; // VCL per layer ptr to sub_layer_hrd_parameters
StdVideoH265HrdFlags flags;
uint8_t cpb_cnt_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
uint16_t elemental_duration_in_tc_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
uint16_t reserved[3];
const StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersNal;
const StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersVcl;
} StdVideoH265HrdParameters;
typedef struct StdVideoH265VpsFlags {
@ -134,26 +168,42 @@ typedef struct StdVideoH265VpsFlags {
uint32_t vps_poc_proportional_to_timing_flag : 1;
} StdVideoH265VpsFlags;
typedef struct StdVideoH265VideoParameterSet
{
typedef struct StdVideoH265ProfileTierLevelFlags {
uint32_t general_tier_flag : 1;
uint32_t general_progressive_source_flag : 1;
uint32_t general_interlaced_source_flag : 1;
uint32_t general_non_packed_constraint_flag : 1;
uint32_t general_frame_only_constraint_flag : 1;
} StdVideoH265ProfileTierLevelFlags;
typedef struct StdVideoH265ProfileTierLevel {
StdVideoH265ProfileTierLevelFlags flags;
StdVideoH265ProfileIdc general_profile_idc;
StdVideoH265LevelIdc general_level_idc;
} StdVideoH265ProfileTierLevel;
typedef struct StdVideoH265VideoParameterSet {
StdVideoH265VpsFlags flags;
uint8_t vps_video_parameter_set_id;
uint8_t vps_max_sub_layers_minus1;
uint8_t reserved1;
uint8_t reserved2;
uint32_t vps_num_units_in_tick;
uint32_t vps_time_scale;
uint32_t vps_num_ticks_poc_diff_one_minus1;
StdVideoH265DecPicBufMgr* pDecPicBufMgr;
StdVideoH265HrdParameters* pHrdParameters;
StdVideoH265VpsFlags flags;
uint32_t reserved3;
const StdVideoH265DecPicBufMgr* pDecPicBufMgr;
const StdVideoH265HrdParameters* pHrdParameters;
const StdVideoH265ProfileTierLevel* pProfileTierLevel;
} StdVideoH265VideoParameterSet;
typedef struct StdVideoH265ScalingLists
{
uint8_t ScalingList4x4[STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS]; // ScalingList[ 0 ][ MatrixID ][ i ] (sizeID = 0)
uint8_t ScalingList8x8[STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS]; // ScalingList[ 1 ][ MatrixID ][ i ] (sizeID = 1)
uint8_t ScalingList16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS]; // ScalingList[ 2 ][ MatrixID ][ i ] (sizeID = 2)
uint8_t ScalingList32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS]; // ScalingList[ 3 ][ MatrixID ][ i ] (sizeID = 3)
uint8_t ScalingListDCCoef16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS]; // scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8, sizeID = 2
uint8_t ScalingListDCCoef32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS]; // scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8. sizeID = 3
typedef struct StdVideoH265ScalingLists {
uint8_t ScalingList4x4[STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS];
uint8_t ScalingList8x8[STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS];
uint8_t ScalingList16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS];
uint8_t ScalingList32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS];
uint8_t ScalingListDCCoef16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS];
uint8_t ScalingListDCCoef32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS];
} StdVideoH265ScalingLists;
typedef struct StdVideoH265SpsVuiFlags {
@ -178,7 +228,8 @@ typedef struct StdVideoH265SpsVuiFlags {
} StdVideoH265SpsVuiFlags;
typedef struct StdVideoH265SequenceParameterSetVui {
uint8_t aspect_ratio_idc;
StdVideoH265SpsVuiFlags flags;
StdVideoH265AspectRatioIdc aspect_ratio_idc;
uint16_t sar_width;
uint16_t sar_height;
uint8_t video_format;
@ -187,6 +238,8 @@ typedef struct StdVideoH265SequenceParameterSetVui {
uint8_t matrix_coeffs;
uint8_t chroma_sample_loc_type_top_field;
uint8_t chroma_sample_loc_type_bottom_field;
uint8_t reserved1;
uint8_t reserved2;
uint16_t def_disp_win_left_offset;
uint16_t def_disp_win_right_offset;
uint16_t def_disp_win_top_offset;
@ -194,23 +247,24 @@ typedef struct StdVideoH265SequenceParameterSetVui {
uint32_t vui_num_units_in_tick;
uint32_t vui_time_scale;
uint32_t vui_num_ticks_poc_diff_one_minus1;
StdVideoH265HrdParameters* pHrdParameters;
uint16_t min_spatial_segmentation_idc;
uint16_t reserved3;
uint8_t max_bytes_per_pic_denom;
uint8_t max_bits_per_min_cu_denom;
uint8_t log2_max_mv_length_horizontal;
uint8_t log2_max_mv_length_vertical;
StdVideoH265SpsVuiFlags flags;
const StdVideoH265HrdParameters* pHrdParameters;
} StdVideoH265SequenceParameterSetVui;
typedef struct StdVideoH265PredictorPaletteEntries
{
typedef struct StdVideoH265PredictorPaletteEntries {
uint16_t PredictorPaletteEntries[STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE][STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE];
} StdVideoH265PredictorPaletteEntries;
typedef struct StdVideoH265SpsFlags {
uint32_t sps_temporal_id_nesting_flag : 1;
uint32_t separate_colour_plane_flag : 1;
uint32_t conformance_window_flag : 1;
uint32_t sps_sub_layer_ordering_info_present_flag : 1;
uint32_t scaling_list_enabled_flag : 1;
uint32_t sps_scaling_list_data_present_flag : 1;
uint32_t amp_enabled_flag : 1;
@ -223,8 +277,6 @@ typedef struct StdVideoH265SpsFlags {
uint32_t vui_parameters_present_flag : 1;
uint32_t sps_extension_present_flag : 1;
uint32_t sps_range_extension_flag : 1;
// extension SPS flags, valid when STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS is set
uint32_t transform_skip_rotation_enabled_flag : 1;
uint32_t transform_skip_context_enabled_flag : 1;
uint32_t implicit_rdpcm_enabled_flag : 1;
@ -234,28 +286,51 @@ typedef struct StdVideoH265SpsFlags {
uint32_t high_precision_offsets_enabled_flag : 1;
uint32_t persistent_rice_adaptation_enabled_flag : 1;
uint32_t cabac_bypass_alignment_enabled_flag : 1;
// extension SPS flags, valid when STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS is set
uint32_t sps_scc_extension_flag : 1;
uint32_t sps_curr_pic_ref_enabled_flag : 1;
uint32_t palette_mode_enabled_flag : 1;
uint32_t sps_palette_predictor_initializer_present_flag : 1;
uint32_t sps_palette_predictor_initializers_present_flag : 1;
uint32_t intra_boundary_filtering_disabled_flag : 1;
} StdVideoH265SpsFlags;
typedef struct StdVideoH265SequenceParameterSet
{
StdVideoH265ProfileIdc profile_idc;
StdVideoH265Level level_idc;
typedef struct StdVideoH265ShortTermRefPicSetFlags {
uint32_t inter_ref_pic_set_prediction_flag : 1;
uint32_t delta_rps_sign : 1;
} StdVideoH265ShortTermRefPicSetFlags;
typedef struct StdVideoH265ShortTermRefPicSet {
StdVideoH265ShortTermRefPicSetFlags flags;
uint32_t delta_idx_minus1;
uint16_t use_delta_flag;
uint16_t abs_delta_rps_minus1;
uint16_t used_by_curr_pic_flag;
uint16_t used_by_curr_pic_s0_flag;
uint16_t used_by_curr_pic_s1_flag;
uint16_t reserved1;
uint8_t reserved2;
uint8_t reserved3;
uint8_t num_negative_pics;
uint8_t num_positive_pics;
uint16_t delta_poc_s0_minus1[STD_VIDEO_H265_MAX_DPB_SIZE];
uint16_t delta_poc_s1_minus1[STD_VIDEO_H265_MAX_DPB_SIZE];
} StdVideoH265ShortTermRefPicSet;
typedef struct StdVideoH265LongTermRefPicsSps {
uint32_t used_by_curr_pic_lt_sps_flag;
uint32_t lt_ref_pic_poc_lsb_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS];
} StdVideoH265LongTermRefPicsSps;
typedef struct StdVideoH265SequenceParameterSet {
StdVideoH265SpsFlags flags;
StdVideoH265ChromaFormatIdc chroma_format_idc;
uint32_t pic_width_in_luma_samples;
uint32_t pic_height_in_luma_samples;
uint8_t sps_video_parameter_set_id;
uint8_t sps_max_sub_layers_minus1;
uint8_t sps_seq_parameter_set_id;
uint8_t chroma_format_idc;
uint8_t bit_depth_luma_minus8;
uint8_t bit_depth_chroma_minus8;
uint8_t log2_max_pic_order_cnt_lsb_minus4;
uint8_t sps_max_dec_pic_buffering_minus1;
uint8_t log2_min_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_luma_coding_block_size;
uint8_t log2_min_luma_transform_block_size_minus2;
@ -268,24 +343,25 @@ typedef struct StdVideoH265SequenceParameterSet
uint8_t pcm_sample_bit_depth_chroma_minus1;
uint8_t log2_min_pcm_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
uint8_t reserved1;
uint8_t reserved2;
uint8_t palette_max_size;
uint8_t delta_palette_max_predictor_size;
uint8_t motion_vector_resolution_control_idc;
uint8_t sps_num_palette_predictor_initializers_minus1;
uint32_t conf_win_left_offset;
uint32_t conf_win_right_offset;
uint32_t conf_win_top_offset;
uint32_t conf_win_bottom_offset;
StdVideoH265DecPicBufMgr* pDecPicBufMgr;
StdVideoH265SpsFlags flags;
StdVideoH265ScalingLists* pScalingLists; // Must be a valid pointer if sps_scaling_list_data_present_flag is set
StdVideoH265SequenceParameterSetVui* pSequenceParameterSetVui; // Must be a valid pointer if StdVideoH265SpsFlags:vui_parameters_present_flag is set palette_max_size;
// extension SPS flags, valid when STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS is set
uint8_t palette_max_size;
uint8_t delta_palette_max_predictor_size;
uint8_t motion_vector_resolution_control_idc;
uint8_t sps_num_palette_predictor_initializer_minus1;
StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries; // Must be a valid pointer if sps_palette_predictor_initializer_present_flag is set
const StdVideoH265ProfileTierLevel* pProfileTierLevel;
const StdVideoH265DecPicBufMgr* pDecPicBufMgr;
const StdVideoH265ScalingLists* pScalingLists;
const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet;
const StdVideoH265LongTermRefPicsSps* pLongTermRefPicsSps;
const StdVideoH265SequenceParameterSetVui* pSequenceParameterSetVui;
const StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries;
} StdVideoH265SequenceParameterSet;
typedef struct StdVideoH265PpsFlags {
uint32_t dependent_slice_segments_enabled_flag : 1;
uint32_t output_flag_present_flag : 1;
@ -310,24 +386,21 @@ typedef struct StdVideoH265PpsFlags {
uint32_t lists_modification_present_flag : 1;
uint32_t slice_segment_header_extension_present_flag : 1;
uint32_t pps_extension_present_flag : 1;
// extension PPS flags, valid when STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS is set
uint32_t cross_component_prediction_enabled_flag : 1;
uint32_t chroma_qp_offset_list_enabled_flag : 1;
// extension PPS flags, valid when STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS is set
uint32_t pps_curr_pic_ref_enabled_flag : 1;
uint32_t residual_adaptive_colour_transform_enabled_flag : 1;
uint32_t pps_slice_act_qp_offsets_present_flag : 1;
uint32_t pps_palette_predictor_initializer_present_flag : 1;
uint32_t pps_palette_predictor_initializers_present_flag : 1;
uint32_t monochrome_palette_flag : 1;
uint32_t pps_range_extension_flag : 1;
} StdVideoH265PpsFlags;
typedef struct StdVideoH265PictureParameterSet
{
typedef struct StdVideoH265PictureParameterSet {
StdVideoH265PpsFlags flags;
uint8_t pps_pic_parameter_set_id;
uint8_t pps_seq_parameter_set_id;
uint8_t sps_video_parameter_set_id;
uint8_t num_extra_slice_header_bits;
uint8_t num_ref_idx_l0_default_active_minus1;
uint8_t num_ref_idx_l1_default_active_minus1;
@ -335,17 +408,9 @@ typedef struct StdVideoH265PictureParameterSet
uint8_t diff_cu_qp_delta_depth;
int8_t pps_cb_qp_offset;
int8_t pps_cr_qp_offset;
uint8_t num_tile_columns_minus1;
uint8_t num_tile_rows_minus1;
uint16_t column_width_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE];
uint16_t row_height_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE];
int8_t pps_beta_offset_div2;
int8_t pps_tc_offset_div2;
uint8_t log2_parallel_merge_level_minus2;
StdVideoH265PpsFlags flags;
StdVideoH265ScalingLists* pScalingLists; // Must be a valid pointer if pps_scaling_list_data_present_flag is set
// extension PPS, valid when STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS is set
uint8_t log2_max_transform_skip_block_size_minus2;
uint8_t diff_cu_chroma_qp_offset_depth;
uint8_t chroma_qp_offset_list_len_minus1;
@ -353,19 +418,26 @@ typedef struct StdVideoH265PictureParameterSet
int8_t cr_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE];
uint8_t log2_sao_offset_scale_luma;
uint8_t log2_sao_offset_scale_chroma;
// extension PPS, valid when STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS is set
int8_t pps_act_y_qp_offset_plus5;
int8_t pps_act_cb_qp_offset_plus5;
int8_t pps_act_cr_qp_offset_plus5;
uint8_t pps_num_palette_predictor_initializer;
int8_t pps_act_cr_qp_offset_plus3;
uint8_t pps_num_palette_predictor_initializers;
uint8_t luma_bit_depth_entry_minus8;
uint8_t chroma_bit_depth_entry_minus8;
StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries; // Must be a valid pointer if pps_palette_predictor_initializer_present_flag is set
uint8_t num_tile_columns_minus1;
uint8_t num_tile_rows_minus1;
uint8_t reserved1;
uint8_t reserved2;
uint16_t column_width_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE];
uint16_t row_height_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE];
uint32_t reserved3;
const StdVideoH265ScalingLists* pScalingLists;
const StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries;
} StdVideoH265PictureParameterSet;
#ifdef __cplusplus
}
#endif
#endif // VULKAN_VIDEO_CODEC_H265STD_H_
#endif

View File

@ -1,24 +1,31 @@
#ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_
#define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1
/*
** Copyright (c) 2019-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_
#define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "vk_video/vulkan_video_codec_h265std.h"
// *************************************************
// Video h265 Decode related parameters:
// *************************************************
#define vulkan_video_codec_h265std_decode 1
// Vulkan 0.9 provisional Vulkan video H.265 decode std specification version number
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_0_9_9 VK_MAKE_VIDEO_STD_VERSION(0, 9, 9) // Patch version should always be set to 0
#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_0_9_9
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode"
typedef struct StdVideoDecodeH265PictureInfoFlags {
uint32_t IrapPicFlag : 1;
uint32_t IdrPicFlag : 1;
@ -27,38 +34,32 @@ typedef struct StdVideoDecodeH265PictureInfoFlags {
} StdVideoDecodeH265PictureInfoFlags;
typedef struct StdVideoDecodeH265PictureInfo {
uint8_t vps_video_parameter_set_id;
uint8_t sps_seq_parameter_set_id;
uint8_t pps_pic_parameter_set_id;
uint8_t num_short_term_ref_pic_sets;
int32_t PicOrderCntVal;
uint16_t NumBitsForSTRefPicSetInSlice; // number of bits used in st_ref_pic_set()
//when short_term_ref_pic_set_sps_flag is 0; otherwise set to 0.
uint8_t NumDeltaPocsOfRefRpsIdx; // NumDeltaPocs[ RefRpsIdx ] when short_term_ref_pic_set_sps_flag = 1, otherwise 0
uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; // slotIndex as used in
// VkVideoReferenceSlotKHR structures representing
//pReferenceSlots in VkVideoDecodeInfoKHR, 0xff for invalid slotIndex
uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; // slotIndex as used in
// VkVideoReferenceSlotKHR structures representing
//pReferenceSlots in VkVideoDecodeInfoKHR, 0xff for invalid slotIndex
uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; // slotIndex as used in
// VkVideoReferenceSlotKHR structures representing
//pReferenceSlots in VkVideoDecodeInfoKHR, 0xff for invalid slotIndex
StdVideoDecodeH265PictureInfoFlags flags;
uint8_t sps_video_parameter_set_id;
uint8_t pps_seq_parameter_set_id;
uint8_t pps_pic_parameter_set_id;
uint8_t NumDeltaPocsOfRefRpsIdx;
int32_t PicOrderCntVal;
uint16_t NumBitsForSTRefPicSetInSlice;
uint16_t reserved;
uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
} StdVideoDecodeH265PictureInfo;
typedef struct StdVideoDecodeH265ReferenceInfoFlags {
uint32_t is_long_term : 1;
uint32_t is_non_existing : 1;
uint32_t used_for_long_term_reference : 1;
uint32_t unused_for_reference : 1;
} StdVideoDecodeH265ReferenceInfoFlags;
typedef struct StdVideoDecodeH265ReferenceInfo {
int32_t PicOrderCntVal;
StdVideoDecodeH265ReferenceInfoFlags flags;
int32_t PicOrderCntVal;
} StdVideoDecodeH265ReferenceInfo;
#ifdef __cplusplus
}
#endif
#endif // VULKAN_VIDEO_CODEC_H265STD_DECODE_H_
#endif

View File

@ -1,30 +1,56 @@
#ifndef VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_
#define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1
/*
** Copyright (c) 2019-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#ifndef VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_
#define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "vk_video/vulkan_video_codec_h265std.h"
// *************************************************
// Video h265 Encode related parameters:
// *************************************************
#define STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE 15
#define STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE 15
#define STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM 2
#define vulkan_video_codec_h265std_encode 1
// Vulkan 0.9 provisional Vulkan video H.265 encode std specification version number
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_0_9_9 VK_MAKE_VIDEO_STD_VERSION(0, 9, 9) // Patch version should always be set to 0
typedef struct StdVideoEncodeH265SliceHeaderFlags {
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_0_9_9
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_encode"
typedef struct StdVideoEncodeH265WeightTableFlags {
uint16_t luma_weight_l0_flag;
uint16_t chroma_weight_l0_flag;
uint16_t luma_weight_l1_flag;
uint16_t chroma_weight_l1_flag;
} StdVideoEncodeH265WeightTableFlags;
typedef struct StdVideoEncodeH265WeightTable {
StdVideoEncodeH265WeightTableFlags flags;
uint8_t luma_log2_weight_denom;
int8_t delta_chroma_log2_weight_denom;
int8_t delta_luma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
int8_t luma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
int8_t delta_chroma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
int8_t delta_chroma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
int8_t delta_luma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
int8_t luma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
int8_t delta_chroma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
int8_t delta_chroma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
} StdVideoEncodeH265WeightTable;
typedef struct StdVideoEncodeH265SliceSegmentHeaderFlags {
uint32_t first_slice_segment_in_pic_flag : 1;
uint32_t no_output_of_prior_pics_flag : 1;
uint32_t dependent_slice_segment_flag : 1;
uint32_t pic_output_flag : 1;
uint32_t short_term_ref_pic_set_sps_flag : 1;
uint32_t slice_temporal_mvp_enable_flag : 1;
uint32_t slice_sao_luma_flag : 1;
@ -32,49 +58,43 @@ typedef struct StdVideoEncodeH265SliceHeaderFlags {
uint32_t num_ref_idx_active_override_flag : 1;
uint32_t mvd_l1_zero_flag : 1;
uint32_t cabac_init_flag : 1;
uint32_t slice_deblocking_filter_disable_flag : 1;
uint32_t cu_chroma_qp_offset_enabled_flag : 1;
uint32_t deblocking_filter_override_flag : 1;
uint32_t slice_deblocking_filter_disabled_flag : 1;
uint32_t collocated_from_l0_flag : 1;
uint32_t slice_loop_filter_across_slices_enabled_flag : 1;
uint32_t bLastSliceInPic : 1;
uint32_t reservedBits : 18;
uint16_t luma_weight_l0_flag; // bit 0 - num_ref_idx_l0_active_minus1
uint16_t chroma_weight_l0_flag; // bit 0 - num_ref_idx_l0_active_minus1
uint16_t luma_weight_l1_flag; // bit 0 - num_ref_idx_l1_active_minus1
uint16_t chroma_weight_l1_flag; // bit 0 - num_ref_idx_l1_active_minus1
} StdVideoEncodeH265SliceHeaderFlags;
} StdVideoEncodeH265SliceSegmentHeaderFlags;
typedef struct StdVideoEncodeH265SliceHeader {
StdVideoH265SliceType slice_type;
uint8_t slice_pic_parameter_set_id;
uint8_t num_short_term_ref_pic_sets;
uint32_t slice_segment_address;
uint8_t short_term_ref_pic_set_idx;
typedef struct StdVideoEncodeH265SliceSegmentLongTermRefPics {
uint8_t num_long_term_sps;
uint8_t num_long_term_pics;
uint8_t lt_idx_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS];
uint8_t poc_lsb_lt[STD_VIDEO_H265_MAX_LONG_TERM_PICS];
uint16_t used_by_curr_pic_lt_flag;
uint8_t delta_poc_msb_present_flag[STD_VIDEO_H265_MAX_DELTA_POC];
uint8_t delta_poc_msb_cycle_lt[STD_VIDEO_H265_MAX_DELTA_POC];
} StdVideoEncodeH265SliceSegmentLongTermRefPics;
typedef struct StdVideoEncodeH265SliceSegmentHeader {
StdVideoEncodeH265SliceSegmentHeaderFlags flags;
StdVideoH265SliceType slice_type;
uint32_t slice_segment_address;
uint8_t short_term_ref_pic_set_idx;
uint8_t collocated_ref_idx;
uint8_t num_ref_idx_l0_active_minus1; // [0, 14]
uint8_t num_ref_idx_l1_active_minus1; // [0, 14]
uint8_t luma_log2_weight_denom; // [0, 7]
int8_t delta_chroma_log2_weight_denom;
int8_t delta_luma_weight_l0[STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE];
int8_t luma_offset_l0[STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE];
int8_t delta_chroma_weight_l0[STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE][STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM];
int8_t delta_chroma_offset_l0[STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE][STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM];
int8_t delta_luma_weight_l1[STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE];
int8_t luma_offset_l1[STD_VIDEO_ENCODE_H265_LUMA_LIST_SIZE];
int8_t delta_chroma_weight_l1[STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE][STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM];
int8_t delta_chroma_offset_l1[STD_VIDEO_ENCODE_H265_CHROMA_LIST_SIZE][STD_VIDEO_ENCODE_H265_CHROMA_LISTS_NUM];
uint8_t num_ref_idx_l0_active_minus1;
uint8_t num_ref_idx_l1_active_minus1;
uint8_t MaxNumMergeCand;
int8_t slice_qp_delta;
int8_t slice_cb_qp_offset; // [-12, 12]
int8_t slice_cr_qp_offset; // [-12, 12]
int8_t slice_beta_offset_div2; // [-6, 6]
int8_t slice_tc_offset_div2; // [-6, 6]
int8_t slice_cb_qp_offset;
int8_t slice_cr_qp_offset;
int8_t slice_beta_offset_div2;
int8_t slice_tc_offset_div2;
int8_t slice_act_y_qp_offset;
int8_t slice_act_cb_qp_offset;
int8_t slice_act_cr_qp_offset;
StdVideoEncodeH265SliceHeaderFlags flags;
} StdVideoEncodeH265SliceHeader;
const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet;
const StdVideoEncodeH265SliceSegmentLongTermRefPics* pLongTermRefPics;
const StdVideoEncodeH265WeightTable* pWeightTable;
} StdVideoEncodeH265SliceSegmentHeader;
typedef struct StdVideoEncodeH265ReferenceModificationFlags {
uint32_t ref_pic_list_modification_flag_l0 : 1;
@ -83,40 +103,44 @@ typedef struct StdVideoEncodeH265ReferenceModificationFlags {
typedef struct StdVideoEncodeH265ReferenceModifications {
StdVideoEncodeH265ReferenceModificationFlags flags;
uint8_t referenceList0ModificationsCount; // num_ref_idx_l0_active_minus1
uint8_t* pReferenceList0Modifications; // list_entry_l0
uint8_t referenceList1ModificationsCount; // num_ref_idx_l1_active_minus1
uint8_t* pReferenceList1Modifications; // list_entry_l1
uint8_t referenceList0ModificationsCount;
const uint8_t* pReferenceList0Modifications;
uint8_t referenceList1ModificationsCount;
const uint8_t* pReferenceList1Modifications;
} StdVideoEncodeH265ReferenceModifications;
typedef struct StdVideoEncodeH265PictureInfoFlags {
uint32_t is_reference_flag : 1;
uint32_t IrapPicFlag : 1;
uint32_t long_term_flag : 1;
uint32_t discardable_flag : 1;
uint32_t cross_layer_bla_flag : 1;
} StdVideoEncodeH265PictureInfoFlags;
typedef struct StdVideoEncodeH265PictureInfo {
StdVideoEncodeH265PictureInfoFlags flags;
StdVideoH265PictureType PictureType;
uint8_t sps_video_parameter_set_id;
uint8_t pps_seq_parameter_set_id;
uint8_t pps_pic_parameter_set_id;
int32_t PicOrderCntVal;
uint8_t TemporalId;
StdVideoEncodeH265PictureInfoFlags flags;
} StdVideoEncodeH265PictureInfo;
typedef struct StdVideoEncodeH265ReferenceInfoFlags {
uint32_t is_long_term : 1;
uint32_t isUsedFlag : 1;
uint32_t used_for_long_term_reference : 1;
uint32_t unused_for_reference : 1;
} StdVideoEncodeH265ReferenceInfoFlags;
typedef struct StdVideoEncodeH265ReferenceInfo {
StdVideoEncodeH265ReferenceInfoFlags flags;
int32_t PicOrderCntVal;
uint8_t TemporalId;
StdVideoEncodeH265ReferenceInfoFlags flags;
} StdVideoEncodeH265ReferenceInfo;
#ifdef __cplusplus
}
#endif
#endif // VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_
#endif

View File

@ -1,21 +1,31 @@
#ifndef VULKAN_VIDEO_CODECS_COMMON_H_
#define VULKAN_VIDEO_CODECS_COMMON_H_ 1
/*
** Copyright (c) 2019-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#ifndef VULKAN_VIDEO_CODEC_COMMON_H_
#define VULKAN_VIDEO_CODEC_COMMON_H_ 1
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#ifdef __cplusplus
extern "C" {
#endif
#define vulkan_video_codecs_common 1
#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
#ifdef __cplusplus
}
#endif
#endif // VULKAN_VIDEO_CODEC_COMMON_H_
#endif

View File

@ -2,7 +2,7 @@
// File: vk_platform.h
//
/*
** Copyright 2014-2021 The Khronos Group Inc.
** Copyright 2014-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -2,7 +2,7 @@
#define VULKAN_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
@ -38,7 +38,6 @@
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
#include <wayland-client.h>
#include "vulkan_wayland.h"
#endif

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define VULKAN_ANDROID_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
@ -44,7 +44,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
#define VK_ANDROID_external_memory_android_hardware_buffer 1
struct AHardwareBuffer;
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 4
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 5
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer"
typedef struct VkAndroidHardwareBufferUsageANDROID {
VkStructureType sType;
@ -95,7 +95,7 @@ typedef struct VkAndroidHardwareBufferFormatProperties2ANDROID {
void* pNext;
VkFormat format;
uint64_t externalFormat;
VkFormatFeatureFlags2KHR formatFeatures;
VkFormatFeatureFlags2 formatFeatures;
VkComponentMapping samplerYcbcrConversionComponents;
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
VkSamplerYcbcrRange suggestedYcbcrRange;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define VULKAN_DIRECTFB_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define VULKAN_FUCHSIA_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define VULKAN_GGP_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

File diff suppressed because it is too large Load Diff

14031
include/vulkan/vulkan_hash.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define VULKAN_IOS_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -2,7 +2,7 @@
#define VULKAN_MACOS_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -2,7 +2,7 @@
#define VULKAN_METAL_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
@ -20,7 +20,6 @@ extern "C" {
#define VK_EXT_metal_surface 1
#ifdef __OBJC__
@class CAMetalLayer;
#else
@ -47,6 +46,146 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT(
VkSurfaceKHR* pSurface);
#endif
#define VK_EXT_metal_objects 1
#ifdef __OBJC__
@protocol MTLDevice;
typedef id<MTLDevice> MTLDevice_id;
#else
typedef void* MTLDevice_id;
#endif
#ifdef __OBJC__
@protocol MTLCommandQueue;
typedef id<MTLCommandQueue> MTLCommandQueue_id;
#else
typedef void* MTLCommandQueue_id;
#endif
#ifdef __OBJC__
@protocol MTLBuffer;
typedef id<MTLBuffer> MTLBuffer_id;
#else
typedef void* MTLBuffer_id;
#endif
#ifdef __OBJC__
@protocol MTLTexture;
typedef id<MTLTexture> MTLTexture_id;
#else
typedef void* MTLTexture_id;
#endif
typedef struct __IOSurface* IOSurfaceRef;
#ifdef __OBJC__
@protocol MTLSharedEvent;
typedef id<MTLSharedEvent> MTLSharedEvent_id;
#else
typedef void* MTLSharedEvent_id;
#endif
#define VK_EXT_METAL_OBJECTS_SPEC_VERSION 1
#define VK_EXT_METAL_OBJECTS_EXTENSION_NAME "VK_EXT_metal_objects"
typedef enum VkExportMetalObjectTypeFlagBitsEXT {
VK_EXPORT_METAL_OBJECT_TYPE_METAL_DEVICE_BIT_EXT = 0x00000001,
VK_EXPORT_METAL_OBJECT_TYPE_METAL_COMMAND_QUEUE_BIT_EXT = 0x00000002,
VK_EXPORT_METAL_OBJECT_TYPE_METAL_BUFFER_BIT_EXT = 0x00000004,
VK_EXPORT_METAL_OBJECT_TYPE_METAL_TEXTURE_BIT_EXT = 0x00000008,
VK_EXPORT_METAL_OBJECT_TYPE_METAL_IOSURFACE_BIT_EXT = 0x00000010,
VK_EXPORT_METAL_OBJECT_TYPE_METAL_SHARED_EVENT_BIT_EXT = 0x00000020,
VK_EXPORT_METAL_OBJECT_TYPE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkExportMetalObjectTypeFlagBitsEXT;
typedef VkFlags VkExportMetalObjectTypeFlagsEXT;
typedef struct VkExportMetalObjectCreateInfoEXT {
VkStructureType sType;
const void* pNext;
VkExportMetalObjectTypeFlagBitsEXT exportObjectType;
} VkExportMetalObjectCreateInfoEXT;
typedef struct VkExportMetalObjectsInfoEXT {
VkStructureType sType;
const void* pNext;
} VkExportMetalObjectsInfoEXT;
typedef struct VkExportMetalDeviceInfoEXT {
VkStructureType sType;
const void* pNext;
MTLDevice_id mtlDevice;
} VkExportMetalDeviceInfoEXT;
typedef struct VkExportMetalCommandQueueInfoEXT {
VkStructureType sType;
const void* pNext;
VkQueue queue;
MTLCommandQueue_id mtlCommandQueue;
} VkExportMetalCommandQueueInfoEXT;
typedef struct VkExportMetalBufferInfoEXT {
VkStructureType sType;
const void* pNext;
VkDeviceMemory memory;
MTLBuffer_id mtlBuffer;
} VkExportMetalBufferInfoEXT;
typedef struct VkImportMetalBufferInfoEXT {
VkStructureType sType;
const void* pNext;
MTLBuffer_id mtlBuffer;
} VkImportMetalBufferInfoEXT;
typedef struct VkExportMetalTextureInfoEXT {
VkStructureType sType;
const void* pNext;
VkImage image;
VkImageView imageView;
VkBufferView bufferView;
VkImageAspectFlagBits plane;
MTLTexture_id mtlTexture;
} VkExportMetalTextureInfoEXT;
typedef struct VkImportMetalTextureInfoEXT {
VkStructureType sType;
const void* pNext;
VkImageAspectFlagBits plane;
MTLTexture_id mtlTexture;
} VkImportMetalTextureInfoEXT;
typedef struct VkExportMetalIOSurfaceInfoEXT {
VkStructureType sType;
const void* pNext;
VkImage image;
IOSurfaceRef ioSurface;
} VkExportMetalIOSurfaceInfoEXT;
typedef struct VkImportMetalIOSurfaceInfoEXT {
VkStructureType sType;
const void* pNext;
IOSurfaceRef ioSurface;
} VkImportMetalIOSurfaceInfoEXT;
typedef struct VkExportMetalSharedEventInfoEXT {
VkStructureType sType;
const void* pNext;
VkSemaphore semaphore;
VkEvent event;
MTLSharedEvent_id mtlSharedEvent;
} VkExportMetalSharedEventInfoEXT;
typedef struct VkImportMetalSharedEventInfoEXT {
VkStructureType sType;
const void* pNext;
MTLSharedEvent_id mtlSharedEvent;
} VkImportMetalSharedEventInfoEXT;
typedef void (VKAPI_PTR *PFN_vkExportMetalObjectsEXT)(VkDevice device, VkExportMetalObjectsInfoEXT* pMetalObjectsInfo);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR void VKAPI_CALL vkExportMetalObjectsEXT(
VkDevice device,
VkExportMetalObjectsInfoEXT* pMetalObjectsInfo);
#endif
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define VULKAN_SCREEN_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define VULKAN_VI_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -2,7 +2,7 @@
#define VULKAN_WAYLAND_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -2,7 +2,7 @@
#define VULKAN_WIN32_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -2,7 +2,7 @@
#define VULKAN_XCB_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -2,7 +2,7 @@
#define VULKAN_XLIB_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -2,7 +2,7 @@
#define VULKAN_XLIB_XRANDR_H_ 1
/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 -i
#
# Copyright 2021 The Khronos Group Inc.
# Copyright 2021-2022 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
# Generic alias for working group-specific API conventions interface.

View File

@ -1,14 +1,16 @@
#!/usr/bin/python3 -i
#
# Copyright 2013-2021 The Khronos Group Inc.
# Copyright 2013-2022 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
import os
import re
from generator import (GeneratorOptions, OutputGenerator, noneStr,
regSortFeatures, write)
from generator import (GeneratorOptions,
MissingGeneratorOptionsConventionsError,
MissingGeneratorOptionsError, MissingRegistryError,
OutputGenerator, noneStr, regSortFeatures, write)
class CGeneratorOptions(GeneratorOptions):
"""CGeneratorOptions - subclass of GeneratorOptions.
@ -17,12 +19,14 @@ class CGeneratorOptions(GeneratorOptions):
generation."""
def __init__(self,
prefixText="",
prefixText='',
genFuncPointers=True,
protectFile=True,
protectFeature=True,
protectProto=None,
protectProtoStr=None,
protectExtensionProto=None,
protectExtensionProtoStr=None,
apicall='',
apientry='',
apientryp='',
@ -31,6 +35,7 @@ class CGeneratorOptions(GeneratorOptions):
alignFuncParam=0,
genEnumBeginEndRange=False,
genAliasMacro=False,
genStructExtendsComment=False,
aliasMacro='',
misracstyle=False,
misracppstyle=False,
@ -40,11 +45,11 @@ class CGeneratorOptions(GeneratorOptions):
Additional parameters beyond parent class:
- prefixText - list of strings to prefix generated header with
(usually a copyright statement + calling convention macros).
(usually a copyright statement + calling convention macros)
- protectFile - True if multiple inclusion protection should be
generated (based on the filename) around the entire header.
generated (based on the filename) around the entire header
- protectFeature - True if #ifndef..#endif protection should be
generated around a feature interface in the header file.
generated around a feature interface in the header file
- genFuncPointers - True if function pointer typedefs should be
generated
- protectProto - If conditional protection should be generated
@ -54,12 +59,19 @@ class CGeneratorOptions(GeneratorOptions):
set to None.
- protectProtoStr - #ifdef/#ifndef symbol to use around prototype
declarations, if protectProto is set
- protectExtensionProto - If conditional protection should be generated
around extension prototype declarations, set to either '#ifdef'
to require opt-in (#ifdef protectExtensionProtoStr) or '#ifndef'
to require opt-out (#ifndef protectExtensionProtoStr). Otherwise
set to None
- protectExtensionProtoStr - #ifdef/#ifndef symbol to use around
extension prototype declarations, if protectExtensionProto is set
- apicall - string to use for the function declaration prefix,
such as APICALL on Windows.
such as APICALL on Windows
- apientry - string to use for the calling convention macro,
in typedefs, such as APIENTRY.
in typedefs, such as APIENTRY
- apientryp - string to use for the calling convention macro
in function pointer typedefs, such as APIENTRYP.
in function pointer typedefs, such as APIENTRYP
- indentFuncProto - True if prototype declarations should put each
parameter on a separate line
- indentFuncPointer - True if typedefed function pointers should put each
@ -70,6 +82,9 @@ class CGeneratorOptions(GeneratorOptions):
be generated for enumerated types
- genAliasMacro - True if the OpenXR alias macro should be generated
for aliased types (unclear what other circumstances this is useful)
- genStructExtendsComment - True if comments showing the structures
whose pNext chain a structure extends are included before its
definition
- aliasMacro - alias macro to inject when genAliasMacro is True
- misracstyle - generate MISRA C-friendly headers
- misracppstyle - generate MISRA C++-friendly headers"""
@ -94,6 +109,12 @@ class CGeneratorOptions(GeneratorOptions):
self.protectProtoStr = protectProtoStr
"""#ifdef/#ifndef symbol to use around prototype declarations, if protectProto is set"""
self.protectExtensionProto = protectExtensionProto
"""If conditional protection should be generated around extension prototype declarations, set to either '#ifdef' to require opt-in (#ifdef protectExtensionProtoStr) or '#ifndef' to require opt-out (#ifndef protectExtensionProtoStr). Otherwise set to None."""
self.protectExtensionProtoStr = protectExtensionProtoStr
"""#ifdef/#ifndef symbol to use around extension prototype declarations, if protectExtensionProto is set"""
self.apicall = apicall
"""string to use for the function declaration prefix, such as APICALL on Windows."""
@ -118,6 +139,9 @@ class CGeneratorOptions(GeneratorOptions):
self.genAliasMacro = genAliasMacro
"""True if the OpenXR alias macro should be generated for aliased types (unclear what other circumstances this is useful)"""
self.genStructExtendsComment = genStructExtendsComment
"""True if comments showing the structures whose pNext chain a structure extends are included before its definition"""
self.aliasMacro = aliasMacro
"""alias macro to inject when genAliasMacro is True"""
@ -148,10 +172,12 @@ class COutputGenerator(OutputGenerator):
def beginFile(self, genOpts):
OutputGenerator.beginFile(self, genOpts)
if self.genOpts is None:
raise MissingGeneratorOptionsError()
# C-specific
#
# Multiple inclusion protection & C++ wrappers.
if genOpts.protectFile and self.genOpts.filename:
if self.genOpts.protectFile and self.genOpts.filename:
headerSym = re.sub(r'\.h', '_h_',
os.path.basename(self.genOpts.filename)).upper()
write('#ifndef', headerSym, file=self.outFile)
@ -173,6 +199,8 @@ class COutputGenerator(OutputGenerator):
def endFile(self):
# C-specific
# Finish C++ wrapper and multiple inclusion protection
if self.genOpts is None:
raise MissingGeneratorOptionsError()
self.newline()
write('#ifdef __cplusplus', file=self.outFile)
write('}', file=self.outFile)
@ -193,48 +221,90 @@ class COutputGenerator(OutputGenerator):
self.sections = {section: [] for section in self.ALL_SECTIONS}
self.feature_not_empty = False
def _endProtectComment(self, protect_str, protect_directive='#ifdef'):
if protect_directive is None or protect_str is None:
raise RuntimeError('Should not call in here without something to protect')
# Do not put comments after #endif closing blocks if this is not set
if not self.genOpts.conventions.protectProtoComment:
return ''
elif 'ifdef' in protect_directive:
return f' /* {protect_str} */'
else:
return f' /* !{protect_str} */'
def endFeature(self):
"Actually write the interface to the output file."
# C-specific
if self.emit:
if self.feature_not_empty:
if self.genOpts is None:
raise MissingGeneratorOptionsError()
if self.genOpts.conventions is None:
raise MissingGeneratorOptionsConventionsError()
is_core = self.featureName and self.featureName.startswith(self.conventions.api_prefix + 'VERSION_')
if self.genOpts.conventions.writeFeature(self.featureExtraProtect, self.genOpts.filename):
self.newline()
if self.genOpts.protectFeature:
write('#ifndef', self.featureName, file=self.outFile)
# If type declarations are needed by other features based on
# this one, it may be necessary to suppress the ExtraProtect,
# or move it below the 'for section...' loop.
if self.featureExtraProtect is not None:
write('#ifdef', self.featureExtraProtect, file=self.outFile)
self.newline()
write('#define', self.featureName, '1', file=self.outFile)
for section in self.TYPE_SECTIONS:
contents = self.sections[section]
if contents:
write('\n'.join(contents), file=self.outFile)
if self.genOpts.genFuncPointers and self.sections['commandPointer']:
write('\n'.join(self.sections['commandPointer']), file=self.outFile)
self.newline()
if self.sections['command']:
if self.genOpts.protectProto:
write(self.genOpts.protectProto,
self.genOpts.protectProtoStr, file=self.outFile)
if self.genOpts.protectExtensionProto and not is_core:
write(self.genOpts.protectExtensionProto,
self.genOpts.protectExtensionProtoStr, file=self.outFile)
write('\n'.join(self.sections['command']), end='', file=self.outFile)
if self.genOpts.protectExtensionProto and not is_core:
write('#endif' +
self._endProtectComment(protect_directive=self.genOpts.protectExtensionProto,
protect_str=self.genOpts.protectExtensionProtoStr),
file=self.outFile)
if self.genOpts.protectProto:
write('#endif', file=self.outFile)
write('#endif' +
self._endProtectComment(protect_directive=self.genOpts.protectProto,
protect_str=self.genOpts.protectProtoStr),
file=self.outFile)
else:
self.newline()
if self.featureExtraProtect is not None:
write('#endif /*', self.featureExtraProtect, '*/', file=self.outFile)
write('#endif' +
self._endProtectComment(protect_str=self.featureExtraProtect),
file=self.outFile)
if self.genOpts.protectFeature:
write('#endif /*', self.featureName, '*/', file=self.outFile)
write('#endif' +
self._endProtectComment(protect_str=self.featureName),
file=self.outFile)
# Finish processing in superclass
OutputGenerator.endFeature(self)
def appendSection(self, section, text):
"Append a definition to the specified section"
# self.sections[section].append('SECTION: ' + section + '\n')
if section is None:
self.logMsg('error', 'Missing section in appendSection (probably a <type> element missing its \'category\' attribute. Text:', text)
exit(1)
self.sections[section].append(text)
self.feature_not_empty = True
@ -260,6 +330,8 @@ class COutputGenerator(OutputGenerator):
# special-purpose generator.
self.genStruct(typeinfo, name, alias)
else:
if self.genOpts is None:
raise MissingGeneratorOptionsError()
# OpenXR: this section was not under 'else:' previously, just fell through
if alias:
# If the type is an alias, just emit a typedef declaration
@ -284,7 +356,7 @@ class COutputGenerator(OutputGenerator):
"""Generate protection string.
Protection strings are the strings defining the OS/Platform/Graphics
requirements for a given OpenXR command. When generating the
requirements for a given API command. When generating the
language header files, we need to make sure the items specific to a
graphics API or OS platform are properly wrapped in #ifs."""
protect_if_str = ''
@ -293,7 +365,7 @@ class COutputGenerator(OutputGenerator):
return (protect_if_str, protect_end_str)
if ',' in protect_str:
protect_list = protect_str.split(",")
protect_list = protect_str.split(',')
protect_defs = ('defined(%s)' % d for d in protect_list)
protect_def_str = ' && '.join(protect_defs)
protect_if_str = '#if %s\n' % protect_def_str
@ -306,6 +378,8 @@ class COutputGenerator(OutputGenerator):
def typeMayAlias(self, typeName):
if not self.may_alias:
if self.registry is None:
raise MissingRegistryError()
# First time we have asked if a type may alias.
# So, populate the set of all names of types that may.
@ -315,9 +389,9 @@ class COutputGenerator(OutputGenerator):
if data.elem.get('mayalias') == 'true')
# Every type mentioned in some other type's parentstruct attribute.
parent_structs = (otherType.elem.get('parentstruct')
polymorphic_bases = (otherType.elem.get('parentstruct')
for otherType in self.registry.typedict.values())
self.may_alias.update(set(x for x in parent_structs
self.may_alias.update(set(x for x in polymorphic_bases
if x is not None))
return typeName in self.may_alias
@ -335,6 +409,9 @@ class COutputGenerator(OutputGenerator):
generate a typedef of that alias."""
OutputGenerator.genStruct(self, typeinfo, typeName, alias)
if self.genOpts is None:
raise MissingGeneratorOptionsError()
typeElem = typeinfo.elem
if alias:
@ -344,6 +421,11 @@ class COutputGenerator(OutputGenerator):
(protect_begin, protect_end) = self.genProtectString(typeElem.get('protect'))
if protect_begin:
body += protect_begin
if self.genOpts.genStructExtendsComment:
structextends = typeElem.get('structextends')
body += '// ' + typeName + ' extends ' + structextends + '\n' if structextends else ''
body += 'typedef ' + typeElem.get('category')
# This is an OpenXR-specific alternative where aliasing refers
@ -387,11 +469,16 @@ class COutputGenerator(OutputGenerator):
body = 'typedef ' + alias + ' ' + groupName + ';\n'
self.appendSection(section, body)
else:
if self.genOpts is None:
raise MissingGeneratorOptionsError()
(section, body) = self.buildEnumCDecl(self.genOpts.genEnumBeginEndRange, groupinfo, groupName)
self.appendSection(section, "\n" + body)
self.appendSection(section, '\n' + body)
def genEnum(self, enuminfo, name, alias):
"""Generate the C declaration for a constant (a single <enum> value)."""
"""Generate the C declaration for a constant (a single <enum> value).
<enum> tags may specify their values in several ways, but are usually
just integers."""
OutputGenerator.genEnum(self, enuminfo, name, alias)
@ -406,6 +493,8 @@ class COutputGenerator(OutputGenerator):
# prefix = '// ' + name + ' is an alias of command ' + alias + '\n'
# else:
# prefix = ''
if self.genOpts is None:
raise MissingGeneratorOptionsError()
prefix = ''
decls = self.makeCDecls(cmdinfo.elem)

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 -i
#
# Copyright 2013-2021 The Khronos Group Inc.
# Copyright 2013-2022 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
"""Base class for source/header/doc generators, as well as some utility functions."""
@ -17,7 +17,7 @@ import tempfile
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
from pathlib2 import Path # type: ignore
from spec_tools.util import getElemName, getElemType
@ -44,7 +44,7 @@ def enquote(s):
for serialization into Python code."""
if s:
if isinstance(s, str):
return "'{}'".format(s)
return f"'{s}'"
else:
return s
return None
@ -55,10 +55,14 @@ def regSortCategoryKey(feature):
Sorts by category of the feature name string:
- Core API features (those defined with a `<feature>` tag)
- (sort VKSC after VK - this is Vulkan-specific)
- ARB/KHR/OES (Khronos extensions)
- other (EXT/vendor extensions)"""
if feature.elem.tag == 'feature':
if feature.name.startswith('VKSC'):
return 0.5
else:
return 0
if (feature.category == 'ARB'
or feature.category == 'KHR'
@ -71,10 +75,15 @@ def regSortCategoryKey(feature):
def regSortOrderKey(feature):
"""Sort key for regSortFeatures - key is the sortorder attribute."""
# print("regSortOrderKey {} -> {}".format(feature.name, feature.sortorder))
return feature.sortorder
def regSortNameKey(feature):
"""Sort key for regSortFeatures - key is the extension name."""
return feature.name
def regSortFeatureVersionKey(feature):
"""Sort key for regSortFeatures - key is the feature version.
`<extension>` elements all have version number 0."""
@ -102,6 +111,36 @@ def regSortFeatures(featureList):
featureList.sort(key=regSortOrderKey)
class MissingGeneratorOptionsError(RuntimeError):
"""Error raised when a Generator tries to do something that requires GeneratorOptions but it is None."""
def __init__(self, msg=None):
full_msg = 'Missing generator options object self.genOpts'
if msg:
full_msg += ': ' + msg
super().__init__(full_msg)
class MissingRegistryError(RuntimeError):
"""Error raised when a Generator tries to do something that requires a Registry object but it is None."""
def __init__(self, msg=None):
full_msg = 'Missing Registry object self.registry'
if msg:
full_msg += ': ' + msg
super().__init__(full_msg)
class MissingGeneratorOptionsConventionsError(RuntimeError):
"""Error raised when a Generator tries to do something that requires a Conventions object but it is None."""
def __init__(self, msg=None):
full_msg = 'Missing Conventions object self.genOpts.conventions'
if msg:
full_msg += ': ' + msg
super().__init__(full_msg)
class GeneratorOptions:
"""Base class for options used during header/documentation production.
@ -134,8 +173,8 @@ class GeneratorOptions:
- conventions - may be mandatory for some generators:
an object that implements ConventionsBase
- filename - basename of file to generate, or None to write to stdout.
- directory - directory in which to generate files
- genpath - path to previously generated files, such as api.py
- directory - directory in which to generate filename
- genpath - path to previously generated files, such as apimap.py
- apiname - string matching `<api>` 'apiname' attribute, e.g. 'gl'.
- profile - string specifying API profile , e.g. 'core', or None.
- versions - regex matching API versions to process interfaces for.
@ -154,8 +193,7 @@ class GeneratorOptions:
to None.
- emitExtensions - regex matching names of extensions to actually emit
interfaces for (though all requested versions are considered when
deciding which interfaces to generate).
to None.
deciding which interfaces to generate). Defaults to None.
- emitSpirv - regex matching names of extensions and capabilities
to actually emit interfaces for.
- emitFormats - regex matching names of formats to actually emit
@ -167,9 +205,11 @@ class GeneratorOptions:
or <extension> being complete. Defaults to True.
- sortProcedure - takes a list of FeatureInfo objects and sorts
them in place to a preferred order in the generated output.
Default is core API versions, ARB/KHR/OES extensions, all other
extensions, by core API version number or extension number in each
group.
Default is
- core API versions
- Khronos (ARB/KHR/OES) extensions
- All other extensions
- By core API version number or extension number in each group.
The regex patterns can be None or empty, in which case they match
nothing."""
@ -181,7 +221,7 @@ class GeneratorOptions:
"basename of file to generate, or None to write to stdout."
self.genpath = genpath
"""path to previously generated files, such as api.py"""
"""path to previously generated files, such as apimap.py"""
self.directory = directory
"directory in which to generate filename"
@ -242,6 +282,9 @@ class GeneratorOptions:
self.codeGenerator = False
"""True if this generator makes compilable code"""
self.registry = None
"""Populated later with the registry object."""
self.requireCommandAliases = requireCommandAliases
"""True if alias= attributes of <command> tags are transitively
required."""
@ -295,9 +338,17 @@ class OutputGenerator:
self.diagFile = diagFile
# Internal state
self.featureName = None
"""The current feature name being generated."""
self.genOpts = None
"""The GeneratorOptions subclass instance."""
self.registry = None
"""The specification registry object."""
self.featureDictionary = {}
"""The dictionary of dictionaries of API features."""
# Used for extension enum value generation
self.extBase = 1000000000
self.extBlockSize = 1000
@ -307,6 +358,9 @@ class OutputGenerator:
# derived generators.
self.apidict = None
# File suffix for generated files, set in beginFile below.
self.file_suffix = ''
def logMsg(self, level, *args):
"""Write a message of different categories to different
destinations.
@ -333,9 +387,17 @@ class OutputGenerator:
raise UserWarning(
'*** FATAL ERROR in Generator.logMsg: unknown level:' + level)
def enumToValue(self, elem, needsNum, bitwidth = 32, forceSuffix = False):
def enumToValue(self, elem, needsNum, bitwidth = 32,
forceSuffix = False, parent_for_alias_dereference=None):
"""Parse and convert an `<enum>` tag into a value.
- elem - <enum> Element
- needsNum - generate a numeric representation of the element value
- bitwidth - size of the numeric representation in bits (32 or 64)
- forceSuffix - if True, always use a 'U' / 'ULL' suffix on integers
- parent_for_alias_dereference - if not None, an Element containing
the parent of elem, used to look for elements this is an alias of
Returns a list:
- first element - integer representation of the value, or None
@ -357,6 +419,11 @@ class OutputGenerator:
- An 'alias' attribute contains the name of another enum
which this is an alias of. The other enum must be
declared first when emitting this enum."""
if self.genOpts is None:
raise MissingGeneratorOptionsError()
if self.genOpts.conventions is None:
raise MissingGeneratorOptionsConventionsError()
name = elem.get('name')
numVal = None
if 'value' in elem.keys():
@ -381,7 +448,7 @@ class OutputGenerator:
bitpos = int(value, 0)
numVal = 1 << bitpos
value = '0x%08x' % numVal
if bitwidth == 64:
if bitwidth == 64 or bitpos >= 32:
value = value + 'ULL'
elif forceSuffix:
value = value + 'U'
@ -408,7 +475,15 @@ class OutputGenerator:
self.logMsg('diag', 'Enum', name, '-> offset [', numVal, ',', value, ']')
return [numVal, value]
if 'alias' in elem.keys():
return [None, elem.get('alias')]
alias_of = elem.get('alias')
if parent_for_alias_dereference is None:
return (None, alias_of)
siblings = parent_for_alias_dereference.findall('enum')
for sib in siblings:
sib_name = sib.get('name')
if sib_name == alias_of:
return self.enumToValue(sib, needsNum)
raise RuntimeError("Could not find the aliased enum value")
return [None, None]
def checkDuplicateEnums(self, enums):
@ -475,6 +550,11 @@ class OutputGenerator:
def buildEnumCDecl(self, expand, groupinfo, groupName):
"""Generate the C declaration for an enum"""
if self.genOpts is None:
raise MissingGeneratorOptionsError()
if self.genOpts.conventions is None:
raise MissingGeneratorOptionsConventionsError()
groupElem = groupinfo.elem
# Determine the required bit width for the enum group.
@ -580,7 +660,10 @@ class OutputGenerator:
# Work around this by chasing the aliases to get the actual value.
while numVal is None:
alias = self.registry.tree.find("enums/enum[@name='" + strVal + "']")
if alias is not None:
(numVal, strVal) = self.enumToValue(alias, True, bitwidth, True)
else:
self.logMsg('error', 'No such alias {} for enum {}'.format(strVal, name))
decl += "static const {} {} = {};\n".format(flagTypeName, name, strVal)
if numVal is not None:
@ -623,7 +706,6 @@ class OutputGenerator:
maxValidValue = 2**(32 - 1) - 1
minValidValue = (maxValidValue * -1) - 1
# Get a list of nested 'enum' tags.
enums = groupElem.findall('enum')
@ -643,6 +725,9 @@ class OutputGenerator:
# aliases can still get in the wrong order.
aliasText = []
maxName = None
minValue = None
maxValue = None
for elem in enums:
# Convert the value to an integer and use that to track min/max.
# Values of form -(number) are accepted but nothing more complex.
@ -683,10 +768,10 @@ class OutputGenerator:
if minName is None:
minName = maxName = name
minValue = maxValue = numVal
elif numVal < minValue:
elif minValue is None or numVal < minValue:
minName = name
minValue = numVal
elif numVal > maxValue:
elif maxValue is None or numVal > maxValue:
maxName = name
maxValue = numVal
@ -695,17 +780,15 @@ class OutputGenerator:
# Generate min/max value tokens - legacy use case.
if isEnum and expand:
body.extend((" {}_BEGIN_RANGE{} = {},".format(expandPrefix, expandSuffix, minName),
" {}_END_RANGE{} = {},".format(
expandPrefix, expandSuffix, maxName),
" {}_RANGE_SIZE{} = ({} - {} + 1),".format(expandPrefix, expandSuffix, maxName, minName)))
body.extend((f' {expandPrefix}_BEGIN_RANGE{expandSuffix} = {minName},',
f' {expandPrefix}_END_RANGE{expandSuffix} = {maxName},',
f' {expandPrefix}_RANGE_SIZE{expandSuffix} = ({maxName} - {minName} + 1),'))
# Generate a range-padding value to ensure the enum is 32 bits, but
# only in code generators, so it does not appear in documentation
if (self.genOpts.codeGenerator or
self.conventions.generate_max_enum_in_docs):
body.append(" {}_MAX_ENUM{} = 0x7FFFFFFF".format(
expandPrefix, expandSuffix))
body.append(f' {expandPrefix}_MAX_ENUM{expandSuffix} = 0x7FFFFFFF')
# Postfix
body.append("} %s;" % groupName)
@ -775,18 +858,24 @@ class OutputGenerator:
"""Start a new interface file
- genOpts - GeneratorOptions controlling what is generated and how"""
self.genOpts = genOpts
if self.genOpts is None:
raise MissingGeneratorOptionsError()
if self.genOpts.conventions is None:
raise MissingGeneratorOptionsConventionsError()
self.should_insert_may_alias_macro = \
self.genOpts.conventions.should_insert_may_alias_macro(self.genOpts)
self.file_suffix = self.genOpts.conventions.file_suffix
# Try to import the API dictionary, api.py, if it exists. Nothing in
# api.py cannot be extracted directly from the XML, and in the
# Try to import the API dictionary, apimap.py, if it exists. Nothing
# in apimap.py cannot be extracted directly from the XML, and in the
# future we should do that.
if self.genOpts.genpath is not None:
try:
sys.path.insert(0, self.genOpts.genpath)
import api
self.apidict = api
import apimap
self.apidict = apimap
except ImportError:
self.apidict = None
@ -805,9 +894,14 @@ class OutputGenerator:
self.warnFile.flush()
if self.diagFile:
self.diagFile.flush()
if self.outFile:
self.outFile.flush()
if self.outFile != sys.stdout and self.outFile != sys.stderr:
self.outFile.close()
if self.genOpts is None:
raise MissingGeneratorOptionsError()
# On successfully generating output, move the temporary file to the
# target file.
if self.genOpts.filename is not None:
@ -927,10 +1021,14 @@ class OutputGenerator:
- name - contents of `<name>` tag
- tail - whatever text follows that tag in the Element"""
if self.genOpts is None:
raise MissingGeneratorOptionsError()
return self.genOpts.apientry + name + tail
def makeTypedefName(self, name, tail):
"""Make the function-pointer typedef name for a command."""
if self.genOpts is None:
raise MissingGeneratorOptionsError()
return '(' + self.genOpts.apientryp + 'PFN_' + name + tail + ')'
def makeCParamDecl(self, param, aligncol):
@ -941,6 +1039,10 @@ class OutputGenerator:
- param - Element (`<param>` or `<member>`) to format
- aligncol - if non-zero, attempt to align the nested `<name>` element
at this column"""
if self.genOpts is None:
raise MissingGeneratorOptionsError()
if self.genOpts.conventions is None:
raise MissingGeneratorOptionsConventionsError()
indent = ' '
paramdecl = indent
prefix = noneStr(param.text)
@ -987,6 +1089,10 @@ class OutputGenerator:
or structure/union member).
- param - Element (`<param>` or `<member>`) to identify"""
if self.genOpts is None:
raise MissingGeneratorOptionsError()
if self.genOpts.conventions is None:
raise MissingGeneratorOptionsConventionsError()
# Allow for missing <name> tag
newLen = 0
@ -1017,6 +1123,9 @@ class OutputGenerator:
def getHandleParent(self, typename):
"""Get the parent of a handle object."""
if self.registry is None:
raise MissingRegistryError()
info = self.registry.typedict.get(typename)
if info is None:
return None
@ -1040,6 +1149,9 @@ class OutputGenerator:
def getTypeCategory(self, typename):
"""Get the category of a type."""
if self.registry is None:
raise MissingRegistryError()
info = self.registry.typedict.get(typename)
if info is None:
return None
@ -1054,6 +1166,8 @@ class OutputGenerator:
# A conventions object is required for this call.
if not self.conventions:
raise RuntimeError("To use isStructAlwaysValid, be sure your options include a Conventions object.")
if self.registry is None:
raise MissingRegistryError()
if self.conventions.type_always_valid(structname):
return True
@ -1063,7 +1177,8 @@ class OutputGenerator:
return False
info = self.registry.typedict.get(structname)
assert(info is not None)
if info is None:
self.logMsg('error', f'isStructAlwaysValid({structname}) - structure not found in typedict')
members = info.getMembers()
@ -1095,6 +1210,21 @@ class OutputGenerator:
return True
def paramIsArray(self, param):
"""Check if the parameter passed in is a pointer to an array.
param the XML information for the param
"""
return param.get('len') is not None
def paramIsPointer(self, param):
"""Check if the parameter passed in is a pointer.
param the XML information for the param
"""
tail = param.find('type').tail
return tail is not None and '*' in tail
def isEnumRequired(self, elem):
"""Return True if this `<enum>` element is
required, False otherwise
@ -1130,6 +1260,8 @@ class OutputGenerator:
`<command>` Element, as a two-element list of strings.
- cmd - Element containing a `<command>` tag"""
if self.genOpts is None:
raise MissingGeneratorOptionsError()
proto = cmd.find('proto')
params = cmd.findall('param')
# Begin accumulating prototype and typedef strings

View File

@ -1,17 +1,21 @@
#!/usr/bin/python3
#
# Copyright 2013-2021 The Khronos Group Inc.
# Copyright 2013-2022 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import pdb
import re
import sys
import time
import xml.etree.ElementTree as etree
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from cgenerator import CGeneratorOptions, COutputGenerator
from docgenerator import DocGeneratorOptions, DocOutputGenerator
from extensionmetadocgenerator import (ExtensionMetaDocGeneratorOptions,
ExtensionMetaDocOutputGenerator)
@ -22,12 +26,11 @@ from hostsyncgenerator import HostSynchronizationOutputGenerator
from formatsgenerator import FormatsOutputGenerator
from pygenerator import PyOutputGenerator
from rubygenerator import RubyOutputGenerator
from reflib import logDiag, logWarn, setLogFile
from reflib import logDiag, logWarn, logErr, setLogFile
from reg import Registry
from validitygenerator import ValidityOutputGenerator
from apiconventions import APIConventions
# Simple timer functions
startTime = None
@ -40,7 +43,7 @@ def startTimer(timeit):
def endTimer(timeit, msg):
global startTime
if timeit:
if timeit and startTime is not None:
endTime = time.process_time()
logDiag(msg, endTime - startTime)
startTime = None
@ -91,7 +94,7 @@ def makeGenOpts(args):
# Output target directory
directory = args.directory
# Path to generated files, particularly api.py
# Path to generated files, particularly apimap.py
genpath = args.genpath
# Generate MISRA C-friendly headers
@ -116,9 +119,9 @@ def makeGenOpts(args):
# The SPDX formatting below works around constraints of the 'reuse' tool
prefixStrings = [
'/*',
'** Copyright 2015-2021 The Khronos Group Inc.',
'** Copyright 2015-2022 The Khronos Group Inc.',
'**',
'** SPDX' + '-License-Identifier: Apache-2.0',
'** SPDX-License-Identifier' + ': Apache-2.0',
'*/',
''
]
@ -172,11 +175,11 @@ def makeGenOpts(args):
# Python and Ruby representations of API information, used by scripts
# that do not need to load the full XML.
genOpts['api.py'] = [
genOpts['apimap.py'] = [
PyOutputGenerator,
DocGeneratorOptions(
conventions = conventions,
filename = 'api.py',
filename = 'apimap.py',
directory = directory,
genpath = None,
apiname = defaultAPIName,
@ -190,11 +193,11 @@ def makeGenOpts(args):
reparentEnums = False)
]
genOpts['api.rb'] = [
genOpts['apimap.rb'] = [
RubyOutputGenerator,
DocGeneratorOptions(
conventions = conventions,
filename = 'api.rb',
filename = 'apimap.rb',
directory = directory,
genpath = None,
apiname = defaultAPIName,
@ -394,7 +397,8 @@ def makeGenOpts(args):
[ 'vulkan_xlib.h', [ 'VK_KHR_xlib_surface' ], commonSuppressExtensions ],
[ 'vulkan_directfb.h', [ 'VK_EXT_directfb_surface' ], commonSuppressExtensions ],
[ 'vulkan_xlib_xrandr.h', [ 'VK_EXT_acquire_xlib_display' ], commonSuppressExtensions ],
[ 'vulkan_metal.h', [ 'VK_EXT_metal_surface' ], commonSuppressExtensions ],
[ 'vulkan_metal.h', [ 'VK_EXT_metal_surface',
'VK_EXT_metal_objects' ], commonSuppressExtensions ],
[ 'vulkan_screen.h', [ 'VK_QNX_screen_surface' ], commonSuppressExtensions ],
[ 'vulkan_beta.h', betaRequireExtensions, betaSuppressExtensions ],
]
@ -511,6 +515,83 @@ def makeGenOpts(args):
misracppstyle = misracppstyle)
]
# Video header target - combines all video extension dependencies into a
# single header, at present.
genOpts['vk_video.h'] = [
COutputGenerator,
CGeneratorOptions(
conventions = conventions,
filename = 'vk_video.h',
directory = directory,
genpath = None,
apiname = 'vulkan',
profile = None,
versions = None,
emitversions = None,
defaultExtensions = defaultExtensions,
addExtensions = addExtensionsPat,
removeExtensions = removeExtensionsPat,
emitExtensions = emitExtensionsPat,
prefixText = prefixStrings + vkPrefixStrings,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = False,
protectProto = '#ifndef',
protectProtoStr = 'VK_NO_PROTOTYPES',
apicall = '',
apientry = '',
apientryp = '',
alignFuncParam = 48,
misracstyle = misracstyle,
misracppstyle = misracppstyle)
]
# Video extension 'Std' interfaces, each in its own header files
# These are not Vulkan extensions, or a part of the Vulkan API at all,
# but are treated in a similar fashion for generation purposes.
#
# Each element of the videoStd[] array is an extension name defining an
# interface, and is also the basis for the generated header file name.
videoStd = [
'vulkan_video_codecs_common',
'vulkan_video_codec_h264std',
'vulkan_video_codec_h264std_decode',
'vulkan_video_codec_h264std_encode',
'vulkan_video_codec_h265std',
'vulkan_video_codec_h265std_decode',
'vulkan_video_codec_h265std_encode',
]
addExtensionRE = makeREstring(videoStd)
for codec in videoStd:
headername = f'{codec}.h'
# Consider all of the codecs 'extensions', but only emit this one
emitExtensionRE = makeREstring([codec])
opts = CGeneratorOptions(
conventions = conventions,
filename = headername,
directory = directory,
genpath = None,
apiname = defaultAPIName,
profile = None,
versions = None,
emitversions = None,
defaultExtensions = None,
addExtensions = addExtensionRE,
removeExtensions = None,
emitExtensions = emitExtensionRE,
prefixText = prefixStrings + vkPrefixStrings,
genFuncPointers = False,
protectFile = protectFile,
protectFeature = False,
alignFuncParam = 48,
)
genOpts[headername] = [ COutputGenerator, opts ]
# Unused - vulkan11.h target.
# It is possible to generate a header with just the Vulkan 1.0 +
# extension interfaces defined, but since the promoted KHR extensions
@ -589,8 +670,6 @@ def genTarget(args):
# Create generator options with parameters specified on command line
makeGenOpts(args)
# pdb.set_trace()
# Select a generator matching the requested target
if args.target in genOpts:
createGenerator = genOpts[args.target][0]
@ -662,8 +741,6 @@ if __name__ == '__main__':
help='Use specified registry file instead of vk.xml')
parser.add_argument('-time', action='store_true',
help='Enable timing')
parser.add_argument('-validate', action='store_true',
help='Validate the registry properties and exit')
parser.add_argument('-genpath', action='store', default='gen',
help='Path to generated files')
parser.add_argument('-o', action='store', dest='directory',
@ -701,8 +778,6 @@ if __name__ == '__main__':
# Log diagnostics and warnings
setLogFile(setDiag = True, setWarn = True, filename = '-')
(gen, options) = (None, None)
if not args.validate:
# Create the API generator & generator options
(gen, options) = genTarget(args)
@ -720,10 +795,6 @@ if __name__ == '__main__':
reg.loadElementTree(tree)
endTimer(args.time, '* Time to parse ElementTree =')
if args.validate:
success = reg.validateRegistry()
sys.exit(0 if success else 1)
if args.dump:
logDiag('* Dumping registry to regdump.txt')
reg.dumpReg(filehandle=open('regdump.txt', 'w', encoding='utf-8'))

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 -i
#
# Copyright 2013-2021 The Khronos Group Inc.
# Copyright 2013-2022 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
@ -11,7 +11,8 @@ import re
import sys
import xml.etree.ElementTree as etree
from collections import defaultdict, deque, namedtuple
from generator import OutputGenerator, GeneratorOptions, write
from generator import GeneratorOptions, OutputGenerator, noneStr, write
from apiconventions import APIConventions
def apiNameMatch(str, supported):
@ -104,13 +105,14 @@ def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True):
for child in parent.findall('*'):
api = child.get('api')
if api:
if not apiNameMatch(apiName, api):
if actuallyDelete:
parent.remove(child)
else:
if apiNameMatch(apiName, api):
# Add child to the queue
stack.append(child)
elif not apiNameMatch(apiName, api):
# Child does not match requested api. Remove it.
if actuallyDelete:
parent.remove(child)
class BaseInfo:
@ -267,22 +269,21 @@ class FeatureInfo(BaseInfo):
attribute of <feature>. Extensions do not have API version
numbers and are assigned number 0."""
self.number = "0"
self.number = 0
self.supported = None
else:
# Extract vendor portion of <APIprefix>_<vendor>_<name>
self.category = self.name.split('_', 2)[1]
self.version = "0"
self.versionNumber = "0"
self.number = elem.get('number')
self.number = int(elem.get('number','0'))
"""extension number, used for ordering and for assigning
enumerant offsets. <feature> features do not have extension
numbers and are assigned number 0."""
numbers and are assigned number 0, as are extensions without
numbers, so sorting works."""
# If there is no 'number' attribute, use 0, so sorting works
if self.number is None:
self.number = 0
self.supported = elem.get('supported')
self.supported = elem.get('supported', 'disabled')
class SpirvInfo(BaseInfo):
"""Registry information about an API <spirvextensions>
@ -294,8 +295,10 @@ class SpirvInfo(BaseInfo):
class FormatInfo(BaseInfo):
"""Registry information about an API <format>."""
def __init__(self, elem):
def __init__(self, elem, condition):
BaseInfo.__init__(self, elem)
# Need to save the condition here when it is known
self.condition = condition
class Registry:
"""Object representing an API registry, loaded from an XML file."""
@ -399,26 +402,19 @@ class Registry:
Intended for internal use only.
- elem - `<type>`/`<enums>`/`<enum>`/`<command>`/`<feature>`/`<extension>`/`<spirvextension>`/`<spirvcapability>`/`<format>` Element
- info - corresponding {Type|Group|Enum|Cmd|Feature|Spirv}Info object
- info - corresponding {Type|Group|Enum|Cmd|Feature|Spirv|Format}Info object
- infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' / 'spirvextension' / 'spirvcapability' / 'format'
- dictionary - self.{type|group|enum|cmd|api|ext|format|spirvext|spirvcap}dict
If the Element has an 'api' attribute, the dictionary key is the
tuple (name,api). If not, the key is the name. 'name' is an
attribute of the Element"""
The dictionary key is the element 'name' attribute."""
# self.gen.logMsg('diag', 'Adding ElementInfo.required =',
# info.required, 'name =', elem.get('name'))
api = elem.get('api')
if api:
key = (elem.get('name'), api)
else:
key = elem.get('name')
if key in dictionary:
if not dictionary[key].compareElem(info, infoName):
self.gen.logMsg('warn', 'Attempt to redefine', key,
'(this should not happen)')
else:
True
else:
dictionary[key] = info
@ -448,6 +444,8 @@ class Registry:
def parseTree(self):
"""Parse the registry Element, once created"""
# This must be the Element for the root <registry>
if self.tree is None:
raise RuntimeError("Tree not initialized!")
self.reg = self.tree.getroot()
# Preprocess the tree by removing all elements with non-matching
@ -459,7 +457,7 @@ class Registry:
# overlapping api attributes, or where one element has an api
# attribute and the other does not.
stripNonmatchingAPIs(self.reg, self.genOpts.apiname)
stripNonmatchingAPIs(self.reg, self.genOpts.apiname, actuallyDelete = True)
# Create dictionary of registry types from toplevel <types> tags
# and add 'name' attribute to each <type> tag (where missing)
@ -472,7 +470,10 @@ class Registry:
# If the <type> does not already have a 'name' attribute, set
# it from contents of its <name> tag.
if type_elem.get('name') is None:
type_elem.set('name', type_elem.find('name').text)
name_elem = type_elem.find('name')
if name_elem is None or not name_elem.text:
raise RuntimeError("Type without a name!")
type_elem.set('name', name_elem.text)
self.addElementInfo(type_elem, TypeInfo(type_elem), 'type', self.typedict)
# Create dictionary of registry enum groups from <enums> tags.
@ -517,7 +518,10 @@ class Registry:
# it from contents of its <proto><name> tag.
name = cmd.get('name')
if name is None:
name = cmd.set('name', cmd.find('proto/name').text)
name_elem = cmd.find('proto/name')
if name_elem is None or not name_elem.text:
raise RuntimeError("Command without a name!")
name = cmd.set('name', name_elem.text)
ci = CmdInfo(cmd)
self.addElementInfo(cmd, ci, 'command', self.cmddict)
alias = cmd.get('alias')
@ -547,6 +551,7 @@ class Registry:
# Create dictionaries of API and extension interfaces
# from toplevel <api> and <extension> tags.
self.apidict = {}
format_condition = dict()
for feature in self.reg.findall('feature'):
featureInfo = FeatureInfo(feature)
self.addElementInfo(feature, featureInfo, 'feature', self.apidict)
@ -583,6 +588,11 @@ class Registry:
else:
self.gen.logMsg('warn', 'NO matching group',
groupName, 'for enum', enum.get('name'), 'found.')
if groupName == "VkFormat":
format_name = enum.get('name')
if enum.get('alias'):
format_name = enum.get('alias')
format_condition[format_name] = featureInfo.name
addEnumInfo = True
elif enum.get('value') or enum.get('bitpos') or enum.get('alias'):
# self.gen.logMsg('diag', 'Adding extension constant "enum"',
@ -617,10 +627,10 @@ class Registry:
# as when redefining an enum in another extension.
extnumber = enum.get('extnumber')
if not extnumber:
enum.set('extnumber', featureInfo.number)
enum.set('extnumber', str(featureInfo.number))
enum.set('extname', featureInfo.name)
enum.set('supported', featureInfo.supported)
enum.set('supported', noneStr(featureInfo.supported))
# Look up the GroupInfo with matching groupName
if groupName in self.groupdict:
# self.gen.logMsg('diag', 'Matching group',
@ -630,6 +640,15 @@ class Registry:
else:
self.gen.logMsg('warn', 'NO matching group',
groupName, 'for enum', enum.get('name'), 'found.')
# This is Vulkan-specific
if groupName == "VkFormat":
format_name = enum.get('name')
if enum.get('alias'):
format_name = enum.get('alias')
if format_name in format_condition:
format_condition[format_name] += "," + featureInfo.name
else:
format_condition[format_name] = featureInfo.name
addEnumInfo = True
elif enum.get('value') or enum.get('bitpos') or enum.get('alias'):
# self.gen.logMsg('diag', 'Adding extension constant "enum"',
@ -647,9 +666,10 @@ class Registry:
disabled_types.append(type_elem.get('name'))
for type_elem in self.reg.findall('types/type'):
if type_elem.get('name') not in disabled_types:
parentStructs = type_elem.get('structextends')
if parentStructs is not None:
for parent in parentStructs.split(','):
# The structure type this may be chained to.
struct_extends = type_elem.get('structextends')
if struct_extends is not None:
for parent in struct_extends.split(','):
# self.gen.logMsg('diag', type.get('name'), 'extends', parent)
self.validextensionstructs[parent].append(type_elem.get('name'))
# Sort the lists so they do not depend on the XML order
@ -666,7 +686,11 @@ class Registry:
self.addElementInfo(spirv, spirvInfo, 'spirvcapability', self.spirvcapdict)
for format in self.reg.findall('formats/format'):
formatInfo = FormatInfo(format)
condition = None
format_name = format.get('name')
if format_name in format_condition:
condition = format_condition[format_name]
formatInfo = FormatInfo(format, condition)
self.addElementInfo(format, formatInfo, 'format', self.formatsdict)
def dumpReg(self, maxlen=120, filehandle=sys.stdout):
@ -720,6 +744,7 @@ class Registry:
- required - boolean (to tag features as required or not)
"""
self.gen.logMsg('diag', 'tagging type:', typename, '-> required =', required)
# Get TypeInfo object for <type> tag corresponding to typename
typeinfo = self.lookupElementInfo(typename, self.typedict)
if typeinfo is not None:
@ -774,20 +799,18 @@ class Registry:
- enumname - name of enum
- required - boolean (to tag features as required or not)"""
self.gen.logMsg('diag', 'tagging enum:', enumname, '-> required =', required)
self.gen.logMsg('diag', 'markEnumRequired: tagging enum:', enumname, '-> required =', required)
enum = self.lookupElementInfo(enumname, self.enumdict)
if enum is not None:
# If the enum is part of a group, and is being removed, then
# look it up in that <group> tag and remove it there, so that it
# is not visible to generators (which traverse the <group> tag
# elements themselves).
# This is not the most robust way of doing this, since a removed
# enum that is later required again will no longer have a group
# element, but it makes the change non-intrusive on generator
# code.
if required is False:
# look it up in that <enums> tag and remove the Element there,
# so that it is not visible to generators (which traverse the
# <enums> tag elements rather than using the dictionaries).
if not required:
groupName = enum.elem.get('extends')
if groupName is not None:
self.gen.logMsg('diag', f'markEnumRequired: Removing extending enum {enum.elem.get("name")}')
# Look up the Info with matching groupName
if groupName in self.groupdict:
gi = self.groupdict[groupName]
@ -796,23 +819,42 @@ class Registry:
# Remove copy of this enum from the group
gi.elem.remove(gienum)
else:
self.gen.logMsg('warn', 'Cannot remove enum',
self.gen.logMsg('warn', 'markEnumRequired: Cannot remove enum',
enumname, 'not found in group',
groupName)
else:
self.gen.logMsg('warn', 'Cannot remove enum',
self.gen.logMsg('warn', 'markEnumRequired: Cannot remove enum',
enumname, 'from nonexistent group',
groupName)
else:
# This enum is not an extending enum.
# The XML tree must be searched for all <enums> that
# might have it, so we know the parent to delete from.
enumName = enum.elem.get('name')
self.gen.logMsg('diag', f'markEnumRequired: Removing non-extending enum {enumName}')
count = 0
for enums in self.reg.findall('enums'):
for thisEnum in enums.findall('enum'):
if thisEnum.get('name') == enumName:
# Actually remove it
count = count + 1
enums.remove(thisEnum)
if count == 0:
self.gen.logMsg('warn', f'markEnumRequired: {enumName}) not found in any <enums> tag')
enum.required = required
# Tag enum dependencies in 'alias' attribute as required
depname = enum.elem.get('alias')
if depname:
self.gen.logMsg('diag', 'Generating dependent enum',
self.gen.logMsg('diag', 'markEnumRequired: Generating dependent enum',
depname, 'for alias', enumname, 'required =', enum.required)
self.markEnumRequired(depname, required)
else:
self.gen.logMsg('warn', 'enum:', enumname, 'IS NOT DEFINED')
self.gen.logMsg('warn', f'markEnumRequired: {enumname} IS NOT DEFINED')
def markCmdRequired(self, cmdname, required):
"""Mark a command as required or not.
@ -841,7 +883,7 @@ class Registry:
self.markCmdRequired(depname, required)
# Tag all parameter types of this command as required.
# This DOES NOT remove types of commands in a <remove>
# This does not remove types of commands in a <remove>
# tag, because many other commands may use the same type.
# We could be more clever and reference count types,
# instead of using a boolean.
@ -954,6 +996,11 @@ class Registry:
# Determine the required extension or version needed for a require block
# Assumes that only one of these is specified
# 'extension', and therefore 'required_key', may be a boolean
# expression of extension names.
# 'required_key' is used only as a dictionary key at
# present, and passed through to the script generators, so
# they must be prepared to parse that expression.
required_key = require.get('feature')
if required_key is None:
required_key = require.get('extension')
@ -1009,11 +1056,11 @@ class Registry:
else:
self.gen.logMsg('warn', 'fillFeatureDictionary: NOT filling for {}'.format(typename))
def requireAndRemoveFeatures(self, interface, featurename, api, profile):
"""Process `<require>` and `<remove>` tags for a `<version>` or `<extension>`.
def requireFeatures(self, interface, featurename, api, profile):
"""Process `<require>` tags for a `<version>` or `<extension>`.
- interface - Element for `<version>` or `<extension>`, containing
`<require>` and `<remove>` tags
`<require>` tags
- featurename - name of the feature
- api - string specifying API name being generated
- profile - string specifying API profile being generated"""
@ -1023,6 +1070,15 @@ class Registry:
if matchAPIProfile(api, profile, feature):
self.markRequired(featurename, feature, True)
def removeFeatures(self, interface, featurename, api, profile):
"""Process `<remove>` tags for a `<version>` or `<extension>`.
- interface - Element for `<version>` or `<extension>`, containing
`<remove>` tags
- featurename - name of the feature
- api - string specifying API name being generated
- profile - string specifying API profile being generated"""
# <remove> marks things that are removed by this version/profile
for feature in interface.findall('remove'):
if matchAPIProfile(api, profile, feature):
@ -1038,6 +1094,7 @@ class Registry:
if v.get('struct'):
self.typedict[v.get('struct')].additionalValidity.append(copy.deepcopy(v))
def removeAdditionalValidity(self, interface, api, profile):
# Loop over all usage inside all <remove> tags.
for feature in interface.findall('remove'):
if matchAPIProfile(api, profile, feature):
@ -1165,7 +1222,8 @@ class Registry:
if extname is not None:
# 'supported' attribute was injected when the <enum> element was
# moved into the <enums> group in Registry.parseTree()
if self.genOpts.defaultExtensions == elem.get('supported'):
supported_list = elem.get('supported').split(",")
if self.genOpts.defaultExtensions in supported_list:
required = True
elif re.match(self.genOpts.addExtensions, extname) is not None:
required = True
@ -1187,6 +1245,8 @@ class Registry:
if name in enumAliases:
elem.set('required', 'true')
self.gen.logMsg('diag', '* also need to require alias', name)
if f is None:
raise RuntimeError("Should not get here")
if f.elem.get('category') == 'bitmask':
followupFeature = f.elem.get('bitvalues')
elif ftype == 'command':
@ -1209,6 +1269,8 @@ class Registry:
# Actually generate the type only if emitting declarations
if self.emitFeatures:
self.gen.logMsg('diag', 'Emitting', ftype, 'decl for', fname)
if genProc is None:
raise RuntimeError("genProc is None when we should be emitting")
genProc(f, fname, alias)
else:
self.gen.logMsg('diag', 'Skipping', ftype, fname,
@ -1353,7 +1415,7 @@ class Registry:
# Get all matching extensions, in order by their extension number,
# and add to the list of features.
# Start with extensions tagged with 'api' pattern matching the API
# Start with extensions whose 'supported' attributes match the API
# being generated. Add extensions matching the pattern specified in
# regExtensions, then remove extensions matching the pattern
# specified in regRemoveExtensions
@ -1373,7 +1435,7 @@ class Registry:
# the regexp specified in the generator options. This allows
# forcing extensions into an interface even if they are not
# tagged appropriately in the registry.
# However we still respect the 'supported' attribute.
# However, we still respect the 'supported' attribute.
if regAddExtensions.match(extName) is not None:
if not apiNameMatch(self.genOpts.apiname, ei.elem.get('supported')):
self.gen.logMsg('diag', 'NOT including extension',
@ -1433,24 +1495,26 @@ class Registry:
# Sort the features list, if a sort procedure is defined
if self.genOpts.sortProcedure:
self.genOpts.sortProcedure(features)
# print('sortProcedure ->', [f.name for f in features])
# Pass 1: loop over requested API versions and extensions tagging
# Passes 1+2: loop over requested API versions and extensions tagging
# types/commands/features as required (in an <require> block) or no
# longer required (in an <remove> block). It is possible to remove
# a feature in one version and restore it later by requiring it in
# a later version.
# longer required (in an <remove> block). <remove>s are processed
# after all <require>s, so removals win.
# If a profile other than 'None' is being generated, it must
# match the profile attribute (if any) of the <require> and
# <remove> tags.
self.gen.logMsg('diag', 'PASS 1: TAG FEATURES')
for f in features:
self.gen.logMsg('diag', 'PASS 1: Tagging required and removed features for',
f.name)
self.gen.logMsg('diag', 'PASS 1: Tagging required and features for', f.name)
self.fillFeatureDictionary(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
self.requireAndRemoveFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
self.requireFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
self.assignAdditionalValidity(f.elem, self.genOpts.apiname, self.genOpts.profile)
for f in features:
self.gen.logMsg('diag', 'PASS 2: Tagging removed features for', f.name)
self.removeFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
self.removeAdditionalValidity(f.elem, self.genOpts.apiname, self.genOpts.profile)
# Now, strip references to APIs that are not required.
# At present such references may occur in:
# Structs in <type category="struct"> 'structextends' attributes
@ -1466,17 +1530,17 @@ class Registry:
# <enable extension="VK_KHR_shader_draw_parameters"/>
# <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderDenormPreserveFloat16" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
# Pass 2: loop over specified API versions and extensions printing
# Pass 3: loop over specified API versions and extensions printing
# declarations for required things which have not already been
# generated.
self.gen.logMsg('diag', 'PASS 2: GENERATE INTERFACES FOR FEATURES')
self.gen.logMsg('diag', 'PASS 3: GENERATE INTERFACES FOR FEATURES')
self.gen.beginFile(self.genOpts)
for f in features:
self.gen.logMsg('diag', 'PASS 2: Generating interface for',
self.gen.logMsg('diag', 'PASS 3: Generating interface for',
f.name)
emit = self.emitFeatures = f.emit
if not emit:
self.gen.logMsg('diag', 'PASS 2: NOT declaring feature',
self.gen.logMsg('diag', 'PASS 3: NOT declaring feature',
f.elem.get('name'), 'because it is not tagged for emission')
# Generate the interface (or just tag its elements as having been
# emitted, if they have not been).
@ -1504,45 +1568,3 @@ class Registry:
self.cmddict[cmd].resetState()
for cmd in self.apidict:
self.apidict[cmd].resetState()
def __validateStructLimittypes(self, struct):
"""Validate 'limittype' attributes for a single struct."""
limittypeDiags = namedtuple('limittypeDiags', ['missing', 'invalid'])
badFields = defaultdict(lambda : limittypeDiags(missing=[], invalid=[]))
validLimittypes = { 'min', 'max', 'bitmask', 'range', 'struct', 'noauto' }
for member in struct.getMembers():
memberName = member.findtext('name')
if memberName in ['sType', 'pNext']:
continue
limittype = member.get('limittype')
if not limittype:
badFields[struct.elem.get('name')].missing.append(memberName)
elif limittype == 'struct':
typeName = member.findtext('type')
memberType = self.typedict[typeName]
badFields.update(self.__validateStructLimittypes(memberType))
elif limittype not in validLimittypes:
badFields[struct.elem.get('name')].invalid.append(memberName)
return badFields
def __validateLimittype(self):
"""Validate 'limittype' attributes."""
badFields = self.__validateStructLimittypes(self.typedict['VkPhysicalDeviceProperties2'])
for featStructName in self.validextensionstructs['VkPhysicalDeviceProperties2']:
featStruct = self.typedict[featStructName]
badFields.update(self.__validateStructLimittypes(featStruct))
if badFields:
self.gen.logMsg('diag', 'SUMMARY OF FIELDS WITH INCORRECT LIMITTYPES')
for key in sorted(badFields.keys()):
diags = badFields[key]
if diags.missing:
self.gen.logMsg('diag', ' ', key, 'missing limittype:', ', '.join(badFields[key].missing))
if diags.invalid:
self.gen.logMsg('diag', ' ', key, 'invalid limittype:', ', '.join(badFields[key].invalid))
return False
return True
def validateRegistry(self):
"""Validate properties of the registry."""
return self.__validateLimittype()

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 -i
#
# Copyright 2013-2021 The Khronos Group Inc.
# Copyright 2013-2022 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
@ -8,6 +8,8 @@
# used in generation.
from enum import Enum
import abc
import re
# Type categories that respond "False" to isStructAlwaysValid
# basetype is home to typedefs like ..Bool32
@ -21,13 +23,16 @@ CATEGORIES_REQUIRING_VALIDATION = set(('handle',
TYPES_KNOWN_ALWAYS_VALID = set(('char',
'float',
'int8_t', 'uint8_t',
'int16_t', 'uint16_t',
'int32_t', 'uint32_t',
'int64_t', 'uint64_t',
'size_t',
'uintptr_t',
'intptr_t', 'uintptr_t',
'int',
))
# Split an extension name into vendor ID and name portions
EXT_NAME_DECOMPOSE_RE = re.compile(r'[A-Z]+_(?P<vendor>[A-Z]+)_(?P<name>[\w_]+)')
class ProseListFormats(Enum):
"""A connective, possibly with a quantifier."""
@ -42,7 +47,7 @@ class ProseListFormats(Enum):
return cls.OR
if s == 'and':
return cls.AND
return None
raise RuntimeError("Unrecognized string connective: " + s)
@property
def connective(self):
@ -63,7 +68,7 @@ class ProseListFormats(Enum):
return ''
class ConventionsBase:
class ConventionsBase(abc.ABC):
"""WG-specific conventions."""
def __init__(self):
@ -72,9 +77,10 @@ class ConventionsBase:
def formatExtension(self, name):
"""Mark up an extension name as a link the spec."""
return '`apiext:{}`'.format(name)
return '`<<{}>>`'.format(name)
@property
@abc.abstractmethod
def null(self):
"""Preferred spelling of NULL."""
raise NotImplementedError
@ -112,6 +118,38 @@ class ConventionsBase:
"""
return 'code:'
@property
@abc.abstractmethod
def structtype_member_name(self):
"""Return name of the structure type member.
Must implement.
"""
raise NotImplementedError()
@property
@abc.abstractmethod
def nextpointer_member_name(self):
"""Return name of the structure pointer chain member.
Must implement.
"""
raise NotImplementedError()
@property
@abc.abstractmethod
def xml_api_name(self):
"""Return the name used in the default API XML registry for the default API"""
raise NotImplementedError()
@abc.abstractmethod
def generate_structure_type_from_name(self, structname):
"""Generate a structure type name, like XR_TYPE_CREATE_INSTANCE_INFO.
Must implement.
"""
raise NotImplementedError()
def makeStructName(self, name):
"""Prepend the appropriate format macro for a structure to a structure type name.
@ -166,10 +204,12 @@ class ConventionsBase:
return ''.join(parts)
@property
@abc.abstractmethod
def file_suffix(self):
"""Return suffix of generated Asciidoctor files"""
raise NotImplementedError
@abc.abstractmethod
def api_name(self, spectype=None):
"""Return API or specification name for citations in ref pages.
@ -206,6 +246,7 @@ class ConventionsBase:
return self._type_prefix
@property
@abc.abstractmethod
def api_prefix(self):
"""Return API token prefix.
@ -329,24 +370,43 @@ class ConventionsBase:
documentation includes."""
return False
def extension_include_string(self, ext):
"""Return format string for include:: line for an extension appendix
file. ext is an object with the following members:
- name - extension string string
- vendor - vendor portion of name
- barename - remainder of name
@abc.abstractmethod
def extension_file_path(self, name):
"""Return file path to an extension appendix relative to a directory
containing all such appendices.
- name - extension name
Must implement."""
raise NotImplementedError
def extension_include_string(self, name):
"""Return format string for include:: line for an extension appendix
file.
- name - extension name"""
return 'include::{{appendices}}/{}[]'.format(
self.extension_file_path(name))
@property
def refpage_generated_include_path(self):
"""Return path relative to the generated reference pages, to the
generated API include files.
def provisional_extension_warning(self):
"""Return True if a warning should be included in extension
appendices for provisional extensions."""
return True
Must implement."""
raise NotImplementedError
@property
def generated_include_path(self):
"""Return path relative to the generated reference pages, to the
generated API include files."""
return '{generated}'
@property
def include_extension_appendix_in_refpage(self):
"""Return True if generating extension refpages by embedding
extension appendix content (default), False otherwise
(OpenXR)."""
return True
def valid_flag_bit(self, bitpos):
"""Return True if bitpos is an allowed numeric bit position for
@ -356,3 +416,30 @@ class ConventionsBase:
or 64 bits), and may depend on assumptions about compiler
handling of sign bits in enumerated types, as well."""
return True
@property
def duplicate_aliased_structs(self):
"""
Should aliased structs have the original struct definition listed in the
generated docs snippet?
"""
return False
@property
def protectProtoComment(self):
"""Return True if generated #endif should have a comment matching
the protection symbol used in the opening #ifdef/#ifndef."""
return False
@property
def extra_refpage_headers(self):
"""Return any extra headers (preceding the title) for generated
reference pages."""
return ''
@property
def extra_refpage_body(self):
"""Return any extra text (following the title) for generated
reference pages."""
return ''

View File

@ -1,6 +1,6 @@
"""Utility functions not closely tied to other spec_tools types."""
# Copyright 2018-2019 Collabora, Ltd.
# Copyright 2013-2021 The Khronos Group Inc.
# Copyright (c) 2018-2019 Collabora, Ltd.
# Copyright 2013-2022 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0

File diff suppressed because one or more lines are too long

1182
registry/video.xml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 -i
#
# Copyright 2013-2021 The Khronos Group Inc.
# Copyright 2013-2022 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
@ -10,8 +10,7 @@
import re
import os
from conventions import ConventionsBase
from spec_tools.conventions import ConventionsBase
# Modified from default implementation - see category_requires_validation() below
CATEGORIES_REQUIRING_VALIDATION = set(('handle', 'enum', 'bitmask'))
@ -22,6 +21,8 @@ CATEGORIES_REQUIRING_VALIDATION = set(('handle', 'enum', 'bitmask'))
# Ideally these would be listed in the spec as exceptions, as OpenXR does.
SPECIAL_WORDS = set((
'16Bit', # VkPhysicalDevice16BitStorageFeatures
'2D', # VkPhysicalDeviceImage2DViewOf3DFeaturesEXT
'3D', # VkPhysicalDeviceImage2DViewOf3DFeaturesEXT
'8Bit', # VkPhysicalDevice8BitStorageFeaturesKHR
'AABB', # VkGeometryAABBNV
'ASTC', # VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT
@ -49,6 +50,10 @@ class VulkanConventions(ConventionsBase):
"""Preferred spelling of NULL."""
return '`NULL`'
def formatExtension(self, name):
"""Mark up an extension name as a link the spec."""
return '`apiext:{}`'.format(name)
@property
def struct_macro(self):
"""Get the appropriate format macro for a structure.
@ -118,7 +123,7 @@ class VulkanConventions(ConventionsBase):
@property
def file_suffix(self):
"""Return suffix of generated Asciidoctor files"""
return '.txt'
return '.adoc'
def api_name(self, spectype='api'):
"""Return API or specification name for citations in ref pages.ref
@ -173,7 +178,7 @@ class VulkanConventions(ConventionsBase):
instead. N.b. this may need to change on a per-refpage basis if
there are multiple documents involved.
"""
return 'https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html'
return 'https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html'
@property
def xml_api_name(self):
@ -196,11 +201,6 @@ class VulkanConventions(ConventionsBase):
section describing extension special uses in detail."""
return 'extendingvulkan-compatibility-specialuse'
@property
def extra_refpage_headers(self):
"""Return any extra text to add to refpage headers."""
return 'include::{config}/attribs.txt[]'
@property
def extension_index_prefixes(self):
"""Return a list of extension prefixes used to group extension refpages."""
@ -249,21 +249,12 @@ class VulkanConventions(ConventionsBase):
return True
def extension_include_string(self, ext):
"""Return format string for include:: line for an extension appendix
file. ext is an object with the following members:
- name - extension string string
- vendor - vendor portion of name
- barename - remainder of name"""
def extension_file_path(self, name):
"""Return file path to an extension appendix relative to a directory
containing all such appendices.
- name - extension name"""
return 'include::{{appendices}}/{name}{suffix}[]'.format(
name=ext.name, suffix=self.file_suffix)
@property
def refpage_generated_include_path(self):
"""Return path relative to the generated reference pages, to the
generated API include files."""
return "{generated}"
return f'{name}{self.file_suffix}'
def valid_flag_bit(self, bitpos):
"""Return True if bitpos is an allowed numeric bit position for
@ -273,3 +264,14 @@ class VulkanConventions(ConventionsBase):
cause Vk*FlagBits values with bit 31 set to result in a 64 bit
enumerated type, so disallows such flags."""
return bitpos >= 0 and bitpos < 31
@property
def extra_refpage_headers(self):
"""Return any extra text to add to refpage headers."""
return 'include::{config}/attribs.adoc[]'
@property
def extra_refpage_body(self):
"""Return any extra text (following the title) for generated
reference pages."""
return 'include::{generated}/specattribs.adoc[]'