Update Vulkan-Headers to 1.3.244 (#697)

* Update Vulkan-Headers to 1.3.239

* Update Vulkan-Headers to 1.3.240

* Upgrade to `bindgen 0.63` and `vk-parse 0.9`

Updates cause no semantic changes in usage nor generated output.

* generator: Support new `deprecated` attribute

* Update Vulkan-Headers to 1.3.241

* generator: Emit `#[deprecated]` annotation for type members (struct fields)

* Update Vulkan-Headers to 1.3.242

* Update Vulkan-Headers to 1.3.243

* Update Vulkan-Headers to 1.3.244
This commit is contained in:
Marijn Suijten 2023-04-02 22:48:17 +02:00
parent 5d130cb97d
commit e7cfe26dcb
No known key found for this signature in database
GPG key ID: 449FC1DE031665DA
12 changed files with 2359 additions and 1142 deletions

View file

@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] - ReleaseDate ## [Unreleased] - ReleaseDate
### Added
- Update Vulkan-Headers to 1.3.244 (#697)
## [0.37.2] - 2022-01-11 ## [0.37.2] - 2022-01-11
### Added ### Added

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ash" name = "ash"
version = "0.37.2+1.3.238" version = "0.37.2+1.3.244"
authors = [ authors = [
"Maik Klein <maikklein@googlemail.com>", "Maik Klein <maikklein@googlemail.com>",
"Benjamin Saunders <ben.e.saunders@gmail.com>", "Benjamin Saunders <ben.e.saunders@gmail.com>",

View file

@ -1280,13 +1280,23 @@ impl VideoEncodeCapabilityFlagsKHR {
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeFeedbackFlagBitsKHR.html>"]
pub struct VideoEncodeFeedbackFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeFeedbackFlagsKHR, Flags);
impl VideoEncodeFeedbackFlagsKHR {
pub const BITSTREAM_BUFFER_OFFSET: Self = Self(0b1);
pub const BITSTREAM_BYTES_WRITTEN: Self = Self(0b10);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeRateControlModeFlagBitsKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeRateControlModeFlagBitsKHR.html>"]
pub struct VideoEncodeRateControlModeFlagsKHR(pub(crate) Flags); pub struct VideoEncodeRateControlModeFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeRateControlModeFlagsKHR, Flags); vk_bitflags_wrapped!(VideoEncodeRateControlModeFlagsKHR, Flags);
impl VideoEncodeRateControlModeFlagsKHR { impl VideoEncodeRateControlModeFlagsKHR {
pub const NONE: Self = Self(0); pub const DEFAULT: Self = Self(0);
pub const CBR: Self = Self(1); pub const DISABLED: Self = Self(0b1);
pub const VBR: Self = Self(2); pub const CBR: Self = Self(0b10);
pub const VBR: Self = Self(0b100);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -1319,26 +1329,7 @@ impl VideoEncodeH264CapabilityFlagsEXT {
pub const ROW_UNALIGNED_SLICE: Self = Self(0b100_0000_0000_0000_0000_0000); pub const ROW_UNALIGNED_SLICE: Self = Self(0b100_0000_0000_0000_0000_0000);
pub const DIFFERENT_SLICE_TYPE: Self = Self(0b1000_0000_0000_0000_0000_0000); pub const DIFFERENT_SLICE_TYPE: Self = Self(0b1000_0000_0000_0000_0000_0000);
pub const B_FRAME_IN_L1_LIST: Self = Self(0b1_0000_0000_0000_0000_0000_0000); pub const B_FRAME_IN_L1_LIST: Self = Self(0b1_0000_0000_0000_0000_0000_0000);
} pub const DIFFERENT_REFERENCE_FINAL_LISTS: Self = Self(0b10_0000_0000_0000_0000_0000_0000);
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH264InputModeFlagBitsEXT.html>"]
pub struct VideoEncodeH264InputModeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH264InputModeFlagsEXT, Flags);
impl VideoEncodeH264InputModeFlagsEXT {
pub const FRAME: Self = Self(0b1);
pub const SLICE: Self = Self(0b10);
pub const NON_VCL: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH264OutputModeFlagBitsEXT.html>"]
pub struct VideoEncodeH264OutputModeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH264OutputModeFlagsEXT, Flags);
impl VideoEncodeH264OutputModeFlagsEXT {
pub const FRAME: Self = Self(0b1);
pub const SLICE: Self = Self(0b10);
pub const NON_VCL: Self = Self(0b100);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -1474,26 +1465,7 @@ impl VideoEncodeH265CapabilityFlagsEXT {
pub const DEPENDENT_SLICE_SEGMENT: Self = Self(0b1000_0000_0000_0000_0000_0000); pub const DEPENDENT_SLICE_SEGMENT: Self = Self(0b1000_0000_0000_0000_0000_0000);
pub const DIFFERENT_SLICE_TYPE: Self = Self(0b1_0000_0000_0000_0000_0000_0000); pub const DIFFERENT_SLICE_TYPE: Self = Self(0b1_0000_0000_0000_0000_0000_0000);
pub const B_FRAME_IN_L1_LIST: Self = Self(0b10_0000_0000_0000_0000_0000_0000); pub const B_FRAME_IN_L1_LIST: Self = Self(0b10_0000_0000_0000_0000_0000_0000);
} pub const DIFFERENT_REFERENCE_FINAL_LISTS: Self = Self(0b100_0000_0000_0000_0000_0000_0000);
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH265InputModeFlagBitsEXT.html>"]
pub struct VideoEncodeH265InputModeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH265InputModeFlagsEXT, Flags);
impl VideoEncodeH265InputModeFlagsEXT {
pub const FRAME: Self = Self(0b1);
pub const SLICE_SEGMENT: Self = Self(0b10);
pub const NON_VCL: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH265OutputModeFlagBitsEXT.html>"]
pub struct VideoEncodeH265OutputModeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH265OutputModeFlagsEXT, Flags);
impl VideoEncodeH265OutputModeFlagsEXT {
pub const FRAME: Self = Self(0b1);
pub const SLICE_SEGMENT: Self = Self(0b10);
pub const NON_VCL: Self = Self(0b100);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]

View file

@ -1204,6 +1204,10 @@ impl fmt::Debug for DescriptorSetLayoutCreateFlags {
DescriptorSetLayoutCreateFlags::HOST_ONLY_POOL_EXT.0, DescriptorSetLayoutCreateFlags::HOST_ONLY_POOL_EXT.0,
"HOST_ONLY_POOL_EXT", "HOST_ONLY_POOL_EXT",
), ),
(
DescriptorSetLayoutCreateFlags::RESERVED_6_EXT.0,
"RESERVED_6_EXT",
),
( (
DescriptorSetLayoutCreateFlags::UPDATE_AFTER_BIND_POOL.0, DescriptorSetLayoutCreateFlags::UPDATE_AFTER_BIND_POOL.0,
"UPDATE_AFTER_BIND_POOL", "UPDATE_AFTER_BIND_POOL",
@ -1525,6 +1529,7 @@ impl fmt::Debug for DriverId {
Self::MESA_VENUS => Some("MESA_VENUS"), Self::MESA_VENUS => Some("MESA_VENUS"),
Self::MESA_DOZEN => Some("MESA_DOZEN"), Self::MESA_DOZEN => Some("MESA_DOZEN"),
Self::MESA_NVK => Some("MESA_NVK"), Self::MESA_NVK => Some("MESA_NVK"),
Self::IMAGINATION_OPEN_SOURCE_MESA => Some("IMAGINATION_OPEN_SOURCE_MESA"),
_ => None, _ => None,
}; };
if let Some(x) = name { if let Some(x) = name {
@ -1548,12 +1553,15 @@ impl fmt::Debug for DynamicState {
Self::STENCIL_REFERENCE => Some("STENCIL_REFERENCE"), Self::STENCIL_REFERENCE => Some("STENCIL_REFERENCE"),
Self::VIEWPORT_W_SCALING_NV => Some("VIEWPORT_W_SCALING_NV"), Self::VIEWPORT_W_SCALING_NV => Some("VIEWPORT_W_SCALING_NV"),
Self::DISCARD_RECTANGLE_EXT => Some("DISCARD_RECTANGLE_EXT"), Self::DISCARD_RECTANGLE_EXT => Some("DISCARD_RECTANGLE_EXT"),
Self::DISCARD_RECTANGLE_ENABLE_EXT => Some("DISCARD_RECTANGLE_ENABLE_EXT"),
Self::DISCARD_RECTANGLE_MODE_EXT => Some("DISCARD_RECTANGLE_MODE_EXT"),
Self::SAMPLE_LOCATIONS_EXT => Some("SAMPLE_LOCATIONS_EXT"), Self::SAMPLE_LOCATIONS_EXT => Some("SAMPLE_LOCATIONS_EXT"),
Self::RAY_TRACING_PIPELINE_STACK_SIZE_KHR => { Self::RAY_TRACING_PIPELINE_STACK_SIZE_KHR => {
Some("RAY_TRACING_PIPELINE_STACK_SIZE_KHR") Some("RAY_TRACING_PIPELINE_STACK_SIZE_KHR")
} }
Self::VIEWPORT_SHADING_RATE_PALETTE_NV => Some("VIEWPORT_SHADING_RATE_PALETTE_NV"), Self::VIEWPORT_SHADING_RATE_PALETTE_NV => Some("VIEWPORT_SHADING_RATE_PALETTE_NV"),
Self::VIEWPORT_COARSE_SAMPLE_ORDER_NV => Some("VIEWPORT_COARSE_SAMPLE_ORDER_NV"), Self::VIEWPORT_COARSE_SAMPLE_ORDER_NV => Some("VIEWPORT_COARSE_SAMPLE_ORDER_NV"),
Self::EXCLUSIVE_SCISSOR_ENABLE_NV => Some("EXCLUSIVE_SCISSOR_ENABLE_NV"),
Self::EXCLUSIVE_SCISSOR_NV => Some("EXCLUSIVE_SCISSOR_NV"), Self::EXCLUSIVE_SCISSOR_NV => Some("EXCLUSIVE_SCISSOR_NV"),
Self::FRAGMENT_SHADING_RATE_KHR => Some("FRAGMENT_SHADING_RATE_KHR"), Self::FRAGMENT_SHADING_RATE_KHR => Some("FRAGMENT_SHADING_RATE_KHR"),
Self::LINE_STIPPLE_EXT => Some("LINE_STIPPLE_EXT"), Self::LINE_STIPPLE_EXT => Some("LINE_STIPPLE_EXT"),
@ -1680,14 +1688,6 @@ impl fmt::Debug for ExternalFenceHandleTypeFlags {
"OPAQUE_WIN32_KMT", "OPAQUE_WIN32_KMT",
), ),
(ExternalFenceHandleTypeFlags::SYNC_FD.0, "SYNC_FD"), (ExternalFenceHandleTypeFlags::SYNC_FD.0, "SYNC_FD"),
(
ExternalFenceHandleTypeFlags::RESERVED_4_NV.0,
"RESERVED_4_NV",
),
(
ExternalFenceHandleTypeFlags::RESERVED_5_NV.0,
"RESERVED_5_NV",
),
]; ];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
@ -1764,10 +1764,6 @@ impl fmt::Debug for ExternalMemoryHandleTypeFlags {
ExternalMemoryHandleTypeFlags::RDMA_ADDRESS_NV.0, ExternalMemoryHandleTypeFlags::RDMA_ADDRESS_NV.0,
"RDMA_ADDRESS_NV", "RDMA_ADDRESS_NV",
), ),
(
ExternalMemoryHandleTypeFlags::RESERVED_13_NV.0,
"RESERVED_13_NV",
),
]; ];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
@ -1825,10 +1821,6 @@ impl fmt::Debug for ExternalSemaphoreHandleTypeFlags {
ExternalSemaphoreHandleTypeFlags::ZIRCON_EVENT_FUCHSIA.0, ExternalSemaphoreHandleTypeFlags::ZIRCON_EVENT_FUCHSIA.0,
"ZIRCON_EVENT_FUCHSIA", "ZIRCON_EVENT_FUCHSIA",
), ),
(
ExternalSemaphoreHandleTypeFlags::RESERVED_5_NV.0,
"RESERVED_5_NV",
),
]; ];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
@ -2740,7 +2732,6 @@ impl fmt::Debug for ImageViewCreateFlags {
ImageViewCreateFlags::FRAGMENT_DENSITY_MAP_DEFERRED_EXT.0, ImageViewCreateFlags::FRAGMENT_DENSITY_MAP_DEFERRED_EXT.0,
"FRAGMENT_DENSITY_MAP_DEFERRED_EXT", "FRAGMENT_DENSITY_MAP_DEFERRED_EXT",
), ),
(ImageViewCreateFlags::RESERVED_3_EXT.0, "RESERVED_3_EXT"),
]; ];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
@ -2925,7 +2916,6 @@ impl fmt::Debug for MemoryHeapFlags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[ const KNOWN: &[(Flags, &str)] = &[
(MemoryHeapFlags::DEVICE_LOCAL.0, "DEVICE_LOCAL"), (MemoryHeapFlags::DEVICE_LOCAL.0, "DEVICE_LOCAL"),
(MemoryHeapFlags::RESERVED_2_KHR.0, "RESERVED_2_KHR"),
(MemoryHeapFlags::MULTI_INSTANCE.0, "MULTI_INSTANCE"), (MemoryHeapFlags::MULTI_INSTANCE.0, "MULTI_INSTANCE"),
]; ];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
@ -2974,6 +2964,12 @@ impl fmt::Debug for MemoryPropertyFlags {
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
} }
impl fmt::Debug for MemoryUnmapFlagsKHR {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[];
debug_flags(f, KNOWN, self.0)
}
}
impl fmt::Debug for MetalSurfaceCreateFlagsEXT { impl fmt::Debug for MetalSurfaceCreateFlagsEXT {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[]; const KNOWN: &[(Flags, &str)] = &[];
@ -3307,14 +3303,10 @@ impl fmt::Debug for PipelineBindPoint {
} }
impl fmt::Debug for PipelineCacheCreateFlags { impl fmt::Debug for PipelineCacheCreateFlags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[ const KNOWN: &[(Flags, &str)] = &[(
(PipelineCacheCreateFlags::RESERVED_1_EXT.0, "RESERVED_1_EXT"), PipelineCacheCreateFlags::EXTERNALLY_SYNCHRONIZED.0,
(PipelineCacheCreateFlags::RESERVED_2_KHR.0, "RESERVED_2_KHR"), "EXTERNALLY_SYNCHRONIZED",
( )];
PipelineCacheCreateFlags::EXTERNALLY_SYNCHRONIZED.0,
"EXTERNALLY_SYNCHRONIZED",
),
];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
} }
@ -3800,8 +3792,8 @@ impl fmt::Debug for PipelineStageFlags2 {
"MICROMAP_BUILD_EXT", "MICROMAP_BUILD_EXT",
), ),
( (
PipelineStageFlags2::RESEVED_41_HUAWEI.0, PipelineStageFlags2::CLUSTER_CULLING_SHADER_HUAWEI.0,
"RESEVED_41_HUAWEI", "CLUSTER_CULLING_SHADER_HUAWEI",
), ),
(PipelineStageFlags2::OPTICAL_FLOW_NV.0, "OPTICAL_FLOW_NV"), (PipelineStageFlags2::OPTICAL_FLOW_NV.0, "OPTICAL_FLOW_NV"),
]; ];
@ -3928,7 +3920,8 @@ impl fmt::Debug for PrimitiveTopology {
} }
impl fmt::Debug for PrivateDataSlotCreateFlags { impl fmt::Debug for PrivateDataSlotCreateFlags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[]; const KNOWN: &[(Flags, &str)] =
&[(PrivateDataSlotCreateFlags::RESERVED_0_NV.0, "RESERVED_0_NV")];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
} }
@ -4007,6 +4000,10 @@ impl fmt::Debug for QueryPipelineStatisticFlags {
QueryPipelineStatisticFlags::MESH_SHADER_INVOCATIONS_EXT.0, QueryPipelineStatisticFlags::MESH_SHADER_INVOCATIONS_EXT.0,
"MESH_SHADER_INVOCATIONS_EXT", "MESH_SHADER_INVOCATIONS_EXT",
), ),
(
QueryPipelineStatisticFlags::CLUSTER_CULLING_SHADER_INVOCATIONS_HUAWEI.0,
"CLUSTER_CULLING_SHADER_INVOCATIONS_HUAWEI",
),
]; ];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
@ -4076,9 +4073,7 @@ impl fmt::Debug for QueryType {
Some("ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV") Some("ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV")
} }
Self::PERFORMANCE_QUERY_INTEL => Some("PERFORMANCE_QUERY_INTEL"), Self::PERFORMANCE_QUERY_INTEL => Some("PERFORMANCE_QUERY_INTEL"),
Self::VIDEO_ENCODESTREAM_BUFFER_RANGE_KHR => { Self::VIDEO_ENCODE_FEEDBACK_KHR => Some("VIDEO_ENCODE_FEEDBACK_KHR"),
Some("VIDEO_ENCODESTREAM_BUFFER_RANGE_KHR")
}
Self::MESH_PRIMITIVES_GENERATED_EXT => Some("MESH_PRIMITIVES_GENERATED_EXT"), Self::MESH_PRIMITIVES_GENERATED_EXT => Some("MESH_PRIMITIVES_GENERATED_EXT"),
Self::PRIMITIVES_GENERATED_EXT => Some("PRIMITIVES_GENERATED_EXT"), Self::PRIMITIVES_GENERATED_EXT => Some("PRIMITIVES_GENERATED_EXT"),
Self::ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR => { Self::ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR => {
@ -4466,7 +4461,10 @@ impl fmt::Debug for ShaderStageFlags {
ShaderStageFlags::SUBPASS_SHADING_HUAWEI.0, ShaderStageFlags::SUBPASS_SHADING_HUAWEI.0,
"SUBPASS_SHADING_HUAWEI", "SUBPASS_SHADING_HUAWEI",
), ),
(ShaderStageFlags::RESERVED_19_HUAWEI.0, "RESERVED_19_HUAWEI"), (
ShaderStageFlags::CLUSTER_CULLING_HUAWEI.0,
"CLUSTER_CULLING_HUAWEI",
),
(ShaderStageFlags::EXT_483_RESERVE_15.0, "EXT_483_RESERVE_15"), (ShaderStageFlags::EXT_483_RESERVE_15.0, "EXT_483_RESERVE_15"),
(ShaderStageFlags::EXT_483_RESERVE_16.0, "EXT_483_RESERVE_16"), (ShaderStageFlags::EXT_483_RESERVE_16.0, "EXT_483_RESERVE_16"),
(ShaderStageFlags::EXT_483_RESERVE_17.0, "EXT_483_RESERVE_17"), (ShaderStageFlags::EXT_483_RESERVE_17.0, "EXT_483_RESERVE_17"),
@ -4745,9 +4743,6 @@ impl fmt::Debug for StructureType {
Self::VIDEO_ENCODE_H264_NALU_SLICE_INFO_EXT => { Self::VIDEO_ENCODE_H264_NALU_SLICE_INFO_EXT => {
Some("VIDEO_ENCODE_H264_NALU_SLICE_INFO_EXT") Some("VIDEO_ENCODE_H264_NALU_SLICE_INFO_EXT")
} }
Self::VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_INFO_EXT => {
Some("VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_INFO_EXT")
}
Self::VIDEO_ENCODE_H264_PROFILE_INFO_EXT => Some("VIDEO_ENCODE_H264_PROFILE_INFO_EXT"), Self::VIDEO_ENCODE_H264_PROFILE_INFO_EXT => Some("VIDEO_ENCODE_H264_PROFILE_INFO_EXT"),
Self::VIDEO_ENCODE_H264_RATE_CONTROL_INFO_EXT => { Self::VIDEO_ENCODE_H264_RATE_CONTROL_INFO_EXT => {
Some("VIDEO_ENCODE_H264_RATE_CONTROL_INFO_EXT") Some("VIDEO_ENCODE_H264_RATE_CONTROL_INFO_EXT")
@ -4755,9 +4750,6 @@ impl fmt::Debug for StructureType {
Self::VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_EXT => { Self::VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_EXT => {
Some("VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_EXT") Some("VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_EXT")
} }
Self::VIDEO_ENCODE_H264_REFERENCE_LISTS_INFO_EXT => {
Some("VIDEO_ENCODE_H264_REFERENCE_LISTS_INFO_EXT")
}
Self::VIDEO_ENCODE_H265_CAPABILITIES_EXT => Some("VIDEO_ENCODE_H265_CAPABILITIES_EXT"), Self::VIDEO_ENCODE_H265_CAPABILITIES_EXT => Some("VIDEO_ENCODE_H265_CAPABILITIES_EXT"),
Self::VIDEO_ENCODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT => { Self::VIDEO_ENCODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT => {
Some("VIDEO_ENCODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT") Some("VIDEO_ENCODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT")
@ -4774,13 +4766,7 @@ impl fmt::Debug for StructureType {
Self::VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_INFO_EXT => { Self::VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_INFO_EXT => {
Some("VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_INFO_EXT") Some("VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_INFO_EXT")
} }
Self::VIDEO_ENCODE_H265_EMIT_PICTURE_PARAMETERS_INFO_EXT => {
Some("VIDEO_ENCODE_H265_EMIT_PICTURE_PARAMETERS_INFO_EXT")
}
Self::VIDEO_ENCODE_H265_PROFILE_INFO_EXT => Some("VIDEO_ENCODE_H265_PROFILE_INFO_EXT"), Self::VIDEO_ENCODE_H265_PROFILE_INFO_EXT => Some("VIDEO_ENCODE_H265_PROFILE_INFO_EXT"),
Self::VIDEO_ENCODE_H265_REFERENCE_LISTS_INFO_EXT => {
Some("VIDEO_ENCODE_H265_REFERENCE_LISTS_INFO_EXT")
}
Self::VIDEO_ENCODE_H265_RATE_CONTROL_INFO_EXT => { Self::VIDEO_ENCODE_H265_RATE_CONTROL_INFO_EXT => {
Some("VIDEO_ENCODE_H265_RATE_CONTROL_INFO_EXT") Some("VIDEO_ENCODE_H265_RATE_CONTROL_INFO_EXT")
} }
@ -5374,6 +5360,8 @@ impl fmt::Debug for StructureType {
Self::PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR => { Self::PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR => {
Some("PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR") Some("PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR")
} }
Self::MEMORY_MAP_INFO_KHR => Some("MEMORY_MAP_INFO_KHR"),
Self::MEMORY_UNMAP_INFO_KHR => Some("MEMORY_UNMAP_INFO_KHR"),
Self::PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT => { Self::PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT => {
Some("PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT") Some("PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT")
} }
@ -5476,6 +5464,9 @@ impl fmt::Debug for StructureType {
} }
Self::VIDEO_ENCODE_CAPABILITIES_KHR => Some("VIDEO_ENCODE_CAPABILITIES_KHR"), Self::VIDEO_ENCODE_CAPABILITIES_KHR => Some("VIDEO_ENCODE_CAPABILITIES_KHR"),
Self::VIDEO_ENCODE_USAGE_INFO_KHR => Some("VIDEO_ENCODE_USAGE_INFO_KHR"), Self::VIDEO_ENCODE_USAGE_INFO_KHR => Some("VIDEO_ENCODE_USAGE_INFO_KHR"),
Self::QUERY_POOL_VIDEO_ENCODE_FEEDBACK_CREATE_INFO_KHR => {
Some("QUERY_POOL_VIDEO_ENCODE_FEEDBACK_CREATE_INFO_KHR")
}
Self::PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV => { Self::PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV => {
Some("PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV") Some("PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV")
} }
@ -5483,6 +5474,7 @@ impl fmt::Debug for StructureType {
Some("DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV") Some("DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV")
} }
Self::RESERVED_QCOM => Some("RESERVED_QCOM"), Self::RESERVED_QCOM => Some("RESERVED_QCOM"),
Self::QUERY_LOW_LATENCY_SUPPORT_NV => Some("QUERY_LOW_LATENCY_SUPPORT_NV"),
Self::EXPORT_METAL_OBJECT_CREATE_INFO_EXT => { Self::EXPORT_METAL_OBJECT_CREATE_INFO_EXT => {
Some("EXPORT_METAL_OBJECT_CREATE_INFO_EXT") Some("EXPORT_METAL_OBJECT_CREATE_INFO_EXT")
} }
@ -5752,6 +5744,12 @@ impl fmt::Debug for StructureType {
Self::ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT => { Self::ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT => {
Some("ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT") Some("ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT")
} }
Self::PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI => {
Some("PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI")
}
Self::PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI => {
Some("PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI")
}
Self::PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT => { Self::PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT => {
Some("PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT") Some("PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT")
} }
@ -5761,6 +5759,13 @@ impl fmt::Debug for StructureType {
Self::PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT => { Self::PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT => {
Some("PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT") Some("PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT")
} }
Self::PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM => {
Some("PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM")
}
Self::PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT => {
Some("PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT")
}
Self::IMAGE_VIEW_SLICED_CREATE_INFO_EXT => Some("IMAGE_VIEW_SLICED_CREATE_INFO_EXT"),
Self::PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE => { Self::PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE => {
Some("PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE") Some("PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE")
} }
@ -5895,6 +5900,15 @@ impl fmt::Debug for StructureType {
Self::PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM => { Self::PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM => {
Some("PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM") Some("PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM")
} }
Self::PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT => {
Some("PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT")
}
Self::PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM => {
Some("PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM")
}
Self::MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM => {
Some("MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM")
}
Self::PHYSICAL_DEVICE_SUBGROUP_PROPERTIES => { Self::PHYSICAL_DEVICE_SUBGROUP_PROPERTIES => {
Some("PHYSICAL_DEVICE_SUBGROUP_PROPERTIES") Some("PHYSICAL_DEVICE_SUBGROUP_PROPERTIES")
} }
@ -6550,6 +6564,7 @@ impl fmt::Debug for VendorId {
Self::CODEPLAY => Some("CODEPLAY"), Self::CODEPLAY => Some("CODEPLAY"),
Self::MESA => Some("MESA"), Self::MESA => Some("MESA"),
Self::POCL => Some("POCL"), Self::POCL => Some("POCL"),
Self::MOBILEYE => Some("MOBILEYE"),
_ => None, _ => None,
}; };
if let Some(x) = name { if let Some(x) = name {
@ -6728,6 +6743,21 @@ impl fmt::Debug for VideoEncodeContentFlagsKHR {
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
} }
impl fmt::Debug for VideoEncodeFeedbackFlagsKHR {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[
(
VideoEncodeFeedbackFlagsKHR::BITSTREAM_BUFFER_OFFSET.0,
"BITSTREAM_BUFFER_OFFSET",
),
(
VideoEncodeFeedbackFlagsKHR::BITSTREAM_BYTES_WRITTEN.0,
"BITSTREAM_BYTES_WRITTEN",
),
];
debug_flags(f, KNOWN, self.0)
}
}
impl fmt::Debug for VideoEncodeFlagsKHR { impl fmt::Debug for VideoEncodeFlagsKHR {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[]; const KNOWN: &[(Flags, &str)] = &[];
@ -6831,26 +6861,10 @@ impl fmt::Debug for VideoEncodeH264CapabilityFlagsEXT {
VideoEncodeH264CapabilityFlagsEXT::B_FRAME_IN_L1_LIST.0, VideoEncodeH264CapabilityFlagsEXT::B_FRAME_IN_L1_LIST.0,
"B_FRAME_IN_L1_LIST", "B_FRAME_IN_L1_LIST",
), ),
]; (
debug_flags(f, KNOWN, self.0) VideoEncodeH264CapabilityFlagsEXT::DIFFERENT_REFERENCE_FINAL_LISTS.0,
} "DIFFERENT_REFERENCE_FINAL_LISTS",
} ),
impl fmt::Debug for VideoEncodeH264InputModeFlagsEXT {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[
(VideoEncodeH264InputModeFlagsEXT::FRAME.0, "FRAME"),
(VideoEncodeH264InputModeFlagsEXT::SLICE.0, "SLICE"),
(VideoEncodeH264InputModeFlagsEXT::NON_VCL.0, "NON_VCL"),
];
debug_flags(f, KNOWN, self.0)
}
}
impl fmt::Debug for VideoEncodeH264OutputModeFlagsEXT {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[
(VideoEncodeH264OutputModeFlagsEXT::FRAME.0, "FRAME"),
(VideoEncodeH264OutputModeFlagsEXT::SLICE.0, "SLICE"),
(VideoEncodeH264OutputModeFlagsEXT::NON_VCL.0, "NON_VCL"),
]; ];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
@ -6977,6 +6991,10 @@ impl fmt::Debug for VideoEncodeH265CapabilityFlagsEXT {
VideoEncodeH265CapabilityFlagsEXT::B_FRAME_IN_L1_LIST.0, VideoEncodeH265CapabilityFlagsEXT::B_FRAME_IN_L1_LIST.0,
"B_FRAME_IN_L1_LIST", "B_FRAME_IN_L1_LIST",
), ),
(
VideoEncodeH265CapabilityFlagsEXT::DIFFERENT_REFERENCE_FINAL_LISTS.0,
"DIFFERENT_REFERENCE_FINAL_LISTS",
),
]; ];
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
@ -6991,32 +7009,6 @@ impl fmt::Debug for VideoEncodeH265CtbSizeFlagsEXT {
debug_flags(f, KNOWN, self.0) debug_flags(f, KNOWN, self.0)
} }
} }
impl fmt::Debug for VideoEncodeH265InputModeFlagsEXT {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[
(VideoEncodeH265InputModeFlagsEXT::FRAME.0, "FRAME"),
(
VideoEncodeH265InputModeFlagsEXT::SLICE_SEGMENT.0,
"SLICE_SEGMENT",
),
(VideoEncodeH265InputModeFlagsEXT::NON_VCL.0, "NON_VCL"),
];
debug_flags(f, KNOWN, self.0)
}
}
impl fmt::Debug for VideoEncodeH265OutputModeFlagsEXT {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[
(VideoEncodeH265OutputModeFlagsEXT::FRAME.0, "FRAME"),
(
VideoEncodeH265OutputModeFlagsEXT::SLICE_SEGMENT.0,
"SLICE_SEGMENT",
),
(VideoEncodeH265OutputModeFlagsEXT::NON_VCL.0, "NON_VCL"),
];
debug_flags(f, KNOWN, self.0)
}
}
impl fmt::Debug for VideoEncodeH265RateControlStructureEXT { impl fmt::Debug for VideoEncodeH265RateControlStructureEXT {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let name = match *self { let name = match *self {
@ -7064,7 +7056,8 @@ impl fmt::Debug for VideoEncodeRateControlFlagsKHR {
impl fmt::Debug for VideoEncodeRateControlModeFlagsKHR { impl fmt::Debug for VideoEncodeRateControlModeFlagsKHR {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
const KNOWN: &[(Flags, &str)] = &[ const KNOWN: &[(Flags, &str)] = &[
(VideoEncodeRateControlModeFlagsKHR::NONE.0, "NONE"), (VideoEncodeRateControlModeFlagsKHR::DEFAULT.0, "DEFAULT"),
(VideoEncodeRateControlModeFlagsKHR::DISABLED.0, "DISABLED"),
(VideoEncodeRateControlModeFlagsKHR::CBR.0, "CBR"), (VideoEncodeRateControlModeFlagsKHR::CBR.0, "CBR"),
(VideoEncodeRateControlModeFlagsKHR::VBR.0, "VBR"), (VideoEncodeRateControlModeFlagsKHR::VBR.0, "VBR"),
]; ];

View file

@ -10,6 +10,7 @@ pub const MAX_MEMORY_HEAPS: usize = 16;
pub const LOD_CLAMP_NONE: f32 = 1000.00; pub const LOD_CLAMP_NONE: f32 = 1000.00;
pub const REMAINING_MIP_LEVELS: u32 = !0; pub const REMAINING_MIP_LEVELS: u32 = !0;
pub const REMAINING_ARRAY_LAYERS: u32 = !0; pub const REMAINING_ARRAY_LAYERS: u32 = !0;
pub const REMAINING_3D_SLICES_EXT: u32 = !0;
pub const WHOLE_SIZE: u64 = !0; pub const WHOLE_SIZE: u64 = !0;
pub const ATTACHMENT_UNUSED: u32 = !0; pub const ATTACHMENT_UNUSED: u32 = !0;
pub const TRUE: Bool32 = 1; pub const TRUE: Bool32 = 1;

File diff suppressed because it is too large Load diff

View file

@ -1744,6 +1744,8 @@ impl VendorId {
pub const MESA: Self = Self(0x1_0005); pub const MESA: Self = Self(0x1_0005);
#[doc = "PoCL vendor ID"] #[doc = "PoCL vendor ID"]
pub const POCL: Self = Self(0x1_0006); pub const POCL: Self = Self(0x1_0006);
#[doc = "Mobileye vendor ID"]
pub const MOBILEYE: Self = Self(0x1_0007);
} }
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
@ -1808,6 +1810,8 @@ impl DriverId {
pub const MESA_DOZEN: Self = Self(23); pub const MESA_DOZEN: Self = Self(23);
#[doc = "Mesa open source project"] #[doc = "Mesa open source project"]
pub const MESA_NVK: Self = Self(24); pub const MESA_NVK: Self = Self(24);
#[doc = "Imagination Technologies"]
pub const IMAGINATION_OPEN_SOURCE_MESA: Self = Self(25);
} }
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)] #[repr(transparent)]
@ -2898,6 +2902,9 @@ impl fmt::Debug for Result {
Self::THREAD_DONE_KHR => Some("THREAD_DONE_KHR"), Self::THREAD_DONE_KHR => Some("THREAD_DONE_KHR"),
Self::OPERATION_DEFERRED_KHR => Some("OPERATION_DEFERRED_KHR"), Self::OPERATION_DEFERRED_KHR => Some("OPERATION_DEFERRED_KHR"),
Self::OPERATION_NOT_DEFERRED_KHR => Some("OPERATION_NOT_DEFERRED_KHR"), Self::OPERATION_NOT_DEFERRED_KHR => Some("OPERATION_NOT_DEFERRED_KHR"),
Self::ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR => {
Some("ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR")
}
Self::ERROR_COMPRESSION_EXHAUSTED_EXT => Some("ERROR_COMPRESSION_EXHAUSTED_EXT"), Self::ERROR_COMPRESSION_EXHAUSTED_EXT => Some("ERROR_COMPRESSION_EXHAUSTED_EXT"),
Self::ERROR_OUT_OF_POOL_MEMORY => Some("ERROR_OUT_OF_POOL_MEMORY"), Self::ERROR_OUT_OF_POOL_MEMORY => Some("ERROR_OUT_OF_POOL_MEMORY"),
Self::ERROR_INVALID_EXTERNAL_HANDLE => Some("ERROR_INVALID_EXTERNAL_HANDLE"), Self::ERROR_INVALID_EXTERNAL_HANDLE => Some("ERROR_INVALID_EXTERNAL_HANDLE"),

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.61.0 */ /* automatically generated by rust-bindgen 0.63.0 */
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
@ -7050,42 +7050,48 @@ impl StdVideoEncodeH264ReferenceInfoFlags {
#[repr(C)] #[repr(C)]
#[repr(align(4))] #[repr(align(4))]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct StdVideoEncodeH264RefMgmtFlags { pub struct StdVideoEncodeH264ReferenceListsInfoFlags {
pub _bitfield_align_1: [u8; 0], pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
pub __bindgen_padding_0: [u8; 3usize], pub __bindgen_padding_0: [u8; 3usize],
} }
#[test] #[test]
fn bindgen_test_layout_StdVideoEncodeH264RefMgmtFlags() { fn bindgen_test_layout_StdVideoEncodeH264ReferenceListsInfoFlags() {
assert_eq!( assert_eq!(
::std::mem::size_of::<StdVideoEncodeH264RefMgmtFlags>(), ::std::mem::size_of::<StdVideoEncodeH264ReferenceListsInfoFlags>(),
4usize, 4usize,
concat!("Size of: ", stringify!(StdVideoEncodeH264RefMgmtFlags)) concat!(
"Size of: ",
stringify!(StdVideoEncodeH264ReferenceListsInfoFlags)
)
); );
assert_eq!( assert_eq!(
::std::mem::align_of::<StdVideoEncodeH264RefMgmtFlags>(), ::std::mem::align_of::<StdVideoEncodeH264ReferenceListsInfoFlags>(),
4usize, 4usize,
concat!("Alignment of ", stringify!(StdVideoEncodeH264RefMgmtFlags)) concat!(
"Alignment of ",
stringify!(StdVideoEncodeH264ReferenceListsInfoFlags)
)
); );
} }
impl StdVideoEncodeH264RefMgmtFlags { impl StdVideoEncodeH264ReferenceListsInfoFlags {
#[inline] #[inline]
pub fn ref_pic_list_modification_l0_flag(&self) -> u32 { pub fn ref_pic_list_modification_flag_l0(&self) -> u32 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
} }
#[inline] #[inline]
pub fn set_ref_pic_list_modification_l0_flag(&mut self, val: u32) { pub fn set_ref_pic_list_modification_flag_l0(&mut self, val: u32) {
unsafe { unsafe {
let val: u32 = ::std::mem::transmute(val); let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(0usize, 1u8, val as u64) self._bitfield_1.set(0usize, 1u8, val as u64)
} }
} }
#[inline] #[inline]
pub fn ref_pic_list_modification_l1_flag(&self) -> u32 { pub fn ref_pic_list_modification_flag_l1(&self) -> u32 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) }
} }
#[inline] #[inline]
pub fn set_ref_pic_list_modification_l1_flag(&mut self, val: u32) { pub fn set_ref_pic_list_modification_flag_l1(&mut self, val: u32) {
unsafe { unsafe {
let val: u32 = ::std::mem::transmute(val); let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(1usize, 1u8, val as u64) self._bitfield_1.set(1usize, 1u8, val as u64)
@ -7093,19 +7099,19 @@ impl StdVideoEncodeH264RefMgmtFlags {
} }
#[inline] #[inline]
pub fn new_bitfield_1( pub fn new_bitfield_1(
ref_pic_list_modification_l0_flag: u32, ref_pic_list_modification_flag_l0: u32,
ref_pic_list_modification_l1_flag: u32, ref_pic_list_modification_flag_l1: u32,
) -> __BindgenBitfieldUnit<[u8; 1usize]> { ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 1u8, { __bindgen_bitfield_unit.set(0usize, 1u8, {
let ref_pic_list_modification_l0_flag: u32 = let ref_pic_list_modification_flag_l0: u32 =
unsafe { ::std::mem::transmute(ref_pic_list_modification_l0_flag) }; unsafe { ::std::mem::transmute(ref_pic_list_modification_flag_l0) };
ref_pic_list_modification_l0_flag as u64 ref_pic_list_modification_flag_l0 as u64
}); });
__bindgen_bitfield_unit.set(1usize, 1u8, { __bindgen_bitfield_unit.set(1usize, 1u8, {
let ref_pic_list_modification_l1_flag: u32 = let ref_pic_list_modification_flag_l1: u32 =
unsafe { ::std::mem::transmute(ref_pic_list_modification_l1_flag) }; unsafe { ::std::mem::transmute(ref_pic_list_modification_flag_l1) };
ref_pic_list_modification_l1_flag as u64 ref_pic_list_modification_flag_l1 as u64
}); });
__bindgen_bitfield_unit __bindgen_bitfield_unit
} }
@ -7255,34 +7261,39 @@ fn bindgen_test_layout_StdVideoEncodeH264RefPicMarkingEntry() {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct StdVideoEncodeH264RefMemMgmtCtrlOperations { pub struct StdVideoEncodeH264ReferenceListsInfo {
pub flags: StdVideoEncodeH264RefMgmtFlags, pub flags: StdVideoEncodeH264ReferenceListsInfoFlags,
pub refPicList0EntryCount: u8,
pub refPicList1EntryCount: u8,
pub refList0ModOpCount: u8, pub refList0ModOpCount: u8,
pub pRefList0ModOperations: *const StdVideoEncodeH264RefListModEntry,
pub refList1ModOpCount: u8, pub refList1ModOpCount: u8,
pub pRefList1ModOperations: *const StdVideoEncodeH264RefListModEntry,
pub refPicMarkingOpCount: u8, pub refPicMarkingOpCount: u8,
pub reserved1: [u8; 7usize],
pub pRefPicList0Entries: *const u8,
pub pRefPicList1Entries: *const u8,
pub pRefList0ModOperations: *const StdVideoEncodeH264RefListModEntry,
pub pRefList1ModOperations: *const StdVideoEncodeH264RefListModEntry,
pub pRefPicMarkingOperations: *const StdVideoEncodeH264RefPicMarkingEntry, pub pRefPicMarkingOperations: *const StdVideoEncodeH264RefPicMarkingEntry,
} }
#[test] #[test]
fn bindgen_test_layout_StdVideoEncodeH264RefMemMgmtCtrlOperations() { fn bindgen_test_layout_StdVideoEncodeH264ReferenceListsInfo() {
const UNINIT: ::std::mem::MaybeUninit<StdVideoEncodeH264RefMemMgmtCtrlOperations> = const UNINIT: ::std::mem::MaybeUninit<StdVideoEncodeH264ReferenceListsInfo> =
::std::mem::MaybeUninit::uninit(); ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr(); let ptr = UNINIT.as_ptr();
assert_eq!( assert_eq!(
::std::mem::size_of::<StdVideoEncodeH264RefMemMgmtCtrlOperations>(), ::std::mem::size_of::<StdVideoEncodeH264ReferenceListsInfo>(),
48usize, 56usize,
concat!( concat!(
"Size of: ", "Size of: ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations) stringify!(StdVideoEncodeH264ReferenceListsInfo)
) )
); );
assert_eq!( assert_eq!(
::std::mem::align_of::<StdVideoEncodeH264RefMemMgmtCtrlOperations>(), ::std::mem::align_of::<StdVideoEncodeH264ReferenceListsInfo>(),
8usize, 8usize,
concat!( concat!(
"Alignment of ", "Alignment of ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations) stringify!(StdVideoEncodeH264ReferenceListsInfo)
) )
); );
assert_eq!( assert_eq!(
@ -7290,67 +7301,117 @@ fn bindgen_test_layout_StdVideoEncodeH264RefMemMgmtCtrlOperations() {
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations), stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::", "::",
stringify!(flags) stringify!(flags)
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).refList0ModOpCount) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).refPicList0EntryCount) as usize - ptr as usize },
4usize, 4usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations), stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::",
stringify!(refPicList0EntryCount)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).refPicList1EntryCount) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::",
stringify!(refPicList1EntryCount)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).refList0ModOpCount) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::", "::",
stringify!(refList0ModOpCount) stringify!(refList0ModOpCount)
) )
); );
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefList0ModOperations) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations),
"::",
stringify!(pRefList0ModOperations)
)
);
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).refList1ModOpCount) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).refList1ModOpCount) as usize - ptr as usize },
16usize, 7usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations), stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::", "::",
stringify!(refList1ModOpCount) stringify!(refList1ModOpCount)
) )
); );
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefList1ModOperations) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations),
"::",
stringify!(pRefList1ModOperations)
)
);
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).refPicMarkingOpCount) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).refPicMarkingOpCount) as usize - ptr as usize },
32usize, 8usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations), stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::", "::",
stringify!(refPicMarkingOpCount) stringify!(refPicMarkingOpCount)
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefPicMarkingOperations) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::",
stringify!(reserved1)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefPicList0Entries) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::",
stringify!(pRefPicList0Entries)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefPicList1Entries) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::",
stringify!(pRefPicList1Entries)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefList0ModOperations) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::",
stringify!(pRefList0ModOperations)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefList1ModOperations) as usize - ptr as usize },
40usize, 40usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264RefMemMgmtCtrlOperations), stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::",
stringify!(pRefList1ModOperations)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefPicMarkingOperations) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceListsInfo),
"::", "::",
stringify!(pRefPicMarkingOperations) stringify!(pRefPicMarkingOperations)
) )
@ -7362,6 +7423,7 @@ pub struct StdVideoEncodeH264PictureInfo {
pub flags: StdVideoEncodeH264PictureInfoFlags, pub flags: StdVideoEncodeH264PictureInfoFlags,
pub seq_parameter_set_id: u8, pub seq_parameter_set_id: u8,
pub pic_parameter_set_id: u8, pub pic_parameter_set_id: u8,
pub reserved1: u16,
pub pictureType: StdVideoH264PictureType, pub pictureType: StdVideoH264PictureType,
pub frame_num: u32, pub frame_num: u32,
pub PicOrderCnt: i32, pub PicOrderCnt: i32,
@ -7411,6 +7473,16 @@ fn bindgen_test_layout_StdVideoEncodeH264PictureInfo() {
stringify!(pic_parameter_set_id) stringify!(pic_parameter_set_id)
) )
); );
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264PictureInfo),
"::",
stringify!(reserved1)
)
);
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pictureType) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).pictureType) as usize - ptr as usize },
8usize, 8usize,
@ -7446,6 +7518,7 @@ fn bindgen_test_layout_StdVideoEncodeH264PictureInfo() {
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct StdVideoEncodeH264ReferenceInfo { pub struct StdVideoEncodeH264ReferenceInfo {
pub flags: StdVideoEncodeH264ReferenceInfoFlags, pub flags: StdVideoEncodeH264ReferenceInfoFlags,
pub pictureType: StdVideoH264PictureType,
pub FrameNum: u32, pub FrameNum: u32,
pub PicOrderCnt: i32, pub PicOrderCnt: i32,
pub long_term_pic_num: u16, pub long_term_pic_num: u16,
@ -7458,7 +7531,7 @@ fn bindgen_test_layout_StdVideoEncodeH264ReferenceInfo() {
let ptr = UNINIT.as_ptr(); let ptr = UNINIT.as_ptr();
assert_eq!( assert_eq!(
::std::mem::size_of::<StdVideoEncodeH264ReferenceInfo>(), ::std::mem::size_of::<StdVideoEncodeH264ReferenceInfo>(),
16usize, 20usize,
concat!("Size of: ", stringify!(StdVideoEncodeH264ReferenceInfo)) concat!("Size of: ", stringify!(StdVideoEncodeH264ReferenceInfo))
); );
assert_eq!( assert_eq!(
@ -7477,8 +7550,18 @@ fn bindgen_test_layout_StdVideoEncodeH264ReferenceInfo() {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).FrameNum) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).pictureType) as usize - ptr as usize },
4usize, 4usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceInfo),
"::",
stringify!(pictureType)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).FrameNum) as usize - ptr as usize },
8usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceInfo), stringify!(StdVideoEncodeH264ReferenceInfo),
@ -7488,7 +7571,7 @@ fn bindgen_test_layout_StdVideoEncodeH264ReferenceInfo() {
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).PicOrderCnt) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).PicOrderCnt) as usize - ptr as usize },
8usize, 12usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceInfo), stringify!(StdVideoEncodeH264ReferenceInfo),
@ -7498,7 +7581,7 @@ fn bindgen_test_layout_StdVideoEncodeH264ReferenceInfo() {
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).long_term_pic_num) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).long_term_pic_num) as usize - ptr as usize },
12usize, 16usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceInfo), stringify!(StdVideoEncodeH264ReferenceInfo),
@ -7508,7 +7591,7 @@ fn bindgen_test_layout_StdVideoEncodeH264ReferenceInfo() {
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).long_term_frame_idx) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).long_term_frame_idx) as usize - ptr as usize },
14usize, 18usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH264ReferenceInfo), stringify!(StdVideoEncodeH264ReferenceInfo),
@ -7530,6 +7613,8 @@ pub struct StdVideoEncodeH264SliceHeader {
pub disable_deblocking_filter_idc: StdVideoH264DisableDeblockingFilterIdc, pub disable_deblocking_filter_idc: StdVideoH264DisableDeblockingFilterIdc,
pub slice_alpha_c0_offset_div2: i8, pub slice_alpha_c0_offset_div2: i8,
pub slice_beta_offset_div2: i8, pub slice_beta_offset_div2: i8,
pub reserved1: u16,
pub reserved2: u32,
pub pWeightTable: *const StdVideoEncodeH264WeightTable, pub pWeightTable: *const StdVideoEncodeH264WeightTable,
} }
#[test] #[test]
@ -7653,6 +7738,26 @@ fn bindgen_test_layout_StdVideoEncodeH264SliceHeader() {
stringify!(slice_beta_offset_div2) stringify!(slice_beta_offset_div2)
) )
); );
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize },
26usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264SliceHeader),
"::",
stringify!(reserved1)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).reserved2) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH264SliceHeader),
"::",
stringify!(reserved2)
)
);
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pWeightTable) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).pWeightTable) as usize - ptr as usize },
32usize, 32usize,
@ -8511,31 +8616,31 @@ fn bindgen_test_layout_StdVideoEncodeH265SliceSegmentHeader() {
#[repr(C)] #[repr(C)]
#[repr(align(4))] #[repr(align(4))]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct StdVideoEncodeH265ReferenceModificationFlags { pub struct StdVideoEncodeH265ReferenceListsInfoFlags {
pub _bitfield_align_1: [u8; 0], pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
pub __bindgen_padding_0: [u8; 3usize], pub __bindgen_padding_0: [u8; 3usize],
} }
#[test] #[test]
fn bindgen_test_layout_StdVideoEncodeH265ReferenceModificationFlags() { fn bindgen_test_layout_StdVideoEncodeH265ReferenceListsInfoFlags() {
assert_eq!( assert_eq!(
::std::mem::size_of::<StdVideoEncodeH265ReferenceModificationFlags>(), ::std::mem::size_of::<StdVideoEncodeH265ReferenceListsInfoFlags>(),
4usize, 4usize,
concat!( concat!(
"Size of: ", "Size of: ",
stringify!(StdVideoEncodeH265ReferenceModificationFlags) stringify!(StdVideoEncodeH265ReferenceListsInfoFlags)
) )
); );
assert_eq!( assert_eq!(
::std::mem::align_of::<StdVideoEncodeH265ReferenceModificationFlags>(), ::std::mem::align_of::<StdVideoEncodeH265ReferenceListsInfoFlags>(),
4usize, 4usize,
concat!( concat!(
"Alignment of ", "Alignment of ",
stringify!(StdVideoEncodeH265ReferenceModificationFlags) stringify!(StdVideoEncodeH265ReferenceListsInfoFlags)
) )
); );
} }
impl StdVideoEncodeH265ReferenceModificationFlags { impl StdVideoEncodeH265ReferenceListsInfoFlags {
#[inline] #[inline]
pub fn ref_pic_list_modification_flag_l0(&self) -> u32 { pub fn ref_pic_list_modification_flag_l0(&self) -> u32 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
@ -8579,32 +8684,35 @@ impl StdVideoEncodeH265ReferenceModificationFlags {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct StdVideoEncodeH265ReferenceModifications { pub struct StdVideoEncodeH265ReferenceListsInfo {
pub flags: StdVideoEncodeH265ReferenceModificationFlags, pub flags: StdVideoEncodeH265ReferenceListsInfoFlags,
pub referenceList0ModificationsCount: u8, pub num_ref_idx_l0_active_minus1: u8,
pub pReferenceList0Modifications: *const u8, pub num_ref_idx_l1_active_minus1: u8,
pub referenceList1ModificationsCount: u8, pub reserved1: u16,
pub pReferenceList1Modifications: *const u8, pub pRefPicList0Entries: *const u8,
pub pRefPicList1Entries: *const u8,
pub pRefList0Modifications: *const u8,
pub pRefList1Modifications: *const u8,
} }
#[test] #[test]
fn bindgen_test_layout_StdVideoEncodeH265ReferenceModifications() { fn bindgen_test_layout_StdVideoEncodeH265ReferenceListsInfo() {
const UNINIT: ::std::mem::MaybeUninit<StdVideoEncodeH265ReferenceModifications> = const UNINIT: ::std::mem::MaybeUninit<StdVideoEncodeH265ReferenceListsInfo> =
::std::mem::MaybeUninit::uninit(); ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr(); let ptr = UNINIT.as_ptr();
assert_eq!( assert_eq!(
::std::mem::size_of::<StdVideoEncodeH265ReferenceModifications>(), ::std::mem::size_of::<StdVideoEncodeH265ReferenceListsInfo>(),
32usize, 40usize,
concat!( concat!(
"Size of: ", "Size of: ",
stringify!(StdVideoEncodeH265ReferenceModifications) stringify!(StdVideoEncodeH265ReferenceListsInfo)
) )
); );
assert_eq!( assert_eq!(
::std::mem::align_of::<StdVideoEncodeH265ReferenceModifications>(), ::std::mem::align_of::<StdVideoEncodeH265ReferenceListsInfo>(),
8usize, 8usize,
concat!( concat!(
"Alignment of ", "Alignment of ",
stringify!(StdVideoEncodeH265ReferenceModifications) stringify!(StdVideoEncodeH265ReferenceListsInfo)
) )
); );
assert_eq!( assert_eq!(
@ -8612,57 +8720,83 @@ fn bindgen_test_layout_StdVideoEncodeH265ReferenceModifications() {
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceModifications), stringify!(StdVideoEncodeH265ReferenceListsInfo),
"::", "::",
stringify!(flags) stringify!(flags)
) )
); );
assert_eq!( assert_eq!(
unsafe { unsafe {
::std::ptr::addr_of!((*ptr).referenceList0ModificationsCount) as usize - ptr as usize ::std::ptr::addr_of!((*ptr).num_ref_idx_l0_active_minus1) as usize - ptr as usize
}, },
4usize, 4usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceModifications), stringify!(StdVideoEncodeH265ReferenceListsInfo),
"::", "::",
stringify!(referenceList0ModificationsCount) stringify!(num_ref_idx_l0_active_minus1)
) )
); );
assert_eq!( assert_eq!(
unsafe { unsafe {
::std::ptr::addr_of!((*ptr).pReferenceList0Modifications) as usize - ptr as usize ::std::ptr::addr_of!((*ptr).num_ref_idx_l1_active_minus1) as usize - ptr as usize
}, },
5usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceListsInfo),
"::",
stringify!(num_ref_idx_l1_active_minus1)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceListsInfo),
"::",
stringify!(reserved1)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefPicList0Entries) as usize - ptr as usize },
8usize, 8usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceModifications), stringify!(StdVideoEncodeH265ReferenceListsInfo),
"::", "::",
stringify!(pReferenceList0Modifications) stringify!(pRefPicList0Entries)
) )
); );
assert_eq!( assert_eq!(
unsafe { unsafe { ::std::ptr::addr_of!((*ptr).pRefPicList1Entries) as usize - ptr as usize },
::std::ptr::addr_of!((*ptr).referenceList1ModificationsCount) as usize - ptr as usize
},
16usize, 16usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceModifications), stringify!(StdVideoEncodeH265ReferenceListsInfo),
"::", "::",
stringify!(referenceList1ModificationsCount) stringify!(pRefPicList1Entries)
) )
); );
assert_eq!( assert_eq!(
unsafe { unsafe { ::std::ptr::addr_of!((*ptr).pRefList0Modifications) as usize - ptr as usize },
::std::ptr::addr_of!((*ptr).pReferenceList1Modifications) as usize - ptr as usize
},
24usize, 24usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceModifications), stringify!(StdVideoEncodeH265ReferenceListsInfo),
"::", "::",
stringify!(pReferenceList1Modifications) stringify!(pRefList0Modifications)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pRefList1Modifications) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceListsInfo),
"::",
stringify!(pRefList1Modifications)
) )
); );
} }
@ -8786,8 +8920,8 @@ pub struct StdVideoEncodeH265PictureInfo {
pub sps_video_parameter_set_id: u8, pub sps_video_parameter_set_id: u8,
pub pps_seq_parameter_set_id: u8, pub pps_seq_parameter_set_id: u8,
pub pps_pic_parameter_set_id: u8, pub pps_pic_parameter_set_id: u8,
pub PicOrderCntVal: i32,
pub TemporalId: u8, pub TemporalId: u8,
pub PicOrderCntVal: i32,
} }
#[test] #[test]
fn bindgen_test_layout_StdVideoEncodeH265PictureInfo() { fn bindgen_test_layout_StdVideoEncodeH265PictureInfo() {
@ -8796,7 +8930,7 @@ fn bindgen_test_layout_StdVideoEncodeH265PictureInfo() {
let ptr = UNINIT.as_ptr(); let ptr = UNINIT.as_ptr();
assert_eq!( assert_eq!(
::std::mem::size_of::<StdVideoEncodeH265PictureInfo>(), ::std::mem::size_of::<StdVideoEncodeH265PictureInfo>(),
20usize, 16usize,
concat!("Size of: ", stringify!(StdVideoEncodeH265PictureInfo)) concat!("Size of: ", stringify!(StdVideoEncodeH265PictureInfo))
); );
assert_eq!( assert_eq!(
@ -8854,6 +8988,16 @@ fn bindgen_test_layout_StdVideoEncodeH265PictureInfo() {
stringify!(pps_pic_parameter_set_id) stringify!(pps_pic_parameter_set_id)
) )
); );
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).TemporalId) as usize - ptr as usize },
11usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH265PictureInfo),
"::",
stringify!(TemporalId)
)
);
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).PicOrderCntVal) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).PicOrderCntVal) as usize - ptr as usize },
12usize, 12usize,
@ -8864,16 +9008,6 @@ fn bindgen_test_layout_StdVideoEncodeH265PictureInfo() {
stringify!(PicOrderCntVal) stringify!(PicOrderCntVal)
) )
); );
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).TemporalId) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH265PictureInfo),
"::",
stringify!(TemporalId)
)
);
} }
#[repr(C)] #[repr(C)]
#[repr(align(4))] #[repr(align(4))]
@ -8947,6 +9081,7 @@ impl StdVideoEncodeH265ReferenceInfoFlags {
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct StdVideoEncodeH265ReferenceInfo { pub struct StdVideoEncodeH265ReferenceInfo {
pub flags: StdVideoEncodeH265ReferenceInfoFlags, pub flags: StdVideoEncodeH265ReferenceInfoFlags,
pub PictureType: StdVideoH265PictureType,
pub PicOrderCntVal: i32, pub PicOrderCntVal: i32,
pub TemporalId: u8, pub TemporalId: u8,
} }
@ -8957,7 +9092,7 @@ fn bindgen_test_layout_StdVideoEncodeH265ReferenceInfo() {
let ptr = UNINIT.as_ptr(); let ptr = UNINIT.as_ptr();
assert_eq!( assert_eq!(
::std::mem::size_of::<StdVideoEncodeH265ReferenceInfo>(), ::std::mem::size_of::<StdVideoEncodeH265ReferenceInfo>(),
12usize, 16usize,
concat!("Size of: ", stringify!(StdVideoEncodeH265ReferenceInfo)) concat!("Size of: ", stringify!(StdVideoEncodeH265ReferenceInfo))
); );
assert_eq!( assert_eq!(
@ -8976,8 +9111,18 @@ fn bindgen_test_layout_StdVideoEncodeH265ReferenceInfo() {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).PicOrderCntVal) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).PictureType) as usize - ptr as usize },
4usize, 4usize,
concat!(
"Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceInfo),
"::",
stringify!(PictureType)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).PicOrderCntVal) as usize - ptr as usize },
8usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceInfo), stringify!(StdVideoEncodeH265ReferenceInfo),
@ -8987,7 +9132,7 @@ fn bindgen_test_layout_StdVideoEncodeH265ReferenceInfo() {
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).TemporalId) as usize - ptr as usize }, unsafe { ::std::ptr::addr_of!((*ptr).TemporalId) as usize - ptr as usize },
8usize, 12usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(StdVideoEncodeH265ReferenceInfo), stringify!(StdVideoEncodeH265ReferenceInfo),

View file

@ -5,7 +5,7 @@ authors = ["Maik Klein <maikklein@googlemail.com>"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
bindgen = "0.61" bindgen = "0.63"
heck = "0.4" heck = "0.4"
itertools = "0.10" itertools = "0.10"
nom = "7.1" nom = "7.1"
@ -13,7 +13,7 @@ once_cell = "1.7"
proc-macro2 = "1.0" proc-macro2 = "1.0"
quote = "1.0" quote = "1.0"
regex = "1.4" regex = "1.4"
vk-parse = { version = "0.9", features = ["vkxml-convert"] } vk-parse = { version = "0.10", features = ["vkxml-convert"] }
vkxml = "0.3" vkxml = "0.3"
[dependencies.syn] [dependencies.syn]

@ -1 +1 @@
Subproject commit 00671c64ba5c488ade22ad572a0ef81d5e64c803 Subproject commit fa204df59c6caea6b9be3cf0754a88cd89056a87

View file

@ -26,6 +26,12 @@ use std::{
}; };
use syn::Ident; use syn::Ident;
const DESIRED_API: &str = "vulkan";
fn contains_desired_api(api: &str) -> bool {
api.split(',').any(|n| n == DESIRED_API)
}
macro_rules! get_variant { macro_rules! get_variant {
($variant:path) => { ($variant:path) => {
|enum_| match enum_ { |enum_| match enum_ {
@ -41,8 +47,6 @@ macro_rules! get_variant {
}; };
} }
const BACKWARDS_COMPATIBLE_ALIAS_COMMENT: &str = "Backwards-compatible alias containing a typo";
pub trait ExtensionExt {} pub trait ExtensionExt {}
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub enum CType { pub enum CType {
@ -311,17 +315,9 @@ pub trait ConstantExt {
fn is_alias(&self) -> bool { fn is_alias(&self) -> bool {
false false
} }
fn doc_attribute(&self) -> TokenStream { fn is_deprecated(&self) -> bool;
assert_ne!( fn doc_attribute(&self) -> Option<TokenStream> {
self.notation(), self.formatted_notation().map(|n| quote!(#[doc = #n]))
Some(BACKWARDS_COMPATIBLE_ALIAS_COMMENT),
"Backwards-compatible constants should not be emitted"
);
match self.formatted_notation() {
Some(n) if n.starts_with("Alias") => quote!(#[deprecated = #n]),
Some(n) => quote!(#[doc = #n]),
None => quote!(),
}
} }
} }
@ -335,6 +331,9 @@ impl ConstantExt for vkxml::ExtensionEnum {
fn notation(&self) -> Option<&str> { fn notation(&self) -> Option<&str> {
self.notation.as_deref() self.notation.as_deref()
} }
fn is_deprecated(&self) -> bool {
todo!()
}
} }
impl ConstantExt for vk_parse::Enum { impl ConstantExt for vk_parse::Enum {
@ -352,6 +351,9 @@ impl ConstantExt for vk_parse::Enum {
fn is_alias(&self) -> bool { fn is_alias(&self) -> bool {
matches!(self.spec, vk_parse::EnumSpec::Alias { .. }) matches!(self.spec, vk_parse::EnumSpec::Alias { .. })
} }
fn is_deprecated(&self) -> bool {
self.deprecated.is_some()
}
} }
impl ConstantExt for vkxml::Constant { impl ConstantExt for vkxml::Constant {
@ -364,6 +366,9 @@ impl ConstantExt for vkxml::Constant {
fn notation(&self) -> Option<&str> { fn notation(&self) -> Option<&str> {
self.notation.as_deref() self.notation.as_deref()
} }
fn is_deprecated(&self) -> bool {
todo!()
}
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -927,6 +932,7 @@ fn generate_function_pointers<'a>(
let params: Vec<_> = cmd let params: Vec<_> = cmd
.params .params
.iter() .iter()
.filter(|param| matches!(param.api.as_deref(), None | Some(DESIRED_API)))
.map(|param| { .map(|param| {
let name = param.param_ident(); let name = param.param_ident();
let ty = param.type_tokens(true); let ty = param.type_tokens(true);
@ -1072,6 +1078,10 @@ impl<'a> ConstantExt for ExtensionConstant<'a> {
fn notation(&self) -> Option<&str> { fn notation(&self) -> Option<&str> {
self.notation self.notation
} }
fn is_deprecated(&self) -> bool {
// We won't create this struct if the extension constant was deprecated
false
}
} }
pub fn generate_extension_constants<'a>( pub fn generate_extension_constants<'a>(
@ -1083,8 +1093,12 @@ pub fn generate_extension_constants<'a>(
) -> TokenStream { ) -> TokenStream {
let items = extension_items let items = extension_items
.iter() .iter()
.filter_map(get_variant!(vk_parse::ExtensionChild::Require { items })) .filter_map(get_variant!(vk_parse::ExtensionChild::Require {
.flatten(); api,
items
}))
.filter(|(api, _items)| matches!(api.as_deref(), None | Some(DESIRED_API)))
.flat_map(|(_api, items)| items);
let mut extended_enums = BTreeMap::<String, Vec<ExtensionConstant>>::new(); let mut extended_enums = BTreeMap::<String, Vec<ExtensionConstant>>::new();
@ -1094,7 +1108,11 @@ pub fn generate_extension_constants<'a>(
continue; continue;
} }
if enum_.comment.as_deref() == Some(BACKWARDS_COMPATIBLE_ALIAS_COMMENT) { if !matches!(enum_.api.as_deref(), None | Some(DESIRED_API)) {
continue;
}
if enum_.deprecated.is_some() {
continue; continue;
} }
@ -1154,8 +1172,12 @@ pub fn generate_extension_commands<'a>(
let mut aliases = HashMap::new(); let mut aliases = HashMap::new();
let names = items let names = items
.iter() .iter()
.filter_map(get_variant!(vk_parse::ExtensionChild::Require { items })) .filter_map(get_variant!(vk_parse::ExtensionChild::Require {
.flatten() api,
items
}))
.filter(|(api, _items)| matches!(api.as_deref(), None | Some(DESIRED_API)))
.flat_map(|(_api, items)| items)
.filter_map(get_variant!(vk_parse::InterfaceItem::Command { name })); .filter_map(get_variant!(vk_parse::InterfaceItem::Command { name }));
for name in names { for name in names {
if let Some(cmd) = cmd_map.get(name).copied() { if let Some(cmd) = cmd_map.get(name).copied() {
@ -1236,6 +1258,7 @@ pub fn generate_extension<'a>(
} }
pub fn generate_define( pub fn generate_define(
define: &vk_parse::Type, define: &vk_parse::Type,
allowed_types: &HashSet<&str>,
identifier_renames: &mut BTreeMap<String, Ident>, identifier_renames: &mut BTreeMap<String, Ident>,
) -> TokenStream { ) -> TokenStream {
let vk_parse::TypeSpec::Code(spec) = &define.spec else { let vk_parse::TypeSpec::Code(spec) = &define.spec else {
@ -1244,6 +1267,11 @@ pub fn generate_define(
let [vk_parse::TypeCodeMarkup::Name(define_name), ..] = &spec.markup[..] else { let [vk_parse::TypeCodeMarkup::Name(define_name), ..] = &spec.markup[..] else {
return quote!(); return quote!();
}; };
if !allowed_types.contains(define_name.as_str()) {
return quote!();
}
let name = constant_name(define_name); let name = constant_name(define_name);
let ident = format_ident!("{}", name); let ident = format_ident!("{}", name);
@ -1257,7 +1285,14 @@ pub fn generate_define(
let deprecated = comment let deprecated = comment
.and_then(|c| c.trim().strip_prefix("DEPRECATED: ")) .and_then(|c| c.trim().strip_prefix("DEPRECATED: "))
.map(|comment| (quote!(#[deprecated = #comment]))); .map(|comment| quote!(#[deprecated = #comment]))
.or_else(|| match define.deprecated.as_ref()?.as_str() {
"true" => Some(quote!(#[deprecated])),
"aliased" => {
Some(quote!(#[deprecated = "an old name not following Vulkan conventions"]))
}
x => panic!("Unknown deprecation reason {}", x),
});
let (code, ident) = if let Some(parameters) = parameters { let (code, ident) = if let Some(parameters) = parameters {
let params = parameters let params = parameters
@ -1425,7 +1460,7 @@ pub fn bitflags_impl_block(
) -> TokenStream { ) -> TokenStream {
let variants = constants let variants = constants
.iter() .iter()
.filter(|constant| constant.notation() != Some(BACKWARDS_COMPATIBLE_ALIAS_COMMENT)) .filter(|constant| !constant.is_deprecated())
.map(|constant| { .map(|constant| {
let variant_ident = constant.variant_ident(enum_name); let variant_ident = constant.variant_ident(enum_name);
let notation = constant.doc_attribute(); let notation = constant.doc_attribute();
@ -1463,7 +1498,7 @@ pub fn generate_enum<'a>(
.children .children
.iter() .iter()
.filter_map(get_variant!(vk_parse::EnumsChild::Enum)) .filter_map(get_variant!(vk_parse::EnumsChild::Enum))
.filter(|constant| constant.notation() != Some(BACKWARDS_COMPATIBLE_ALIAS_COMMENT)) .filter(|constant| !constant.is_deprecated())
.collect_vec(); .collect_vec();
let mut values = Vec::with_capacity(constants.len()); let mut values = Vec::with_capacity(constants.len());
@ -1577,18 +1612,13 @@ pub fn generate_result(ident: Ident, enum_: &vk_parse::Enums) -> TokenStream {
} }
fn is_static_array(field: &vkxml::Field) -> bool { fn is_static_array(field: &vkxml::Field) -> bool {
field matches!(field.array, Some(vkxml::ArrayType::Static))
.array
.as_ref()
.map(|ty| matches!(ty, vkxml::ArrayType::Static))
.unwrap_or(false)
} }
pub fn derive_default(struct_: &vkxml::Struct) -> Option<TokenStream> { pub fn derive_default(
struct_: &vkxml::Struct,
members: &[(&vkxml::Field, Option<TokenStream>)],
) -> Option<TokenStream> {
let name = name_to_tokens(&struct_.name); let name = name_to_tokens(&struct_.name);
let members = struct_
.elements
.iter()
.filter_map(get_variant!(vkxml::StructElement::Member));
let is_structure_type = |field: &vkxml::Field| field.basetype == "VkStructureType"; let is_structure_type = |field: &vkxml::Field| field.basetype == "VkStructureType";
// These are also pointers, and therefor also don't implement Default. The spec // These are also pointers, and therefor also don't implement Default. The spec
@ -1606,13 +1636,18 @@ pub fn derive_default(struct_: &vkxml::Struct) -> Option<TokenStream> {
"MTLSharedEvent_id", "MTLSharedEvent_id",
"MTLTexture_id", "MTLTexture_id",
]; ];
let contains_ptr = members.clone().any(|field| field.reference.is_some()); let contains_ptr = members
let contains_structure_type = members.clone().any(is_structure_type); .iter()
let contains_static_array = members.clone().any(is_static_array); .cloned()
.any(|(field, _)| field.reference.is_some());
let contains_structure_type = members.iter().map(|(f, _)| *f).any(is_structure_type);
let contains_static_array = members.iter().map(|(f, _)| *f).any(is_static_array);
let contains_deprecated = members.iter().any(|(_, d)| d.is_some());
let allow_deprecated = contains_deprecated.then(|| quote!(#[allow(deprecated)]));
if !(contains_ptr || contains_structure_type || contains_static_array) { if !(contains_ptr || contains_structure_type || contains_static_array) {
return None; return None;
}; };
let default_fields = members.clone().map(|field| { let default_fields = members.iter().map(|(field, _)| {
let param_ident = field.param_ident(); let param_ident = field.param_ident();
if is_structure_type(field) { if is_structure_type(field) {
if field.type_enums.is_some() { if field.type_enums.is_some() {
@ -1645,6 +1680,7 @@ pub fn derive_default(struct_: &vkxml::Struct) -> Option<TokenStream> {
impl ::std::default::Default for #name { impl ::std::default::Default for #name {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
#allow_deprecated
Self { Self {
#( #(
#default_fields #default_fields
@ -1655,13 +1691,13 @@ pub fn derive_default(struct_: &vkxml::Struct) -> Option<TokenStream> {
}; };
Some(q) Some(q)
} }
pub fn derive_debug(struct_: &vkxml::Struct, union_types: &HashSet<&str>) -> Option<TokenStream> { pub fn derive_debug(
struct_: &vkxml::Struct,
members: &[(&vkxml::Field, Option<TokenStream>)],
union_types: &HashSet<&str>,
) -> Option<TokenStream> {
let name = name_to_tokens(&struct_.name); let name = name_to_tokens(&struct_.name);
let members = struct_ let contains_pfn = members.iter().any(|(field, _)| {
.elements
.iter()
.filter_map(get_variant!(vkxml::StructElement::Member));
let contains_pfn = members.clone().any(|field| {
field field
.name .name
.as_ref() .as_ref()
@ -1669,15 +1705,15 @@ pub fn derive_debug(struct_: &vkxml::Struct, union_types: &HashSet<&str>) -> Opt
.unwrap_or(false) .unwrap_or(false)
}); });
let contains_static_array = members let contains_static_array = members
.clone() .iter()
.any(|x| is_static_array(x) && x.basetype == "char"); .any(|(x, _)| is_static_array(x) && x.basetype == "char");
let contains_union = members let contains_union = members
.clone() .iter()
.any(|field| union_types.contains(field.basetype.as_str())); .any(|(field, _)| union_types.contains(field.basetype.as_str()));
if !(contains_union || contains_static_array || contains_pfn) { if !(contains_union || contains_static_array || contains_pfn) {
return None; return None;
} }
let debug_fields = members.clone().map(|field| { let debug_fields = members.iter().map(|(field, _)| {
let param_ident = field.param_ident(); let param_ident = field.param_ident();
let param_str = param_ident.to_string(); let param_str = param_ident.to_string();
let debug_value = if is_static_array(field) && field.basetype == "char" { let debug_value = if is_static_array(field) && field.basetype == "char" {
@ -1717,6 +1753,7 @@ pub fn derive_debug(struct_: &vkxml::Struct, union_types: &HashSet<&str>) -> Opt
pub fn derive_setters( pub fn derive_setters(
struct_: &vkxml::Struct, struct_: &vkxml::Struct,
members: &[(&vkxml::Field, Option<TokenStream>)],
root_structs: &HashSet<Ident>, root_structs: &HashSet<Ident>,
) -> Option<TokenStream> { ) -> Option<TokenStream> {
if &struct_.name == "VkBaseInStructure" if &struct_.name == "VkBaseInStructure"
@ -1730,18 +1767,13 @@ pub fn derive_setters(
let name = name_to_tokens(&struct_.name); let name = name_to_tokens(&struct_.name);
let name_builder = name_to_tokens(&(struct_.name.clone() + "Builder")); let name_builder = name_to_tokens(&(struct_.name.clone() + "Builder"));
let members = struct_
.elements
.iter()
.filter_map(get_variant!(vkxml::StructElement::Member));
let next_field = members let next_field = members
.clone() .iter()
.find(|field| field.param_ident() == "p_next"); .find(|(field, _)| field.param_ident() == "p_next");
let structure_type_field = members let structure_type_field = members
.clone() .iter()
.find(|field| field.param_ident() == "s_type"); .find(|(field, _)| field.param_ident() == "s_type");
// Must either have both, or none: // Must either have both, or none:
assert_eq!(next_field.is_some(), structure_type_field.is_some()); assert_eq!(next_field.is_some(), structure_type_field.is_some());
@ -1752,8 +1784,8 @@ pub fn derive_setters(
("VkDescriptorSetLayoutBinding", "pImmutableSamplers"), ("VkDescriptorSetLayoutBinding", "pImmutableSamplers"),
]; ];
let filter_members: Vec<String> = members let filter_members: Vec<String> = members
.clone() .iter()
.filter_map(|field| { .filter_map(|(field, _)| {
let field_name = field.name.as_ref().unwrap(); let field_name = field.name.as_ref().unwrap();
// Associated _count members // Associated _count members
@ -1774,7 +1806,8 @@ pub fn derive_setters(
}) })
.collect(); .collect();
let setters = members.clone().filter_map(|field| { let setters = members.iter().filter_map(|(field, deprecated)| {
let deprecated = deprecated.as_ref().map(|d| quote!(#d #[allow(deprecated)]));
let param_ident = field.param_ident(); let param_ident = field.param_ident();
let param_ty_tokens = field.safe_type_tokens(quote!('a), None); let param_ty_tokens = field.safe_type_tokens(quote!('a), None);
@ -1834,6 +1867,7 @@ pub fn derive_setters(
assert_eq!(field.size, None); assert_eq!(field.size, None);
return Some(quote!{ return Some(quote!{
#[inline] #[inline]
#deprecated
pub fn #param_ident_short(mut self, #param_ident_short: &'a ::std::ffi::CStr) -> Self { pub fn #param_ident_short(mut self, #param_ident_short: &'a ::std::ffi::CStr) -> Self {
self.inner.#param_ident = #param_ident_short.as_ptr(); self.inner.#param_ident = #param_ident_short.as_ptr();
self self
@ -1880,7 +1914,7 @@ pub fn derive_setters(
let array_size_ident = format_ident!("{}", array_size.to_snake_case()); let array_size_ident = format_ident!("{}", array_size.to_snake_case());
let size_field = members.clone().find(|m| m.name.as_deref() == Some(array_size)).unwrap(); let size_field = members.iter().map(|(m, _)| m).find(|m| m.name.as_deref() == Some(array_size)).unwrap();
let cast = if size_field.basetype == "size_t" { let cast = if size_field.basetype == "size_t" {
quote!() quote!()
@ -1895,6 +1929,7 @@ pub fn derive_setters(
return Some(quote! { return Some(quote! {
#[inline] #[inline]
#deprecated
pub fn #param_ident_short(mut self, #param_ident_short: &'a #mutable #slice_param_ty_tokens) -> Self { pub fn #param_ident_short(mut self, #param_ident_short: &'a #mutable #slice_param_ty_tokens) -> Self {
#set_size_stmt #set_size_stmt
self.inner.#param_ident = #param_ident_short #ptr; self.inner.#param_ident = #param_ident_short #ptr;
@ -1908,6 +1943,7 @@ pub fn derive_setters(
if field.basetype == "VkBool32" { if field.basetype == "VkBool32" {
return Some(quote!{ return Some(quote!{
#[inline] #[inline]
#deprecated
pub fn #param_ident_short(mut self, #param_ident_short: bool) -> Self { pub fn #param_ident_short(mut self, #param_ident_short: bool) -> Self {
self.inner.#param_ident = #param_ident_short.into(); self.inner.#param_ident = #param_ident_short.into();
self self
@ -1924,6 +1960,7 @@ pub fn derive_setters(
Some(quote!{ Some(quote!{
#[inline] #[inline]
#deprecated
pub fn #param_ident_short(mut self, #param_ident_short: #param_ty_tokens) -> Self { pub fn #param_ident_short(mut self, #param_ident_short: #param_ty_tokens) -> Self {
self.inner.#param_ident = #param_ident_short; self.inner.#param_ident = #param_ident_short;
self self
@ -1937,7 +1974,7 @@ pub fn derive_setters(
let root_struct_next_field = next_field.filter(|_| root_structs.contains(&name)); let root_struct_next_field = next_field.filter(|_| root_structs.contains(&name));
// We only implement a next methods for root structs with a `pnext` field. // We only implement a next methods for root structs with a `pnext` field.
let next_function = if let Some(next_field) = root_struct_next_field { let next_function = if let Some((next_field, _)) = root_struct_next_field {
assert_eq!(next_field.basetype, "void"); assert_eq!(next_field.basetype, "void");
let mutability = if next_field.is_const { let mutability = if next_field.is_const {
quote!(const) quote!(const)
@ -1994,7 +2031,7 @@ pub fn derive_setters(
} }
}); });
let impl_structure_type_trait = structure_type_field.map(|s_type| { let impl_structure_type_trait = structure_type_field.map(|(s_type, _)| {
let value = s_type let value = s_type
.type_enums .type_enums
.as_deref() .as_deref()
@ -2074,10 +2111,16 @@ pub fn manual_derives(struct_: &vkxml::Struct) -> TokenStream {
} }
pub fn generate_struct( pub fn generate_struct(
struct_: &vkxml::Struct, struct_: &vkxml::Struct,
vk_parse_types: &HashMap<String, &vk_parse::Type>,
root_structs: &HashSet<Ident>, root_structs: &HashSet<Ident>,
union_types: &HashSet<&str>, union_types: &HashSet<&str>,
) -> TokenStream { ) -> TokenStream {
let name = name_to_tokens(&struct_.name); let name = name_to_tokens(&struct_.name);
let vk_parse_struct = vk_parse_types[&struct_.name];
let vk_parse::TypeSpec::Members(vk_parse_members) = &vk_parse_struct.spec else {
panic!()
};
if &struct_.name == "VkTransformMatrixKHR" { if &struct_.name == "VkTransformMatrixKHR" {
return quote! { return quote! {
#[repr(C)] #[repr(C)]
@ -2147,9 +2190,31 @@ pub fn generate_struct(
let members = struct_ let members = struct_
.elements .elements
.iter() .iter()
.filter_map(get_variant!(vkxml::StructElement::Member)); .filter_map(get_variant!(vkxml::StructElement::Member))
.zip(
vk_parse_members
.iter()
.filter_map(get_variant!(vk_parse::TypeMember::Definition)),
)
.filter(|(_, vk_parse_field)| {
matches!(vk_parse_field.api.as_deref(), None | Some(DESIRED_API))
})
.map(|(field, vk_parse_field)| {
let deprecation = vk_parse_field
.deprecated
.as_ref()
.map(|deprecated| match deprecated.as_str() {
"true" => quote!(#[deprecated]),
"ignored" => {
quote!(#[deprecated = "functionality described by this member no longer operates"])
}
x => panic!("Unknown deprecation reason {}", x),
});
(field, deprecation)
})
.collect::<Vec<_>>();
let params = members.clone().map(|field| { let params = members.iter().map(|(field, deprecation)| {
let param_ident = field.param_ident(); let param_ident = field.param_ident();
let param_ty_tokens = if field.basetype == struct_.name { let param_ty_tokens = if field.basetype == struct_.name {
let pointer = field let pointer = field
@ -2160,12 +2225,13 @@ pub fn generate_struct(
} else { } else {
field.type_tokens(false) field.type_tokens(false)
}; };
quote! {pub #param_ident: #param_ty_tokens}
quote!(#deprecation pub #param_ident: #param_ty_tokens)
}); });
let debug_tokens = derive_debug(struct_, union_types); let debug_tokens = derive_debug(struct_, &members, union_types);
let default_tokens = derive_default(struct_); let default_tokens = derive_default(struct_, &members);
let setter_tokens = derive_setters(struct_, root_structs); let setter_tokens = derive_setters(struct_, &members, root_structs);
let manual_derive_tokens = manual_derives(struct_); let manual_derive_tokens = manual_derives(struct_);
let dbg_str = if debug_tokens.is_none() { let dbg_str = if debug_tokens.is_none() {
quote!(#[cfg_attr(feature = "debug", derive(Debug))]) quote!(#[cfg_attr(feature = "debug", derive(Debug))])
@ -2266,45 +2332,88 @@ fn generate_union(union: &vkxml::Union) -> TokenStream {
} }
} }
/// Root structs are all structs that are extended by other structs. /// Root structs are all structs that are extended by other structs.
pub fn root_structs(definitions: &[&vkxml::DefinitionsElement]) -> HashSet<Ident> { pub fn root_structs(
let mut root_structs = HashSet::new(); definitions: &[&vk_parse::Type],
allowed_types: &HashSet<&str>,
) -> HashSet<Ident> {
// Loop over all structs and collect their extends // Loop over all structs and collect their extends
for definition in definitions { definitions
if let vkxml::DefinitionsElement::Struct(ref struct_) = definition { .iter()
if let Some(extends) = &struct_.extends { .filter(|type_| {
root_structs.extend(extends.split(',').map(name_to_tokens)); type_
} .name
}; .as_ref()
} .map_or(false, |name| allowed_types.contains(name.as_str()))
root_structs })
.filter_map(|type_| type_.structextends.as_ref())
.flat_map(|e| e.split(','))
.map(name_to_tokens)
.collect()
} }
pub fn generate_definition_vk_parse( pub fn generate_definition_vk_parse(
definition: &vk_parse::Type, definition: &vk_parse::Type,
allowed_types: &HashSet<&str>,
identifier_renames: &mut BTreeMap<String, Ident>, identifier_renames: &mut BTreeMap<String, Ident>,
) -> Option<TokenStream> { ) -> Option<TokenStream> {
if let Some(api) = &definition.api {
if api != DESIRED_API {
return None;
}
}
match definition.category.as_deref() { match definition.category.as_deref() {
Some("define") => Some(generate_define(definition, identifier_renames)), Some("define") => Some(generate_define(
definition,
allowed_types,
identifier_renames,
)),
_ => None, _ => None,
} }
} }
#[allow(clippy::too_many_arguments)]
pub fn generate_definition( pub fn generate_definition(
definition: &vkxml::DefinitionsElement, definition: &vkxml::DefinitionsElement,
allowed_types: &HashSet<&str>,
union_types: &HashSet<&str>, union_types: &HashSet<&str>,
root_structs: &HashSet<Ident>, root_structs: &HashSet<Ident>,
vk_parse_types: &HashMap<String, &vk_parse::Type>,
bitflags_cache: &mut HashSet<Ident>, bitflags_cache: &mut HashSet<Ident>,
const_values: &mut BTreeMap<Ident, ConstantTypeInfo>, const_values: &mut BTreeMap<Ident, ConstantTypeInfo>,
) -> Option<TokenStream> { ) -> Option<TokenStream> {
match *definition { match *definition {
vkxml::DefinitionsElement::Typedef(ref typedef) => Some(generate_typedef(typedef)), vkxml::DefinitionsElement::Typedef(ref typedef)
vkxml::DefinitionsElement::Struct(ref struct_) => { if allowed_types.contains(typedef.name.as_str()) =>
Some(generate_struct(struct_, root_structs, union_types)) {
Some(generate_typedef(typedef))
} }
vkxml::DefinitionsElement::Bitmask(ref mask) => { vkxml::DefinitionsElement::Struct(ref struct_)
if allowed_types.contains(struct_.name.as_str()) =>
{
Some(generate_struct(
struct_,
vk_parse_types,
root_structs,
union_types,
))
}
vkxml::DefinitionsElement::Bitmask(ref mask)
if allowed_types.contains(mask.name.as_str()) =>
{
generate_bitmask(mask, bitflags_cache, const_values) generate_bitmask(mask, bitflags_cache, const_values)
} }
vkxml::DefinitionsElement::Handle(ref handle) => generate_handle(handle), vkxml::DefinitionsElement::Handle(ref handle)
vkxml::DefinitionsElement::FuncPtr(ref fp) => Some(generate_funcptr(fp)), if allowed_types.contains(handle.name.as_str()) =>
vkxml::DefinitionsElement::Union(ref union) => Some(generate_union(union)), {
generate_handle(handle)
}
vkxml::DefinitionsElement::FuncPtr(ref fp) if allowed_types.contains(fp.name.as_str()) => {
Some(generate_funcptr(fp))
}
vkxml::DefinitionsElement::Union(ref union)
if allowed_types.contains(union.name.as_str()) =>
{
Some(generate_union(union))
}
_ => None, _ => None,
} }
} }
@ -2313,6 +2422,10 @@ pub fn generate_feature<'a>(
commands: &CommandMap<'a>, commands: &CommandMap<'a>,
fn_cache: &mut HashSet<&'a str>, fn_cache: &mut HashSet<&'a str>,
) -> TokenStream { ) -> TokenStream {
if !contains_desired_api(&feature.api) {
return quote!();
}
let (static_commands, entry_commands, device_commands, instance_commands) = feature let (static_commands, entry_commands, device_commands, instance_commands) = feature
.elements .elements
.iter() .iter()
@ -2404,6 +2517,7 @@ pub fn generate_feature_extension<'a>(
.0 .0
.iter() .iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Feature)) .filter_map(get_variant!(vk_parse::RegistryChild::Feature))
.filter(|feature| contains_desired_api(&feature.api))
.map(|feature| { .map(|feature| {
generate_extension_constants( generate_extension_constants(
&feature.name, &feature.name,
@ -2556,6 +2670,7 @@ pub fn extract_native_types(registry: &vk_parse::Registry) -> (Vec<(String, Stri
} }
pub fn generate_aliases_of_types( pub fn generate_aliases_of_types(
types: &vk_parse::Types, types: &vk_parse::Types,
allowed_types: &HashSet<&str>,
ty_cache: &mut HashSet<Ident>, ty_cache: &mut HashSet<Ident>,
) -> TokenStream { ) -> TokenStream {
let aliases = types let aliases = types
@ -2564,6 +2679,9 @@ pub fn generate_aliases_of_types(
.filter_map(get_variant!(vk_parse::TypesChild::Type)) .filter_map(get_variant!(vk_parse::TypesChild::Type))
.filter_map(|ty| { .filter_map(|ty| {
let name = ty.name.as_ref()?; let name = ty.name.as_ref()?;
if !allowed_types.contains(name.as_str()) {
return None;
}
let alias = ty.alias.as_ref()?; let alias = ty.alias.as_ref()?;
let name_ident = name_to_tokens(name); let name_ident = name_to_tokens(name);
if !ty_cache.insert(name_ident.clone()) { if !ty_cache.insert(name_ident.clone()) {
@ -2584,38 +2702,30 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
use std::fs::File; use std::fs::File;
use std::io::Write; use std::io::Write;
let (spec2, _errors) = vk_parse::parse_file(&vk_xml).expect("Invalid xml file"); let (spec2, _errors) = vk_parse::parse_file(&vk_xml).expect("Invalid xml file");
let extensions: &Vec<vk_parse::Extension> = spec2 let extensions: Vec<&vk_parse::Extension> = spec2
.0 .0
.iter() .iter()
.find_map(get_variant!(vk_parse::RegistryChild::Extensions)) .find_map(get_variant!(vk_parse::RegistryChild::Extensions))
.map(|ext| &ext.children) .expect("extension")
.expect("extension"); .children
let mut ty_cache = HashSet::new();
let aliases: Vec<_> = spec2
.0
.iter() .iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Types)) .filter(|e| {
.map(|ty| generate_aliases_of_types(ty, &mut ty_cache)) if let Some(supported) = &e.supported {
contains_desired_api(supported) ||
// Backwards-compatibility with ash 0.37:
// Keep extension 196 disabled as it aliases an undefined constant
(supported == "disabled" && e.number != Some(196)) ||
// VK_ANDROID_native_buffer is for internal use only, but types defined elsewhere
// reference enum extension constants. Exempt the extension from this check until
// types are properly folded in with their extension (where applicable).
e.name == "VK_ANDROID_native_buffer"
} else {
true
}
})
.collect(); .collect();
let spec = vk_parse::parse_file_as_vkxml(&vk_xml).expect("Invalid xml file."); let spec = vk_parse::parse_file_as_vkxml(&vk_xml).expect("Invalid xml file.");
let cmd_aliases: HashMap<String, String> = spec2
.0
.iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Commands))
.flat_map(|cmds| &cmds.children)
.filter_map(get_variant!(vk_parse::Command::Alias { name, alias }))
.map(|(name, alias)| (name.to_string(), alias.to_string()))
.collect();
let commands: CommandMap<'_> = spec2
.0
.iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Commands))
.flat_map(|cmds| &cmds.children)
.filter_map(get_variant!(vk_parse::Command::Definition))
.map(|cmd| (cmd.proto.name.clone(), cmd))
.collect();
let features: Vec<&vkxml::Feature> = spec let features: Vec<&vkxml::Feature> = spec
.elements .elements
@ -2638,6 +2748,53 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
.flat_map(|constants| &constants.elements) .flat_map(|constants| &constants.elements)
.collect(); .collect();
let features_children = spec2
.0
.iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Feature))
.filter(|feature| contains_desired_api(&feature.api))
.flat_map(|features| &features.children);
let extension_children = extensions.iter().flat_map(|extension| &extension.children);
let (required_types, required_commands) = features_children
.chain(extension_children)
.filter_map(get_variant!(vk_parse::FeatureChild::Require { api, items }))
.filter(|(api, _items)| matches!(api.as_deref(), None | Some(DESIRED_API)))
.flat_map(|(_api, items)| items)
.fold((HashSet::new(), HashSet::new()), |mut acc, elem| {
match elem {
vk_parse::InterfaceItem::Type { name, .. } => {
acc.0.insert(name.as_str());
}
vk_parse::InterfaceItem::Command { name, .. } => {
acc.1.insert(name.as_str());
}
_ => {}
};
acc
});
let commands: CommandMap<'_> = spec2
.0
.iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Commands))
.flat_map(|cmds| &cmds.children)
.filter_map(get_variant!(vk_parse::Command::Definition))
.filter(|cmd| required_commands.contains(&cmd.proto.name.as_str()))
.map(|cmd| (cmd.proto.name.clone(), cmd))
.collect();
let cmd_aliases: HashMap<String, String> = spec2
.0
.iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Commands))
.flat_map(|cmds| &cmds.children)
.filter_map(get_variant!(vk_parse::Command::Alias { name, alias }))
.filter(|(name, _alias)| required_commands.contains(name.as_str()))
.map(|(name, alias)| (name.to_string(), alias.to_string()))
.collect();
let mut fn_cache = HashSet::new(); let mut fn_cache = HashSet::new();
let mut bitflags_cache = HashSet::new(); let mut bitflags_cache = HashSet::new();
let mut const_cache = HashSet::new(); let mut const_cache = HashSet::new();
@ -2649,6 +2806,11 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
.iter() .iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Enums)) .filter_map(get_variant!(vk_parse::RegistryChild::Enums))
.filter(|enums| enums.kind.is_some()) .filter(|enums| enums.kind.is_some())
.filter(|enums| {
enums.name.as_ref().map_or(true, |n| {
required_types.contains(n.replace("FlagBits", "Flags").as_str())
})
})
.map(|e| generate_enum(e, &mut const_cache, &mut const_values, &mut bitflags_cache)) .map(|e| generate_enum(e, &mut const_cache, &mut const_values, &mut bitflags_cache))
.fold((Vec::new(), Vec::new()), |mut acc, elem| { .fold((Vec::new(), Vec::new()), |mut acc, elem| {
match elem { match elem {
@ -2687,7 +2849,7 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
let mut identifier_renames = BTreeMap::new(); let mut identifier_renames = BTreeMap::new();
let vk_parse_definitions: Vec<_> = spec2 let vk_parse_types = spec2
.0 .0
.iter() .iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Types)) .filter_map(get_variant!(vk_parse::RegistryChild::Types))
@ -2696,23 +2858,43 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
.iter() .iter()
.filter_map(get_variant!(vk_parse::TypesChild::Type)) .filter_map(get_variant!(vk_parse::TypesChild::Type))
}) })
.filter_map(|def| generate_definition_vk_parse(def, &mut identifier_renames)) .collect::<Vec<_>>();
let vk_parse_definitions: Vec<_> = vk_parse_types
.iter()
.filter_map(|def| {
generate_definition_vk_parse(def, &required_types, &mut identifier_renames)
})
.collect(); .collect();
let root_structs = root_structs(&definitions); let root_structs = root_structs(&vk_parse_types, &required_types);
let vk_parse_types = vk_parse_types
.into_iter()
.filter_map(|t| t.name.clone().map(|n| (n, t)))
.collect::<HashMap<_, _>>();
let definition_code: Vec<_> = vk_parse_definitions let definition_code: Vec<_> = vk_parse_definitions
.into_iter() .into_iter()
.chain(definitions.into_iter().filter_map(|def| { .chain(definitions.into_iter().filter_map(|def| {
generate_definition( generate_definition(
def, def,
&required_types,
&union_types, &union_types,
&root_structs, &root_structs,
&vk_parse_types,
&mut bitflags_cache, &mut bitflags_cache,
&mut const_values, &mut const_values,
) )
})) }))
.collect(); .collect();
let mut ty_cache = HashSet::new();
let aliases: Vec<_> = spec2
.0
.iter()
.filter_map(get_variant!(vk_parse::RegistryChild::Types))
.map(|ty| generate_aliases_of_types(ty, &required_types, &mut ty_cache))
.collect();
let feature_code: Vec<_> = features let feature_code: Vec<_> = features
.iter() .iter()
.map(|feature| generate_feature(feature, &commands, &mut fn_cache)) .map(|feature| generate_feature(feature, &commands, &mut fn_cache))