early-access version 2323

This commit is contained in:
pineappleEA 2021-12-18 08:41:22 +01:00
parent 994096ad3a
commit f244f6654f
31 changed files with 41800 additions and 121887 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2321. This is the source code for early-access 2323.
## Legal Notice ## Legal Notice

View File

@ -2,6 +2,17 @@
Vulkan header files and API registry Vulkan header files and API registry
## Default branch changed to 'main' 2021-09-12
As discussed in #222, the default branch of this repository is now 'main'. This change should be largely transparent to repository users, since github rewrites many references to the old 'master' branch to 'main'. However, if you have a checked-out local clone, you may wish to take the following steps as recommended by github:
```sh
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
```
## Repository Content ## Repository Content
The contents of this repository are largely obtained from other repositories The contents of this repository are largely obtained from other repositories
@ -35,14 +46,23 @@ Files in this repository originate from:
* README.md * README.md
* cmake/Copyright_cmake.txt * cmake/Copyright_cmake.txt
* cmake/cmake_uninstall.cmake.in * cmake/cmake_uninstall.cmake.in
* Non-API headers (report issues against @lenny-lunarg) * Non-API headers (report issues to the [Vulkan-Loader/issues](https://github.com/KhronosGroup/Vulkan-Loader/issues) tracker)
* include/vulkan/vk_icd.h * include/vulkan/vk_icd.h
* include/vulkan/vk_layer.h * include/vulkan/vk_layer.h
* include/vulkan/vk_sdk_platform.h * include/vulkan/vk_sdk_platform.h
### Vulkan C++ Binding Repository (https://github.com/KhronosGroup/Vulkan-Hpp) ### Vulkan C++ Binding Repository (https://github.com/KhronosGroup/Vulkan-Hpp)
As of the Vulkan-Docs 1.2.182 spec update, the Vulkan-Hpp headers have been
split into multiple files. All of those files are now included in this
repository.
* include/vulkan/vulkan.hpp * include/vulkan/vulkan.hpp
* include/vulkan/vulkan_enums.hpp
* include/vulkan/vulkan_funcs.hpp
* include/vulkan/vulkan_handles.hpp
* include/vulkan/vulkan_raii.hpp
* include/vulkan/vulkan_structs.hpp
## Version Tagging Scheme ## Version Tagging Scheme

View File

@ -14,170 +14,182 @@ extern "C" {
#include "vk_video/vulkan_video_codecs_common.h" #include "vk_video/vulkan_video_codecs_common.h"
// Vulkan 0.9 provisional Vulkan video H.264 encode and decode std specification version number // 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 VK_MAKE_VIDEO_STD_VERSION(0, 9, 0) // Patch version should always be set to 0 #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. // 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 #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" #define VK_STD_VULKAN_VIDEO_CODEC_H264_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264"
// ************************************************* // *************************************************
// Video H.264 common definitions: // Video H.264 common definitions:
// ************************************************* // *************************************************
#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_ELEMENTS 64
typedef enum StdVideoH264ChromaFormatIdc { typedef enum StdVideoH264ChromaFormatIdc {
std_video_h264_chroma_format_idc_monochrome = 0, STD_VIDEO_H264_CHROMA_FORMAT_IDC_MONOCHROME = 0,
std_video_h264_chroma_format_idc_420 = 1, STD_VIDEO_H264_CHROMA_FORMAT_IDC_420 = 1,
std_video_h264_chroma_format_idc_422 = 2, STD_VIDEO_H264_CHROMA_FORMAT_IDC_422 = 2,
std_video_h264_chroma_format_idc_444 = 3, STD_VIDEO_H264_CHROMA_FORMAT_IDC_444 = 3,
STD_VIDEO_H264_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF
} StdVideoH264ChromaFormatIdc; } StdVideoH264ChromaFormatIdc;
typedef enum StdVideoH264ProfileIdc { typedef enum StdVideoH264ProfileIdc {
std_video_h264_profile_idc_baseline = 66, /* Only constrained baseline is supported */ STD_VIDEO_H264_PROFILE_IDC_BASELINE = 66, /* Only constrained baseline is supported */
std_video_h264_profile_idc_main = 77, STD_VIDEO_H264_PROFILE_IDC_MAIN = 77,
std_video_h264_profile_idc_high = 100, STD_VIDEO_H264_PROFILE_IDC_HIGH = 100,
std_video_h264_profile_idc_high_444_predictive = 244, STD_VIDEO_H264_PROFILE_IDC_HIGH_444_PREDICTIVE = 244,
std_video_h264_profile_idc_invalid = 0x7FFFFFFF STD_VIDEO_H264_PROFILE_IDC_INVALID = 0x7FFFFFFF
} StdVideoH264ProfileIdc; } StdVideoH264ProfileIdc;
typedef enum StdVideoH264Level { typedef enum StdVideoH264Level {
std_video_h264_level_1_0 = 0, STD_VIDEO_H264_LEVEL_1_0 = 0,
std_video_h264_level_1_1 = 1, STD_VIDEO_H264_LEVEL_1_1 = 1,
std_video_h264_level_1_2 = 2, STD_VIDEO_H264_LEVEL_1_2 = 2,
std_video_h264_level_1_3 = 3, STD_VIDEO_H264_LEVEL_1_3 = 3,
std_video_h264_level_2_0 = 4, STD_VIDEO_H264_LEVEL_2_0 = 4,
std_video_h264_level_2_1 = 5, STD_VIDEO_H264_LEVEL_2_1 = 5,
std_video_h264_level_2_2 = 6, STD_VIDEO_H264_LEVEL_2_2 = 6,
std_video_h264_level_3_0 = 7, STD_VIDEO_H264_LEVEL_3_0 = 7,
std_video_h264_level_3_1 = 8, STD_VIDEO_H264_LEVEL_3_1 = 8,
std_video_h264_level_3_2 = 9, STD_VIDEO_H264_LEVEL_3_2 = 9,
std_video_h264_level_4_0 = 10, STD_VIDEO_H264_LEVEL_4_0 = 10,
std_video_h264_level_4_1 = 11, STD_VIDEO_H264_LEVEL_4_1 = 11,
std_video_h264_level_4_2 = 12, STD_VIDEO_H264_LEVEL_4_2 = 12,
std_video_h264_level_5_0 = 13, STD_VIDEO_H264_LEVEL_5_0 = 13,
std_video_h264_level_5_1 = 14, STD_VIDEO_H264_LEVEL_5_1 = 14,
std_video_h264_level_5_2 = 15, STD_VIDEO_H264_LEVEL_5_2 = 15,
std_video_h264_level_6_0 = 16, STD_VIDEO_H264_LEVEL_6_0 = 16,
std_video_h264_level_6_1 = 17, STD_VIDEO_H264_LEVEL_6_1 = 17,
std_video_h264_level_6_2 = 18, STD_VIDEO_H264_LEVEL_6_2 = 18,
std_video_h264_level_invalid = 0x7FFFFFFF STD_VIDEO_H264_LEVEL_INVALID = 0x7FFFFFFF
} StdVideoH264Level; } StdVideoH264Level;
typedef enum StdVideoH264PocType { typedef enum StdVideoH264PocType {
std_video_h264_poc_type_0 = 0, STD_VIDEO_H264_POC_TYPE_0 = 0,
std_video_h264_poc_type_1 = 1, STD_VIDEO_H264_POC_TYPE_1 = 1,
std_video_h264_poc_type_2 = 2, STD_VIDEO_H264_POC_TYPE_2 = 2,
std_video_h264_poc_type_invalid = 0x7FFFFFFF STD_VIDEO_H264_POC_TYPE_INVALID = 0x7FFFFFFF
} StdVideoH264PocType; } StdVideoH264PocType;
typedef enum StdVideoH264AspectRatioIdc { typedef enum StdVideoH264AspectRatioIdc {
std_video_h264_aspect_ratio_idc_unspecified = 0, STD_VIDEO_H264_ASPECT_RATIO_IDC_UNSPECIFIED = 0,
std_video_h264_aspect_ratio_idc_square = 1, STD_VIDEO_H264_ASPECT_RATIO_IDC_SQUARE = 1,
std_video_h264_aspect_ratio_idc_12_11 = 2, STD_VIDEO_H264_ASPECT_RATIO_IDC_12_11 = 2,
std_video_h264_aspect_ratio_idc_10_11 = 3, STD_VIDEO_H264_ASPECT_RATIO_IDC_10_11 = 3,
std_video_h264_aspect_ratio_idc_16_11 = 4, STD_VIDEO_H264_ASPECT_RATIO_IDC_16_11 = 4,
std_video_h264_aspect_ratio_idc_40_33 = 5, STD_VIDEO_H264_ASPECT_RATIO_IDC_40_33 = 5,
std_video_h264_aspect_ratio_idc_24_11 = 6, STD_VIDEO_H264_ASPECT_RATIO_IDC_24_11 = 6,
std_video_h264_aspect_ratio_idc_20_11 = 7, STD_VIDEO_H264_ASPECT_RATIO_IDC_20_11 = 7,
std_video_h264_aspect_ratio_idc_32_11 = 8, STD_VIDEO_H264_ASPECT_RATIO_IDC_32_11 = 8,
std_video_h264_aspect_ratio_idc_80_33 = 9, STD_VIDEO_H264_ASPECT_RATIO_IDC_80_33 = 9,
std_video_h264_aspect_ratio_idc_18_11 = 10, STD_VIDEO_H264_ASPECT_RATIO_IDC_18_11 = 10,
std_video_h264_aspect_ratio_idc_15_11 = 11, STD_VIDEO_H264_ASPECT_RATIO_IDC_15_11 = 11,
std_video_h264_aspect_ratio_idc_64_33 = 12, STD_VIDEO_H264_ASPECT_RATIO_IDC_64_33 = 12,
std_video_h264_aspect_ratio_idc_160_99 = 13, STD_VIDEO_H264_ASPECT_RATIO_IDC_160_99 = 13,
std_video_h264_aspect_ratio_idc_4_3 = 14, STD_VIDEO_H264_ASPECT_RATIO_IDC_4_3 = 14,
std_video_h264_aspect_ratio_idc_3_2 = 15, STD_VIDEO_H264_ASPECT_RATIO_IDC_3_2 = 15,
std_video_h264_aspect_ratio_idc_2_1 = 16, STD_VIDEO_H264_ASPECT_RATIO_IDC_2_1 = 16,
std_video_h264_aspect_ratio_idc_extended_sar = 255, 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
} StdVideoH264AspectRatioIdc; } StdVideoH264AspectRatioIdc;
typedef enum StdVideoH264WeightedBiPredIdc { typedef enum StdVideoH264WeightedBipredIdc {
std_video_h264_default_weighted_b_slices_prediction_idc = 0, STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_DEFAULT = 0,
std_video_h264_explicit_weighted_b_slices_prediction_idc = 1, STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_EXPLICIT = 1,
std_video_h264_implicit_weighted_b_slices_prediction_idc = 2, STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_IMPLICIT = 2,
std_video_h264_invalid_weighted_b_slices_prediction_idc = 0x7FFFFFFF STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_INVALID = 0x7FFFFFFF
} StdVideoH264WeightedBiPredIdc; } StdVideoH264WeightedBipredIdc;
typedef enum StdVideoH264ModificationOfPicNumsIdc { typedef enum StdVideoH264ModificationOfPicNumsIdc {
std_video_h264_modification_of_pic_nums_idc_short_term_subtract = 0, STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_SUBTRACT = 0,
std_video_h264_modification_of_pic_nums_idc_short_term_add = 1, 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_LONG_TERM = 2,
std_video_h264_modification_of_pic_nums_idc_end = 3, 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
} StdVideoH264ModificationOfPicNumsIdc; } StdVideoH264ModificationOfPicNumsIdc;
typedef enum StdVideoH264MemMgmtControlOp { typedef enum StdVideoH264MemMgmtControlOp {
std_video_h264_mem_mgmt_control_op_end = 0, STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_END = 0,
std_video_h264_mem_mgmt_control_op_unmark_short_term = 1, STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_SHORT_TERM = 1,
std_video_h264_mem_mgmt_control_op_unmark_long_term = 2, STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_LONG_TERM = 2,
std_video_h264_mem_mgmt_control_op_mark_long_term = 3, STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_LONG_TERM = 3,
std_video_h264_mem_mgmt_control_op_set_max_long_term_index = 4, 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_UNMARK_ALL = 5,
std_video_h264_mem_mgmt_control_op_mark_current_as_long_term = 6, 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
} StdVideoH264MemMgmtControlOp; } StdVideoH264MemMgmtControlOp;
typedef enum StdVideoH264CabacInitIdc { typedef enum StdVideoH264CabacInitIdc {
std_video_h264_cabac_init_idc_0 = 0, STD_VIDEO_H264_CABAC_INIT_IDC_0 = 0,
std_video_h264_cabac_init_idc_1 = 1, STD_VIDEO_H264_CABAC_INIT_IDC_1 = 1,
std_video_h264_cabac_init_idc_2 = 2, STD_VIDEO_H264_CABAC_INIT_IDC_2 = 2,
std_video_h264_cabac_init_idc_invalid = 0x7FFFFFFF STD_VIDEO_H264_CABAC_INIT_IDC_INVALID = 0x7FFFFFFF
} StdVideoH264CabacInitIdc; } StdVideoH264CabacInitIdc;
typedef enum StdVideoH264DisableDeblockingFilterIdc { typedef enum StdVideoH264DisableDeblockingFilterIdc {
std_video_h264_disable_deblocking_filter_idc_disabled = 0, 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_ENABLED = 1,
std_video_h264_disable_deblocking_filter_idc_partial = 2, 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
} StdVideoH264DisableDeblockingFilterIdc; } StdVideoH264DisableDeblockingFilterIdc;
typedef enum StdVideoH264PictureType {
std_video_h264_picture_type_i = 0,
std_video_h264_picture_type_p = 1,
std_video_h264_picture_type_b = 2,
std_video_h264_picture_type_invalid = 0x7FFFFFFF
} StdVideoH264PictureType;
typedef enum StdVideoH264SliceType { typedef enum StdVideoH264SliceType {
std_video_h264_slice_type_i = 0, STD_VIDEO_H264_SLICE_TYPE_P = 0,
std_video_h264_slice_type_p = 1, STD_VIDEO_H264_SLICE_TYPE_B = 1,
std_video_h264_slice_type_b = 2, STD_VIDEO_H264_SLICE_TYPE_I = 2,
std_video_h264_slice_type_invalid = 0x7FFFFFFF // reserved STD_VIDEO_H264_SLICE_TYPE_SP = 3,
// reserved STD_VIDEO_H264_SLICE_TYPE_SI = 4,
STD_VIDEO_H264_SLICE_TYPE_INVALID = 0x7FFFFFFF
} StdVideoH264SliceType; } 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
} StdVideoH264PictureType;
typedef enum StdVideoH264NonVclNaluType { typedef enum StdVideoH264NonVclNaluType {
std_video_h264_non_vcl_nalu_type_sps = 0, STD_VIDEO_H264_NON_VCL_NALU_TYPE_SPS = 0,
std_video_h264_non_vcl_nalu_type_pps = 1, STD_VIDEO_H264_NON_VCL_NALU_TYPE_PPS = 1,
std_video_h264_non_vcl_nalu_type_aud = 2, STD_VIDEO_H264_NON_VCL_NALU_TYPE_AUD = 2,
std_video_h264_non_vcl_nalu_type_prefix = 3, STD_VIDEO_H264_NON_VCL_NALU_TYPE_PREFIX = 3,
std_video_h264_non_vcl_nalu_type_end_of_sequence = 4, 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_END_OF_STREAM = 5,
std_video_h264_non_vcl_nalu_type_precoded = 6, 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
} StdVideoH264NonVclNaluType; } StdVideoH264NonVclNaluType;
typedef struct StdVideoH264SpsVuiFlags { typedef struct StdVideoH264SpsVuiFlags {
uint32_t aspect_ratio_info_present_flag:1; uint32_t aspect_ratio_info_present_flag : 1;
uint32_t overscan_info_present_flag:1; uint32_t overscan_info_present_flag : 1;
uint32_t overscan_appropriate_flag:1; uint32_t overscan_appropriate_flag : 1;
uint32_t video_signal_type_present_flag:1; uint32_t video_signal_type_present_flag : 1;
uint32_t video_full_range_flag:1; uint32_t video_full_range_flag : 1;
uint32_t color_description_present_flag:1; uint32_t color_description_present_flag : 1;
uint32_t chroma_loc_info_present_flag:1; uint32_t chroma_loc_info_present_flag : 1;
uint32_t timing_info_present_flag:1; uint32_t timing_info_present_flag : 1;
uint32_t fixed_frame_rate_flag:1; uint32_t fixed_frame_rate_flag : 1;
uint32_t bitstream_restriction_flag:1; uint32_t bitstream_restriction_flag : 1;
uint32_t nal_hrd_parameters_present_flag:1; uint32_t nal_hrd_parameters_present_flag : 1;
uint32_t vcl_hrd_parameters_present_flag:1; uint32_t vcl_hrd_parameters_present_flag : 1;
} StdVideoH264SpsVuiFlags; } StdVideoH264SpsVuiFlags;
typedef struct StdVideoH264HrdParameters { typedef struct StdVideoH264HrdParameters { // hrd_parameters
uint8_t cpb_cnt_minus1; uint8_t cpb_cnt_minus1;
uint8_t bit_rate_scale; uint8_t bit_rate_scale;
uint8_t cpb_size_scale; uint8_t cpb_size_scale;
uint32_t bit_rate_value_minus1[32]; 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[32]; uint32_t cpb_size_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; // cpb_cnt_minus1 number of valid elements
uint8_t cbr_flag[32]; uint8_t cbr_flag[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; // cpb_cnt_minus1 number of valid elements
uint32_t initial_cpb_removal_delay_length_minus1; uint32_t initial_cpb_removal_delay_length_minus1;
uint32_t cpb_removal_delay_length_minus1; uint32_t cpb_removal_delay_length_minus1;
uint32_t dpb_output_delay_length_minus1; uint32_t dpb_output_delay_length_minus1;
@ -194,30 +206,29 @@ typedef struct StdVideoH264SequenceParameterSetVui {
uint8_t matrix_coefficients; uint8_t matrix_coefficients;
uint32_t num_units_in_tick; uint32_t num_units_in_tick;
uint32_t time_scale; uint32_t time_scale;
StdVideoH264HrdParameters hrd_parameters; 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 num_reorder_frames; uint8_t max_num_reorder_frames;
uint8_t max_dec_frame_buffering; uint8_t max_dec_frame_buffering;
StdVideoH264SpsVuiFlags flags; StdVideoH264SpsVuiFlags flags;
} StdVideoH264SequenceParameterSetVui; } StdVideoH264SequenceParameterSetVui;
typedef struct StdVideoH264SpsFlags { typedef struct StdVideoH264SpsFlags {
uint32_t constraint_set0_flag:1; uint32_t constraint_set0_flag : 1;
uint32_t constraint_set1_flag:1; uint32_t constraint_set1_flag : 1;
uint32_t constraint_set2_flag:1; uint32_t constraint_set2_flag : 1;
uint32_t constraint_set3_flag:1; uint32_t constraint_set3_flag : 1;
uint32_t constraint_set4_flag:1; uint32_t constraint_set4_flag : 1;
uint32_t constraint_set5_flag:1; uint32_t constraint_set5_flag : 1;
uint32_t direct_8x8_inference_flag:1; uint32_t direct_8x8_inference_flag : 1;
uint32_t mb_adaptive_frame_field_flag:1; uint32_t mb_adaptive_frame_field_flag : 1;
uint32_t frame_mbs_only_flag:1; uint32_t frame_mbs_only_flag : 1;
uint32_t delta_pic_order_always_zero_flag:1; uint32_t delta_pic_order_always_zero_flag : 1;
uint32_t residual_colour_transform_flag:1; uint32_t separate_colour_plane_flag : 1;
uint32_t gaps_in_frame_num_value_allowed_flag:1; uint32_t gaps_in_frame_num_value_allowed_flag : 1;
uint32_t first_picture_after_seek_flag:1; // where is this being documented? uint32_t qpprime_y_zero_transform_bypass_flag : 1;
uint32_t qpprime_y_zero_transform_bypass_flag:1; uint32_t frame_cropping_flag : 1;
uint32_t frame_cropping_flag:1; uint32_t seq_scaling_matrix_present_flag : 1;
uint32_t scaling_matrix_present_flag:1; uint32_t vui_parameters_present_flag : 1;
uint32_t vui_parameters_present_flag:1;
} StdVideoH264SpsFlags; } StdVideoH264SpsFlags;
typedef struct StdVideoH264ScalingLists typedef struct StdVideoH264ScalingLists
@ -234,8 +245,8 @@ typedef struct StdVideoH264ScalingLists
// bit 0 - 5 are for each entry of ScalingList4x4 // bit 0 - 5 are for each entry of ScalingList4x4
// bit 6 - 7 are for each entry plus 6 for ScalingList8x8 // bit 6 - 7 are for each entry plus 6 for ScalingList8x8
uint8_t use_default_scaling_matrix_mask; uint8_t use_default_scaling_matrix_mask;
uint8_t ScalingList4x4[6][16]; uint8_t ScalingList4x4[STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS];
uint8_t ScalingList8x8[2][64]; uint8_t ScalingList8x8[STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS];
} StdVideoH264ScalingLists; } StdVideoH264ScalingLists;
typedef struct StdVideoH264SequenceParameterSet typedef struct StdVideoH264SequenceParameterSet
@ -260,21 +271,23 @@ typedef struct StdVideoH264SequenceParameterSet
uint32_t frame_crop_top_offset; uint32_t frame_crop_top_offset;
uint32_t frame_crop_bottom_offset; uint32_t frame_crop_bottom_offset;
StdVideoH264SpsFlags flags; StdVideoH264SpsFlags flags;
int32_t offset_for_ref_frame[255]; // The number of valid values are defined by the num_ref_frames_in_pic_order_cnt_cycle // pOffsetForRefFrame is a pointer representing the offset_for_ref_frame array with num_ref_frames_in_pic_order_cnt_cycle number of elements
StdVideoH264ScalingLists* pScalingLists; // Must be a valid pointer if scaling_matrix_present_flag is set // 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 StdVideoH264SequenceParameterSetVui* pSequenceParameterSetVui; // Must be a valid pointer if StdVideoH264SpsFlags:vui_parameters_present_flag is set
} StdVideoH264SequenceParameterSet; } StdVideoH264SequenceParameterSet;
typedef struct StdVideoH264PpsFlags { typedef struct StdVideoH264PpsFlags {
uint32_t transform_8x8_mode_flag:1; uint32_t transform_8x8_mode_flag : 1;
uint32_t redundant_pic_cnt_present_flag:1; uint32_t redundant_pic_cnt_present_flag : 1;
uint32_t constrained_intra_pred_flag:1; uint32_t constrained_intra_pred_flag : 1;
uint32_t deblocking_filter_control_present_flag:1; uint32_t deblocking_filter_control_present_flag : 1;
uint32_t weighted_bipred_idc_flag:1; uint32_t weighted_bipred_idc_flag : 1;
uint32_t weighted_pred_flag:1; uint32_t weighted_pred_flag : 1;
uint32_t pic_order_present_flag:1; uint32_t pic_order_present_flag : 1;
uint32_t entropy_coding_mode_flag:1; uint32_t entropy_coding_mode_flag : 1;
uint32_t scaling_matrix_present_flag:1; uint32_t pic_scaling_matrix_present_flag : 1;
} StdVideoH264PpsFlags; } StdVideoH264PpsFlags;
typedef struct StdVideoH264PictureParameterSet typedef struct StdVideoH264PictureParameterSet
@ -283,13 +296,13 @@ typedef struct StdVideoH264PictureParameterSet
uint8_t pic_parameter_set_id; uint8_t pic_parameter_set_id;
uint8_t num_ref_idx_l0_default_active_minus1; uint8_t num_ref_idx_l0_default_active_minus1;
uint8_t num_ref_idx_l1_default_active_minus1; uint8_t num_ref_idx_l1_default_active_minus1;
StdVideoH264WeightedBiPredIdc weighted_bipred_idc; StdVideoH264WeightedBipredIdc weighted_bipred_idc;
int8_t pic_init_qp_minus26; int8_t pic_init_qp_minus26;
int8_t pic_init_qs_minus26; int8_t pic_init_qs_minus26;
int8_t chroma_qp_index_offset; int8_t chroma_qp_index_offset;
int8_t second_chroma_qp_index_offset; int8_t second_chroma_qp_index_offset;
StdVideoH264PpsFlags flags; StdVideoH264PpsFlags flags;
StdVideoH264ScalingLists* pScalingLists; // Must be a valid pointer if StdVideoH264PpsFlags::scaling_matrix_present_flag is set. StdVideoH264ScalingLists* pScalingLists; // Must be a valid pointer if StdVideoH264PpsFlags::pic_scaling_matrix_present_flag is set.
} StdVideoH264PictureParameterSet; } StdVideoH264PictureParameterSet;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -17,12 +17,22 @@ extern "C" {
// Video H.264 Decode related parameters: // Video H.264 Decode related parameters:
// ************************************************* // *************************************************
#define STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE 15
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;
typedef struct StdVideoDecodeH264PictureInfoFlags { typedef struct StdVideoDecodeH264PictureInfoFlags {
uint32_t field_pic_flag:1; // Is field picture uint32_t field_pic_flag : 1; // Is field picture
uint32_t is_intra:1; // Is intra picture uint32_t is_intra : 1; // Is intra picture
uint32_t bottom_field_flag:1; // bottom (true) or top (false) field if field_pic_flag is set. uint32_t IdrPicFlag : 1; // instantaneous decoding refresh (IDR) picture
uint32_t is_reference:1; // This only applies to picture info, and not to the DPB lists. uint32_t bottom_field_flag : 1; // bottom (true) or top (false) field if field_pic_flag is set.
uint32_t complementary_field_pair:1; // complementary field pair, complementary non-reference field pair, complementary reference field pair 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
} StdVideoDecodeH264PictureInfoFlags; } StdVideoDecodeH264PictureInfoFlags;
typedef struct StdVideoDecodeH264PictureInfo { typedef struct StdVideoDecodeH264PictureInfo {
@ -32,15 +42,15 @@ typedef struct StdVideoDecodeH264PictureInfo {
uint16_t frame_num; // 7.4.3 Slice header semantics uint16_t frame_num; // 7.4.3 Slice header semantics
uint16_t idr_pic_id; // 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 // PicOrderCnt is based on TopFieldOrderCnt and BottomFieldOrderCnt. See 8.2.1 Decoding process for picture order count type 0 - 2
int32_t PicOrderCnt[2]; // TopFieldOrderCnt and BottomFieldOrderCnt fields. int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; // TopFieldOrderCnt and BottomFieldOrderCnt fields.
StdVideoDecodeH264PictureInfoFlags flags; StdVideoDecodeH264PictureInfoFlags flags;
} StdVideoDecodeH264PictureInfo; } StdVideoDecodeH264PictureInfo;
typedef struct StdVideoDecodeH264ReferenceInfoFlags { typedef struct StdVideoDecodeH264ReferenceInfoFlags {
uint32_t top_field_flag:1; // Reference is used for top field reference. 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 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_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 is_non_existing : 1; // Must be handled in accordance with 8.2.5.2: Decoding process for gaps in frame_num
} StdVideoDecodeH264ReferenceInfoFlags; } StdVideoDecodeH264ReferenceInfoFlags;
typedef struct StdVideoDecodeH264ReferenceInfo { typedef struct StdVideoDecodeH264ReferenceInfo {
@ -52,9 +62,9 @@ typedef struct StdVideoDecodeH264ReferenceInfo {
} StdVideoDecodeH264ReferenceInfo; } StdVideoDecodeH264ReferenceInfo;
typedef struct StdVideoDecodeH264MvcElementFlags { typedef struct StdVideoDecodeH264MvcElementFlags {
uint32_t non_idr:1; uint32_t non_idr : 1;
uint32_t anchor_pic:1; uint32_t anchor_pic : 1;
uint32_t inter_view:1; uint32_t inter_view : 1;
} StdVideoDecodeH264MvcElementFlags; } StdVideoDecodeH264MvcElementFlags;
typedef struct StdVideoDecodeH264MvcElement { typedef struct StdVideoDecodeH264MvcElement {
@ -64,13 +74,13 @@ typedef struct StdVideoDecodeH264MvcElement {
uint16_t temporalId; // move out? uint16_t temporalId; // move out?
uint16_t priorityId; // move out? uint16_t priorityId; // move out?
uint16_t numOfAnchorRefsInL0; uint16_t numOfAnchorRefsInL0;
uint16_t viewIdOfAnchorRefsInL0[15]; uint16_t viewIdOfAnchorRefsInL0[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE];
uint16_t numOfAnchorRefsInL1; uint16_t numOfAnchorRefsInL1;
uint16_t viewIdOfAnchorRefsInL1[15]; uint16_t viewIdOfAnchorRefsInL1[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE];
uint16_t numOfNonAnchorRefsInL0; uint16_t numOfNonAnchorRefsInL0;
uint16_t viewIdOfNonAnchorRefsInL0[15]; uint16_t viewIdOfNonAnchorRefsInL0[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE];
uint16_t numOfNonAnchorRefsInL1; uint16_t numOfNonAnchorRefsInL1;
uint16_t viewIdOfNonAnchorRefsInL1[15]; uint16_t viewIdOfNonAnchorRefsInL1[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE];
} StdVideoDecodeH264MvcElement; } StdVideoDecodeH264MvcElement;
typedef struct StdVideoDecodeH264Mvc { typedef struct StdVideoDecodeH264Mvc {

View File

@ -18,24 +18,24 @@ extern "C" {
// ************************************************* // *************************************************
typedef struct StdVideoEncodeH264SliceHeaderFlags { typedef struct StdVideoEncodeH264SliceHeaderFlags {
uint32_t idr_flag:1; uint32_t idr_flag : 1;
uint32_t is_reference_flag:1; uint32_t is_reference_flag : 1;
uint32_t num_ref_idx_active_override_flag:1; uint32_t num_ref_idx_active_override_flag : 1;
uint32_t no_output_of_prior_pics_flag:1; uint32_t no_output_of_prior_pics_flag : 1;
uint32_t long_term_reference_flag:1; uint32_t long_term_reference_flag : 1;
uint32_t adaptive_ref_pic_marking_mode_flag:1; uint32_t adaptive_ref_pic_marking_mode_flag : 1;
uint32_t no_prior_references_available_flag:1; uint32_t no_prior_references_available_flag : 1;
} StdVideoEncodeH264SliceHeaderFlags; } StdVideoEncodeH264SliceHeaderFlags;
typedef struct StdVideoEncodeH264PictureInfoFlags { typedef struct StdVideoEncodeH264PictureInfoFlags {
uint32_t idr_flag:1; uint32_t idr_flag : 1;
uint32_t is_reference_flag:1; uint32_t is_reference_flag : 1;
uint32_t long_term_reference_flag:1; uint32_t long_term_reference_flag : 1;
} StdVideoEncodeH264PictureInfoFlags; } StdVideoEncodeH264PictureInfoFlags;
typedef struct StdVideoEncodeH264RefMgmtFlags { typedef struct StdVideoEncodeH264RefMgmtFlags {
uint32_t ref_pic_list_modification_l0_flag:1; uint32_t ref_pic_list_modification_l0_flag : 1;
uint32_t ref_pic_list_modification_l1_flag:1; uint32_t ref_pic_list_modification_l1_flag : 1;
} StdVideoEncodeH264RefMgmtFlags; } StdVideoEncodeH264RefMgmtFlags;
typedef struct StdVideoEncodeH264RefListModEntry { typedef struct StdVideoEncodeH264RefListModEntry {

View File

@ -14,58 +14,89 @@ extern "C" {
#include "vk_video/vulkan_video_codecs_common.h" #include "vk_video/vulkan_video_codecs_common.h"
// Vulkan 0.5 version number WIP // Vulkan 0.5 version number WIP
#define VK_STD_VULKAN_VIDEO_CODEC_H265_API_VERSION_0_5 VK_MAKE_VIDEO_STD_VERSION(0, 5, 0) // Patch version should always be set to 0 #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. // 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_5 #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 VK_STD_VULKAN_VIDEO_CODEC_H265_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265"
#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
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS 64
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS 6
#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_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
typedef enum StdVideoH265ChromaFormatIdc { typedef enum StdVideoH265ChromaFormatIdc {
std_video_h265_chroma_format_idc_monochrome = 0, STD_VIDEO_H265_CHROMA_FORMAT_IDC_MONOCHROME = 0,
std_video_h265_chroma_format_idc_420 = 1, STD_VIDEO_H265_CHROMA_FORMAT_IDC_420 = 1,
std_video_h265_chroma_format_idc_422 = 2, STD_VIDEO_H265_CHROMA_FORMAT_IDC_422 = 2,
std_video_h265_chroma_format_idc_444 = 3, STD_VIDEO_H265_CHROMA_FORMAT_IDC_444 = 3,
STD_VIDEO_H265_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF
} StdVideoH265ChromaFormatIdc; } StdVideoH265ChromaFormatIdc;
typedef enum StdVideoH265ProfileIdc { typedef enum StdVideoH265ProfileIdc {
std_video_h265_profile_idc_main = 1, STD_VIDEO_H265_PROFILE_IDC_MAIN = 1,
std_video_h265_profile_idc_main_10 = 2, STD_VIDEO_H265_PROFILE_IDC_MAIN_10 = 2,
std_video_h265_profile_idc_main_still_picture = 3, STD_VIDEO_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3,
std_video_h265_profile_idc_format_range_extensions = 4, STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS = 4,
std_video_h265_profile_idc_scc_extensions = 9, STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS = 9,
std_video_h265_profile_idc_invalid = 0x7FFFFFFF STD_VIDEO_H265_PROFILE_IDC_INVALID = 0x7FFFFFFF
} StdVideoH265ProfileIdc; } StdVideoH265ProfileIdc;
typedef enum StdVideoH265Level { typedef enum StdVideoH265Level {
std_video_h265_level_1_0 = 0, STD_VIDEO_H265_LEVEL_1_0 = 0,
std_video_h265_level_2_0 = 1, STD_VIDEO_H265_LEVEL_2_0 = 1,
std_video_h265_level_2_1 = 2, STD_VIDEO_H265_LEVEL_2_1 = 2,
std_video_h265_level_3_0 = 3, STD_VIDEO_H265_LEVEL_3_0 = 3,
std_video_h265_level_3_1 = 4, STD_VIDEO_H265_LEVEL_3_1 = 4,
std_video_h265_level_4_0 = 5, STD_VIDEO_H265_LEVEL_4_0 = 5,
std_video_h265_level_4_1 = 6, STD_VIDEO_H265_LEVEL_4_1 = 6,
std_video_h265_level_5_0 = 7, STD_VIDEO_H265_LEVEL_5_0 = 7,
std_video_h265_level_5_1 = 8, STD_VIDEO_H265_LEVEL_5_1 = 8,
std_video_h265_level_5_2 = 9, STD_VIDEO_H265_LEVEL_5_2 = 9,
std_video_h265_level_6_0 = 10, STD_VIDEO_H265_LEVEL_6_0 = 10,
std_video_h265_level_6_1 = 11, STD_VIDEO_H265_LEVEL_6_1 = 11,
std_video_h265_level_6_2 = 12, STD_VIDEO_H265_LEVEL_6_2 = 12,
std_video_h265_level_invalid = 0x7FFFFFFF STD_VIDEO_H265_LEVEL_INVALID = 0x7FFFFFFF
} StdVideoH265Level; } StdVideoH265Level;
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
} StdVideoH265SliceType;
typedef enum StdVideoH265PictureType {
STD_VIDEO_H265_PICTURE_TYPE_P = 0,
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
} StdVideoH265PictureType;
typedef struct StdVideoH265DecPicBufMgr typedef struct StdVideoH265DecPicBufMgr
{ {
uint32_t max_latency_increase_plus1[7]; uint32_t max_latency_increase_plus1[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
uint8_t max_dec_pic_buffering_minus1[7]; uint8_t max_dec_pic_buffering_minus1[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
uint8_t max_num_reorder_pics[7]; uint8_t max_num_reorder_pics[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
} StdVideoH265DecPicBufMgr; } StdVideoH265DecPicBufMgr;
typedef struct StdVideoH265SubLayerHrdParameters { typedef struct StdVideoH265SubLayerHrdParameters { // sub_layer_hrd_parameters
uint32_t bit_rate_value_minus1[32]; uint32_t bit_rate_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
uint32_t cpb_size_value_minus1[32]; uint32_t cpb_size_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
uint32_t cpb_size_du_value_minus1[32]; uint32_t cpb_size_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
uint32_t bit_rate_du_value_minus1[32]; 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; // each bit represents a range of CpbCounts (bit 0 - cpb_cnt_minus1) per sub-layer
} StdVideoH265SubLayerHrdParameters; } StdVideoH265SubLayerHrdParameters;
@ -74,9 +105,9 @@ typedef struct StdVideoH265HrdFlags {
uint32_t vcl_hrd_parameters_present_flag : 1; uint32_t vcl_hrd_parameters_present_flag : 1;
uint32_t sub_pic_hrd_params_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 sub_pic_cpb_params_in_pic_timing_sei_flag : 1;
uint8_t fixed_pic_rate_general_flag; // each bit represents a sublayer, bit 0 - vps_max_sub_layers_minus1 uint32_t fixed_pic_rate_general_flag : 8; // each bit represents a sublayer, bit 0 - vps_max_sub_layers_minus1
uint8_t fixed_pic_rate_within_cvs_flag; // 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
uint8_t low_delay_hrd_flag; // 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
} StdVideoH265HrdFlags; } StdVideoH265HrdFlags;
typedef struct StdVideoH265HrdParameters { typedef struct StdVideoH265HrdParameters {
@ -89,10 +120,10 @@ typedef struct StdVideoH265HrdParameters {
uint8_t initial_cpb_removal_delay_length_minus1; uint8_t initial_cpb_removal_delay_length_minus1;
uint8_t au_cpb_removal_delay_length_minus1; uint8_t au_cpb_removal_delay_length_minus1;
uint8_t dpb_output_delay_length_minus1; uint8_t dpb_output_delay_length_minus1;
uint8_t cpb_cnt_minus1[7]; uint8_t cpb_cnt_minus1[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
uint16_t elemental_duration_in_tc_minus1[7]; uint16_t elemental_duration_in_tc_minus1[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE];
StdVideoH265SubLayerHrdParameters* SubLayerHrdParametersNal[7]; StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersNal[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE]; // NAL per layer ptr to sub_layer_hrd_parameters
StdVideoH265SubLayerHrdParameters* SubLayerHrdParametersVcl[7]; StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersVcl[STD_VIDEO_H265_SUBLAYERS_MINUS1_LIST_SIZE]; // VCL per layer ptr to sub_layer_hrd_parameters
StdVideoH265HrdFlags flags; StdVideoH265HrdFlags flags;
} StdVideoH265HrdParameters; } StdVideoH265HrdParameters;
@ -111,18 +142,18 @@ typedef struct StdVideoH265VideoParameterSet
uint32_t vps_time_scale; uint32_t vps_time_scale;
uint32_t vps_num_ticks_poc_diff_one_minus1; uint32_t vps_num_ticks_poc_diff_one_minus1;
StdVideoH265DecPicBufMgr* pDecPicBufMgr; StdVideoH265DecPicBufMgr* pDecPicBufMgr;
StdVideoH265HrdParameters* hrd_parameters; StdVideoH265HrdParameters* pHrdParameters;
StdVideoH265VpsFlags flags; StdVideoH265VpsFlags flags;
} StdVideoH265VideoParameterSet; } StdVideoH265VideoParameterSet;
typedef struct StdVideoH265ScalingLists typedef struct StdVideoH265ScalingLists
{ {
uint8_t ScalingList4x4[6][16]; // ScalingList[ 0 ][ MatrixID ][ i ] (sizeID = 0) 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[6][64]; // ScalingList[ 1 ][ MatrixID ][ i ] (sizeID = 1) 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[6][64]; // ScalingList[ 2 ][ MatrixID ][ i ] (sizeID = 2) 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[2][64]; // ScalingList[ 3 ][ MatrixID ][ i ] (sizeID = 3) 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[6]; // scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8, sizeID = 2 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[2]; // scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8. sizeID = 3 uint8_t ScalingListDCCoef32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS]; // scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8. sizeID = 3
} StdVideoH265ScalingLists; } StdVideoH265ScalingLists;
typedef struct StdVideoH265SpsVuiFlags { typedef struct StdVideoH265SpsVuiFlags {
@ -163,7 +194,7 @@ typedef struct StdVideoH265SequenceParameterSetVui {
uint32_t vui_num_units_in_tick; uint32_t vui_num_units_in_tick;
uint32_t vui_time_scale; uint32_t vui_time_scale;
uint32_t vui_num_ticks_poc_diff_one_minus1; uint32_t vui_num_ticks_poc_diff_one_minus1;
StdVideoH265HrdParameters* hrd_parameters; StdVideoH265HrdParameters* pHrdParameters;
uint16_t min_spatial_segmentation_idc; uint16_t min_spatial_segmentation_idc;
uint8_t max_bytes_per_pic_denom; uint8_t max_bytes_per_pic_denom;
uint8_t max_bits_per_min_cu_denom; uint8_t max_bits_per_min_cu_denom;
@ -174,10 +205,9 @@ typedef struct StdVideoH265SequenceParameterSetVui {
typedef struct StdVideoH265PredictorPaletteEntries typedef struct StdVideoH265PredictorPaletteEntries
{ {
uint16_t PredictorPaletteEntries[3][128]; uint16_t PredictorPaletteEntries[STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE][STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE];
} StdVideoH265PredictorPaletteEntries; } StdVideoH265PredictorPaletteEntries;
typedef struct StdVideoH265SpsFlags { typedef struct StdVideoH265SpsFlags {
uint32_t sps_temporal_id_nesting_flag : 1; uint32_t sps_temporal_id_nesting_flag : 1;
uint32_t separate_colour_plane_flag : 1; uint32_t separate_colour_plane_flag : 1;
@ -194,7 +224,7 @@ typedef struct StdVideoH265SpsFlags {
uint32_t sps_extension_present_flag : 1; uint32_t sps_extension_present_flag : 1;
uint32_t sps_range_extension_flag : 1; uint32_t sps_range_extension_flag : 1;
// extension SPS flags, valid when std_video_h265_profile_idc_format_range_extensions is set // 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_rotation_enabled_flag : 1;
uint32_t transform_skip_context_enabled_flag : 1; uint32_t transform_skip_context_enabled_flag : 1;
uint32_t implicit_rdpcm_enabled_flag : 1; uint32_t implicit_rdpcm_enabled_flag : 1;
@ -205,7 +235,7 @@ typedef struct StdVideoH265SpsFlags {
uint32_t persistent_rice_adaptation_enabled_flag : 1; uint32_t persistent_rice_adaptation_enabled_flag : 1;
uint32_t cabac_bypass_alignment_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 // extension SPS flags, valid when STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS is set
uint32_t sps_curr_pic_ref_enabled_flag : 1; uint32_t sps_curr_pic_ref_enabled_flag : 1;
uint32_t palette_mode_enabled_flag : 1; uint32_t palette_mode_enabled_flag : 1;
uint32_t sps_palette_predictor_initializer_present_flag : 1; uint32_t sps_palette_predictor_initializer_present_flag : 1;
@ -247,7 +277,7 @@ typedef struct StdVideoH265SequenceParameterSet
StdVideoH265ScalingLists* pScalingLists; // Must be a valid pointer if sps_scaling_list_data_present_flag is set 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; 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 // extension SPS flags, valid when STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS is set
uint8_t palette_max_size; uint8_t palette_max_size;
uint8_t delta_palette_max_predictor_size; uint8_t delta_palette_max_predictor_size;
uint8_t motion_vector_resolution_control_idc; uint8_t motion_vector_resolution_control_idc;
@ -281,11 +311,11 @@ typedef struct StdVideoH265PpsFlags {
uint32_t slice_segment_header_extension_present_flag : 1; uint32_t slice_segment_header_extension_present_flag : 1;
uint32_t pps_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 // 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 cross_component_prediction_enabled_flag : 1;
uint32_t chroma_qp_offset_list_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 // 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 pps_curr_pic_ref_enabled_flag : 1;
uint32_t residual_adaptive_colour_transform_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_slice_act_qp_offsets_present_flag : 1;
@ -307,24 +337,24 @@ typedef struct StdVideoH265PictureParameterSet
int8_t pps_cr_qp_offset; int8_t pps_cr_qp_offset;
uint8_t num_tile_columns_minus1; uint8_t num_tile_columns_minus1;
uint8_t num_tile_rows_minus1; uint8_t num_tile_rows_minus1;
uint16_t column_width_minus1[19]; uint16_t column_width_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE];
uint16_t row_height_minus1[21]; uint16_t row_height_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE];
int8_t pps_beta_offset_div2; int8_t pps_beta_offset_div2;
int8_t pps_tc_offset_div2; int8_t pps_tc_offset_div2;
uint8_t log2_parallel_merge_level_minus2; uint8_t log2_parallel_merge_level_minus2;
StdVideoH265PpsFlags flags; StdVideoH265PpsFlags flags;
StdVideoH265ScalingLists* pScalingLists; // Must be a valid pointer if pps_scaling_list_data_present_flag is set 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 // 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 log2_max_transform_skip_block_size_minus2;
uint8_t diff_cu_chroma_qp_offset_depth; uint8_t diff_cu_chroma_qp_offset_depth;
uint8_t chroma_qp_offset_list_len_minus1; uint8_t chroma_qp_offset_list_len_minus1;
int8_t cb_qp_offset_list[6]; int8_t cb_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE];
int8_t cr_qp_offset_list[6]; 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_luma;
uint8_t log2_sao_offset_scale_chroma; uint8_t log2_sao_offset_scale_chroma;
// extension PPS, valid when std_video_h265_profile_idc_scc_extensions is set // 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_y_qp_offset_plus5;
int8_t pps_act_cb_qp_offset_plus5; int8_t pps_act_cb_qp_offset_plus5;
int8_t pps_act_cr_qp_offset_plus5; int8_t pps_act_cr_qp_offset_plus5;

View File

@ -17,6 +17,8 @@ extern "C" {
// Video h265 Decode related parameters: // Video h265 Decode related parameters:
// ************************************************* // *************************************************
#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8
typedef struct StdVideoDecodeH265PictureInfoFlags { typedef struct StdVideoDecodeH265PictureInfoFlags {
uint32_t IrapPicFlag : 1; uint32_t IrapPicFlag : 1;
uint32_t IdrPicFlag : 1; uint32_t IdrPicFlag : 1;
@ -33,11 +35,14 @@ typedef struct StdVideoDecodeH265PictureInfo {
uint16_t NumBitsForSTRefPicSetInSlice; // number of bits used in st_ref_pic_set() 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. //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 NumDeltaPocsOfRefRpsIdx; // NumDeltaPocs[ RefRpsIdx ] when short_term_ref_pic_set_sps_flag = 1, otherwise 0
uint8_t RefPicSetStCurrBefore[8]; // slotIndex as used in VkVideoReferenceSlotKHR structures representing 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 //pReferenceSlots in VkVideoDecodeInfoKHR, 0xff for invalid slotIndex
uint8_t RefPicSetStCurrAfter[8]; // slotIndex as used in VkVideoReferenceSlotKHR structures representing 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 //pReferenceSlots in VkVideoDecodeInfoKHR, 0xff for invalid slotIndex
uint8_t RefPicSetLtCurr[8]; // slotIndex as used in VkVideoReferenceSlotKHR structures representing 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 //pReferenceSlots in VkVideoDecodeInfoKHR, 0xff for invalid slotIndex
StdVideoDecodeH265PictureInfoFlags flags; StdVideoDecodeH265PictureInfoFlags flags;
} StdVideoDecodeH265PictureInfo; } StdVideoDecodeH265PictureInfo;

View File

@ -33,7 +33,7 @@
// Version 2 - Add Loader/ICD Interface version negotiation // Version 2 - Add Loader/ICD Interface version negotiation
// via vk_icdNegotiateLoaderICDInterfaceVersion. // via vk_icdNegotiateLoaderICDInterfaceVersion.
// Version 3 - Add ICD creation/destruction of KHR_surface objects. // Version 3 - Add ICD creation/destruction of KHR_surface objects.
// Version 4 - Add unknown physical device extension qyering via // Version 4 - Add unknown physical device extension querying via
// vk_icdGetPhysicalDeviceProcAddr. // vk_icdGetPhysicalDeviceProcAddr.
// Version 5 - Tells ICDs that the loader is now paying attention to the // Version 5 - Tells ICDs that the loader is now paying attention to the
// application version of Vulkan passed into the ApplicationInfo // application version of Vulkan passed into the ApplicationInfo

View File

@ -42,7 +42,7 @@ extern "C"
#define VKAPI_CALL __stdcall #define VKAPI_CALL __stdcall
#define VKAPI_PTR VKAPI_CALL #define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
#error "Vulkan isn't supported for the 'armeabi' NDK ABI" #error "Vulkan is not supported for the 'armeabi' NDK ABI"
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
// calling convention, i.e. float parameters are passed in registers. This // calling convention, i.e. float parameters are passed in registers. This

View File

@ -85,7 +85,6 @@
#include "vulkan_screen.h" #include "vulkan_screen.h"
#endif #endif
#ifdef VK_ENABLE_BETA_EXTENSIONS #ifdef VK_ENABLE_BETA_EXTENSIONS
#include "vulkan_beta.h" #include "vulkan_beta.h"
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
#define VK_ANDROID_external_memory_android_hardware_buffer 1 #define VK_ANDROID_external_memory_android_hardware_buffer 1
struct AHardwareBuffer; struct AHardwareBuffer;
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 3 #define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 4
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer" #define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer"
typedef struct VkAndroidHardwareBufferUsageANDROID { typedef struct VkAndroidHardwareBufferUsageANDROID {
VkStructureType sType; VkStructureType sType;
@ -90,6 +90,19 @@ typedef struct VkExternalFormatANDROID {
uint64_t externalFormat; uint64_t externalFormat;
} VkExternalFormatANDROID; } VkExternalFormatANDROID;
typedef struct VkAndroidHardwareBufferFormatProperties2ANDROID {
VkStructureType sType;
void* pNext;
VkFormat format;
uint64_t externalFormat;
VkFormatFeatureFlags2KHR formatFeatures;
VkComponentMapping samplerYcbcrConversionComponents;
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
VkSamplerYcbcrRange suggestedYcbcrRange;
VkChromaLocation suggestedXChromaOffset;
VkChromaLocation suggestedYChromaOffset;
} VkAndroidHardwareBufferFormatProperties2ANDROID;
typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties); typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties);
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer); typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer);

View File

@ -22,7 +22,7 @@ extern "C" {
#define VK_KHR_video_queue 1 #define VK_KHR_video_queue 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionKHR)
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionParametersKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionParametersKHR)
#define VK_KHR_VIDEO_QUEUE_SPEC_VERSION 1 #define VK_KHR_VIDEO_QUEUE_SPEC_VERSION 2
#define VK_KHR_VIDEO_QUEUE_EXTENSION_NAME "VK_KHR_video_queue" #define VK_KHR_VIDEO_QUEUE_EXTENSION_NAME "VK_KHR_video_queue"
typedef enum VkQueryResultStatusKHR { typedef enum VkQueryResultStatusKHR {
@ -37,6 +37,9 @@ typedef enum VkVideoCodecOperationFlagBitsKHR {
#ifdef VK_ENABLE_BETA_EXTENSIONS #ifdef VK_ENABLE_BETA_EXTENSIONS
VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT = 0x00010000, VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT = 0x00010000,
#endif #endif
#ifdef VK_ENABLE_BETA_EXTENSIONS
VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT = 0x00020000,
#endif
#ifdef VK_ENABLE_BETA_EXTENSIONS #ifdef VK_ENABLE_BETA_EXTENSIONS
VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT = 0x00000001, VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT = 0x00000001,
#endif #endif
@ -66,12 +69,12 @@ typedef enum VkVideoComponentBitDepthFlagBitsKHR {
} VkVideoComponentBitDepthFlagBitsKHR; } VkVideoComponentBitDepthFlagBitsKHR;
typedef VkFlags VkVideoComponentBitDepthFlagsKHR; typedef VkFlags VkVideoComponentBitDepthFlagsKHR;
typedef enum VkVideoCapabilitiesFlagBitsKHR { typedef enum VkVideoCapabilityFlagBitsKHR {
VK_VIDEO_CAPABILITIES_PROTECTED_CONTENT_BIT_KHR = 0x00000001, VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR = 0x00000001,
VK_VIDEO_CAPABILITIES_SEPARATE_REFERENCE_IMAGES_BIT_KHR = 0x00000002, VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR = 0x00000002,
VK_VIDEO_CAPABILITIES_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF VK_VIDEO_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkVideoCapabilitiesFlagBitsKHR; } VkVideoCapabilityFlagBitsKHR;
typedef VkFlags VkVideoCapabilitiesFlagsKHR; typedef VkFlags VkVideoCapabilityFlagsKHR;
typedef enum VkVideoSessionCreateFlagBitsKHR { typedef enum VkVideoSessionCreateFlagBitsKHR {
VK_VIDEO_SESSION_CREATE_DEFAULT_KHR = 0, VK_VIDEO_SESSION_CREATE_DEFAULT_KHR = 0,
@ -90,7 +93,6 @@ typedef enum VkVideoCodingControlFlagBitsKHR {
typedef VkFlags VkVideoCodingControlFlagsKHR; typedef VkFlags VkVideoCodingControlFlagsKHR;
typedef enum VkVideoCodingQualityPresetFlagBitsKHR { typedef enum VkVideoCodingQualityPresetFlagBitsKHR {
VK_VIDEO_CODING_QUALITY_PRESET_DEFAULT_BIT_KHR = 0,
VK_VIDEO_CODING_QUALITY_PRESET_NORMAL_BIT_KHR = 0x00000001, VK_VIDEO_CODING_QUALITY_PRESET_NORMAL_BIT_KHR = 0x00000001,
VK_VIDEO_CODING_QUALITY_PRESET_POWER_BIT_KHR = 0x00000002, VK_VIDEO_CODING_QUALITY_PRESET_POWER_BIT_KHR = 0x00000002,
VK_VIDEO_CODING_QUALITY_PRESET_QUALITY_BIT_KHR = 0x00000004, VK_VIDEO_CODING_QUALITY_PRESET_QUALITY_BIT_KHR = 0x00000004,
@ -122,7 +124,7 @@ typedef struct VkVideoProfilesKHR {
typedef struct VkVideoCapabilitiesKHR { typedef struct VkVideoCapabilitiesKHR {
VkStructureType sType; VkStructureType sType;
void* pNext; void* pNext;
VkVideoCapabilitiesFlagsKHR capabilityFlags; VkVideoCapabilityFlagsKHR capabilityFlags;
VkDeviceSize minBitstreamBufferOffsetAlignment; VkDeviceSize minBitstreamBufferOffsetAlignment;
VkDeviceSize minBitstreamBufferSizeAlignment; VkDeviceSize minBitstreamBufferSizeAlignment;
VkExtent2D videoPictureExtentGranularity; VkExtent2D videoPictureExtentGranularity;
@ -134,7 +136,7 @@ typedef struct VkVideoCapabilitiesKHR {
typedef struct VkPhysicalDeviceVideoFormatInfoKHR { typedef struct VkPhysicalDeviceVideoFormatInfoKHR {
VkStructureType sType; VkStructureType sType;
const void* pNext; void* pNext;
VkImageUsageFlags imageUsage; VkImageUsageFlags imageUsage;
const VkVideoProfilesKHR* pVideoProfiles; const VkVideoProfilesKHR* pVideoProfiles;
} VkPhysicalDeviceVideoFormatInfoKHR; } VkPhysicalDeviceVideoFormatInfoKHR;
@ -305,7 +307,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdControlVideoCodingKHR(
#define VK_KHR_video_decode_queue 1 #define VK_KHR_video_decode_queue 1
#define VK_KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION 1 #define VK_KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION 2
#define VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME "VK_KHR_video_decode_queue" #define VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME "VK_KHR_video_decode_queue"
typedef enum VkVideoDecodeFlagBitsKHR { typedef enum VkVideoDecodeFlagBitsKHR {
@ -370,7 +372,7 @@ typedef struct VkPhysicalDevicePortabilitySubsetPropertiesKHR {
#define VK_KHR_video_encode_queue 1 #define VK_KHR_video_encode_queue 1
#define VK_KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION 2 #define VK_KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION 3
#define VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME "VK_KHR_video_encode_queue" #define VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME "VK_KHR_video_encode_queue"
typedef enum VkVideoEncodeFlagBitsKHR { typedef enum VkVideoEncodeFlagBitsKHR {
@ -382,7 +384,7 @@ typedef VkFlags VkVideoEncodeFlagsKHR;
typedef enum VkVideoEncodeRateControlFlagBitsKHR { typedef enum VkVideoEncodeRateControlFlagBitsKHR {
VK_VIDEO_ENCODE_RATE_CONTROL_DEFAULT_KHR = 0, VK_VIDEO_ENCODE_RATE_CONTROL_DEFAULT_KHR = 0,
VK_VIDEO_ENCODE_RATE_CONTROL_RESET_BIT_KHR = 0x00000001, VK_VIDEO_ENCODE_RATE_CONTROL_RESERVED_0_BIT_KHR = 0x00000001,
VK_VIDEO_ENCODE_RATE_CONTROL_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF VK_VIDEO_ENCODE_RATE_CONTROL_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkVideoEncodeRateControlFlagBitsKHR; } VkVideoEncodeRateControlFlagBitsKHR;
typedef VkFlags VkVideoEncodeRateControlFlagsKHR; typedef VkFlags VkVideoEncodeRateControlFlagsKHR;
@ -407,18 +409,27 @@ typedef struct VkVideoEncodeInfoKHR {
const VkVideoReferenceSlotKHR* pSetupReferenceSlot; const VkVideoReferenceSlotKHR* pSetupReferenceSlot;
uint32_t referenceSlotCount; uint32_t referenceSlotCount;
const VkVideoReferenceSlotKHR* pReferenceSlots; const VkVideoReferenceSlotKHR* pReferenceSlots;
uint32_t precedingExternallyEncodedBytes;
} VkVideoEncodeInfoKHR; } VkVideoEncodeInfoKHR;
typedef struct VkVideoEncodeRateControlLayerInfoKHR {
VkStructureType sType;
const void* pNext;
uint32_t averageBitrate;
uint32_t maxBitrate;
uint32_t frameRateNumerator;
uint32_t frameRateDenominator;
uint32_t virtualBufferSizeInMs;
uint32_t initialVirtualBufferSizeInMs;
} VkVideoEncodeRateControlLayerInfoKHR;
typedef struct VkVideoEncodeRateControlInfoKHR { typedef struct VkVideoEncodeRateControlInfoKHR {
VkStructureType sType; VkStructureType sType;
const void* pNext; const void* pNext;
VkVideoEncodeRateControlFlagsKHR flags; VkVideoEncodeRateControlFlagsKHR flags;
VkVideoEncodeRateControlModeFlagBitsKHR rateControlMode; VkVideoEncodeRateControlModeFlagBitsKHR rateControlMode;
uint32_t averageBitrate; uint8_t layerCount;
uint16_t peakToAverageBitrateRatio; const VkVideoEncodeRateControlLayerInfoKHR* pLayerConfigs;
uint16_t frameRateNumerator;
uint16_t frameRateDenominator;
uint32_t virtualBufferSizeInMs;
} VkVideoEncodeRateControlInfoKHR; } VkVideoEncodeRateControlInfoKHR;
typedef void (VKAPI_PTR *PFN_vkCmdEncodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo); typedef void (VKAPI_PTR *PFN_vkCmdEncodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo);
@ -433,10 +444,10 @@ VKAPI_ATTR void VKAPI_CALL vkCmdEncodeVideoKHR(
#define VK_EXT_video_encode_h264 1 #define VK_EXT_video_encode_h264 1
#include "vk_video/vulkan_video_codec_h264std.h" #include "vk_video/vulkan_video_codec_h264std.h"
#include "vk_video/vulkan_video_codec_h264std_encode.h" #include "vk_video/vulkan_video_codec_h264std_encode.h"
#define VK_EXT_VIDEO_ENCODE_H264_SPEC_VERSION 1 #define VK_EXT_VIDEO_ENCODE_H264_SPEC_VERSION 2
#define VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME "VK_EXT_video_encode_h264" #define VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME "VK_EXT_video_encode_h264"
typedef enum VkVideoEncodeH264CapabilitiesFlagBitsEXT { typedef enum VkVideoEncodeH264CapabilityFlagBitsEXT {
VK_VIDEO_ENCODE_H264_CAPABILITY_CABAC_BIT_EXT = 0x00000001, VK_VIDEO_ENCODE_H264_CAPABILITY_CABAC_BIT_EXT = 0x00000001,
VK_VIDEO_ENCODE_H264_CAPABILITY_CAVLC_BIT_EXT = 0x00000002, VK_VIDEO_ENCODE_H264_CAPABILITY_CAVLC_BIT_EXT = 0x00000002,
VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BI_PRED_IMPLICIT_BIT_EXT = 0x00000004, VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BI_PRED_IMPLICIT_BIT_EXT = 0x00000004,
@ -448,9 +459,10 @@ typedef enum VkVideoEncodeH264CapabilitiesFlagBitsEXT {
VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_PARTIAL_BIT_EXT = 0x00000100, VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_PARTIAL_BIT_EXT = 0x00000100,
VK_VIDEO_ENCODE_H264_CAPABILITY_MULTIPLE_SLICE_PER_FRAME_BIT_EXT = 0x00000200, VK_VIDEO_ENCODE_H264_CAPABILITY_MULTIPLE_SLICE_PER_FRAME_BIT_EXT = 0x00000200,
VK_VIDEO_ENCODE_H264_CAPABILITY_EVENLY_DISTRIBUTED_SLICE_SIZE_BIT_EXT = 0x00000400, VK_VIDEO_ENCODE_H264_CAPABILITY_EVENLY_DISTRIBUTED_SLICE_SIZE_BIT_EXT = 0x00000400,
VK_VIDEO_ENCODE_H264_CAPABILITIES_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF VK_VIDEO_ENCODE_H264_CAPABILITY_OPTIONAL_RC_EXTENSION_STRUCT_BIT_EXT = 0x00000800,
} VkVideoEncodeH264CapabilitiesFlagBitsEXT; VK_VIDEO_ENCODE_H264_CAPABILITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
typedef VkFlags VkVideoEncodeH264CapabilitiesFlagsEXT; } VkVideoEncodeH264CapabilityFlagBitsEXT;
typedef VkFlags VkVideoEncodeH264CapabilityFlagsEXT;
typedef enum VkVideoEncodeH264InputModeFlagBitsEXT { typedef enum VkVideoEncodeH264InputModeFlagBitsEXT {
VK_VIDEO_ENCODE_H264_INPUT_MODE_FRAME_BIT_EXT = 0x00000001, VK_VIDEO_ENCODE_H264_INPUT_MODE_FRAME_BIT_EXT = 0x00000001,
@ -474,10 +486,18 @@ typedef enum VkVideoEncodeH264CreateFlagBitsEXT {
VK_VIDEO_ENCODE_H264_CREATE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF VK_VIDEO_ENCODE_H264_CREATE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkVideoEncodeH264CreateFlagBitsEXT; } VkVideoEncodeH264CreateFlagBitsEXT;
typedef VkFlags VkVideoEncodeH264CreateFlagsEXT; typedef VkFlags VkVideoEncodeH264CreateFlagsEXT;
typedef enum VkVideoEncodeH264RateControlStructureFlagBitsEXT {
VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT = 0,
VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_FLAT_BIT_EXT = 0x00000001,
VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_DYADIC_BIT_EXT = 0x00000002,
VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkVideoEncodeH264RateControlStructureFlagBitsEXT;
typedef VkFlags VkVideoEncodeH264RateControlStructureFlagsEXT;
typedef struct VkVideoEncodeH264CapabilitiesEXT { typedef struct VkVideoEncodeH264CapabilitiesEXT {
VkStructureType sType; VkStructureType sType;
const void* pNext; const void* pNext;
VkVideoEncodeH264CapabilitiesFlagsEXT flags; VkVideoEncodeH264CapabilityFlagsEXT flags;
VkVideoEncodeH264InputModeFlagsEXT inputModeFlags; VkVideoEncodeH264InputModeFlagsEXT inputModeFlags;
VkVideoEncodeH264OutputModeFlagsEXT outputModeFlags; VkVideoEncodeH264OutputModeFlagsEXT outputModeFlags;
VkExtent2D minPictureSizeInMbs; VkExtent2D minPictureSizeInMbs;
@ -531,9 +551,6 @@ typedef struct VkVideoEncodeH264NaluSliceEXT {
const VkVideoEncodeH264DpbSlotInfoEXT* pRefFinalList0Entries; const VkVideoEncodeH264DpbSlotInfoEXT* pRefFinalList0Entries;
uint8_t refFinalList1EntryCount; uint8_t refFinalList1EntryCount;
const VkVideoEncodeH264DpbSlotInfoEXT* pRefFinalList1Entries; const VkVideoEncodeH264DpbSlotInfoEXT* pRefFinalList1Entries;
uint32_t precedingNaluBytes;
uint8_t minQp;
uint8_t maxQp;
} VkVideoEncodeH264NaluSliceEXT; } VkVideoEncodeH264NaluSliceEXT;
typedef struct VkVideoEncodeH264VclFrameInfoEXT { typedef struct VkVideoEncodeH264VclFrameInfoEXT {
@ -563,26 +580,232 @@ typedef struct VkVideoEncodeH264ProfileEXT {
StdVideoH264ProfileIdc stdProfileIdc; StdVideoH264ProfileIdc stdProfileIdc;
} VkVideoEncodeH264ProfileEXT; } VkVideoEncodeH264ProfileEXT;
typedef struct VkVideoEncodeH264RateControlInfoEXT {
VkStructureType sType;
const void* pNext;
uint32_t gopFrameCount;
uint32_t idrPeriod;
uint32_t consecutiveBFrameCount;
VkVideoEncodeH264RateControlStructureFlagBitsEXT rateControlStructure;
} VkVideoEncodeH264RateControlInfoEXT;
typedef struct VkVideoEncodeH264QpEXT {
int32_t qpI;
int32_t qpP;
int32_t qpB;
} VkVideoEncodeH264QpEXT;
typedef struct VkVideoEncodeH264FrameSizeEXT {
uint32_t frameISize;
uint32_t framePSize;
uint32_t frameBSize;
} VkVideoEncodeH264FrameSizeEXT;
typedef struct VkVideoEncodeH264RateControlLayerInfoEXT {
VkStructureType sType;
const void* pNext;
uint8_t temporalLayerId;
VkBool32 useInitialRcQp;
VkVideoEncodeH264QpEXT initialRcQp;
VkBool32 useMinQp;
VkVideoEncodeH264QpEXT minQp;
VkBool32 useMaxQp;
VkVideoEncodeH264QpEXT maxQp;
VkBool32 useMaxFrameSize;
VkVideoEncodeH264FrameSizeEXT maxFrameSize;
} VkVideoEncodeH264RateControlLayerInfoEXT;
#define VK_EXT_video_encode_h265 1
#include "vk_video/vulkan_video_codec_h265std.h"
#include "vk_video/vulkan_video_codec_h265std_encode.h"
#define VK_EXT_VIDEO_ENCODE_H265_SPEC_VERSION 2
#define VK_EXT_VIDEO_ENCODE_H265_EXTENSION_NAME "VK_EXT_video_encode_h265"
typedef VkFlags VkVideoEncodeH265CapabilityFlagsEXT;
typedef enum VkVideoEncodeH265InputModeFlagBitsEXT {
VK_VIDEO_ENCODE_H265_INPUT_MODE_FRAME_BIT_EXT = 0x00000001,
VK_VIDEO_ENCODE_H265_INPUT_MODE_SLICE_BIT_EXT = 0x00000002,
VK_VIDEO_ENCODE_H265_INPUT_MODE_NON_VCL_BIT_EXT = 0x00000004,
VK_VIDEO_ENCODE_H265_INPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkVideoEncodeH265InputModeFlagBitsEXT;
typedef VkFlags VkVideoEncodeH265InputModeFlagsEXT;
typedef enum VkVideoEncodeH265OutputModeFlagBitsEXT {
VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FRAME_BIT_EXT = 0x00000001,
VK_VIDEO_ENCODE_H265_OUTPUT_MODE_SLICE_BIT_EXT = 0x00000002,
VK_VIDEO_ENCODE_H265_OUTPUT_MODE_NON_VCL_BIT_EXT = 0x00000004,
VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkVideoEncodeH265OutputModeFlagBitsEXT;
typedef VkFlags VkVideoEncodeH265OutputModeFlagsEXT;
typedef VkFlags VkVideoEncodeH265CreateFlagsEXT;
typedef enum VkVideoEncodeH265CtbSizeFlagBitsEXT {
VK_VIDEO_ENCODE_H265_CTB_SIZE_8_BIT_EXT = 0x00000001,
VK_VIDEO_ENCODE_H265_CTB_SIZE_16_BIT_EXT = 0x00000002,
VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_EXT = 0x00000004,
VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_EXT = 0x00000008,
VK_VIDEO_ENCODE_H265_CTB_SIZE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkVideoEncodeH265CtbSizeFlagBitsEXT;
typedef VkFlags VkVideoEncodeH265CtbSizeFlagsEXT;
typedef enum VkVideoEncodeH265RateControlStructureFlagBitsEXT {
VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT = 0,
VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_FLAT_BIT_EXT = 0x00000001,
VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_DYADIC_BIT_EXT = 0x00000002,
VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkVideoEncodeH265RateControlStructureFlagBitsEXT;
typedef VkFlags VkVideoEncodeH265RateControlStructureFlagsEXT;
typedef struct VkVideoEncodeH265CapabilitiesEXT {
VkStructureType sType;
const void* pNext;
VkVideoEncodeH265CapabilityFlagsEXT flags;
VkVideoEncodeH265InputModeFlagsEXT inputModeFlags;
VkVideoEncodeH265OutputModeFlagsEXT outputModeFlags;
VkVideoEncodeH265CtbSizeFlagsEXT ctbSizes;
VkExtent2D inputImageDataAlignment;
uint8_t maxNumL0ReferenceForP;
uint8_t maxNumL0ReferenceForB;
uint8_t maxNumL1Reference;
uint8_t maxNumSubLayers;
uint8_t qualityLevelCount;
VkExtensionProperties stdExtensionVersion;
} VkVideoEncodeH265CapabilitiesEXT;
typedef struct VkVideoEncodeH265SessionCreateInfoEXT {
VkStructureType sType;
const void* pNext;
VkVideoEncodeH265CreateFlagsEXT flags;
const VkExtensionProperties* pStdExtensionVersion;
} VkVideoEncodeH265SessionCreateInfoEXT;
typedef struct VkVideoEncodeH265SessionParametersAddInfoEXT {
VkStructureType sType;
const void* pNext;
uint32_t vpsStdCount;
const StdVideoH265VideoParameterSet* pVpsStd;
uint32_t spsStdCount;
const StdVideoH265SequenceParameterSet* pSpsStd;
uint32_t ppsStdCount;
const StdVideoH265PictureParameterSet* pPpsStd;
} VkVideoEncodeH265SessionParametersAddInfoEXT;
typedef struct VkVideoEncodeH265SessionParametersCreateInfoEXT {
VkStructureType sType;
const void* pNext;
uint32_t maxVpsStdCount;
uint32_t maxSpsStdCount;
uint32_t maxPpsStdCount;
const VkVideoEncodeH265SessionParametersAddInfoEXT* pParametersAddInfo;
} VkVideoEncodeH265SessionParametersCreateInfoEXT;
typedef struct VkVideoEncodeH265DpbSlotInfoEXT {
VkStructureType sType;
const void* pNext;
int8_t slotIndex;
const StdVideoEncodeH265ReferenceInfo* pStdReferenceInfo;
} VkVideoEncodeH265DpbSlotInfoEXT;
typedef struct VkVideoEncodeH265ReferenceListsEXT {
VkStructureType sType;
const void* pNext;
uint8_t referenceList0EntryCount;
const VkVideoEncodeH265DpbSlotInfoEXT* pReferenceList0Entries;
uint8_t referenceList1EntryCount;
const VkVideoEncodeH265DpbSlotInfoEXT* pReferenceList1Entries;
const StdVideoEncodeH265ReferenceModifications* pReferenceModifications;
} VkVideoEncodeH265ReferenceListsEXT;
typedef struct VkVideoEncodeH265NaluSliceEXT {
VkStructureType sType;
const void* pNext;
uint32_t ctbCount;
const VkVideoEncodeH265ReferenceListsEXT* pReferenceFinalLists;
const StdVideoEncodeH265SliceHeader* pSliceHeaderStd;
} VkVideoEncodeH265NaluSliceEXT;
typedef struct VkVideoEncodeH265VclFrameInfoEXT {
VkStructureType sType;
const void* pNext;
const VkVideoEncodeH265ReferenceListsEXT* pReferenceFinalLists;
uint32_t naluSliceEntryCount;
const VkVideoEncodeH265NaluSliceEXT* pNaluSliceEntries;
const StdVideoEncodeH265PictureInfo* pCurrentPictureInfo;
} VkVideoEncodeH265VclFrameInfoEXT;
typedef struct VkVideoEncodeH265EmitPictureParametersEXT {
VkStructureType sType;
const void* pNext;
uint8_t vpsId;
uint8_t spsId;
VkBool32 emitVpsEnable;
VkBool32 emitSpsEnable;
uint32_t ppsIdEntryCount;
const uint8_t* ppsIdEntries;
} VkVideoEncodeH265EmitPictureParametersEXT;
typedef struct VkVideoEncodeH265ProfileEXT {
VkStructureType sType;
const void* pNext;
StdVideoH265ProfileIdc stdProfileIdc;
} VkVideoEncodeH265ProfileEXT;
typedef struct VkVideoEncodeH265RateControlInfoEXT {
VkStructureType sType;
const void* pNext;
uint32_t gopFrameCount;
uint32_t idrPeriod;
uint32_t consecutiveBFrameCount;
VkVideoEncodeH265RateControlStructureFlagBitsEXT rateControlStructure;
} VkVideoEncodeH265RateControlInfoEXT;
typedef struct VkVideoEncodeH265QpEXT {
int32_t qpI;
int32_t qpP;
int32_t qpB;
} VkVideoEncodeH265QpEXT;
typedef struct VkVideoEncodeH265FrameSizeEXT {
uint32_t frameISize;
uint32_t framePSize;
uint32_t frameBSize;
} VkVideoEncodeH265FrameSizeEXT;
typedef struct VkVideoEncodeH265RateControlLayerInfoEXT {
VkStructureType sType;
const void* pNext;
uint8_t temporalId;
VkBool32 useInitialRcQp;
VkVideoEncodeH265QpEXT initialRcQp;
VkBool32 useMinQp;
VkVideoEncodeH265QpEXT minQp;
VkBool32 useMaxQp;
VkVideoEncodeH265QpEXT maxQp;
VkBool32 useMaxFrameSize;
VkVideoEncodeH265FrameSizeEXT maxFrameSize;
} VkVideoEncodeH265RateControlLayerInfoEXT;
#define VK_EXT_video_decode_h264 1 #define VK_EXT_video_decode_h264 1
#include "vk_video/vulkan_video_codec_h264std_decode.h" #include "vk_video/vulkan_video_codec_h264std_decode.h"
#define VK_EXT_VIDEO_DECODE_H264_SPEC_VERSION 1 #define VK_EXT_VIDEO_DECODE_H264_SPEC_VERSION 3
#define VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME "VK_EXT_video_decode_h264" #define VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME "VK_EXT_video_decode_h264"
typedef enum VkVideoDecodeH264FieldLayoutFlagBitsEXT { typedef enum VkVideoDecodeH264PictureLayoutFlagBitsEXT {
VK_VIDEO_DECODE_H264_PROGRESSIVE_PICTURES_ONLY_EXT = 0, VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_EXT = 0,
VK_VIDEO_DECODE_H264_FIELD_LAYOUT_LINE_INTERLACED_PLANE_BIT_EXT = 0x00000001, VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_EXT = 0x00000001,
VK_VIDEO_DECODE_H264_FIELD_LAYOUT_SEPARATE_INTERLACED_PLANE_BIT_EXT = 0x00000002, VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_EXT = 0x00000002,
VK_VIDEO_DECODE_H264_FIELD_LAYOUT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkVideoDecodeH264FieldLayoutFlagBitsEXT; } VkVideoDecodeH264PictureLayoutFlagBitsEXT;
typedef VkFlags VkVideoDecodeH264FieldLayoutFlagsEXT; typedef VkFlags VkVideoDecodeH264PictureLayoutFlagsEXT;
typedef VkFlags VkVideoDecodeH264CreateFlagsEXT; typedef VkFlags VkVideoDecodeH264CreateFlagsEXT;
typedef struct VkVideoDecodeH264ProfileEXT { typedef struct VkVideoDecodeH264ProfileEXT {
VkStructureType sType; VkStructureType sType;
const void* pNext; const void* pNext;
StdVideoH264ProfileIdc stdProfileIdc; StdVideoH264ProfileIdc stdProfileIdc;
VkVideoDecodeH264FieldLayoutFlagsEXT fieldLayout; VkVideoDecodeH264PictureLayoutFlagsEXT pictureLayout;
} VkVideoDecodeH264ProfileEXT; } VkVideoDecodeH264ProfileEXT;
typedef struct VkVideoDecodeH264CapabilitiesEXT { typedef struct VkVideoDecodeH264CapabilitiesEXT {
@ -640,7 +863,6 @@ typedef struct VkVideoDecodeH264DpbSlotInfoEXT {
#define VK_EXT_video_decode_h265 1 #define VK_EXT_video_decode_h265 1
#include "vk_video/vulkan_video_codec_h265std.h"
#include "vk_video/vulkan_video_codec_h265std_decode.h" #include "vk_video/vulkan_video_codec_h265std_decode.h"
#define VK_EXT_VIDEO_DECODE_H265_SPEC_VERSION 1 #define VK_EXT_VIDEO_DECODE_H265_SPEC_VERSION 1
#define VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME "VK_EXT_video_decode_h265" #define VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME "VK_EXT_video_decode_h265"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -114,6 +114,143 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreZirconHandleFUCHSIA(
zx_handle_t* pZirconHandle); zx_handle_t* pZirconHandle);
#endif #endif
#define VK_FUCHSIA_buffer_collection 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferCollectionFUCHSIA)
#define VK_FUCHSIA_BUFFER_COLLECTION_SPEC_VERSION 2
#define VK_FUCHSIA_BUFFER_COLLECTION_EXTENSION_NAME "VK_FUCHSIA_buffer_collection"
typedef VkFlags VkImageFormatConstraintsFlagsFUCHSIA;
typedef enum VkImageConstraintsInfoFlagBitsFUCHSIA {
VK_IMAGE_CONSTRAINTS_INFO_CPU_READ_RARELY_FUCHSIA = 0x00000001,
VK_IMAGE_CONSTRAINTS_INFO_CPU_READ_OFTEN_FUCHSIA = 0x00000002,
VK_IMAGE_CONSTRAINTS_INFO_CPU_WRITE_RARELY_FUCHSIA = 0x00000004,
VK_IMAGE_CONSTRAINTS_INFO_CPU_WRITE_OFTEN_FUCHSIA = 0x00000008,
VK_IMAGE_CONSTRAINTS_INFO_PROTECTED_OPTIONAL_FUCHSIA = 0x00000010,
VK_IMAGE_CONSTRAINTS_INFO_FLAG_BITS_MAX_ENUM_FUCHSIA = 0x7FFFFFFF
} VkImageConstraintsInfoFlagBitsFUCHSIA;
typedef VkFlags VkImageConstraintsInfoFlagsFUCHSIA;
typedef struct VkBufferCollectionCreateInfoFUCHSIA {
VkStructureType sType;
const void* pNext;
zx_handle_t collectionToken;
} VkBufferCollectionCreateInfoFUCHSIA;
typedef struct VkImportMemoryBufferCollectionFUCHSIA {
VkStructureType sType;
const void* pNext;
VkBufferCollectionFUCHSIA collection;
uint32_t index;
} VkImportMemoryBufferCollectionFUCHSIA;
typedef struct VkBufferCollectionImageCreateInfoFUCHSIA {
VkStructureType sType;
const void* pNext;
VkBufferCollectionFUCHSIA collection;
uint32_t index;
} VkBufferCollectionImageCreateInfoFUCHSIA;
typedef struct VkBufferCollectionConstraintsInfoFUCHSIA {
VkStructureType sType;
const void* pNext;
uint32_t minBufferCount;
uint32_t maxBufferCount;
uint32_t minBufferCountForCamping;
uint32_t minBufferCountForDedicatedSlack;
uint32_t minBufferCountForSharedSlack;
} VkBufferCollectionConstraintsInfoFUCHSIA;
typedef struct VkBufferConstraintsInfoFUCHSIA {
VkStructureType sType;
const void* pNext;
VkBufferCreateInfo createInfo;
VkFormatFeatureFlags requiredFormatFeatures;
VkBufferCollectionConstraintsInfoFUCHSIA bufferCollectionConstraints;
} VkBufferConstraintsInfoFUCHSIA;
typedef struct VkBufferCollectionBufferCreateInfoFUCHSIA {
VkStructureType sType;
const void* pNext;
VkBufferCollectionFUCHSIA collection;
uint32_t index;
} VkBufferCollectionBufferCreateInfoFUCHSIA;
typedef struct VkSysmemColorSpaceFUCHSIA {
VkStructureType sType;
const void* pNext;
uint32_t colorSpace;
} VkSysmemColorSpaceFUCHSIA;
typedef struct VkBufferCollectionPropertiesFUCHSIA {
VkStructureType sType;
void* pNext;
uint32_t memoryTypeBits;
uint32_t bufferCount;
uint32_t createInfoIndex;
uint64_t sysmemPixelFormat;
VkFormatFeatureFlags formatFeatures;
VkSysmemColorSpaceFUCHSIA sysmemColorSpaceIndex;
VkComponentMapping samplerYcbcrConversionComponents;
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
VkSamplerYcbcrRange suggestedYcbcrRange;
VkChromaLocation suggestedXChromaOffset;
VkChromaLocation suggestedYChromaOffset;
} VkBufferCollectionPropertiesFUCHSIA;
typedef struct VkImageFormatConstraintsInfoFUCHSIA {
VkStructureType sType;
const void* pNext;
VkImageCreateInfo imageCreateInfo;
VkFormatFeatureFlags requiredFormatFeatures;
VkImageFormatConstraintsFlagsFUCHSIA flags;
uint64_t sysmemPixelFormat;
uint32_t colorSpaceCount;
const VkSysmemColorSpaceFUCHSIA* pColorSpaces;
} VkImageFormatConstraintsInfoFUCHSIA;
typedef struct VkImageConstraintsInfoFUCHSIA {
VkStructureType sType;
const void* pNext;
uint32_t formatConstraintsCount;
const VkImageFormatConstraintsInfoFUCHSIA* pFormatConstraints;
VkBufferCollectionConstraintsInfoFUCHSIA bufferCollectionConstraints;
VkImageConstraintsInfoFlagsFUCHSIA flags;
} VkImageConstraintsInfoFUCHSIA;
typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferCollectionFUCHSIA)(VkDevice device, const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferCollectionFUCHSIA* pCollection);
typedef VkResult (VKAPI_PTR *PFN_vkSetBufferCollectionImageConstraintsFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo);
typedef VkResult (VKAPI_PTR *PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo);
typedef void (VKAPI_PTR *PFN_vkDestroyBufferCollectionFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkAllocationCallbacks* pAllocator);
typedef VkResult (VKAPI_PTR *PFN_vkGetBufferCollectionPropertiesFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, VkBufferCollectionPropertiesFUCHSIA* pProperties);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferCollectionFUCHSIA(
VkDevice device,
const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkBufferCollectionFUCHSIA* pCollection);
VKAPI_ATTR VkResult VKAPI_CALL vkSetBufferCollectionImageConstraintsFUCHSIA(
VkDevice device,
VkBufferCollectionFUCHSIA collection,
const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo);
VKAPI_ATTR VkResult VKAPI_CALL vkSetBufferCollectionBufferConstraintsFUCHSIA(
VkDevice device,
VkBufferCollectionFUCHSIA collection,
const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo);
VKAPI_ATTR void VKAPI_CALL vkDestroyBufferCollectionFUCHSIA(
VkDevice device,
VkBufferCollectionFUCHSIA collection,
const VkAllocationCallbacks* pAllocator);
VKAPI_ATTR VkResult VKAPI_CALL vkGetBufferCollectionPropertiesFUCHSIA(
VkDevice device,
VkBufferCollectionFUCHSIA collection,
VkBufferCollectionPropertiesFUCHSIA* pProperties);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -480,6 +480,10 @@ namespace VULKAN_HPP_NAMESPACE
struct VideoEncodeH264DpbSlotInfoEXT; struct VideoEncodeH264DpbSlotInfoEXT;
struct VideoEncodeH264NaluSliceEXT; struct VideoEncodeH264NaluSliceEXT;
struct VideoEncodeH264ProfileEXT; struct VideoEncodeH264ProfileEXT;
struct VideoEncodeH264RateControlInfoEXT;
struct VideoEncodeH264RateControlLayerInfoEXT;
struct VideoEncodeH264QpEXT;
struct VideoEncodeH264FrameSizeEXT;
#endif /*VK_ENABLE_BETA_EXTENSIONS*/ #endif /*VK_ENABLE_BETA_EXTENSIONS*/
#if defined( VK_ENABLE_BETA_EXTENSIONS ) #if defined( VK_ENABLE_BETA_EXTENSIONS )
@ -494,6 +498,10 @@ namespace VULKAN_HPP_NAMESPACE
struct VideoEncodeH265NaluSliceEXT; struct VideoEncodeH265NaluSliceEXT;
struct VideoEncodeH265ProfileEXT; struct VideoEncodeH265ProfileEXT;
struct VideoEncodeH265ReferenceListsEXT; struct VideoEncodeH265ReferenceListsEXT;
struct VideoEncodeH265RateControlInfoEXT;
struct VideoEncodeH265RateControlLayerInfoEXT;
struct VideoEncodeH265QpEXT;
struct VideoEncodeH265FrameSizeEXT;
#endif /*VK_ENABLE_BETA_EXTENSIONS*/ #endif /*VK_ENABLE_BETA_EXTENSIONS*/
#if defined( VK_ENABLE_BETA_EXTENSIONS ) #if defined( VK_ENABLE_BETA_EXTENSIONS )
@ -1108,6 +1116,7 @@ namespace VULKAN_HPP_NAMESPACE
//=== VK_KHR_video_encode_queue === //=== VK_KHR_video_encode_queue ===
struct VideoEncodeInfoKHR; struct VideoEncodeInfoKHR;
struct VideoEncodeRateControlInfoKHR; struct VideoEncodeRateControlInfoKHR;
struct VideoEncodeRateControlLayerInfoKHR;
#endif /*VK_ENABLE_BETA_EXTENSIONS*/ #endif /*VK_ENABLE_BETA_EXTENSIONS*/
//=== VK_NV_device_diagnostics_config === //=== VK_NV_device_diagnostics_config ===
@ -14522,4 +14531,476 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
} // namespace VULKAN_HPP_NAMESPACE } // namespace VULKAN_HPP_NAMESPACE
namespace std
{
//=======================
//=== HASH structures ===
//=======================
//=== VK_VERSION_1_0 ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::Instance>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Instance const & instance ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkInstance>{}( static_cast<VkInstance>( instance ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PhysicalDevice>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PhysicalDevice const & physicalDevice ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPhysicalDevice>{}( static_cast<VkPhysicalDevice>( physicalDevice ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Device>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Device const & device ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDevice>{}( static_cast<VkDevice>( device ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Queue>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Queue const & queue ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkQueue>{}( static_cast<VkQueue>( queue ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DeviceMemory>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DeviceMemory const & deviceMemory ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDeviceMemory>{}( static_cast<VkDeviceMemory>( deviceMemory ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Fence>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Fence const & fence ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkFence>{}( static_cast<VkFence>( fence ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Semaphore>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Semaphore const & semaphore ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSemaphore>{}( static_cast<VkSemaphore>( semaphore ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Event>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Event const & event ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkEvent>{}( static_cast<VkEvent>( event ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::QueryPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::QueryPool const & queryPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkQueryPool>{}( static_cast<VkQueryPool>( queryPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Buffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Buffer const & buffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBuffer>{}( static_cast<VkBuffer>( buffer ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::BufferView>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::BufferView const & bufferView ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBufferView>{}( static_cast<VkBufferView>( bufferView ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Image>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Image const & image ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkImage>{}( static_cast<VkImage>( image ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::ImageView>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::ImageView const & imageView ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkImageView>{}( static_cast<VkImageView>( imageView ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::ShaderModule>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::ShaderModule const & shaderModule ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkShaderModule>{}( static_cast<VkShaderModule>( shaderModule ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PipelineCache>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PipelineCache const & pipelineCache ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipelineCache>{}( static_cast<VkPipelineCache>( pipelineCache ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Pipeline>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Pipeline const & pipeline ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipeline>{}( static_cast<VkPipeline>( pipeline ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::PipelineLayout>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PipelineLayout const & pipelineLayout ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPipelineLayout>{}( static_cast<VkPipelineLayout>( pipelineLayout ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Sampler>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Sampler const & sampler ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSampler>{}( static_cast<VkSampler>( sampler ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorPool const & descriptorPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorPool>{}( static_cast<VkDescriptorPool>( descriptorPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorSet>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorSet const & descriptorSet ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorSet>{}( static_cast<VkDescriptorSet>( descriptorSet ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorSetLayout>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::DescriptorSetLayout const & descriptorSetLayout ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorSetLayout>{}( static_cast<VkDescriptorSetLayout>( descriptorSetLayout ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::Framebuffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::Framebuffer const & framebuffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkFramebuffer>{}( static_cast<VkFramebuffer>( framebuffer ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::RenderPass>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::RenderPass const & renderPass ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkRenderPass>{}( static_cast<VkRenderPass>( renderPass ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CommandPool>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CommandPool const & commandPool ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCommandPool>{}( static_cast<VkCommandPool>( commandPool ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CommandBuffer>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CommandBuffer const & commandBuffer ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCommandBuffer>{}( static_cast<VkCommandBuffer>( commandBuffer ) );
}
};
//=== VK_VERSION_1_1 ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SamplerYcbcrConversion>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SamplerYcbcrConversion const & samplerYcbcrConversion ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSamplerYcbcrConversion>{}( static_cast<VkSamplerYcbcrConversion>( samplerYcbcrConversion ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DescriptorUpdateTemplate>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DescriptorUpdateTemplate const & descriptorUpdateTemplate ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDescriptorUpdateTemplate>{}(
static_cast<VkDescriptorUpdateTemplate>( descriptorUpdateTemplate ) );
}
};
//=== VK_KHR_surface ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SurfaceKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SurfaceKHR const & surfaceKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSurfaceKHR>{}( static_cast<VkSurfaceKHR>( surfaceKHR ) );
}
};
//=== VK_KHR_swapchain ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::SwapchainKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::SwapchainKHR const & swapchainKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkSwapchainKHR>{}( static_cast<VkSwapchainKHR>( swapchainKHR ) );
}
};
//=== VK_KHR_display ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DisplayKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DisplayKHR const & displayKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDisplayKHR>{}( static_cast<VkDisplayKHR>( displayKHR ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::DisplayModeKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DisplayModeKHR const & displayModeKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDisplayModeKHR>{}( static_cast<VkDisplayModeKHR>( displayModeKHR ) );
}
};
//=== VK_EXT_debug_report ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DebugReportCallbackEXT>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DebugReportCallbackEXT const & debugReportCallbackEXT ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDebugReportCallbackEXT>{}( static_cast<VkDebugReportCallbackEXT>( debugReportCallbackEXT ) );
}
};
#if defined( VK_ENABLE_BETA_EXTENSIONS )
//=== VK_KHR_video_queue ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::VideoSessionKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::VideoSessionKHR const & videoSessionKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkVideoSessionKHR>{}( static_cast<VkVideoSessionKHR>( videoSessionKHR ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::VideoSessionParametersKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::VideoSessionParametersKHR const & videoSessionParametersKHR ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkVideoSessionParametersKHR>{}(
static_cast<VkVideoSessionParametersKHR>( videoSessionParametersKHR ) );
}
};
#endif /*VK_ENABLE_BETA_EXTENSIONS*/
//=== VK_NVX_binary_import ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::CuModuleNVX>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CuModuleNVX const & cuModuleNVX ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCuModuleNVX>{}( static_cast<VkCuModuleNVX>( cuModuleNVX ) );
}
};
template <>
struct hash<VULKAN_HPP_NAMESPACE::CuFunctionNVX>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::CuFunctionNVX const & cuFunctionNVX ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkCuFunctionNVX>{}( static_cast<VkCuFunctionNVX>( cuFunctionNVX ) );
}
};
//=== VK_EXT_debug_utils ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DebugUtilsMessengerEXT>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::DebugUtilsMessengerEXT const & debugUtilsMessengerEXT ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDebugUtilsMessengerEXT>{}( static_cast<VkDebugUtilsMessengerEXT>( debugUtilsMessengerEXT ) );
}
};
//=== VK_KHR_acceleration_structure ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::AccelerationStructureKHR>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::AccelerationStructureKHR const & accelerationStructureKHR ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkAccelerationStructureKHR>{}(
static_cast<VkAccelerationStructureKHR>( accelerationStructureKHR ) );
}
};
//=== VK_EXT_validation_cache ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::ValidationCacheEXT>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::ValidationCacheEXT const & validationCacheEXT ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkValidationCacheEXT>{}( static_cast<VkValidationCacheEXT>( validationCacheEXT ) );
}
};
//=== VK_NV_ray_tracing ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::AccelerationStructureNV>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::AccelerationStructureNV const & accelerationStructureNV ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkAccelerationStructureNV>{}(
static_cast<VkAccelerationStructureNV>( accelerationStructureNV ) );
}
};
//=== VK_INTEL_performance_query ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::PerformanceConfigurationINTEL const & performanceConfigurationINTEL )
const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPerformanceConfigurationINTEL>{}(
static_cast<VkPerformanceConfigurationINTEL>( performanceConfigurationINTEL ) );
}
};
//=== VK_KHR_deferred_host_operations ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::DeferredOperationKHR>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::DeferredOperationKHR const & deferredOperationKHR ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkDeferredOperationKHR>{}( static_cast<VkDeferredOperationKHR>( deferredOperationKHR ) );
}
};
//=== VK_NV_device_generated_commands ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::IndirectCommandsLayoutNV>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::IndirectCommandsLayoutNV const & indirectCommandsLayoutNV ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkIndirectCommandsLayoutNV>{}(
static_cast<VkIndirectCommandsLayoutNV>( indirectCommandsLayoutNV ) );
}
};
//=== VK_EXT_private_data ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::PrivateDataSlotEXT>
{
std::size_t
operator()( VULKAN_HPP_NAMESPACE::PrivateDataSlotEXT const & privateDataSlotEXT ) const VULKAN_HPP_NOEXCEPT
{
return std::hash<VkPrivateDataSlotEXT>{}( static_cast<VkPrivateDataSlotEXT>( privateDataSlotEXT ) );
}
};
#if defined( VK_USE_PLATFORM_FUCHSIA )
//=== VK_FUCHSIA_buffer_collection ===
template <>
struct hash<VULKAN_HPP_NAMESPACE::BufferCollectionFUCHSIA>
{
std::size_t operator()( VULKAN_HPP_NAMESPACE::BufferCollectionFUCHSIA const & bufferCollectionFUCHSIA ) const
VULKAN_HPP_NOEXCEPT
{
return std::hash<VkBufferCollectionFUCHSIA>{}(
static_cast<VkBufferCollectionFUCHSIA>( bufferCollectionFUCHSIA ) );
}
};
#endif /*VK_USE_PLATFORM_FUCHSIA*/
} // namespace std
#endif #endif

View File

@ -82,7 +82,6 @@ namespace VULKAN_HPP_NAMESPACE
vkGetInstanceProcAddr( instance, "vkGetPhysicalDeviceQueueFamilyProperties" ) ); vkGetInstanceProcAddr( instance, "vkGetPhysicalDeviceQueueFamilyProperties" ) );
vkGetPhysicalDeviceMemoryProperties = PFN_vkGetPhysicalDeviceMemoryProperties( vkGetPhysicalDeviceMemoryProperties = PFN_vkGetPhysicalDeviceMemoryProperties(
vkGetInstanceProcAddr( instance, "vkGetPhysicalDeviceMemoryProperties" ) ); vkGetInstanceProcAddr( instance, "vkGetPhysicalDeviceMemoryProperties" ) );
vkGetInstanceProcAddr = PFN_vkGetInstanceProcAddr( vkGetInstanceProcAddr( instance, "vkGetInstanceProcAddr" ) );
vkCreateDevice = PFN_vkCreateDevice( vkGetInstanceProcAddr( instance, "vkCreateDevice" ) ); vkCreateDevice = PFN_vkCreateDevice( vkGetInstanceProcAddr( instance, "vkCreateDevice" ) );
vkEnumerateDeviceExtensionProperties = PFN_vkEnumerateDeviceExtensionProperties( vkEnumerateDeviceExtensionProperties = PFN_vkEnumerateDeviceExtensionProperties(
vkGetInstanceProcAddr( instance, "vkEnumerateDeviceExtensionProperties" ) ); vkGetInstanceProcAddr( instance, "vkEnumerateDeviceExtensionProperties" ) );
@ -5167,7 +5166,8 @@ namespace VULKAN_HPP_NAMESPACE
const VULKAN_HPP_NAMESPACE::DependencyInfoKHR & dependencyInfo ) const VULKAN_HPP_NOEXCEPT; const VULKAN_HPP_NAMESPACE::DependencyInfoKHR & dependencyInfo ) const VULKAN_HPP_NOEXCEPT;
void resetEvent2KHR( VULKAN_HPP_NAMESPACE::Event event, void resetEvent2KHR( VULKAN_HPP_NAMESPACE::Event event,
VULKAN_HPP_NAMESPACE::PipelineStageFlags2KHR stageMask ) const VULKAN_HPP_NOEXCEPT; VULKAN_HPP_NAMESPACE::PipelineStageFlags2KHR stageMask
VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
void waitEvents2KHR( ArrayProxy<const VULKAN_HPP_NAMESPACE::Event> const & events, void waitEvents2KHR( ArrayProxy<const VULKAN_HPP_NAMESPACE::Event> const & events,
ArrayProxy<const VULKAN_HPP_NAMESPACE::DependencyInfoKHR> const & dependencyInfos ) const ArrayProxy<const VULKAN_HPP_NAMESPACE::DependencyInfoKHR> const & dependencyInfos ) const

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
#!/usr/bin/python3 -i
#
# Copyright 2021 The Khronos Group Inc.
# SPDX-License-Identifier: Apache-2.0
# Generic alias for working group-specific API conventions interface.
# This import should be changed at the repository / working group level to
# specify the correct API's conventions.
from vkconventions import VulkanConventions as APIConventions

View File

@ -188,7 +188,7 @@ class COutputGenerator(OutputGenerator):
OutputGenerator.beginFeature(self, interface, emit) OutputGenerator.beginFeature(self, interface, emit)
# C-specific # C-specific
# Accumulate includes, defines, types, enums, function pointer typedefs, # Accumulate includes, defines, types, enums, function pointer typedefs,
# end function prototypes separately for this feature. They're only # end function prototypes separately for this feature. They are only
# printed in endFeature(). # printed in endFeature().
self.sections = {section: [] for section in self.ALL_SECTIONS} self.sections = {section: [] for section in self.ALL_SECTIONS}
self.feature_not_empty = False self.feature_not_empty = False
@ -267,7 +267,7 @@ class COutputGenerator(OutputGenerator):
else: else:
# Replace <apientry /> tags with an APIENTRY-style string # Replace <apientry /> tags with an APIENTRY-style string
# (from self.genOpts). Copy other text through unchanged. # (from self.genOpts). Copy other text through unchanged.
# If the resulting text is an empty string, don't emit it. # If the resulting text is an empty string, do not emit it.
body = noneStr(typeElem.text) body = noneStr(typeElem.text)
for elem in typeElem: for elem in typeElem:
if elem.tag == 'apientry': if elem.tag == 'apientry':
@ -306,8 +306,8 @@ class COutputGenerator(OutputGenerator):
def typeMayAlias(self, typeName): def typeMayAlias(self, typeName):
if not self.may_alias: if not self.may_alias:
# First time we've asked if a type may alias. # First time we have asked if a type may alias.
# So, let's populate the set of all names of types that may. # So, populate the set of all names of types that may.
# Everyone with an explicit mayalias="true" # Everyone with an explicit mayalias="true"
self.may_alias = set(typeName self.may_alias = set(typeName

View File

@ -139,9 +139,9 @@ class ConventionsBase:
Optionally adds a quantifier (like 'any') before a list of 2 or more, Optionally adds a quantifier (like 'any') before a list of 2 or more,
if specified by fmt. if specified by fmt.
Don't edit these defaults, override self.makeProseList(). Do not edit these defaults, override self.makeProseList().
""" """
assert(serial_comma) # didn't implement what we didn't need assert(serial_comma) # did not implement what we did not need
if isinstance(fmt, str): if isinstance(fmt, str):
fmt = ProseListFormats.from_string(fmt) fmt = ProseListFormats.from_string(fmt)

View File

@ -43,7 +43,10 @@ def enquote(s):
"""Return string argument with surrounding quotes, """Return string argument with surrounding quotes,
for serialization into Python code.""" for serialization into Python code."""
if s: if s:
if isinstance(s, str):
return "'{}'".format(s) return "'{}'".format(s)
else:
return s
return None return None
@ -119,8 +122,11 @@ class GeneratorOptions:
removeExtensions=None, removeExtensions=None,
emitExtensions=None, emitExtensions=None,
emitSpirv=None, emitSpirv=None,
emitFormats=None,
reparentEnums=True, reparentEnums=True,
sortProcedure=regSortFeatures): sortProcedure=regSortFeatures,
requireCommandAliases=False,
):
"""Constructor. """Constructor.
Arguments: Arguments:
@ -152,6 +158,8 @@ class GeneratorOptions:
to None. to None.
- emitSpirv - regex matching names of extensions and capabilities - emitSpirv - regex matching names of extensions and capabilities
to actually emit interfaces for. to actually emit interfaces for.
- emitFormats - regex matching names of formats to actually emit
interfaces for.
- reparentEnums - move <enum> elements which extend an enumerated - reparentEnums - move <enum> elements which extend an enumerated
type from <feature> or <extension> elements to the target <enums> type from <feature> or <extension> elements to the target <enums>
element. This is required for almost all purposes, but the element. This is required for almost all purposes, but the
@ -217,6 +225,10 @@ class GeneratorOptions:
"""regex matching names of extensions and capabilities """regex matching names of extensions and capabilities
to actually emit interfaces for.""" to actually emit interfaces for."""
self.emitFormats = self.emptyRegex(emitFormats)
"""regex matching names of formats
to actually emit interfaces for."""
self.reparentEnums = reparentEnums self.reparentEnums = reparentEnums
"""boolean specifying whether to remove <enum> elements from """boolean specifying whether to remove <enum> elements from
<feature> or <extension> when extending an <enums> type.""" <feature> or <extension> when extending an <enums> type."""
@ -230,6 +242,10 @@ class GeneratorOptions:
self.codeGenerator = False self.codeGenerator = False
"""True if this generator makes compilable code""" """True if this generator makes compilable code"""
self.requireCommandAliases = requireCommandAliases
"""True if alias= attributes of <command> tags are transitively
required."""
def emptyRegex(self, pat): def emptyRegex(self, pat):
"""Substitute a regular expression which matches no version """Substitute a regular expression which matches no version
or extension names for None or the empty string.""" or extension names for None or the empty string."""
@ -257,6 +273,17 @@ class OutputGenerator:
'basetype': 'basetypes', 'basetype': 'basetypes',
} }
def breakName(self, name, msg):
"""Break into debugger if this is a special name"""
# List of string names to break on
bad = (
)
if name in bad and True:
print('breakName {}: {}'.format(name, msg))
pdb.set_trace()
def __init__(self, errFile=sys.stderr, warnFile=sys.stderr, diagFile=sys.stdout): def __init__(self, errFile=sys.stderr, warnFile=sys.stderr, diagFile=sys.stdout):
"""Constructor """Constructor
@ -337,7 +364,7 @@ class OutputGenerator:
# print('About to translate value =', value, 'type =', type(value)) # print('About to translate value =', value, 'type =', type(value))
if needsNum: if needsNum:
numVal = int(value, 0) numVal = int(value, 0)
# If there's a non-integer, numeric 'type' attribute (e.g. 'u' or # If there is a non-integer, numeric 'type' attribute (e.g. 'u' or
# 'ull'), append it to the string value. # 'ull'), append it to the string value.
# t = enuminfo.elem.get('type') # t = enuminfo.elem.get('type')
# if t is not None and t != '' and t != 'i' and t != 's': # if t is not None and t != '' and t != 'i' and t != 's':
@ -418,7 +445,7 @@ class OutputGenerator:
+ ') found with different values:' + strVal + ') found with different values:' + strVal
+ ' and ' + strVal2) + ' and ' + strVal2)
# Don't add the duplicate to the returned list # Do not add the duplicate to the returned list
continue continue
elif numVal in valueMap: elif numVal in valueMap:
# Duplicate value found (such as an alias); report it, but # Duplicate value found (such as an alias); report it, but
@ -519,7 +546,7 @@ class OutputGenerator:
# Accumulate non-numeric enumerant values separately and append # Accumulate non-numeric enumerant values separately and append
# them following the numeric values, to allow for aliases. # them following the numeric values, to allow for aliases.
# NOTE: this doesn't do a topological sort yet, so aliases of # NOTE: this does not do a topological sort yet, so aliases of
# aliases can still get in the wrong order. # aliases can still get in the wrong order.
aliasText = '' aliasText = ''
@ -553,7 +580,7 @@ class OutputGenerator:
# Work around this by chasing the aliases to get the actual value. # Work around this by chasing the aliases to get the actual value.
while numVal is None: while numVal is None:
alias = self.registry.tree.find("enums/enum[@name='" + strVal + "']") alias = self.registry.tree.find("enums/enum[@name='" + strVal + "']")
(numVal, strVal) = self.enumToValue(alias, True) (numVal, strVal) = self.enumToValue(alias, True, bitwidth, True)
decl += "static const {} {} = {};\n".format(flagTypeName, name, strVal) decl += "static const {} {} = {};\n".format(flagTypeName, name, strVal)
if numVal is not None: if numVal is not None:
@ -612,7 +639,7 @@ class OutputGenerator:
# Accumulate non-numeric enumerant values separately and append # Accumulate non-numeric enumerant values separately and append
# them following the numeric values, to allow for aliases. # them following the numeric values, to allow for aliases.
# NOTE: this doesn't do a topological sort yet, so aliases of # NOTE: this does not do a topological sort yet, so aliases of
# aliases can still get in the wrong order. # aliases can still get in the wrong order.
aliasText = [] aliasText = []
@ -651,7 +678,7 @@ class OutputGenerator:
self.logMsg('error', 'Allowable range for C enum types is [', minValidValue, ',', maxValidValue, '], but', name, 'has a value outside of this (', strVal, ')\n') self.logMsg('error', 'Allowable range for C enum types is [', minValidValue, ',', maxValidValue, '], but', name, 'has a value outside of this (', strVal, ')\n')
exit(1) exit(1)
# Don't track min/max for non-numbers (numVal is None) # Do not track min/max for non-numbers (numVal is None)
if isEnum and numVal is not None and elem.get('extends') is None: if isEnum and numVal is not None and elem.get('extends') is None:
if minName is None: if minName is None:
minName = maxName = name minName = maxName = name
@ -674,7 +701,7 @@ class OutputGenerator:
" {}_RANGE_SIZE{} = ({} - {} + 1),".format(expandPrefix, expandSuffix, maxName, minName))) " {}_RANGE_SIZE{} = ({} - {} + 1),".format(expandPrefix, expandSuffix, maxName, minName)))
# Generate a range-padding value to ensure the enum is 32 bits, but # Generate a range-padding value to ensure the enum is 32 bits, but
# only in code generators, so it doesn't appear in documentation # only in code generators, so it does not appear in documentation
if (self.genOpts.codeGenerator or if (self.genOpts.codeGenerator or
self.conventions.generate_max_enum_in_docs): self.conventions.generate_max_enum_in_docs):
body.append(" {}_MAX_ENUM{} = 0x7FFFFFFF".format( body.append(" {}_MAX_ENUM{} = 0x7FFFFFFF".format(
@ -747,7 +774,7 @@ class OutputGenerator:
def beginFile(self, genOpts): def beginFile(self, genOpts):
"""Start a new interface file """Start a new interface file
- genOpts - GeneratorOptions controlling what's generated and how""" - genOpts - GeneratorOptions controlling what is generated and how"""
self.genOpts = genOpts self.genOpts = genOpts
self.should_insert_may_alias_macro = \ self.should_insert_may_alias_macro = \
self.genOpts.conventions.should_insert_may_alias_macro(self.genOpts) self.genOpts.conventions.should_insert_may_alias_macro(self.genOpts)
@ -778,7 +805,6 @@ class OutputGenerator:
self.warnFile.flush() self.warnFile.flush()
if self.diagFile: if self.diagFile:
self.diagFile.flush() self.diagFile.flush()
self.outFile.flush()
if self.outFile != sys.stdout and self.outFile != sys.stderr: if self.outFile != sys.stdout and self.outFile != sys.stderr:
self.outFile.close() self.outFile.close()
@ -800,7 +826,7 @@ class OutputGenerator:
- emit - actually write to the header only when True""" - emit - actually write to the header only when True"""
self.emit = emit self.emit = emit
self.featureName = interface.get('name') self.featureName = interface.get('name')
# If there's an additional 'protect' attribute in the feature, save it # If there is an additional 'protect' attribute in the feature, save it
self.featureExtraProtect = interface.get('protect') self.featureExtraProtect = interface.get('protect')
def endFeature(self): def endFeature(self):
@ -812,7 +838,7 @@ class OutputGenerator:
def genRequirements(self, name, mustBeFound = True): def genRequirements(self, name, mustBeFound = True):
"""Generate text showing what core versions and extensions introduce """Generate text showing what core versions and extensions introduce
an API. This exists in the base Generator class because it's used by an API. This exists in the base Generator class because it is used by
the shared enumerant-generating interfaces (buildEnumCDecl, etc.). the shared enumerant-generating interfaces (buildEnumCDecl, etc.).
Here it returns an empty string for most generators, but can be Here it returns an empty string for most generators, but can be
overridden by e.g. DocGenerator. overridden by e.g. DocGenerator.
@ -825,7 +851,7 @@ class OutputGenerator:
return '' return ''
def validateFeature(self, featureType, featureName): def validateFeature(self, featureType, featureName):
"""Validate we're generating something only inside a `<feature>` tag""" """Validate we are generating something only inside a `<feature>` tag"""
if self.featureName is None: if self.featureName is None:
raise UserWarning('Attempt to generate', featureType, raise UserWarning('Attempt to generate', featureType,
featureName, 'when not in feature') featureName, 'when not in feature')
@ -887,6 +913,14 @@ class OutputGenerator:
Extend to generate as desired in your derived class.""" Extend to generate as desired in your derived class."""
return return
def genFormat(self, format, formatinfo, alias):
"""Generate interface for a format element.
- formatinfo - FormatInfo
Extend to generate as desired in your derived class."""
return
def makeProtoName(self, name, tail): def makeProtoName(self, name, tail):
"""Turn a `<proto>` `<name>` into C-language prototype """Turn a `<proto>` `<name>` into C-language prototype
and typedef declarations for that name. and typedef declarations for that name.
@ -939,6 +973,9 @@ class OutputGenerator:
# Clear prefix for subsequent iterations # Clear prefix for subsequent iterations
prefix = '' prefix = ''
paramdecl = paramdecl + prefix
if aligncol == 0: if aligncol == 0:
# Squeeze out multiple spaces other than the indentation # Squeeze out multiple spaces other than the indentation
paramdecl = indent + ' '.join(paramdecl.split()) paramdecl = indent + ' '.join(paramdecl.split())
@ -1013,7 +1050,7 @@ class OutputGenerator:
return None return None
def isStructAlwaysValid(self, structname): def isStructAlwaysValid(self, structname):
"""Try to do check if a structure is always considered valid (i.e. there's no rules to its acceptance).""" """Try to do check if a structure is always considered valid (i.e. there is no rules to its acceptance)."""
# A conventions object is required for this call. # A conventions object is required for this call.
if not self.conventions: if not self.conventions:
raise RuntimeError("To use isStructAlwaysValid, be sure your options include a Conventions object.") raise RuntimeError("To use isStructAlwaysValid, be sure your options include a Conventions object.")
@ -1109,7 +1146,7 @@ class OutputGenerator:
# Leading text # Leading text
pdecl += noneStr(proto.text) pdecl += noneStr(proto.text)
tdecl += noneStr(proto.text) tdecl += noneStr(proto.text)
# For each child element, if it's a <name> wrap in appropriate # For each child element, if it is a <name> wrap in appropriate
# declaration. Otherwise append its contents and tail contents. # declaration. Otherwise append its contents and tail contents.
for elem in proto: for elem in proto:
text = noneStr(elem.text) text = noneStr(elem.text)

View File

@ -19,11 +19,13 @@ from interfacedocgenerator import InterfaceDocGenerator
from generator import write from generator import write
from spirvcapgenerator import SpirvCapabilityOutputGenerator from spirvcapgenerator import SpirvCapabilityOutputGenerator
from hostsyncgenerator import HostSynchronizationOutputGenerator from hostsyncgenerator import HostSynchronizationOutputGenerator
from formatsgenerator import FormatsOutputGenerator
from pygenerator import PyOutputGenerator from pygenerator import PyOutputGenerator
from rubygenerator import RubyOutputGenerator
from reflib import logDiag, logWarn, setLogFile from reflib import logDiag, logWarn, setLogFile
from reg import Registry from reg import Registry
from validitygenerator import ValidityOutputGenerator from validitygenerator import ValidityOutputGenerator
from vkconventions import VulkanConventions from apiconventions import APIConventions
# Simple timer functions # Simple timer functions
@ -77,6 +79,9 @@ def makeGenOpts(args):
# SPIR-V capabilities / features to emit (list of extensions & capabilities) # SPIR-V capabilities / features to emit (list of extensions & capabilities)
emitSpirv = args.emitSpirv emitSpirv = args.emitSpirv
# Vulkan Formats to emit
emitFormats = args.emitFormats
# Features to include (list of features) # Features to include (list of features)
features = args.feature features = args.feature
@ -97,13 +102,14 @@ def makeGenOpts(args):
# Descriptive names for various regexp patterns used to select # Descriptive names for various regexp patterns used to select
# versions and extensions # versions and extensions
allSpirv = allFeatures = allExtensions = r'.*' allFormats = allSpirv = allFeatures = allExtensions = r'.*'
# Turn lists of names/patterns into matching regular expressions # Turn lists of names/patterns into matching regular expressions
addExtensionsPat = makeREstring(extensions, None) addExtensionsPat = makeREstring(extensions, None)
removeExtensionsPat = makeREstring(removeExtensions, None) removeExtensionsPat = makeREstring(removeExtensions, None)
emitExtensionsPat = makeREstring(emitExtensions, allExtensions) emitExtensionsPat = makeREstring(emitExtensions, allExtensions)
emitSpirvPat = makeREstring(emitSpirv, allSpirv) emitSpirvPat = makeREstring(emitSpirv, allSpirv)
emitFormatsPat = makeREstring(emitFormats, allFormats)
featuresPat = makeREstring(features, allFeatures) featuresPat = makeREstring(features, allFeatures)
# Copyright text prefixing all headers (list of strings). # Copyright text prefixing all headers (list of strings).
@ -130,7 +136,9 @@ def makeGenOpts(args):
protectFile = protect protectFile = protect
# An API style conventions object # An API style conventions object
conventions = VulkanConventions() conventions = APIConventions()
defaultAPIName = conventions.xml_api_name
# API include files for spec and ref pages # API include files for spec and ref pages
# Overwrites include subdirectories in spec source tree # Overwrites include subdirectories in spec source tree
@ -146,7 +154,7 @@ def makeGenOpts(args):
filename = 'timeMarker', filename = 'timeMarker',
directory = directory, directory = directory,
genpath = genpath, genpath = genpath,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = featuresPat, emitversions = featuresPat,
@ -162,8 +170,8 @@ def makeGenOpts(args):
expandEnumerants = False) expandEnumerants = False)
] ]
# Python representation of API information, used by scripts that # Python and Ruby representations of API information, used by scripts
# don't need to load the full XML. # that do not need to load the full XML.
genOpts['api.py'] = [ genOpts['api.py'] = [
PyOutputGenerator, PyOutputGenerator,
DocGeneratorOptions( DocGeneratorOptions(
@ -171,7 +179,7 @@ def makeGenOpts(args):
filename = 'api.py', filename = 'api.py',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = featuresPat, emitversions = featuresPat,
@ -182,7 +190,30 @@ def makeGenOpts(args):
reparentEnums = False) reparentEnums = False)
] ]
genOpts['api.rb'] = [
RubyOutputGenerator,
DocGeneratorOptions(
conventions = conventions,
filename = 'api.rb',
directory = directory,
genpath = None,
apiname = defaultAPIName,
profile = None,
versions = featuresPat,
emitversions = featuresPat,
defaultExtensions = None,
addExtensions = addExtensionsPat,
removeExtensions = removeExtensionsPat,
emitExtensions = emitExtensionsPat,
reparentEnums = False)
]
# API validity files for spec # API validity files for spec
#
# requireCommandAliases is set to True because we need validity files
# for the command something is promoted to even when the promoted-to
# feature is not included. This avoids wordy includes of validity files.
genOpts['validinc'] = [ genOpts['validinc'] = [
ValidityOutputGenerator, ValidityOutputGenerator,
DocGeneratorOptions( DocGeneratorOptions(
@ -190,14 +221,16 @@ def makeGenOpts(args):
filename = 'timeMarker', filename = 'timeMarker',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = featuresPat, emitversions = featuresPat,
defaultExtensions = None, defaultExtensions = None,
addExtensions = addExtensionsPat, addExtensions = addExtensionsPat,
removeExtensions = removeExtensionsPat, removeExtensions = removeExtensionsPat,
emitExtensions = emitExtensionsPat) emitExtensions = emitExtensionsPat,
requireCommandAliases = True,
)
] ]
# API host sync table files for spec # API host sync table files for spec
@ -208,7 +241,7 @@ def makeGenOpts(args):
filename = 'timeMarker', filename = 'timeMarker',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = featuresPat, emitversions = featuresPat,
@ -230,7 +263,7 @@ def makeGenOpts(args):
filename = 'timeMarker', filename = 'timeMarker',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = None, emitversions = None,
@ -249,7 +282,7 @@ def makeGenOpts(args):
filename = 'timeMarker', filename = 'timeMarker',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = featuresPat, emitversions = featuresPat,
@ -267,7 +300,7 @@ def makeGenOpts(args):
filename = 'timeMarker', filename = 'timeMarker',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = featuresPat, emitversions = featuresPat,
@ -279,6 +312,26 @@ def makeGenOpts(args):
reparentEnums = False) reparentEnums = False)
] ]
# Used to generate various format chapter tables
genOpts['formatsinc'] = [
FormatsOutputGenerator,
DocGeneratorOptions(
conventions = conventions,
filename = 'timeMarker',
directory = directory,
genpath = None,
apiname = defaultAPIName,
profile = None,
versions = featuresPat,
emitversions = featuresPat,
defaultExtensions = None,
addExtensions = addExtensionsPat,
removeExtensions = removeExtensionsPat,
emitExtensions = emitExtensionsPat,
emitFormats = emitFormatsPat,
reparentEnums = False)
]
# Platform extensions, in their own header files # Platform extensions, in their own header files
# Each element of the platforms[] array defines information for # Each element of the platforms[] array defines information for
# generating a single platform: # generating a single platform:
@ -307,6 +360,7 @@ def makeGenOpts(args):
'VK_EXT_video_decode_h264', 'VK_EXT_video_decode_h264',
'VK_EXT_video_decode_h265', 'VK_EXT_video_decode_h265',
'VK_EXT_video_encode_h264', 'VK_EXT_video_encode_h264',
'VK_EXT_video_encode_h265',
] ]
betaSuppressExtensions = [] betaSuppressExtensions = []
@ -314,10 +368,13 @@ def makeGenOpts(args):
platforms = [ platforms = [
[ 'vulkan_android.h', [ 'VK_KHR_android_surface', [ 'vulkan_android.h', [ 'VK_KHR_android_surface',
'VK_ANDROID_external_memory_android_hardware_buffer' 'VK_ANDROID_external_memory_android_hardware_buffer'
], commonSuppressExtensions ], ], commonSuppressExtensions +
[ 'VK_KHR_format_feature_flags2',
] ],
[ 'vulkan_fuchsia.h', [ 'VK_FUCHSIA_imagepipe_surface', [ 'vulkan_fuchsia.h', [ 'VK_FUCHSIA_imagepipe_surface',
'VK_FUCHSIA_external_memory', 'VK_FUCHSIA_external_memory',
'VK_FUCHSIA_external_semaphore' ], commonSuppressExtensions ], 'VK_FUCHSIA_external_semaphore',
'VK_FUCHSIA_buffer_collection' ], commonSuppressExtensions ],
[ 'vulkan_ggp.h', [ 'VK_GGP_stream_descriptor_surface', [ 'vulkan_ggp.h', [ 'VK_GGP_stream_descriptor_surface',
'VK_GGP_frame_token' ], commonSuppressExtensions ], 'VK_GGP_frame_token' ], commonSuppressExtensions ],
[ 'vulkan_ios.h', [ 'VK_MVK_ios_surface' ], commonSuppressExtensions ], [ 'vulkan_ios.h', [ 'VK_MVK_ios_surface' ], commonSuppressExtensions ],
@ -357,7 +414,7 @@ def makeGenOpts(args):
filename = headername, filename = headername,
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = None, emitversions = None,
@ -398,7 +455,7 @@ def makeGenOpts(args):
filename = 'vulkan_core.h', filename = 'vulkan_core.h',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = featuresPat, emitversions = featuresPat,
@ -432,7 +489,7 @@ def makeGenOpts(args):
filename = 'vulkan10.h', filename = 'vulkan10.h',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = 'VK_VERSION_1_0', versions = 'VK_VERSION_1_0',
emitversions = 'VK_VERSION_1_0', emitversions = 'VK_VERSION_1_0',
@ -466,7 +523,7 @@ def makeGenOpts(args):
filename = 'vulkan11.h', filename = 'vulkan11.h',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = '^VK_VERSION_1_[01]$', versions = '^VK_VERSION_1_[01]$',
emitversions = '^VK_VERSION_1_[01]$', emitversions = '^VK_VERSION_1_[01]$',
@ -495,7 +552,7 @@ def makeGenOpts(args):
filename = 'alias.h', filename = 'alias.h',
directory = directory, directory = directory,
genpath = None, genpath = None,
apiname = 'vulkan', apiname = defaultAPIName,
profile = None, profile = None,
versions = featuresPat, versions = featuresPat,
emitversions = featuresPat, emitversions = featuresPat,
@ -546,6 +603,8 @@ def genTarget(args):
logDiag('* options.addExtensions =', options.addExtensions) logDiag('* options.addExtensions =', options.addExtensions)
logDiag('* options.removeExtensions =', options.removeExtensions) logDiag('* options.removeExtensions =', options.removeExtensions)
logDiag('* options.emitExtensions =', options.emitExtensions) logDiag('* options.emitExtensions =', options.emitExtensions)
logDiag('* options.emitSpirv =', options.emitSpirv)
logDiag('* options.emitFormats =', options.emitFormats)
gen = createGenerator(errFile=errWarn, gen = createGenerator(errFile=errWarn,
warnFile=errWarn, warnFile=errWarn,
@ -564,7 +623,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-defaultExtensions', action='store', parser.add_argument('-defaultExtensions', action='store',
default='vulkan', default=APIConventions().xml_api_name,
help='Specify a single class of extensions to add to targets') help='Specify a single class of extensions to add to targets')
parser.add_argument('-extension', action='append', parser.add_argument('-extension', action='append',
default=[], default=[],
@ -578,6 +637,9 @@ if __name__ == '__main__':
parser.add_argument('-emitSpirv', action='append', parser.add_argument('-emitSpirv', action='append',
default=[], default=[],
help='Specify a SPIR-V extension or capability to emit in targets') help='Specify a SPIR-V extension or capability to emit in targets')
parser.add_argument('-emitFormats', action='append',
default=[],
help='Specify Vulkan Formats to emit in targets')
parser.add_argument('-feature', action='append', parser.add_argument('-feature', action='append',
default=[], default=[],
help='Specify a core API feature name or names to add to targets') help='Specify a core API feature name or names to add to targets')
@ -601,7 +663,7 @@ if __name__ == '__main__':
parser.add_argument('-time', action='store_true', parser.add_argument('-time', action='store_true',
help='Enable timing') help='Enable timing')
parser.add_argument('-validate', action='store_true', parser.add_argument('-validate', action='store_true',
help='Enable XML group validation') help='Validate the registry properties and exit')
parser.add_argument('-genpath', action='store', default='gen', parser.add_argument('-genpath', action='store', default='gen',
help='Path to generated files') help='Path to generated files')
parser.add_argument('-o', action='store', dest='directory', parser.add_argument('-o', action='store', dest='directory',
@ -635,6 +697,12 @@ if __name__ == '__main__':
else: else:
diag = None diag = None
if args.time:
# Log diagnostics and warnings
setLogFile(setDiag = True, setWarn = True, filename = '-')
(gen, options) = (None, None)
if not args.validate:
# Create the API generator & generator options # Create the API generator & generator options
(gen, options) = genTarget(args) (gen, options) = genTarget(args)
@ -653,7 +721,8 @@ if __name__ == '__main__':
endTimer(args.time, '* Time to parse ElementTree =') endTimer(args.time, '* Time to parse ElementTree =')
if args.validate: if args.validate:
reg.validateGroups() success = reg.validateRegistry()
sys.exit(0 if success else 1)
if args.dump: if args.dump:
logDiag('* Dumping registry to regdump.txt') logDiag('* Dumping registry to regdump.txt')

View File

@ -10,19 +10,24 @@ import copy
import re import re
import sys import sys
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
from collections import defaultdict, namedtuple from collections import defaultdict, deque, namedtuple
from generator import OutputGenerator, GeneratorOptions, write from generator import OutputGenerator, GeneratorOptions, write
import pdb from apiconventions import APIConventions
def apiNameMatch(str, supported): def apiNameMatch(str, supported):
"""Return whether a required api name matches a pattern specified for an """Return whether a required api name matches a pattern specified for an
XML <feature> 'api' attribute or <extension> 'supported' attribute. XML <feature> 'api' attribute or <extension> 'supported' attribute.
- str - api name such as 'vulkan' or 'openxr' - str - API name such as 'vulkan' or 'openxr'. May be None, in which
- supported - comma-separated list of XML API names""" case it never matches (this should not happen).
- supported - comma-separated list of XML API names. May be None, in
which case str always matches (this is the usual case)."""
return (str is not None and str in supported.split(',')) if str is not None:
return supported is None or str in supported.split(',')
# Fallthrough case - either str is None or the test failed
return False
def matchAPIProfile(api, profile, elem): def matchAPIProfile(api, profile, elem):
"""Return whether an API and profile """Return whether an API and profile
@ -52,7 +57,7 @@ def matchAPIProfile(api, profile, elem):
--------- -------- --------- --------
None None Always matches None None Always matches
'string' None Always matches 'string' None Always matches
None 'string' Does not match. Can't generate multiple APIs None 'string' Does not match. Cannot generate multiple APIs
or profiles, so if an API/profile constraint or profiles, so if an API/profile constraint
is present, it must be asked for explicitly. is present, it must be asked for explicitly.
'string' 'string' Strings must match 'string' 'string' Strings must match
@ -60,7 +65,7 @@ def matchAPIProfile(api, profile, elem):
** In the future, we will allow regexes for the attributes, ** In the future, we will allow regexes for the attributes,
not just strings, so that `api="^(gl|gles2)"` will match. Even not just strings, so that `api="^(gl|gles2)"` will match. Even
this isn't really quite enough, we might prefer something this is not really quite enough, we might prefer something
like `"gl(core)|gles1(common-lite)"`.""" like `"gl(core)|gles1(common-lite)"`."""
# Match 'api', if present # Match 'api', if present
elem_api = elem.get('api') elem_api = elem.get('api')
@ -69,7 +74,7 @@ def matchAPIProfile(api, profile, elem):
raise UserWarning("No API requested, but 'api' attribute is present with value '" raise UserWarning("No API requested, but 'api' attribute is present with value '"
+ elem_api + "'") + elem_api + "'")
elif api != elem_api: elif api != elem_api:
# Requested API doesn't match attribute # Requested API does not match attribute
return False return False
elem_profile = elem.get('profile') elem_profile = elem.get('profile')
if elem_profile: if elem_profile:
@ -77,11 +82,37 @@ def matchAPIProfile(api, profile, elem):
raise UserWarning("No profile requested, but 'profile' attribute is present with value '" raise UserWarning("No profile requested, but 'profile' attribute is present with value '"
+ elem_profile + "'") + elem_profile + "'")
elif profile != elem_profile: elif profile != elem_profile:
# Requested profile doesn't match attribute # Requested profile does not match attribute
return False return False
return True return True
def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True):
"""Remove tree Elements with 'api' attributes matching apiName.
tree - Element at the root of the hierarchy to strip. Only its
children can actually be removed, not the tree itself.
apiName - string which much match a command-separated component of
the 'api' attribute.
actuallyDelete - only delete matching elements if True."""
stack = deque()
stack.append(tree)
while len(stack) > 0:
parent = stack.pop()
for child in parent.findall('*'):
api = child.get('api')
if api:
if not apiNameMatch(apiName, api):
if actuallyDelete:
parent.remove(child)
else:
# Add child to the queue
stack.append(child)
class BaseInfo: class BaseInfo:
"""Base class for information about a registry feature """Base class for information about a registry feature
(type/group/enum/command/API/extension). (type/group/enum/command/API/extension).
@ -128,12 +159,12 @@ class BaseInfo:
if (self.compareKeys(info, 'value', required = True) or if (self.compareKeys(info, 'value', required = True) or
self.compareKeys(info, 'bitpos', required = True)): self.compareKeys(info, 'bitpos', required = True)):
# If both specify the same value or bit position, # If both specify the same value or bit position,
# they're equal # they are equal
return True return True
elif (self.compareKeys(info, 'extnumber') and elif (self.compareKeys(info, 'extnumber') and
self.compareKeys(info, 'offset') and self.compareKeys(info, 'offset') and
self.compareKeys(info, 'dir')): self.compareKeys(info, 'dir')):
# If both specify the same relative offset, they're equal # If both specify the same relative offset, they are equal
return True return True
elif (self.compareKeys(info, 'alias')): elif (self.compareKeys(info, 'alias')):
# If both are aliases of the same value # If both are aliases of the same value
@ -141,7 +172,7 @@ class BaseInfo:
else: else:
return False return False
else: else:
# The same enum can't extend two different types # The same enum cannot extend two different types
return False return False
else: else:
# Non-<enum>s should never be redefined # Non-<enum>s should never be redefined
@ -248,7 +279,7 @@ class FeatureInfo(BaseInfo):
enumerant offsets. <feature> features do not have extension enumerant offsets. <feature> features do not have extension
numbers and are assigned number 0.""" numbers and are assigned number 0."""
# If there's no 'number' attribute, use 0, so sorting works # If there is no 'number' attribute, use 0, so sorting works
if self.number is None: if self.number is None:
self.number = 0 self.number = 0
self.supported = elem.get('supported') self.supported = elem.get('supported')
@ -260,6 +291,12 @@ class SpirvInfo(BaseInfo):
def __init__(self, elem): def __init__(self, elem):
BaseInfo.__init__(self, elem) BaseInfo.__init__(self, elem)
class FormatInfo(BaseInfo):
"""Registry information about an API <format>."""
def __init__(self, elem):
BaseInfo.__init__(self, elem)
class Registry: class Registry:
"""Object representing an API registry, loaded from an XML file.""" """Object representing an API registry, loaded from an XML file."""
@ -272,7 +309,9 @@ class Registry:
"Output generator used to write headers / messages" "Output generator used to write headers / messages"
if genOpts is None: if genOpts is None:
self.genOpts = GeneratorOptions() # If no generator is provided, we may still need the XML API name
# (for example, in genRef.py).
self.genOpts = GeneratorOptions(apiname = APIConventions().xml_api_name)
else: else:
self.genOpts = genOpts self.genOpts = genOpts
"Options controlling features to write and how to format them" "Options controlling features to write and how to format them"
@ -311,6 +350,9 @@ class Registry:
self.spirvcapdict = {} self.spirvcapdict = {}
"dictionary of FeatureInfo objects for `<spirvcapability>` elements keyed by spirv capability name" "dictionary of FeatureInfo objects for `<spirvcapability>` elements keyed by spirv capability name"
self.formatsdict = {}
"dictionary of FeatureInfo objects for `<format>` elements keyed by VkFormat name"
self.emitFeatures = False self.emitFeatures = False
"""True to actually emit features for a version / extension, """True to actually emit features for a version / extension,
or False to just treat them as emitted""" or False to just treat them as emitted"""
@ -356,10 +398,10 @@ class Registry:
Intended for internal use only. Intended for internal use only.
- elem - `<type>`/`<enums>`/`<enum>`/`<command>`/`<feature>`/`<extension>`/`<spirvextension>`/`<spirvcapability>` Element - 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}Info object
- infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' / 'spirvextension' / 'spirvcapability' - infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' / 'spirvextension' / 'spirvcapability' / 'format'
- dictionary - self.{type|group|enum|cmd|api|ext|spirvext|spirvcap}dict - dictionary - self.{type|group|enum|cmd|api|ext|format|spirvext|spirvcap}dict
If the Element has an 'api' attribute, the dictionary key is the 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 tuple (name,api). If not, the key is the name. 'name' is an
@ -408,15 +450,26 @@ class Registry:
# This must be the Element for the root <registry> # This must be the Element for the root <registry>
self.reg = self.tree.getroot() self.reg = self.tree.getroot()
# Preprocess the tree by removing all elements with non-matching
# 'api' attributes by breadth-first tree traversal.
# This is a blunt hammer, but eliminates the need to track and test
# the apis deeper in processing to select the correct elements and
# avoid duplicates.
# Schema validation should prevent duplicate elements with
# overlapping api attributes, or where one element has an api
# attribute and the other does not.
stripNonmatchingAPIs(self.reg, self.genOpts.apiname)
# Create dictionary of registry types from toplevel <types> tags # Create dictionary of registry types from toplevel <types> tags
# and add 'name' attribute to each <type> tag (where missing) # and add 'name' attribute to each <type> tag (where missing)
# based on its <name> element. # based on its <name> element.
# #
# There's usually one <types> block; more are OK # There is usually one <types> block; more are OK
# Required <type> attributes: 'name' or nested <name> tag contents # Required <type> attributes: 'name' or nested <name> tag contents
self.typedict = {} self.typedict = {}
for type_elem in self.reg.findall('types/type'): for type_elem in self.reg.findall('types/type'):
# If the <type> doesn't already have a 'name' attribute, set # If the <type> does not already have a 'name' attribute, set
# it from contents of its <name> tag. # it from contents of its <name> tag.
if type_elem.get('name') is None: if type_elem.get('name') is None:
type_elem.set('name', type_elem.find('name').text) type_elem.set('name', type_elem.find('name').text)
@ -425,8 +478,8 @@ class Registry:
# Create dictionary of registry enum groups from <enums> tags. # Create dictionary of registry enum groups from <enums> tags.
# #
# Required <enums> attributes: 'name'. If no name is given, one is # Required <enums> attributes: 'name'. If no name is given, one is
# generated, but that group can't be identified and turned into an # generated, but that group cannot be identified and turned into an
# enum type definition - it's just a container for <enum> tags. # enum type definition - it is just a container for <enum> tags.
self.groupdict = {} self.groupdict = {}
for group in self.reg.findall('enums'): for group in self.reg.findall('enums'):
self.addElementInfo(group, GroupInfo(group), 'group', self.groupdict) self.addElementInfo(group, GroupInfo(group), 'group', self.groupdict)
@ -452,7 +505,7 @@ class Registry:
# and add 'name' attribute to each <command> tag (where missing) # and add 'name' attribute to each <command> tag (where missing)
# based on its <proto><name> element. # based on its <proto><name> element.
# #
# There's usually only one <commands> block; more are OK. # There is usually only one <commands> block; more are OK.
# Required <command> attributes: 'name' or <proto><name> tag contents # Required <command> attributes: 'name' or <proto><name> tag contents
self.cmddict = {} self.cmddict = {}
# List of commands which alias others. Contains # List of commands which alias others. Contains
@ -460,7 +513,7 @@ class Registry:
# for each alias # for each alias
cmdAlias = [] cmdAlias = []
for cmd in self.reg.findall('commands/command'): for cmd in self.reg.findall('commands/command'):
# If the <command> doesn't already have a 'name' attribute, set # If the <command> does not already have a 'name' attribute, set
# it from contents of its <proto><name> tag. # it from contents of its <proto><name> tag.
name = cmd.get('name') name = cmd.get('name')
if name is None: if name is None:
@ -507,11 +560,11 @@ class Registry:
# Instead, generateRequiredInterface ignores <enum> elements # Instead, generateRequiredInterface ignores <enum> elements
# that extend enumerated types. # that extend enumerated types.
# #
# For <enum> tags which are actually just constants, if there's # For <enum> tags which are actually just constants, if there is
# no 'extends' tag but there is a 'value' or 'bitpos' tag, just # no 'extends' tag but there is a 'value' or 'bitpos' tag, just
# add an EnumInfo record to the dictionary. That works because # add an EnumInfo record to the dictionary. That works because
# output generation of constants is purely dependency-based, and # output generation of constants is purely dependency-based, and
# doesn't need to iterate through the XML tags. # does not need to iterate through the XML tags.
for elem in feature.findall('require'): for elem in feature.findall('require'):
for enum in elem.findall('enum'): for enum in elem.findall('enum'):
addEnumInfo = False addEnumInfo = False
@ -599,7 +652,7 @@ class Registry:
for parent in parentStructs.split(','): for parent in parentStructs.split(','):
# self.gen.logMsg('diag', type.get('name'), 'extends', parent) # self.gen.logMsg('diag', type.get('name'), 'extends', parent)
self.validextensionstructs[parent].append(type_elem.get('name')) self.validextensionstructs[parent].append(type_elem.get('name'))
# Sort the lists so they don't depend on the XML order # Sort the lists so they do not depend on the XML order
for parent in self.validextensionstructs: for parent in self.validextensionstructs:
self.validextensionstructs[parent].sort() self.validextensionstructs[parent].sort()
@ -612,6 +665,10 @@ class Registry:
spirvInfo = SpirvInfo(spirv) spirvInfo = SpirvInfo(spirv)
self.addElementInfo(spirv, spirvInfo, 'spirvcapability', self.spirvcapdict) self.addElementInfo(spirv, spirvInfo, 'spirvcapability', self.spirvcapdict)
for format in self.reg.findall('formats/format'):
formatInfo = FormatInfo(format)
self.addElementInfo(format, formatInfo, 'format', self.formatsdict)
def dumpReg(self, maxlen=120, filehandle=sys.stdout): def dumpReg(self, maxlen=120, filehandle=sys.stdout):
"""Dump all the dictionaries constructed from the Registry object. """Dump all the dictionaries constructed from the Registry object.
@ -651,6 +708,10 @@ class Registry:
for key in self.spirvcapdict: for key in self.spirvcapdict:
write(' SPIR-V Capability', key, '->', write(' SPIR-V Capability', key, '->',
etree.tostring(self.spirvcapdict[key].elem)[0:maxlen], file=filehandle) etree.tostring(self.spirvcapdict[key].elem)[0:maxlen], file=filehandle)
write('// VkFormat', file=filehandle)
for key in self.formatsdict:
write(' VkFormat', key, '->',
etree.tostring(self.formatsdict[key].elem)[0:maxlen], file=filehandle)
def markTypeRequired(self, typename, required): def markTypeRequired(self, typename, required):
"""Require (along with its dependencies) or remove (but not its dependencies) a type. """Require (along with its dependencies) or remove (but not its dependencies) a type.
@ -671,7 +732,7 @@ class Registry:
if depname: if depname:
self.gen.logMsg('diag', 'Generating dependent type', self.gen.logMsg('diag', 'Generating dependent type',
depname, 'for', attrib_name, 'type', typename) depname, 'for', attrib_name, 'type', typename)
# Don't recurse on self-referential structures. # Do not recurse on self-referential structures.
if typename != depname: if typename != depname:
self.markTypeRequired(depname, required) self.markTypeRequired(depname, required)
else: else:
@ -718,10 +779,10 @@ class Registry:
if enum is not None: if enum is not None:
# If the enum is part of a group, and is being removed, then # 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 # look it up in that <group> tag and remove it there, so that it
# isn't visible to generators (which traverse the <group> tag # is not visible to generators (which traverse the <group> tag
# elements themselves). # elements themselves).
# This isn't the most robust way of doing this, since a removed # This is not the most robust way of doing this, since a removed
# enum that's later required again will no longer have a group # enum that is later required again will no longer have a group
# element, but it makes the change non-intrusive on generator # element, but it makes the change non-intrusive on generator
# code. # code.
if required is False: if required is False:
@ -762,12 +823,23 @@ class Registry:
cmd = self.lookupElementInfo(cmdname, self.cmddict) cmd = self.lookupElementInfo(cmdname, self.cmddict)
if cmd is not None: if cmd is not None:
cmd.required = required cmd.required = required
# Tag command dependencies in 'alias' attribute as required # Tag command dependencies in 'alias' attribute as required
#
# This is usually not done, because command 'aliases' are not
# actual C language aliases like type and enum aliases. Instead
# they are just duplicates of the function signature of the
# alias. This means that there is no dependency of a command
# alias on what it aliases. One exception is validity includes,
# where the spec markup needs the promoted-to validity include
# even if only the promoted-from command is being built.
if self.genOpts.requireCommandAliases:
depname = cmd.elem.get('alias') depname = cmd.elem.get('alias')
if depname: if depname:
self.gen.logMsg('diag', 'Generating dependent command', self.gen.logMsg('diag', 'Generating dependent command',
depname, 'for alias', cmdname) depname, 'for alias', cmdname)
self.markCmdRequired(depname, required) self.markCmdRequired(depname, required)
# Tag all parameter types of this command as 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. # tag, because many other commands may use the same type.
@ -792,7 +864,7 @@ class Registry:
# Loop over types, enums, and commands in the tag # Loop over types, enums, and commands in the tag
# @@ It would be possible to respect 'api' and 'profile' attributes # @@ It would be possible to respect 'api' and 'profile' attributes
# in individual features, but that's not done yet. # in individual features, but that is not done yet.
for typeElem in feature.findall('type'): for typeElem in feature.findall('type'):
self.markTypeRequired(typeElem.get('name'), required) self.markTypeRequired(typeElem.get('name'), required)
for enumElem in feature.findall('enum'): for enumElem in feature.findall('enum'):
@ -842,8 +914,13 @@ class Registry:
- require - `<require>` block from the registry - require - `<require>` block from the registry
- tag - tag to look for in the require block""" - tag - tag to look for in the require block"""
if alias and require.findall(tag + "[@name='" + alias + "']"): # For the time being, the code below is bypassed. It has the effect
return True # of excluding "spelling aliases" created to comply with the style
# guide, but this leaves references out of the specification and
# causes broken internal links.
#
# if alias and require.findall(tag + "[@name='" + alias + "']"):
# return True
return False return False
@ -887,7 +964,7 @@ class Registry:
typeinfo = self.lookupElementInfo(typename, self.typedict) typeinfo = self.lookupElementInfo(typename, self.typedict)
if typeinfo: if typeinfo:
# Remove aliases in the same extension/feature; these are always added as a correction. Don't need the original to be visible. # Remove aliases in the same extension/feature; these are always added as a correction. Do not need the original to be visible.
alias = self.getAlias(typeElem, self.typedict) alias = self.getAlias(typeElem, self.typedict)
if not self.checkForCorrectionAliases(alias, require, 'type'): if not self.checkForCorrectionAliases(alias, require, 'type'):
# Resolve the type info to the actual type, so we get an accurate read for 'structextends' # Resolve the type info to the actual type, so we get an accurate read for 'structextends'
@ -902,12 +979,15 @@ class Registry:
if not typeextends in self.gen.featureDictionary[featurename][typecat][required_key]: if not typeextends in self.gen.featureDictionary[featurename][typecat][required_key]:
self.gen.featureDictionary[featurename][typecat][required_key][typeextends] = [] self.gen.featureDictionary[featurename][typecat][required_key][typeextends] = []
self.gen.featureDictionary[featurename][typecat][required_key][typeextends].append(typename) self.gen.featureDictionary[featurename][typecat][required_key][typeextends].append(typename)
else:
self.gen.logMsg('warn', 'fillFeatureDictionary: NOT filling for {}'.format(typename))
for enumElem in require.findall('enum'): for enumElem in require.findall('enum'):
enumname = enumElem.get('name') enumname = enumElem.get('name')
typeinfo = self.lookupElementInfo(enumname, self.enumdict) typeinfo = self.lookupElementInfo(enumname, self.enumdict)
# Remove aliases in the same extension/feature; these are always added as a correction. Don't need the original to be visible. # Remove aliases in the same extension/feature; these are always added as a correction. Do not need the original to be visible.
alias = self.getAlias(enumElem, self.enumdict) alias = self.getAlias(enumElem, self.enumdict)
if not self.checkForCorrectionAliases(alias, require, 'enum'): if not self.checkForCorrectionAliases(alias, require, 'enum'):
enumextends = enumElem.get('extends') enumextends = enumElem.get('extends')
@ -916,16 +996,18 @@ class Registry:
if not enumextends in self.gen.featureDictionary[featurename]['enumconstant'][required_key]: if not enumextends in self.gen.featureDictionary[featurename]['enumconstant'][required_key]:
self.gen.featureDictionary[featurename]['enumconstant'][required_key][enumextends] = [] self.gen.featureDictionary[featurename]['enumconstant'][required_key][enumextends] = []
self.gen.featureDictionary[featurename]['enumconstant'][required_key][enumextends].append(enumname) self.gen.featureDictionary[featurename]['enumconstant'][required_key][enumextends].append(enumname)
else:
self.gen.logMsg('warn', 'fillFeatureDictionary: NOT filling for {}'.format(typename))
for cmdElem in require.findall('command'): for cmdElem in require.findall('command'):
# Remove aliases in the same extension/feature; these are always added as a correction. Do not need the original to be visible.
# Remove aliases in the same extension/feature; these are always added as a correction. Don't need the original to be visible.
alias = self.getAlias(cmdElem, self.cmddict) alias = self.getAlias(cmdElem, self.cmddict)
if not self.checkForCorrectionAliases(alias, require, 'command'): if not self.checkForCorrectionAliases(alias, require, 'command'):
if not required_key in self.gen.featureDictionary[featurename]['command']: if not required_key in self.gen.featureDictionary[featurename]['command']:
self.gen.featureDictionary[featurename]['command'][required_key] = [] self.gen.featureDictionary[featurename]['command'][required_key] = []
self.gen.featureDictionary[featurename]['command'][required_key].append(cmdElem.get('name')) self.gen.featureDictionary[featurename]['command'][required_key].append(cmdElem.get('name'))
else:
self.gen.logMsg('warn', 'fillFeatureDictionary: NOT filling for {}'.format(typename))
def requireAndRemoveFeatures(self, interface, featurename, api, profile): def requireAndRemoveFeatures(self, interface, featurename, api, profile):
"""Process `<require>` and `<remove>` tags for a `<version>` or `<extension>`. """Process `<require>` and `<remove>` tags for a `<version>` or `<extension>`.
@ -935,10 +1017,12 @@ class Registry:
- featurename - name of the feature - featurename - name of the feature
- api - string specifying API name being generated - api - string specifying API name being generated
- profile - string specifying API profile being generated""" - profile - string specifying API profile being generated"""
# <require> marks things that are required by this version/profile # <require> marks things that are required by this version/profile
for feature in interface.findall('require'): for feature in interface.findall('require'):
if matchAPIProfile(api, profile, feature): if matchAPIProfile(api, profile, feature):
self.markRequired(featurename, feature, True) self.markRequired(featurename, feature, True)
# <remove> marks things that are removed by this version/profile # <remove> marks things that are removed by this version/profile
for feature in interface.findall('remove'): for feature in interface.findall('remove'):
if matchAPIProfile(api, profile, feature): if matchAPIProfile(api, profile, feature):
@ -979,7 +1063,7 @@ class Registry:
'returning!') 'returning!')
return return
# If feature isn't required, or has already been declared, return # If feature is not required, or has already been declared, return
if not f.required: if not f.required:
self.gen.logMsg('diag', 'Skipping', ftype, fname, '(not required)') self.gen.logMsg('diag', 'Skipping', ftype, fname, '(not required)')
return return
@ -1056,7 +1140,7 @@ class Registry:
# @ The enum group is not ready for generation. At this # @ The enum group is not ready for generation. At this
# @ point, it contains all <enum> tags injected by # @ point, it contains all <enum> tags injected by
# @ <extension> tags without any verification of whether # @ <extension> tags without any verification of whether
# @ they're required or not. It may also contain # @ they are required or not. It may also contain
# @ duplicates injected by multiple consistent # @ duplicates injected by multiple consistent
# @ definitions of an <enum>. # @ definitions of an <enum>.
@ -1094,7 +1178,7 @@ class Registry:
if required: if required:
# Mark this element as required (in the element, not the EnumInfo) # Mark this element as required (in the element, not the EnumInfo)
elem.set('required', 'true') elem.set('required', 'true')
# If it's an alias, track that for later use # If it is an alias, track that for later use
enumAlias = elem.get('alias') enumAlias = elem.get('alias')
if enumAlias: if enumAlias:
enumAliases.append(enumAlias) enumAliases.append(enumAlias)
@ -1145,7 +1229,7 @@ class Registry:
for t in features.findall('type'): for t in features.findall('type'):
self.generateFeature(t.get('name'), 'type', self.typedict) self.generateFeature(t.get('name'), 'type', self.typedict)
for e in features.findall('enum'): for e in features.findall('enum'):
# If this is an enum extending an enumerated type, don't # If this is an enum extending an enumerated type, do not
# generate it - this has already been done in reg.parseTree, # generate it - this has already been done in reg.parseTree,
# by copying this element into the enumerated type. # by copying this element into the enumerated type.
enumextends = e.get('extends') enumextends = e.get('extends')
@ -1167,6 +1251,45 @@ class Registry:
genProc = self.gen.genSpirv genProc = self.gen.genSpirv
genProc(spirv, name, alias) genProc(spirv, name, alias)
def stripUnsupportedAPIs(self, dictionary, attribute, supportedDictionary):
"""Strip unsupported APIs from attributes of APIs.
dictionary - *Info dictionary of APIs to be updated
attribute - attribute name to look for in each API
supportedDictionary - dictionary in which to look for supported
API elements in the attribute"""
for key in dictionary:
eleminfo = dictionary[key]
attribstring = eleminfo.elem.get(attribute)
if attribstring is not None:
apis = []
stripped = False
for api in attribstring.split(','):
##print('Checking API {} referenced by {}'.format(api, key))
if supportedDictionary[api].required:
apis.append(api)
else:
stripped = True
##print('\t**STRIPPING API {} from {}'.format(api, key))
# Update the attribute after stripping stuff.
# Could sort apis before joining, but it is not a clear win
if stripped:
eleminfo.elem.set(attribute, ','.join(apis))
def generateFormat(self, format, dictionary):
if format is None:
self.gen.logMsg('diag', 'No entry found for format element',
'returning!')
return
name = format.elem.get('name')
# No known alias for VkFormat elements
alias = None
if format.emit:
genProc = self.gen.genFormat
genProc(format, name, alias)
def apiGen(self): def apiGen(self):
"""Generate interface for specified versions using the current """Generate interface for specified versions using the current
generator and generator options""" generator and generator options"""
@ -1177,8 +1300,13 @@ class Registry:
'profile:', self.genOpts.profile) 'profile:', self.genOpts.profile)
self.gen.logMsg('diag', '*******************************************') self.gen.logMsg('diag', '*******************************************')
# Reset required/declared flags for all features # Could reset required/declared flags for all features here.
self.apiReset() # This has been removed as never used. The initial motivation was
# the idea of calling apiGen() repeatedly for different targets, but
# this has never been done. The 20% or so build-time speedup that
# might result is not worth the effort to make it actually work.
#
# self.apiReset()
# Compile regexps used to select versions & extensions # Compile regexps used to select versions & extensions
regVersions = re.compile(self.genOpts.versions) regVersions = re.compile(self.genOpts.versions)
@ -1187,6 +1315,7 @@ class Registry:
regRemoveExtensions = re.compile(self.genOpts.removeExtensions) regRemoveExtensions = re.compile(self.genOpts.removeExtensions)
regEmitExtensions = re.compile(self.genOpts.emitExtensions) regEmitExtensions = re.compile(self.genOpts.emitExtensions)
regEmitSpirv = re.compile(self.genOpts.emitSpirv) regEmitSpirv = re.compile(self.genOpts.emitSpirv)
regEmitFormats = re.compile(self.genOpts.emitFormats)
# Get all matching API feature names & add to list of FeatureInfo # Get all matching API feature names & add to list of FeatureInfo
# Note we used to select on feature version attributes, not names. # Note we used to select on feature version attributes, not names.
@ -1242,7 +1371,7 @@ class Registry:
# Include additional extensions if the extension name matches # Include additional extensions if the extension name matches
# the regexp specified in the generator options. This allows # the regexp specified in the generator options. This allows
# forcing extensions into an interface even if they're not # forcing extensions into an interface even if they are not
# tagged appropriately in the registry. # 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 regAddExtensions.match(extName) is not None:
@ -1256,7 +1385,7 @@ class Registry:
include = True include = True
# Remove extensions if the name matches the regexp specified # Remove extensions if the name matches the regexp specified
# in generator options. This allows forcing removal of # in generator options. This allows forcing removal of
# extensions from an interface even if they're tagged that # extensions from an interface even if they are tagged that
# way in the registry. # way in the registry.
if regRemoveExtensions.match(extName) is not None: if regRemoveExtensions.match(extName) is not None:
self.gen.logMsg('diag', 'Removing extension', self.gen.logMsg('diag', 'Removing extension',
@ -1274,8 +1403,8 @@ class Registry:
'for emission (does not match emitextensions pattern)') 'for emission (does not match emitextensions pattern)')
# Hack - can be removed when validity generator goes away # Hack - can be removed when validity generator goes away
# (Jon) I'm not sure what this does, or if it should respect # (Jon) I am not sure what this does, or if it should
# the ei.emit flag above. # respect the ei.emit flag above.
self.requiredextensions.append(extName) self.requiredextensions.append(extName)
else: else:
self.gen.logMsg('diag', 'NOT including extension', self.gen.logMsg('diag', 'NOT including extension',
@ -1295,6 +1424,12 @@ class Registry:
si.emit = (regEmitSpirv.match(key) is not None) si.emit = (regEmitSpirv.match(key) is not None)
spirvcaps.append(si) spirvcaps.append(si)
formats = []
for key in self.formatsdict:
si = self.formatsdict[key]
si.emit = (regEmitFormats.match(key) is not None)
formats.append(si)
# Sort the features list, if a sort procedure is defined # Sort the features list, if a sort procedure is defined
if self.genOpts.sortProcedure: if self.genOpts.sortProcedure:
self.genOpts.sortProcedure(features) self.genOpts.sortProcedure(features)
@ -1316,8 +1451,23 @@ class Registry:
self.requireAndRemoveFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile) self.requireAndRemoveFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
self.assignAdditionalValidity(f.elem, self.genOpts.apiname, self.genOpts.profile) self.assignAdditionalValidity(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
# Enums in <command> 'successcodes' and 'errorcodes' attributes
self.stripUnsupportedAPIs(self.typedict, 'structextends', self.typedict)
self.stripUnsupportedAPIs(self.cmddict, 'successcodes', self.enumdict)
self.stripUnsupportedAPIs(self.cmddict, 'errorcodes', self.enumdict)
# @@May need to strip <spirvcapability> / <spirvextension> <enable>
# tags of these forms:
# <enable version="VK_API_VERSION_1_0"/>
# <enable struct="VkPhysicalDeviceFeatures" feature="geometryShader" requires="VK_VERSION_1_0"/>
# <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 2: loop over specified API versions and extensions printing
# declarations for required things which haven't already been # declarations for required things which have not already been
# generated. # generated.
self.gen.logMsg('diag', 'PASS 2: GENERATE INTERFACES FOR FEATURES') self.gen.logMsg('diag', 'PASS 2: GENERATE INTERFACES FOR FEATURES')
self.gen.beginFile(self.genOpts) self.gen.beginFile(self.genOpts)
@ -1329,7 +1479,7 @@ class Registry:
self.gen.logMsg('diag', 'PASS 2: NOT declaring feature', self.gen.logMsg('diag', 'PASS 2: NOT declaring feature',
f.elem.get('name'), 'because it is not tagged for emission') f.elem.get('name'), 'because it is not tagged for emission')
# Generate the interface (or just tag its elements as having been # Generate the interface (or just tag its elements as having been
# emitted, if they haven't been). # emitted, if they have not been).
self.gen.beginFeature(f.elem, emit) self.gen.beginFeature(f.elem, emit)
self.generateRequiredInterface(f.elem) self.generateRequiredInterface(f.elem)
self.gen.endFeature() self.gen.endFeature()
@ -1338,6 +1488,8 @@ class Registry:
self.generateSpirv(s, self.spirvextdict) self.generateSpirv(s, self.spirvextdict)
for s in spirvcaps: for s in spirvcaps:
self.generateSpirv(s, self.spirvcapdict) self.generateSpirv(s, self.spirvcapdict)
for s in formats:
self.generateFormat(s, self.formatsdict)
self.gen.endFile() self.gen.endFile()
def apiReset(self): def apiReset(self):
@ -1353,39 +1505,44 @@ class Registry:
for cmd in self.apidict: for cmd in self.apidict:
self.apidict[cmd].resetState() self.apidict[cmd].resetState()
def validateGroups(self): def __validateStructLimittypes(self, struct):
"""Validate `group=` attributes on `<param>` and `<proto>` tags. """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
Check that `group=` attributes match actual groups""" def __validateLimittype(self):
# Keep track of group names not in <group> tags """Validate 'limittype' attributes."""
badGroup = {} badFields = self.__validateStructLimittypes(self.typedict['VkPhysicalDeviceProperties2'])
self.gen.logMsg('diag', 'VALIDATING GROUP ATTRIBUTES') for featStructName in self.validextensionstructs['VkPhysicalDeviceProperties2']:
for cmd in self.reg.findall('commands/command'): featStruct = self.typedict[featStructName]
proto = cmd.find('proto') badFields.update(self.__validateStructLimittypes(featStruct))
# funcname = cmd.find('proto/name').text
group = proto.get('group')
if group is not None and group not in self.groupdict:
# self.gen.logMsg('diag', '*** Command ', funcname, ' has UNKNOWN return group ', group)
if group not in badGroup:
badGroup[group] = 1
else:
badGroup[group] = badGroup[group] + 1
for param in cmd.findall('param'): if badFields:
pname = param.find('name') self.gen.logMsg('diag', 'SUMMARY OF FIELDS WITH INCORRECT LIMITTYPES')
if pname is not None: for key in sorted(badFields.keys()):
pname = pname.text diags = badFields[key]
else: if diags.missing:
pname = param.get('name') self.gen.logMsg('diag', ' ', key, 'missing limittype:', ', '.join(badFields[key].missing))
group = param.get('group') if diags.invalid:
if group is not None and group not in self.groupdict: self.gen.logMsg('diag', ' ', key, 'invalid limittype:', ', '.join(badFields[key].invalid))
# self.gen.logMsg('diag', '*** Command ', funcname, ' param ', pname, ' has UNKNOWN group ', group) return False
if group not in badGroup: return True
badGroup[group] = 1
else:
badGroup[group] = badGroup[group] + 1
if badGroup: def validateRegistry(self):
self.gen.logMsg('diag', 'SUMMARY OF UNRECOGNIZED GROUPS') """Validate properties of the registry."""
for key in sorted(badGroup.keys()): return self.__validateLimittype()
self.gen.logMsg('diag', ' ', key, ' occurred ', badGroup[key], ' times')

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@ SPECIAL_WORDS = set((
'Int64', # VkPhysicalDeviceShaderAtomicInt64FeaturesKHR 'Int64', # VkPhysicalDeviceShaderAtomicInt64FeaturesKHR
'Int8', # VkPhysicalDeviceShaderFloat16Int8FeaturesKHR 'Int8', # VkPhysicalDeviceShaderFloat16Int8FeaturesKHR
'MacOS', # VkMacOSSurfaceCreateInfoMVK 'MacOS', # VkMacOSSurfaceCreateInfoMVK
'RGBA10X6', # VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT
'Uint8', # VkPhysicalDeviceIndexTypeUint8FeaturesEXT 'Uint8', # VkPhysicalDeviceIndexTypeUint8FeaturesEXT
'Win32', # VkWin32SurfaceCreateInfoKHR 'Win32', # VkWin32SurfaceCreateInfoKHR
)) ))
@ -168,7 +169,7 @@ class VulkanConventions(ConventionsBase):
def specURL(self, spectype='api'): def specURL(self, spectype='api'):
"""Return public registry URL which ref pages should link to for the """Return public registry URL which ref pages should link to for the
current all-extensions HTML specification, so xrefs in the current all-extensions HTML specification, so xrefs in the
asciidoc source that aren't to ref pages can link into it asciidoc source that are not to ref pages can link into it
instead. N.b. this may need to change on a per-refpage basis if instead. N.b. this may need to change on a per-refpage basis if
there are multiple documents involved. there are multiple documents involved.
""" """
@ -208,7 +209,7 @@ class VulkanConventions(ConventionsBase):
@property @property
def unified_flag_refpages(self): def unified_flag_refpages(self):
"""Return True if Flags/FlagBits refpages are unified, False if """Return True if Flags/FlagBits refpages are unified, False if
they're separate. they are separate.
""" """
return False return False
@ -231,7 +232,8 @@ class VulkanConventions(ConventionsBase):
def category_requires_validation(self, category): def category_requires_validation(self, category):
"""Return True if the given type 'category' always requires validation. """Return True if the given type 'category' always requires validation.
Overridden because Vulkan doesn't require "valid" text for basetype in the spec right now.""" Overridden because Vulkan does not require "valid" text for basetype
in the spec right now."""
return category in CATEGORIES_REQUIRING_VALIDATION return category in CATEGORIES_REQUIRING_VALIDATION
@property @property

View File

@ -605,7 +605,11 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
.flags = 0, .flags = 0,
.topology = input_assembly_topology, .topology = input_assembly_topology,
.primitiveRestartEnable = key.state.primitive_restart_enable != 0 && .primitiveRestartEnable = key.state.primitive_restart_enable != 0 &&
SupportsPrimitiveRestart(input_assembly_topology), ((input_assembly_topology != VK_PRIMITIVE_TOPOLOGY_PATCH_LIST &&
device.IsTopologyListPrimitiveRestartSupported()) ||
SupportsPrimitiveRestart(input_assembly_topology) ||
(input_assembly_topology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST &&
device.IsPatchListPrimitiveRestartSupported())),
}; };
const VkPipelineTessellationStateCreateInfo tessellation_ci{ const VkPipelineTessellationStateCreateInfo tessellation_ci{
.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO,
@ -613,7 +617,6 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
.flags = 0, .flags = 0,
.patchControlPoints = key.state.patch_control_points_minus_one.Value() + 1, .patchControlPoints = key.state.patch_control_points_minus_one.Value() + 1,
}; };
std::array<VkViewportSwizzleNV, Maxwell::NumViewports> swizzles; std::array<VkViewportSwizzleNV, Maxwell::NumViewports> swizzles;
std::ranges::transform(key.state.viewport_swizzles, swizzles.begin(), UnpackViewportSwizzle); std::ranges::transform(key.state.viewport_swizzles, swizzles.begin(), UnpackViewportSwizzle);
const VkPipelineViewportSwizzleStateCreateInfoNV swizzle_ci{ const VkPipelineViewportSwizzleStateCreateInfoNV swizzle_ci{
@ -748,8 +751,8 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.logicOpEnable = VK_FALSE, .logicOpEnable = key.state.logic_op_enable != 0,
.logicOp = VK_LOGIC_OP_COPY, .logicOp = static_cast<VkLogicOp>(key.state.logic_op.Value()),
.attachmentCount = static_cast<u32>(cb_attachments.size()), .attachmentCount = static_cast<u32>(cb_attachments.size()),
.pAttachments = cb_attachments.data(), .pAttachments = cb_attachments.data(),
.blendConstants = {}, .blendConstants = {},

View File

@ -271,7 +271,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
.tessellationShader = true, .tessellationShader = true,
.sampleRateShading = true, .sampleRateShading = true,
.dualSrcBlend = true, .dualSrcBlend = true,
.logicOp = false, .logicOp = true,
.multiDrawIndirect = false, .multiDrawIndirect = false,
.drawIndirectFirstInstance = false, .drawIndirectFirstInstance = false,
.depthClamp = true, .depthClamp = true,
@ -433,6 +433,19 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
LOG_INFO(Render_Vulkan, "Device doesn't support uint8 indexes"); LOG_INFO(Render_Vulkan, "Device doesn't support uint8 indexes");
} }
VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT primitive_topology_list_restart;
if (is_topology_list_restart_supported || is_patch_list_restart_supported) {
primitive_topology_list_restart = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT,
.pNext = nullptr,
.primitiveTopologyListRestart = is_topology_list_restart_supported,
.primitiveTopologyPatchListRestart = is_patch_list_restart_supported,
};
SetNext(next, primitive_topology_list_restart);
} else {
LOG_INFO(Render_Vulkan, "Device doesn't support list topology primitive restart");
}
VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback; VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback;
if (ext_transform_feedback) { if (ext_transform_feedback) {
transform_feedback = { transform_feedback = {
@ -891,6 +904,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
bool has_ext_provoking_vertex{}; bool has_ext_provoking_vertex{};
bool has_ext_vertex_input_dynamic_state{}; bool has_ext_vertex_input_dynamic_state{};
bool has_ext_line_rasterization{}; bool has_ext_line_rasterization{};
bool has_ext_primitive_topology_list_restart{};
for (const std::string& extension : supported_extensions) { for (const std::string& extension : supported_extensions) {
const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name, const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name,
bool push) { bool push) {
@ -915,6 +929,8 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
test(has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, false); test(has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, false);
test(ext_depth_range_unrestricted, VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME, true); test(ext_depth_range_unrestricted, VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME, true);
test(ext_index_type_uint8, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME, true); test(ext_index_type_uint8, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME, true);
test(has_ext_primitive_topology_list_restart,
VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME, true);
test(ext_sampler_filter_minmax, VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, true); test(ext_sampler_filter_minmax, VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, true);
test(ext_shader_viewport_index_layer, VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME, test(ext_shader_viewport_index_layer, VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME,
true); true);
@ -1113,6 +1129,19 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
khr_pipeline_executable_properties = true; khr_pipeline_executable_properties = true;
} }
} }
if (has_ext_primitive_topology_list_restart) {
VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT primitive_topology_list_restart{};
primitive_topology_list_restart.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT;
primitive_topology_list_restart.pNext = nullptr;
features.pNext = &primitive_topology_list_restart;
physical.GetFeatures2KHR(features);
is_topology_list_restart_supported =
primitive_topology_list_restart.primitiveTopologyListRestart;
is_patch_list_restart_supported =
primitive_topology_list_restart.primitiveTopologyPatchListRestart;
}
if (has_khr_image_format_list && has_khr_swapchain_mutable_format) { if (has_khr_image_format_list && has_khr_swapchain_mutable_format) {
extensions.push_back(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME); extensions.push_back(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
extensions.push_back(VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME); extensions.push_back(VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME);

View File

@ -238,6 +238,16 @@ public:
return khr_workgroup_memory_explicit_layout; return khr_workgroup_memory_explicit_layout;
} }
/// Returns true if the device supports VK_EXT_primitive_topology_list_restart.
bool IsTopologyListPrimitiveRestartSupported() const {
return is_topology_list_restart_supported;
}
/// Returns true if the device supports VK_EXT_primitive_topology_list_restart.
bool IsPatchListPrimitiveRestartSupported() const {
return is_patch_list_restart_supported;
}
/// Returns true if the device supports VK_EXT_index_type_uint8. /// Returns true if the device supports VK_EXT_index_type_uint8.
bool IsExtIndexTypeUint8Supported() const { bool IsExtIndexTypeUint8Supported() const {
return ext_index_type_uint8; return ext_index_type_uint8;
@ -401,6 +411,9 @@ private:
bool is_shader_int16_supported{}; ///< Support for int16. bool is_shader_int16_supported{}; ///< Support for int16.
bool is_shader_storage_image_multisample{}; ///< Support for image operations on MSAA images. bool is_shader_storage_image_multisample{}; ///< Support for image operations on MSAA images.
bool is_blit_depth_stencil_supported{}; ///< Support for blitting from and to depth stencil. bool is_blit_depth_stencil_supported{}; ///< Support for blitting from and to depth stencil.
bool is_topology_list_restart_supported{}; ///< Support for primitive restart with list
///< topologies.
bool is_patch_list_restart_supported{}; ///< Support for primitive restart with list patch.
bool nv_viewport_swizzle{}; ///< Support for VK_NV_viewport_swizzle. bool nv_viewport_swizzle{}; ///< Support for VK_NV_viewport_swizzle.
bool nv_viewport_array2{}; ///< Support for VK_NV_viewport_array2. bool nv_viewport_array2{}; ///< Support for VK_NV_viewport_array2.
bool nv_geometry_shader_passthrough{}; ///< Support for VK_NV_geometry_shader_passthrough. bool nv_geometry_shader_passthrough{}; ///< Support for VK_NV_geometry_shader_passthrough.