Replace builders with lifetimes/setters directly on Vulkan structs (#602)

* Replace builders with lifetimes/setters directly on Vulkan structs

* Inline setters
This commit is contained in:
Benjamin Saunders 2022-03-29 10:15:14 -07:00 committed by GitHub
parent e43e9c0c9b
commit 71bb3d337c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 10112 additions and 29619 deletions

View file

@ -17,8 +17,8 @@ fn main() -> Result<(), Box<dyn Error>> {
unsafe { unsafe {
let entry = ash::Entry::linked(); let entry = ash::Entry::linked();
let surface_extensions = ash_window::enumerate_required_extensions(&window)?; let surface_extensions = ash_window::enumerate_required_extensions(&window)?;
let app_desc = vk::ApplicationInfo::builder().api_version(vk::make_api_version(0, 1, 0, 0)); let app_desc = vk::ApplicationInfo::default().api_version(vk::make_api_version(0, 1, 0, 0));
let instance_desc = vk::InstanceCreateInfo::builder() let instance_desc = vk::InstanceCreateInfo::default()
.application_info(&app_desc) .application_info(&app_desc)
.enabled_extension_names(surface_extensions); .enabled_extension_names(surface_extensions);

View file

@ -26,7 +26,7 @@ pub unsafe fn create_surface(
match window_handle.raw_window_handle() { match window_handle.raw_window_handle() {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
RawWindowHandle::Windows(handle) => { RawWindowHandle::Windows(handle) => {
let surface_desc = vk::Win32SurfaceCreateInfoKHR::builder() let surface_desc = vk::Win32SurfaceCreateInfoKHR::default()
.hinstance(handle.hinstance) .hinstance(handle.hinstance)
.hwnd(handle.hwnd); .hwnd(handle.hwnd);
let surface_fn = khr::Win32Surface::new(entry, instance); let surface_fn = khr::Win32Surface::new(entry, instance);
@ -41,7 +41,7 @@ pub unsafe fn create_surface(
target_os = "openbsd" target_os = "openbsd"
))] ))]
RawWindowHandle::Wayland(handle) => { RawWindowHandle::Wayland(handle) => {
let surface_desc = vk::WaylandSurfaceCreateInfoKHR::builder() let surface_desc = vk::WaylandSurfaceCreateInfoKHR::default()
.display(handle.display) .display(handle.display)
.surface(handle.surface); .surface(handle.surface);
let surface_fn = khr::WaylandSurface::new(entry, instance); let surface_fn = khr::WaylandSurface::new(entry, instance);
@ -56,7 +56,7 @@ pub unsafe fn create_surface(
target_os = "openbsd" target_os = "openbsd"
))] ))]
RawWindowHandle::Xlib(handle) => { RawWindowHandle::Xlib(handle) => {
let surface_desc = vk::XlibSurfaceCreateInfoKHR::builder() let surface_desc = vk::XlibSurfaceCreateInfoKHR::default()
.dpy(handle.display as *mut _) .dpy(handle.display as *mut _)
.window(handle.window); .window(handle.window);
let surface_fn = khr::XlibSurface::new(entry, instance); let surface_fn = khr::XlibSurface::new(entry, instance);
@ -71,7 +71,7 @@ pub unsafe fn create_surface(
target_os = "openbsd" target_os = "openbsd"
))] ))]
RawWindowHandle::Xcb(handle) => { RawWindowHandle::Xcb(handle) => {
let surface_desc = vk::XcbSurfaceCreateInfoKHR::builder() let surface_desc = vk::XcbSurfaceCreateInfoKHR::default()
.connection(handle.connection) .connection(handle.connection)
.window(handle.window); .window(handle.window);
let surface_fn = khr::XcbSurface::new(entry, instance); let surface_fn = khr::XcbSurface::new(entry, instance);
@ -81,7 +81,7 @@ pub unsafe fn create_surface(
#[cfg(any(target_os = "android"))] #[cfg(any(target_os = "android"))]
RawWindowHandle::Android(handle) => { RawWindowHandle::Android(handle) => {
let surface_desc = let surface_desc =
vk::AndroidSurfaceCreateInfoKHR::builder().window(handle.a_native_window); vk::AndroidSurfaceCreateInfoKHR::default().window(handle.a_native_window);
let surface_fn = khr::AndroidSurface::new(entry, instance); let surface_fn = khr::AndroidSurface::new(entry, instance);
surface_fn.create_android_surface(&surface_desc, allocation_callbacks) surface_fn.create_android_surface(&surface_desc, allocation_callbacks)
} }
@ -95,7 +95,7 @@ pub unsafe fn create_surface(
Layer::None => return Err(vk::Result::ERROR_INITIALIZATION_FAILED), Layer::None => return Err(vk::Result::ERROR_INITIALIZATION_FAILED),
}; };
let surface_desc = vk::MetalSurfaceCreateInfoEXT::builder().layer(&*layer); let surface_desc = vk::MetalSurfaceCreateInfoEXT::default().layer(&*layer);
let surface_fn = ext::MetalSurface::new(entry, instance); let surface_fn = ext::MetalSurface::new(entry, instance);
surface_fn.create_metal_surface(&surface_desc, allocation_callbacks) surface_fn.create_metal_surface(&surface_desc, allocation_callbacks)
} }
@ -109,7 +109,7 @@ pub unsafe fn create_surface(
Layer::None => return Err(vk::Result::ERROR_INITIALIZATION_FAILED), Layer::None => return Err(vk::Result::ERROR_INITIALIZATION_FAILED),
}; };
let surface_desc = vk::MetalSurfaceCreateInfoEXT::builder().layer(&*layer); let surface_desc = vk::MetalSurfaceCreateInfoEXT::default().layer(&*layer);
let surface_fn = ext::MetalSurface::new(entry, instance); let surface_fn = ext::MetalSurface::new(entry, instance);
surface_fn.create_metal_surface(&surface_desc, allocation_callbacks) surface_fn.create_metal_surface(&surface_desc, allocation_callbacks)
} }

View file

@ -12,7 +12,7 @@ impl PhysicalDeviceDrm {
) -> vk::PhysicalDeviceDrmPropertiesEXT { ) -> vk::PhysicalDeviceDrmPropertiesEXT {
let mut props_drm = vk::PhysicalDeviceDrmPropertiesEXT::default(); let mut props_drm = vk::PhysicalDeviceDrmPropertiesEXT::default();
{ {
let mut props = vk::PhysicalDeviceProperties2::builder().push_next(&mut props_drm); let mut props = vk::PhysicalDeviceProperties2::default().push_next(&mut props_drm);
instance.get_physical_device_properties2(pdevice, &mut props); instance.get_physical_device_properties2(pdevice, &mut props);
} }
props_drm props_drm

View file

@ -26,7 +26,7 @@ impl AccelerationStructure {
) -> vk::PhysicalDeviceAccelerationStructurePropertiesKHR { ) -> vk::PhysicalDeviceAccelerationStructurePropertiesKHR {
let mut props_rt = vk::PhysicalDeviceAccelerationStructurePropertiesKHR::default(); let mut props_rt = vk::PhysicalDeviceAccelerationStructurePropertiesKHR::default();
{ {
let mut props = vk::PhysicalDeviceProperties2::builder().push_next(&mut props_rt); let mut props = vk::PhysicalDeviceProperties2::default().push_next(&mut props_rt);
instance.get_physical_device_properties2(pdevice, &mut props); instance.get_physical_device_properties2(pdevice, &mut props);
} }
props_rt props_rt

View file

@ -26,7 +26,7 @@ impl RayTracingPipeline {
) -> vk::PhysicalDeviceRayTracingPipelinePropertiesKHR { ) -> vk::PhysicalDeviceRayTracingPipelinePropertiesKHR {
let mut props_rt = vk::PhysicalDeviceRayTracingPipelinePropertiesKHR::default(); let mut props_rt = vk::PhysicalDeviceRayTracingPipelinePropertiesKHR::default();
{ {
let mut props = vk::PhysicalDeviceProperties2::builder().push_next(&mut props_rt); let mut props = vk::PhysicalDeviceProperties2::default().push_next(&mut props_rt);
instance.get_physical_device_properties2(pdevice, &mut props); instance.get_physical_device_properties2(pdevice, &mut props);
} }
props_rt props_rt

View file

@ -26,7 +26,7 @@ impl RayTracing {
) -> vk::PhysicalDeviceRayTracingPropertiesNV { ) -> vk::PhysicalDeviceRayTracingPropertiesNV {
let mut props_rt = vk::PhysicalDeviceRayTracingPropertiesNV::default(); let mut props_rt = vk::PhysicalDeviceRayTracingPropertiesNV::default();
{ {
let mut props = vk::PhysicalDeviceProperties2::builder().push_next(&mut props_rt); let mut props = vk::PhysicalDeviceProperties2::default().push_next(&mut props_rt);
instance.get_physical_device_properties2(pdevice, &mut props); instance.get_physical_device_properties2(pdevice, &mut props);
} }
props_rt props_rt

View file

@ -71,13 +71,13 @@ mod tests {
use super::vk; use super::vk;
#[test] #[test]
fn test_ptr_chains() { fn test_ptr_chains() {
let mut variable_pointers = vk::PhysicalDeviceVariablePointerFeatures::builder(); let mut variable_pointers = vk::PhysicalDeviceVariablePointerFeatures::default();
let mut corner = vk::PhysicalDeviceCornerSampledImageFeaturesNV::builder(); let mut corner = vk::PhysicalDeviceCornerSampledImageFeaturesNV::default();
let chain = vec![ let chain = vec![
<*mut _>::cast(&mut variable_pointers), <*mut _>::cast(&mut variable_pointers),
<*mut _>::cast(&mut corner), <*mut _>::cast(&mut corner),
]; ];
let mut device_create_info = vk::DeviceCreateInfo::builder() let mut device_create_info = vk::DeviceCreateInfo::default()
.push_next(&mut corner) .push_next(&mut corner)
.push_next(&mut variable_pointers); .push_next(&mut variable_pointers);
let chain2: Vec<*mut vk::BaseOutStructure> = unsafe { let chain2: Vec<*mut vk::BaseOutStructure> = unsafe {

View file

@ -45,198 +45,216 @@ pub type ChromaLocationKHR = ChromaLocation;
pub type SamplerReductionModeEXT = SamplerReductionMode; pub type SamplerReductionModeEXT = SamplerReductionMode;
pub type ShaderFloatControlsIndependenceKHR = ShaderFloatControlsIndependence; pub type ShaderFloatControlsIndependenceKHR = ShaderFloatControlsIndependence;
pub type DriverIdKHR = DriverId; pub type DriverIdKHR = DriverId;
pub type DevicePrivateDataCreateInfoEXT = DevicePrivateDataCreateInfo; pub type DevicePrivateDataCreateInfoEXT<'a> = DevicePrivateDataCreateInfo<'a>;
pub type PrivateDataSlotCreateInfoEXT = PrivateDataSlotCreateInfo; pub type PrivateDataSlotCreateInfoEXT<'a> = PrivateDataSlotCreateInfo<'a>;
pub type PhysicalDevicePrivateDataFeaturesEXT = PhysicalDevicePrivateDataFeatures; pub type PhysicalDevicePrivateDataFeaturesEXT<'a> = PhysicalDevicePrivateDataFeatures<'a>;
pub type PhysicalDeviceFeatures2KHR = PhysicalDeviceFeatures2; pub type PhysicalDeviceFeatures2KHR<'a> = PhysicalDeviceFeatures2<'a>;
pub type PhysicalDeviceProperties2KHR = PhysicalDeviceProperties2; pub type PhysicalDeviceProperties2KHR<'a> = PhysicalDeviceProperties2<'a>;
pub type FormatProperties2KHR = FormatProperties2; pub type FormatProperties2KHR<'a> = FormatProperties2<'a>;
pub type ImageFormatProperties2KHR = ImageFormatProperties2; pub type ImageFormatProperties2KHR<'a> = ImageFormatProperties2<'a>;
pub type PhysicalDeviceImageFormatInfo2KHR = PhysicalDeviceImageFormatInfo2; pub type PhysicalDeviceImageFormatInfo2KHR<'a> = PhysicalDeviceImageFormatInfo2<'a>;
pub type QueueFamilyProperties2KHR = QueueFamilyProperties2; pub type QueueFamilyProperties2KHR<'a> = QueueFamilyProperties2<'a>;
pub type PhysicalDeviceMemoryProperties2KHR = PhysicalDeviceMemoryProperties2; pub type PhysicalDeviceMemoryProperties2KHR<'a> = PhysicalDeviceMemoryProperties2<'a>;
pub type SparseImageFormatProperties2KHR = SparseImageFormatProperties2; pub type SparseImageFormatProperties2KHR<'a> = SparseImageFormatProperties2<'a>;
pub type PhysicalDeviceSparseImageFormatInfo2KHR = PhysicalDeviceSparseImageFormatInfo2; pub type PhysicalDeviceSparseImageFormatInfo2KHR<'a> = PhysicalDeviceSparseImageFormatInfo2<'a>;
pub type ConformanceVersionKHR = ConformanceVersion; pub type ConformanceVersionKHR = ConformanceVersion;
pub type PhysicalDeviceDriverPropertiesKHR = PhysicalDeviceDriverProperties; pub type PhysicalDeviceDriverPropertiesKHR<'a> = PhysicalDeviceDriverProperties<'a>;
pub type PhysicalDeviceVariablePointersFeaturesKHR = PhysicalDeviceVariablePointersFeatures; pub type PhysicalDeviceVariablePointersFeaturesKHR<'a> = PhysicalDeviceVariablePointersFeatures<'a>;
pub type PhysicalDeviceVariablePointerFeaturesKHR = PhysicalDeviceVariablePointersFeatures; pub type PhysicalDeviceVariablePointerFeaturesKHR<'a> = PhysicalDeviceVariablePointersFeatures<'a>;
pub type PhysicalDeviceVariablePointerFeatures = PhysicalDeviceVariablePointersFeatures; pub type PhysicalDeviceVariablePointerFeatures<'a> = PhysicalDeviceVariablePointersFeatures<'a>;
pub type ExternalMemoryPropertiesKHR = ExternalMemoryProperties; pub type ExternalMemoryPropertiesKHR = ExternalMemoryProperties;
pub type PhysicalDeviceExternalImageFormatInfoKHR = PhysicalDeviceExternalImageFormatInfo; pub type PhysicalDeviceExternalImageFormatInfoKHR<'a> = PhysicalDeviceExternalImageFormatInfo<'a>;
pub type ExternalImageFormatPropertiesKHR = ExternalImageFormatProperties; pub type ExternalImageFormatPropertiesKHR<'a> = ExternalImageFormatProperties<'a>;
pub type PhysicalDeviceExternalBufferInfoKHR = PhysicalDeviceExternalBufferInfo; pub type PhysicalDeviceExternalBufferInfoKHR<'a> = PhysicalDeviceExternalBufferInfo<'a>;
pub type ExternalBufferPropertiesKHR = ExternalBufferProperties; pub type ExternalBufferPropertiesKHR<'a> = ExternalBufferProperties<'a>;
pub type PhysicalDeviceIDPropertiesKHR = PhysicalDeviceIDProperties; pub type PhysicalDeviceIDPropertiesKHR<'a> = PhysicalDeviceIDProperties<'a>;
pub type ExternalMemoryImageCreateInfoKHR = ExternalMemoryImageCreateInfo; pub type ExternalMemoryImageCreateInfoKHR<'a> = ExternalMemoryImageCreateInfo<'a>;
pub type ExternalMemoryBufferCreateInfoKHR = ExternalMemoryBufferCreateInfo; pub type ExternalMemoryBufferCreateInfoKHR<'a> = ExternalMemoryBufferCreateInfo<'a>;
pub type ExportMemoryAllocateInfoKHR = ExportMemoryAllocateInfo; pub type ExportMemoryAllocateInfoKHR<'a> = ExportMemoryAllocateInfo<'a>;
pub type PhysicalDeviceExternalSemaphoreInfoKHR = PhysicalDeviceExternalSemaphoreInfo; pub type PhysicalDeviceExternalSemaphoreInfoKHR<'a> = PhysicalDeviceExternalSemaphoreInfo<'a>;
pub type ExternalSemaphorePropertiesKHR = ExternalSemaphoreProperties; pub type ExternalSemaphorePropertiesKHR<'a> = ExternalSemaphoreProperties<'a>;
pub type ExportSemaphoreCreateInfoKHR = ExportSemaphoreCreateInfo; pub type ExportSemaphoreCreateInfoKHR<'a> = ExportSemaphoreCreateInfo<'a>;
pub type PhysicalDeviceExternalFenceInfoKHR = PhysicalDeviceExternalFenceInfo; pub type PhysicalDeviceExternalFenceInfoKHR<'a> = PhysicalDeviceExternalFenceInfo<'a>;
pub type ExternalFencePropertiesKHR = ExternalFenceProperties; pub type ExternalFencePropertiesKHR<'a> = ExternalFenceProperties<'a>;
pub type ExportFenceCreateInfoKHR = ExportFenceCreateInfo; pub type ExportFenceCreateInfoKHR<'a> = ExportFenceCreateInfo<'a>;
pub type PhysicalDeviceMultiviewFeaturesKHR = PhysicalDeviceMultiviewFeatures; pub type PhysicalDeviceMultiviewFeaturesKHR<'a> = PhysicalDeviceMultiviewFeatures<'a>;
pub type PhysicalDeviceMultiviewPropertiesKHR = PhysicalDeviceMultiviewProperties; pub type PhysicalDeviceMultiviewPropertiesKHR<'a> = PhysicalDeviceMultiviewProperties<'a>;
pub type RenderPassMultiviewCreateInfoKHR = RenderPassMultiviewCreateInfo; pub type RenderPassMultiviewCreateInfoKHR<'a> = RenderPassMultiviewCreateInfo<'a>;
pub type PhysicalDeviceGroupPropertiesKHR = PhysicalDeviceGroupProperties; pub type PhysicalDeviceGroupPropertiesKHR<'a> = PhysicalDeviceGroupProperties<'a>;
pub type MemoryAllocateFlagsInfoKHR = MemoryAllocateFlagsInfo; pub type MemoryAllocateFlagsInfoKHR<'a> = MemoryAllocateFlagsInfo<'a>;
pub type BindBufferMemoryInfoKHR = BindBufferMemoryInfo; pub type BindBufferMemoryInfoKHR<'a> = BindBufferMemoryInfo<'a>;
pub type BindBufferMemoryDeviceGroupInfoKHR = BindBufferMemoryDeviceGroupInfo; pub type BindBufferMemoryDeviceGroupInfoKHR<'a> = BindBufferMemoryDeviceGroupInfo<'a>;
pub type BindImageMemoryInfoKHR = BindImageMemoryInfo; pub type BindImageMemoryInfoKHR<'a> = BindImageMemoryInfo<'a>;
pub type BindImageMemoryDeviceGroupInfoKHR = BindImageMemoryDeviceGroupInfo; pub type BindImageMemoryDeviceGroupInfoKHR<'a> = BindImageMemoryDeviceGroupInfo<'a>;
pub type DeviceGroupRenderPassBeginInfoKHR = DeviceGroupRenderPassBeginInfo; pub type DeviceGroupRenderPassBeginInfoKHR<'a> = DeviceGroupRenderPassBeginInfo<'a>;
pub type DeviceGroupCommandBufferBeginInfoKHR = DeviceGroupCommandBufferBeginInfo; pub type DeviceGroupCommandBufferBeginInfoKHR<'a> = DeviceGroupCommandBufferBeginInfo<'a>;
pub type DeviceGroupSubmitInfoKHR = DeviceGroupSubmitInfo; pub type DeviceGroupSubmitInfoKHR<'a> = DeviceGroupSubmitInfo<'a>;
pub type DeviceGroupBindSparseInfoKHR = DeviceGroupBindSparseInfo; pub type DeviceGroupBindSparseInfoKHR<'a> = DeviceGroupBindSparseInfo<'a>;
pub type DeviceGroupDeviceCreateInfoKHR = DeviceGroupDeviceCreateInfo; pub type DeviceGroupDeviceCreateInfoKHR<'a> = DeviceGroupDeviceCreateInfo<'a>;
pub type DescriptorUpdateTemplateEntryKHR = DescriptorUpdateTemplateEntry; pub type DescriptorUpdateTemplateEntryKHR = DescriptorUpdateTemplateEntry;
pub type DescriptorUpdateTemplateCreateInfoKHR = DescriptorUpdateTemplateCreateInfo; pub type DescriptorUpdateTemplateCreateInfoKHR<'a> = DescriptorUpdateTemplateCreateInfo<'a>;
pub type InputAttachmentAspectReferenceKHR = InputAttachmentAspectReference; pub type InputAttachmentAspectReferenceKHR = InputAttachmentAspectReference;
pub type RenderPassInputAttachmentAspectCreateInfoKHR = RenderPassInputAttachmentAspectCreateInfo; pub type RenderPassInputAttachmentAspectCreateInfoKHR<'a> =
pub type PhysicalDevice16BitStorageFeaturesKHR = PhysicalDevice16BitStorageFeatures; RenderPassInputAttachmentAspectCreateInfo<'a>;
pub type PhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR = pub type PhysicalDevice16BitStorageFeaturesKHR<'a> = PhysicalDevice16BitStorageFeatures<'a>;
PhysicalDeviceShaderSubgroupExtendedTypesFeatures; pub type PhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR<'a> =
pub type BufferMemoryRequirementsInfo2KHR = BufferMemoryRequirementsInfo2; PhysicalDeviceShaderSubgroupExtendedTypesFeatures<'a>;
pub type DeviceBufferMemoryRequirementsKHR = DeviceBufferMemoryRequirements; pub type BufferMemoryRequirementsInfo2KHR<'a> = BufferMemoryRequirementsInfo2<'a>;
pub type ImageMemoryRequirementsInfo2KHR = ImageMemoryRequirementsInfo2; pub type DeviceBufferMemoryRequirementsKHR<'a> = DeviceBufferMemoryRequirements<'a>;
pub type ImageSparseMemoryRequirementsInfo2KHR = ImageSparseMemoryRequirementsInfo2; pub type ImageMemoryRequirementsInfo2KHR<'a> = ImageMemoryRequirementsInfo2<'a>;
pub type DeviceImageMemoryRequirementsKHR = DeviceImageMemoryRequirements; pub type ImageSparseMemoryRequirementsInfo2KHR<'a> = ImageSparseMemoryRequirementsInfo2<'a>;
pub type MemoryRequirements2KHR = MemoryRequirements2; pub type DeviceImageMemoryRequirementsKHR<'a> = DeviceImageMemoryRequirements<'a>;
pub type SparseImageMemoryRequirements2KHR = SparseImageMemoryRequirements2; pub type MemoryRequirements2KHR<'a> = MemoryRequirements2<'a>;
pub type PhysicalDevicePointClippingPropertiesKHR = PhysicalDevicePointClippingProperties; pub type SparseImageMemoryRequirements2KHR<'a> = SparseImageMemoryRequirements2<'a>;
pub type MemoryDedicatedRequirementsKHR = MemoryDedicatedRequirements; pub type PhysicalDevicePointClippingPropertiesKHR<'a> = PhysicalDevicePointClippingProperties<'a>;
pub type MemoryDedicatedAllocateInfoKHR = MemoryDedicatedAllocateInfo; pub type MemoryDedicatedRequirementsKHR<'a> = MemoryDedicatedRequirements<'a>;
pub type ImageViewUsageCreateInfoKHR = ImageViewUsageCreateInfo; pub type MemoryDedicatedAllocateInfoKHR<'a> = MemoryDedicatedAllocateInfo<'a>;
pub type PipelineTessellationDomainOriginStateCreateInfoKHR = pub type ImageViewUsageCreateInfoKHR<'a> = ImageViewUsageCreateInfo<'a>;
PipelineTessellationDomainOriginStateCreateInfo; pub type PipelineTessellationDomainOriginStateCreateInfoKHR<'a> =
pub type SamplerYcbcrConversionInfoKHR = SamplerYcbcrConversionInfo; PipelineTessellationDomainOriginStateCreateInfo<'a>;
pub type SamplerYcbcrConversionCreateInfoKHR = SamplerYcbcrConversionCreateInfo; pub type SamplerYcbcrConversionInfoKHR<'a> = SamplerYcbcrConversionInfo<'a>;
pub type BindImagePlaneMemoryInfoKHR = BindImagePlaneMemoryInfo; pub type SamplerYcbcrConversionCreateInfoKHR<'a> = SamplerYcbcrConversionCreateInfo<'a>;
pub type ImagePlaneMemoryRequirementsInfoKHR = ImagePlaneMemoryRequirementsInfo; pub type BindImagePlaneMemoryInfoKHR<'a> = BindImagePlaneMemoryInfo<'a>;
pub type PhysicalDeviceSamplerYcbcrConversionFeaturesKHR = pub type ImagePlaneMemoryRequirementsInfoKHR<'a> = ImagePlaneMemoryRequirementsInfo<'a>;
PhysicalDeviceSamplerYcbcrConversionFeatures; pub type PhysicalDeviceSamplerYcbcrConversionFeaturesKHR<'a> =
pub type SamplerYcbcrConversionImageFormatPropertiesKHR = PhysicalDeviceSamplerYcbcrConversionFeatures<'a>;
SamplerYcbcrConversionImageFormatProperties; pub type SamplerYcbcrConversionImageFormatPropertiesKHR<'a> =
pub type PhysicalDeviceSamplerFilterMinmaxPropertiesEXT = SamplerYcbcrConversionImageFormatProperties<'a>;
PhysicalDeviceSamplerFilterMinmaxProperties; pub type PhysicalDeviceSamplerFilterMinmaxPropertiesEXT<'a> =
pub type SamplerReductionModeCreateInfoEXT = SamplerReductionModeCreateInfo; PhysicalDeviceSamplerFilterMinmaxProperties<'a>;
pub type PhysicalDeviceInlineUniformBlockFeaturesEXT = PhysicalDeviceInlineUniformBlockFeatures; pub type SamplerReductionModeCreateInfoEXT<'a> = SamplerReductionModeCreateInfo<'a>;
pub type PhysicalDeviceInlineUniformBlockPropertiesEXT = PhysicalDeviceInlineUniformBlockProperties; pub type PhysicalDeviceInlineUniformBlockFeaturesEXT<'a> =
pub type WriteDescriptorSetInlineUniformBlockEXT = WriteDescriptorSetInlineUniformBlock; PhysicalDeviceInlineUniformBlockFeatures<'a>;
pub type DescriptorPoolInlineUniformBlockCreateInfoEXT = DescriptorPoolInlineUniformBlockCreateInfo; pub type PhysicalDeviceInlineUniformBlockPropertiesEXT<'a> =
pub type ImageFormatListCreateInfoKHR = ImageFormatListCreateInfo; PhysicalDeviceInlineUniformBlockProperties<'a>;
pub type PhysicalDeviceMaintenance3PropertiesKHR = PhysicalDeviceMaintenance3Properties; pub type WriteDescriptorSetInlineUniformBlockEXT<'a> = WriteDescriptorSetInlineUniformBlock<'a>;
pub type PhysicalDeviceMaintenance4FeaturesKHR = PhysicalDeviceMaintenance4Features; pub type DescriptorPoolInlineUniformBlockCreateInfoEXT<'a> =
pub type PhysicalDeviceMaintenance4PropertiesKHR = PhysicalDeviceMaintenance4Properties; DescriptorPoolInlineUniformBlockCreateInfo<'a>;
pub type DescriptorSetLayoutSupportKHR = DescriptorSetLayoutSupport; pub type ImageFormatListCreateInfoKHR<'a> = ImageFormatListCreateInfo<'a>;
pub type PhysicalDeviceShaderDrawParameterFeatures = PhysicalDeviceShaderDrawParametersFeatures; pub type PhysicalDeviceMaintenance3PropertiesKHR<'a> = PhysicalDeviceMaintenance3Properties<'a>;
pub type PhysicalDeviceShaderFloat16Int8FeaturesKHR = PhysicalDeviceShaderFloat16Int8Features; pub type PhysicalDeviceMaintenance4FeaturesKHR<'a> = PhysicalDeviceMaintenance4Features<'a>;
pub type PhysicalDeviceFloat16Int8FeaturesKHR = PhysicalDeviceShaderFloat16Int8Features; pub type PhysicalDeviceMaintenance4PropertiesKHR<'a> = PhysicalDeviceMaintenance4Properties<'a>;
pub type PhysicalDeviceFloatControlsPropertiesKHR = PhysicalDeviceFloatControlsProperties; pub type DescriptorSetLayoutSupportKHR<'a> = DescriptorSetLayoutSupport<'a>;
pub type PhysicalDeviceHostQueryResetFeaturesEXT = PhysicalDeviceHostQueryResetFeatures; pub type PhysicalDeviceShaderDrawParameterFeatures<'a> =
pub type DeviceQueueGlobalPriorityCreateInfoEXT = DeviceQueueGlobalPriorityCreateInfoKHR; PhysicalDeviceShaderDrawParametersFeatures<'a>;
pub type PhysicalDeviceGlobalPriorityQueryFeaturesEXT = pub type PhysicalDeviceShaderFloat16Int8FeaturesKHR<'a> =
PhysicalDeviceGlobalPriorityQueryFeaturesKHR; PhysicalDeviceShaderFloat16Int8Features<'a>;
pub type QueueFamilyGlobalPriorityPropertiesEXT = QueueFamilyGlobalPriorityPropertiesKHR; pub type PhysicalDeviceFloat16Int8FeaturesKHR<'a> = PhysicalDeviceShaderFloat16Int8Features<'a>;
pub type PhysicalDeviceDescriptorIndexingFeaturesEXT = PhysicalDeviceDescriptorIndexingFeatures; pub type PhysicalDeviceFloatControlsPropertiesKHR<'a> = PhysicalDeviceFloatControlsProperties<'a>;
pub type PhysicalDeviceDescriptorIndexingPropertiesEXT = PhysicalDeviceDescriptorIndexingProperties; pub type PhysicalDeviceHostQueryResetFeaturesEXT<'a> = PhysicalDeviceHostQueryResetFeatures<'a>;
pub type DescriptorSetLayoutBindingFlagsCreateInfoEXT = DescriptorSetLayoutBindingFlagsCreateInfo; pub type DeviceQueueGlobalPriorityCreateInfoEXT<'a> = DeviceQueueGlobalPriorityCreateInfoKHR<'a>;
pub type DescriptorSetVariableDescriptorCountAllocateInfoEXT = pub type PhysicalDeviceGlobalPriorityQueryFeaturesEXT<'a> =
DescriptorSetVariableDescriptorCountAllocateInfo; PhysicalDeviceGlobalPriorityQueryFeaturesKHR<'a>;
pub type DescriptorSetVariableDescriptorCountLayoutSupportEXT = pub type QueueFamilyGlobalPriorityPropertiesEXT<'a> = QueueFamilyGlobalPriorityPropertiesKHR<'a>;
DescriptorSetVariableDescriptorCountLayoutSupport; pub type PhysicalDeviceDescriptorIndexingFeaturesEXT<'a> =
pub type AttachmentDescription2KHR = AttachmentDescription2; PhysicalDeviceDescriptorIndexingFeatures<'a>;
pub type AttachmentReference2KHR = AttachmentReference2; pub type PhysicalDeviceDescriptorIndexingPropertiesEXT<'a> =
pub type SubpassDescription2KHR = SubpassDescription2; PhysicalDeviceDescriptorIndexingProperties<'a>;
pub type SubpassDependency2KHR = SubpassDependency2; pub type DescriptorSetLayoutBindingFlagsCreateInfoEXT<'a> =
pub type RenderPassCreateInfo2KHR = RenderPassCreateInfo2; DescriptorSetLayoutBindingFlagsCreateInfo<'a>;
pub type SubpassBeginInfoKHR = SubpassBeginInfo; pub type DescriptorSetVariableDescriptorCountAllocateInfoEXT<'a> =
pub type SubpassEndInfoKHR = SubpassEndInfo; DescriptorSetVariableDescriptorCountAllocateInfo<'a>;
pub type PhysicalDeviceTimelineSemaphoreFeaturesKHR = PhysicalDeviceTimelineSemaphoreFeatures; pub type DescriptorSetVariableDescriptorCountLayoutSupportEXT<'a> =
pub type PhysicalDeviceTimelineSemaphorePropertiesKHR = PhysicalDeviceTimelineSemaphoreProperties; DescriptorSetVariableDescriptorCountLayoutSupport<'a>;
pub type SemaphoreTypeCreateInfoKHR = SemaphoreTypeCreateInfo; pub type AttachmentDescription2KHR<'a> = AttachmentDescription2<'a>;
pub type TimelineSemaphoreSubmitInfoKHR = TimelineSemaphoreSubmitInfo; pub type AttachmentReference2KHR<'a> = AttachmentReference2<'a>;
pub type SemaphoreWaitInfoKHR = SemaphoreWaitInfo; pub type SubpassDescription2KHR<'a> = SubpassDescription2<'a>;
pub type SemaphoreSignalInfoKHR = SemaphoreSignalInfo; pub type SubpassDependency2KHR<'a> = SubpassDependency2<'a>;
pub type PhysicalDevice8BitStorageFeaturesKHR = PhysicalDevice8BitStorageFeatures; pub type RenderPassCreateInfo2KHR<'a> = RenderPassCreateInfo2<'a>;
pub type PhysicalDeviceVulkanMemoryModelFeaturesKHR = PhysicalDeviceVulkanMemoryModelFeatures; pub type SubpassBeginInfoKHR<'a> = SubpassBeginInfo<'a>;
pub type PhysicalDeviceShaderAtomicInt64FeaturesKHR = PhysicalDeviceShaderAtomicInt64Features; pub type SubpassEndInfoKHR<'a> = SubpassEndInfo<'a>;
pub type PhysicalDeviceDepthStencilResolvePropertiesKHR = pub type PhysicalDeviceTimelineSemaphoreFeaturesKHR<'a> =
PhysicalDeviceDepthStencilResolveProperties; PhysicalDeviceTimelineSemaphoreFeatures<'a>;
pub type SubpassDescriptionDepthStencilResolveKHR = SubpassDescriptionDepthStencilResolve; pub type PhysicalDeviceTimelineSemaphorePropertiesKHR<'a> =
pub type ImageStencilUsageCreateInfoEXT = ImageStencilUsageCreateInfo; PhysicalDeviceTimelineSemaphoreProperties<'a>;
pub type PhysicalDeviceScalarBlockLayoutFeaturesEXT = PhysicalDeviceScalarBlockLayoutFeatures; pub type SemaphoreTypeCreateInfoKHR<'a> = SemaphoreTypeCreateInfo<'a>;
pub type PhysicalDeviceUniformBufferStandardLayoutFeaturesKHR = pub type TimelineSemaphoreSubmitInfoKHR<'a> = TimelineSemaphoreSubmitInfo<'a>;
PhysicalDeviceUniformBufferStandardLayoutFeatures; pub type SemaphoreWaitInfoKHR<'a> = SemaphoreWaitInfo<'a>;
pub type PhysicalDeviceBufferDeviceAddressFeaturesKHR = PhysicalDeviceBufferDeviceAddressFeatures; pub type SemaphoreSignalInfoKHR<'a> = SemaphoreSignalInfo<'a>;
pub type PhysicalDeviceBufferAddressFeaturesEXT = PhysicalDeviceBufferDeviceAddressFeaturesEXT; pub type PhysicalDevice8BitStorageFeaturesKHR<'a> = PhysicalDevice8BitStorageFeatures<'a>;
pub type BufferDeviceAddressInfoKHR = BufferDeviceAddressInfo; pub type PhysicalDeviceVulkanMemoryModelFeaturesKHR<'a> =
pub type BufferDeviceAddressInfoEXT = BufferDeviceAddressInfo; PhysicalDeviceVulkanMemoryModelFeatures<'a>;
pub type BufferOpaqueCaptureAddressCreateInfoKHR = BufferOpaqueCaptureAddressCreateInfo; pub type PhysicalDeviceShaderAtomicInt64FeaturesKHR<'a> =
pub type PhysicalDeviceImagelessFramebufferFeaturesKHR = PhysicalDeviceImagelessFramebufferFeatures; PhysicalDeviceShaderAtomicInt64Features<'a>;
pub type FramebufferAttachmentsCreateInfoKHR = FramebufferAttachmentsCreateInfo; pub type PhysicalDeviceDepthStencilResolvePropertiesKHR<'a> =
pub type FramebufferAttachmentImageInfoKHR = FramebufferAttachmentImageInfo; PhysicalDeviceDepthStencilResolveProperties<'a>;
pub type RenderPassAttachmentBeginInfoKHR = RenderPassAttachmentBeginInfo; pub type SubpassDescriptionDepthStencilResolveKHR<'a> = SubpassDescriptionDepthStencilResolve<'a>;
pub type PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT = pub type ImageStencilUsageCreateInfoEXT<'a> = ImageStencilUsageCreateInfo<'a>;
PhysicalDeviceTextureCompressionASTCHDRFeatures; pub type PhysicalDeviceScalarBlockLayoutFeaturesEXT<'a> =
PhysicalDeviceScalarBlockLayoutFeatures<'a>;
pub type PhysicalDeviceUniformBufferStandardLayoutFeaturesKHR<'a> =
PhysicalDeviceUniformBufferStandardLayoutFeatures<'a>;
pub type PhysicalDeviceBufferDeviceAddressFeaturesKHR<'a> =
PhysicalDeviceBufferDeviceAddressFeatures<'a>;
pub type PhysicalDeviceBufferAddressFeaturesEXT<'a> =
PhysicalDeviceBufferDeviceAddressFeaturesEXT<'a>;
pub type BufferDeviceAddressInfoKHR<'a> = BufferDeviceAddressInfo<'a>;
pub type BufferDeviceAddressInfoEXT<'a> = BufferDeviceAddressInfo<'a>;
pub type BufferOpaqueCaptureAddressCreateInfoKHR<'a> = BufferOpaqueCaptureAddressCreateInfo<'a>;
pub type PhysicalDeviceImagelessFramebufferFeaturesKHR<'a> =
PhysicalDeviceImagelessFramebufferFeatures<'a>;
pub type FramebufferAttachmentsCreateInfoKHR<'a> = FramebufferAttachmentsCreateInfo<'a>;
pub type FramebufferAttachmentImageInfoKHR<'a> = FramebufferAttachmentImageInfo<'a>;
pub type RenderPassAttachmentBeginInfoKHR<'a> = RenderPassAttachmentBeginInfo<'a>;
pub type PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT<'a> =
PhysicalDeviceTextureCompressionASTCHDRFeatures<'a>;
pub type PipelineCreationFeedbackEXT = PipelineCreationFeedback; pub type PipelineCreationFeedbackEXT = PipelineCreationFeedback;
pub type PipelineCreationFeedbackCreateInfoEXT = PipelineCreationFeedbackCreateInfo; pub type PipelineCreationFeedbackCreateInfoEXT<'a> = PipelineCreationFeedbackCreateInfo<'a>;
pub type QueryPoolCreateInfoINTEL = QueryPoolPerformanceQueryCreateInfoINTEL; pub type QueryPoolCreateInfoINTEL<'a> = QueryPoolPerformanceQueryCreateInfoINTEL<'a>;
pub type PhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR = pub type PhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR<'a> =
PhysicalDeviceSeparateDepthStencilLayoutsFeatures; PhysicalDeviceSeparateDepthStencilLayoutsFeatures<'a>;
pub type AttachmentReferenceStencilLayoutKHR = AttachmentReferenceStencilLayout; pub type AttachmentReferenceStencilLayoutKHR<'a> = AttachmentReferenceStencilLayout<'a>;
pub type AttachmentDescriptionStencilLayoutKHR = AttachmentDescriptionStencilLayout; pub type AttachmentDescriptionStencilLayoutKHR<'a> = AttachmentDescriptionStencilLayout<'a>;
pub type PhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT = pub type PhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT<'a> =
PhysicalDeviceShaderDemoteToHelperInvocationFeatures; PhysicalDeviceShaderDemoteToHelperInvocationFeatures<'a>;
pub type PhysicalDeviceTexelBufferAlignmentPropertiesEXT = pub type PhysicalDeviceTexelBufferAlignmentPropertiesEXT<'a> =
PhysicalDeviceTexelBufferAlignmentProperties; PhysicalDeviceTexelBufferAlignmentProperties<'a>;
pub type PhysicalDeviceSubgroupSizeControlFeaturesEXT = PhysicalDeviceSubgroupSizeControlFeatures; pub type PhysicalDeviceSubgroupSizeControlFeaturesEXT<'a> =
pub type PhysicalDeviceSubgroupSizeControlPropertiesEXT = PhysicalDeviceSubgroupSizeControlFeatures<'a>;
PhysicalDeviceSubgroupSizeControlProperties; pub type PhysicalDeviceSubgroupSizeControlPropertiesEXT<'a> =
pub type PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT = PhysicalDeviceSubgroupSizeControlProperties<'a>;
PipelineShaderStageRequiredSubgroupSizeCreateInfo; pub type PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT<'a> =
pub type MemoryOpaqueCaptureAddressAllocateInfoKHR = MemoryOpaqueCaptureAddressAllocateInfo; PipelineShaderStageRequiredSubgroupSizeCreateInfo<'a>;
pub type DeviceMemoryOpaqueCaptureAddressInfoKHR = DeviceMemoryOpaqueCaptureAddressInfo; pub type MemoryOpaqueCaptureAddressAllocateInfoKHR<'a> = MemoryOpaqueCaptureAddressAllocateInfo<'a>;
pub type PhysicalDevicePipelineCreationCacheControlFeaturesEXT = pub type DeviceMemoryOpaqueCaptureAddressInfoKHR<'a> = DeviceMemoryOpaqueCaptureAddressInfo<'a>;
PhysicalDevicePipelineCreationCacheControlFeatures; pub type PhysicalDevicePipelineCreationCacheControlFeaturesEXT<'a> =
pub type PhysicalDeviceToolPropertiesEXT = PhysicalDeviceToolProperties; PhysicalDevicePipelineCreationCacheControlFeatures<'a>;
pub type PhysicalDeviceToolPropertiesEXT<'a> = PhysicalDeviceToolProperties<'a>;
pub type AabbPositionsNV = AabbPositionsKHR; pub type AabbPositionsNV = AabbPositionsKHR;
pub type TransformMatrixNV = TransformMatrixKHR; pub type TransformMatrixNV = TransformMatrixKHR;
pub type AccelerationStructureInstanceNV = AccelerationStructureInstanceKHR; pub type AccelerationStructureInstanceNV = AccelerationStructureInstanceKHR;
pub type PhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR = pub type PhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR<'a> =
PhysicalDeviceZeroInitializeWorkgroupMemoryFeatures; PhysicalDeviceZeroInitializeWorkgroupMemoryFeatures<'a>;
pub type PhysicalDeviceImageRobustnessFeaturesEXT = PhysicalDeviceImageRobustnessFeatures; pub type PhysicalDeviceImageRobustnessFeaturesEXT<'a> = PhysicalDeviceImageRobustnessFeatures<'a>;
pub type BufferCopy2KHR = BufferCopy2; pub type BufferCopy2KHR<'a> = BufferCopy2<'a>;
pub type ImageCopy2KHR = ImageCopy2; pub type ImageCopy2KHR<'a> = ImageCopy2<'a>;
pub type ImageBlit2KHR = ImageBlit2; pub type ImageBlit2KHR<'a> = ImageBlit2<'a>;
pub type BufferImageCopy2KHR = BufferImageCopy2; pub type BufferImageCopy2KHR<'a> = BufferImageCopy2<'a>;
pub type ImageResolve2KHR = ImageResolve2; pub type ImageResolve2KHR<'a> = ImageResolve2<'a>;
pub type CopyBufferInfo2KHR = CopyBufferInfo2; pub type CopyBufferInfo2KHR<'a> = CopyBufferInfo2<'a>;
pub type CopyImageInfo2KHR = CopyImageInfo2; pub type CopyImageInfo2KHR<'a> = CopyImageInfo2<'a>;
pub type BlitImageInfo2KHR = BlitImageInfo2; pub type BlitImageInfo2KHR<'a> = BlitImageInfo2<'a>;
pub type CopyBufferToImageInfo2KHR = CopyBufferToImageInfo2; pub type CopyBufferToImageInfo2KHR<'a> = CopyBufferToImageInfo2<'a>;
pub type CopyImageToBufferInfo2KHR = CopyImageToBufferInfo2; pub type CopyImageToBufferInfo2KHR<'a> = CopyImageToBufferInfo2<'a>;
pub type ResolveImageInfo2KHR = ResolveImageInfo2; pub type ResolveImageInfo2KHR<'a> = ResolveImageInfo2<'a>;
pub type PhysicalDeviceShaderTerminateInvocationFeaturesKHR = pub type PhysicalDeviceShaderTerminateInvocationFeaturesKHR<'a> =
PhysicalDeviceShaderTerminateInvocationFeatures; PhysicalDeviceShaderTerminateInvocationFeatures<'a>;
pub type MemoryBarrier2KHR = MemoryBarrier2; pub type MemoryBarrier2KHR<'a> = MemoryBarrier2<'a>;
pub type ImageMemoryBarrier2KHR = ImageMemoryBarrier2; pub type ImageMemoryBarrier2KHR<'a> = ImageMemoryBarrier2<'a>;
pub type BufferMemoryBarrier2KHR = BufferMemoryBarrier2; pub type BufferMemoryBarrier2KHR<'a> = BufferMemoryBarrier2<'a>;
pub type DependencyInfoKHR = DependencyInfo; pub type DependencyInfoKHR<'a> = DependencyInfo<'a>;
pub type SemaphoreSubmitInfoKHR = SemaphoreSubmitInfo; pub type SemaphoreSubmitInfoKHR<'a> = SemaphoreSubmitInfo<'a>;
pub type CommandBufferSubmitInfoKHR = CommandBufferSubmitInfo; pub type CommandBufferSubmitInfoKHR<'a> = CommandBufferSubmitInfo<'a>;
pub type SubmitInfo2KHR = SubmitInfo2; pub type SubmitInfo2KHR<'a> = SubmitInfo2<'a>;
pub type PhysicalDeviceSynchronization2FeaturesKHR = PhysicalDeviceSynchronization2Features; pub type PhysicalDeviceSynchronization2FeaturesKHR<'a> = PhysicalDeviceSynchronization2Features<'a>;
pub type PhysicalDeviceShaderIntegerDotProductFeaturesKHR = pub type PhysicalDeviceShaderIntegerDotProductFeaturesKHR<'a> =
PhysicalDeviceShaderIntegerDotProductFeatures; PhysicalDeviceShaderIntegerDotProductFeatures<'a>;
pub type PhysicalDeviceShaderIntegerDotProductPropertiesKHR = pub type PhysicalDeviceShaderIntegerDotProductPropertiesKHR<'a> =
PhysicalDeviceShaderIntegerDotProductProperties; PhysicalDeviceShaderIntegerDotProductProperties<'a>;
pub type FormatProperties3KHR = FormatProperties3; pub type FormatProperties3KHR<'a> = FormatProperties3<'a>;
pub type PipelineRenderingCreateInfoKHR = PipelineRenderingCreateInfo; pub type PipelineRenderingCreateInfoKHR<'a> = PipelineRenderingCreateInfo<'a>;
pub type RenderingInfoKHR = RenderingInfo; pub type RenderingInfoKHR<'a> = RenderingInfo<'a>;
pub type RenderingAttachmentInfoKHR = RenderingAttachmentInfo; pub type RenderingAttachmentInfoKHR<'a> = RenderingAttachmentInfo<'a>;
pub type PhysicalDeviceDynamicRenderingFeaturesKHR = PhysicalDeviceDynamicRenderingFeatures; pub type PhysicalDeviceDynamicRenderingFeaturesKHR<'a> = PhysicalDeviceDynamicRenderingFeatures<'a>;
pub type CommandBufferInheritanceRenderingInfoKHR = CommandBufferInheritanceRenderingInfo; pub type CommandBufferInheritanceRenderingInfoKHR<'a> = CommandBufferInheritanceRenderingInfo<'a>;
pub type AttachmentSampleCountInfoNV = AttachmentSampleCountInfoAMD; pub type AttachmentSampleCountInfoNV<'a> = AttachmentSampleCountInfoAMD<'a>;

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@ use ash::vk::{PhysicalDeviceProperties, PipelineColorBlendStateCreateInfo};
fn assert_struct_field_is_array() { fn assert_struct_field_is_array() {
let pipeline_cache_uuid: [u8; 16] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; let pipeline_cache_uuid: [u8; 16] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let _ = PhysicalDeviceProperties::builder().pipeline_cache_uuid(pipeline_cache_uuid); let _ = PhysicalDeviceProperties::default().pipeline_cache_uuid(pipeline_cache_uuid);
let _ = PhysicalDeviceProperties { let _ = PhysicalDeviceProperties {
pipeline_cache_uuid, pipeline_cache_uuid,
@ -13,7 +13,7 @@ fn assert_struct_field_is_array() {
let blend_constants: [f32; 4] = [0.0, 0.0, 0.0, 0.0]; let blend_constants: [f32; 4] = [0.0, 0.0, 0.0, 0.0];
let _ = PipelineColorBlendStateCreateInfo::builder().blend_constants(blend_constants); let _ = PipelineColorBlendStateCreateInfo::default().blend_constants(blend_constants);
let _ = PipelineColorBlendStateCreateInfo { let _ = PipelineColorBlendStateCreateInfo {
blend_constants, blend_constants,

View file

@ -62,12 +62,12 @@ fn main() {
..Default::default() ..Default::default()
}]; }];
let subpass = vk::SubpassDescription::builder() let subpass = vk::SubpassDescription::default()
.color_attachments(&color_attachment_refs) .color_attachments(&color_attachment_refs)
.depth_stencil_attachment(&depth_attachment_ref) .depth_stencil_attachment(&depth_attachment_ref)
.pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS); .pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS);
let renderpass_create_info = vk::RenderPassCreateInfo::builder() let renderpass_create_info = vk::RenderPassCreateInfo::default()
.attachments(&renderpass_attachments) .attachments(&renderpass_attachments)
.subpasses(std::slice::from_ref(&subpass)) .subpasses(std::slice::from_ref(&subpass))
.dependencies(&dependencies); .dependencies(&dependencies);
@ -82,7 +82,7 @@ fn main() {
.iter() .iter()
.map(|&present_image_view| { .map(|&present_image_view| {
let framebuffer_attachments = [present_image_view, base.depth_image_view]; let framebuffer_attachments = [present_image_view, base.depth_image_view];
let frame_buffer_create_info = vk::FramebufferCreateInfo::builder() let frame_buffer_create_info = vk::FramebufferCreateInfo::default()
.render_pass(renderpass) .render_pass(renderpass)
.attachments(&framebuffer_attachments) .attachments(&framebuffer_attachments)
.width(base.surface_resolution.width) .width(base.surface_resolution.width)
@ -378,12 +378,11 @@ fn main() {
&[], &[],
&[texture_barrier], &[texture_barrier],
); );
let buffer_copy_regions = vk::BufferImageCopy::builder() let buffer_copy_regions = vk::BufferImageCopy::default()
.image_subresource( .image_subresource(
vk::ImageSubresourceLayers::builder() vk::ImageSubresourceLayers::default()
.aspect_mask(vk::ImageAspectFlags::COLOR) .aspect_mask(vk::ImageAspectFlags::COLOR)
.layer_count(1) .layer_count(1),
.build(),
) )
.image_extent(image_extent.into()); .image_extent(image_extent.into());
@ -392,7 +391,7 @@ fn main() {
image_buffer, image_buffer,
texture_image, texture_image,
vk::ImageLayout::TRANSFER_DST_OPTIMAL, vk::ImageLayout::TRANSFER_DST_OPTIMAL,
&[buffer_copy_regions.build()], &[buffer_copy_regions],
); );
let texture_barrier_end = vk::ImageMemoryBarrier { let texture_barrier_end = vk::ImageMemoryBarrier {
src_access_mask: vk::AccessFlags::TRANSFER_WRITE, src_access_mask: vk::AccessFlags::TRANSFER_WRITE,
@ -467,7 +466,7 @@ fn main() {
descriptor_count: 1, descriptor_count: 1,
}, },
]; ];
let descriptor_pool_info = vk::DescriptorPoolCreateInfo::builder() let descriptor_pool_info = vk::DescriptorPoolCreateInfo::default()
.pool_sizes(&descriptor_sizes) .pool_sizes(&descriptor_sizes)
.max_sets(1); .max_sets(1);
@ -491,14 +490,14 @@ fn main() {
}, },
]; ];
let descriptor_info = let descriptor_info =
vk::DescriptorSetLayoutCreateInfo::builder().bindings(&desc_layout_bindings); vk::DescriptorSetLayoutCreateInfo::default().bindings(&desc_layout_bindings);
let desc_set_layouts = [base let desc_set_layouts = [base
.device .device
.create_descriptor_set_layout(&descriptor_info, None) .create_descriptor_set_layout(&descriptor_info, None)
.unwrap()]; .unwrap()];
let desc_alloc_info = vk::DescriptorSetAllocateInfo::builder() let desc_alloc_info = vk::DescriptorSetAllocateInfo::default()
.descriptor_pool(descriptor_pool) .descriptor_pool(descriptor_pool)
.set_layouts(&desc_set_layouts); .set_layouts(&desc_set_layouts);
let descriptor_sets = base let descriptor_sets = base
@ -542,11 +541,11 @@ fn main() {
let vertex_code = let vertex_code =
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file"); read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");
let vertex_shader_info = vk::ShaderModuleCreateInfo::builder().code(&vertex_code); let vertex_shader_info = vk::ShaderModuleCreateInfo::default().code(&vertex_code);
let frag_code = let frag_code =
read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file"); read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file");
let frag_shader_info = vk::ShaderModuleCreateInfo::builder().code(&frag_code); let frag_shader_info = vk::ShaderModuleCreateInfo::default().code(&frag_code);
let vertex_shader_module = base let vertex_shader_module = base
.device .device
@ -559,7 +558,7 @@ fn main() {
.expect("Fragment shader module error"); .expect("Fragment shader module error");
let layout_create_info = let layout_create_info =
vk::PipelineLayoutCreateInfo::builder().set_layouts(&desc_set_layouts); vk::PipelineLayoutCreateInfo::default().set_layouts(&desc_set_layouts);
let pipeline_layout = base let pipeline_layout = base
.device .device
@ -600,7 +599,7 @@ fn main() {
offset: offset_of!(Vertex, uv) as u32, offset: offset_of!(Vertex, uv) as u32,
}, },
]; ];
let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::builder() let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::default()
.vertex_attribute_descriptions(&vertex_input_attribute_descriptions) .vertex_attribute_descriptions(&vertex_input_attribute_descriptions)
.vertex_binding_descriptions(&vertex_input_binding_descriptions); .vertex_binding_descriptions(&vertex_input_binding_descriptions);
@ -617,7 +616,7 @@ fn main() {
max_depth: 1.0, max_depth: 1.0,
}]; }];
let scissors = [base.surface_resolution.into()]; let scissors = [base.surface_resolution.into()];
let viewport_state_info = vk::PipelineViewportStateCreateInfo::builder() let viewport_state_info = vk::PipelineViewportStateCreateInfo::default()
.scissors(&scissors) .scissors(&scissors)
.viewports(&viewports); .viewports(&viewports);
@ -628,7 +627,7 @@ fn main() {
..Default::default() ..Default::default()
}; };
let multisample_state_info = vk::PipelineMultisampleStateCreateInfo::builder() let multisample_state_info = vk::PipelineMultisampleStateCreateInfo::default()
.rasterization_samples(vk::SampleCountFlags::TYPE_1); .rasterization_samples(vk::SampleCountFlags::TYPE_1);
let noop_stencil_state = vk::StencilOpState { let noop_stencil_state = vk::StencilOpState {
@ -658,15 +657,15 @@ fn main() {
alpha_blend_op: vk::BlendOp::ADD, alpha_blend_op: vk::BlendOp::ADD,
color_write_mask: vk::ColorComponentFlags::RGBA, color_write_mask: vk::ColorComponentFlags::RGBA,
}]; }];
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder() let color_blend_state = vk::PipelineColorBlendStateCreateInfo::default()
.logic_op(vk::LogicOp::CLEAR) .logic_op(vk::LogicOp::CLEAR)
.attachments(&color_blend_attachment_states); .attachments(&color_blend_attachment_states);
let dynamic_state = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR]; let dynamic_state = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
let dynamic_state_info = let dynamic_state_info =
vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&dynamic_state); vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&dynamic_state);
let graphic_pipeline_infos = vk::GraphicsPipelineCreateInfo::builder() let graphic_pipeline_infos = vk::GraphicsPipelineCreateInfo::default()
.stages(&shader_stage_create_infos) .stages(&shader_stage_create_infos)
.vertex_input_state(&vertex_input_state_info) .vertex_input_state(&vertex_input_state_info)
.input_assembly_state(&vertex_input_assembly_state_info) .input_assembly_state(&vertex_input_assembly_state_info)
@ -681,11 +680,7 @@ fn main() {
let graphics_pipelines = base let graphics_pipelines = base
.device .device
.create_graphics_pipelines( .create_graphics_pipelines(vk::PipelineCache::null(), &[graphic_pipeline_infos], None)
vk::PipelineCache::null(),
&[graphic_pipeline_infos.build()],
None,
)
.unwrap(); .unwrap();
let graphic_pipeline = graphics_pipelines[0]; let graphic_pipeline = graphics_pipelines[0];
@ -714,7 +709,7 @@ fn main() {
}, },
]; ];
let render_pass_begin_info = vk::RenderPassBeginInfo::builder() let render_pass_begin_info = vk::RenderPassBeginInfo::default()
.render_pass(renderpass) .render_pass(renderpass)
.framebuffer(framebuffers[present_index as usize]) .framebuffer(framebuffers[present_index as usize])
.render_area(base.surface_resolution.into()) .render_area(base.surface_resolution.into())

View file

@ -51,12 +51,12 @@ fn main() {
..Default::default() ..Default::default()
}]; }];
let subpass = vk::SubpassDescription::builder() let subpass = vk::SubpassDescription::default()
.color_attachments(&color_attachment_refs) .color_attachments(&color_attachment_refs)
.depth_stencil_attachment(&depth_attachment_ref) .depth_stencil_attachment(&depth_attachment_ref)
.pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS); .pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS);
let renderpass_create_info = vk::RenderPassCreateInfo::builder() let renderpass_create_info = vk::RenderPassCreateInfo::default()
.attachments(&renderpass_attachments) .attachments(&renderpass_attachments)
.subpasses(std::slice::from_ref(&subpass)) .subpasses(std::slice::from_ref(&subpass))
.dependencies(&dependencies); .dependencies(&dependencies);
@ -71,7 +71,7 @@ fn main() {
.iter() .iter()
.map(|&present_image_view| { .map(|&present_image_view| {
let framebuffer_attachments = [present_image_view, base.depth_image_view]; let framebuffer_attachments = [present_image_view, base.depth_image_view];
let frame_buffer_create_info = vk::FramebufferCreateInfo::builder() let frame_buffer_create_info = vk::FramebufferCreateInfo::default()
.render_pass(renderpass) .render_pass(renderpass)
.attachments(&framebuffer_attachments) .attachments(&framebuffer_attachments)
.width(base.surface_resolution.width) .width(base.surface_resolution.width)
@ -85,7 +85,7 @@ fn main() {
.collect(); .collect();
let index_buffer_data = [0u32, 1, 2]; let index_buffer_data = [0u32, 1, 2];
let index_buffer_info = vk::BufferCreateInfo::builder() let index_buffer_info = vk::BufferCreateInfo::default()
.size(std::mem::size_of_val(&index_buffer_data) as u64) .size(std::mem::size_of_val(&index_buffer_data) as u64)
.usage(vk::BufferUsageFlags::INDEX_BUFFER) .usage(vk::BufferUsageFlags::INDEX_BUFFER)
.sharing_mode(vk::SharingMode::EXCLUSIVE); .sharing_mode(vk::SharingMode::EXCLUSIVE);
@ -203,11 +203,11 @@ fn main() {
let vertex_code = let vertex_code =
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file"); read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");
let vertex_shader_info = vk::ShaderModuleCreateInfo::builder().code(&vertex_code); let vertex_shader_info = vk::ShaderModuleCreateInfo::default().code(&vertex_code);
let frag_code = let frag_code =
read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file"); read_spv(&mut frag_spv_file).expect("Failed to read fragment shader spv file");
let frag_shader_info = vk::ShaderModuleCreateInfo::builder().code(&frag_code); let frag_shader_info = vk::ShaderModuleCreateInfo::default().code(&frag_code);
let vertex_shader_module = base let vertex_shader_module = base
.device .device
@ -262,7 +262,7 @@ fn main() {
}, },
]; ];
let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::builder() let vertex_input_state_info = vk::PipelineVertexInputStateCreateInfo::default()
.vertex_attribute_descriptions(&vertex_input_attribute_descriptions) .vertex_attribute_descriptions(&vertex_input_attribute_descriptions)
.vertex_binding_descriptions(&vertex_input_binding_descriptions); .vertex_binding_descriptions(&vertex_input_binding_descriptions);
let vertex_input_assembly_state_info = vk::PipelineInputAssemblyStateCreateInfo { let vertex_input_assembly_state_info = vk::PipelineInputAssemblyStateCreateInfo {
@ -278,7 +278,7 @@ fn main() {
max_depth: 1.0, max_depth: 1.0,
}]; }];
let scissors = [base.surface_resolution.into()]; let scissors = [base.surface_resolution.into()];
let viewport_state_info = vk::PipelineViewportStateCreateInfo::builder() let viewport_state_info = vk::PipelineViewportStateCreateInfo::default()
.scissors(&scissors) .scissors(&scissors)
.viewports(&viewports); .viewports(&viewports);
@ -318,15 +318,15 @@ fn main() {
alpha_blend_op: vk::BlendOp::ADD, alpha_blend_op: vk::BlendOp::ADD,
color_write_mask: vk::ColorComponentFlags::RGBA, color_write_mask: vk::ColorComponentFlags::RGBA,
}]; }];
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder() let color_blend_state = vk::PipelineColorBlendStateCreateInfo::default()
.logic_op(vk::LogicOp::CLEAR) .logic_op(vk::LogicOp::CLEAR)
.attachments(&color_blend_attachment_states); .attachments(&color_blend_attachment_states);
let dynamic_state = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR]; let dynamic_state = [vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR];
let dynamic_state_info = let dynamic_state_info =
vk::PipelineDynamicStateCreateInfo::builder().dynamic_states(&dynamic_state); vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&dynamic_state);
let graphic_pipeline_info = vk::GraphicsPipelineCreateInfo::builder() let graphic_pipeline_info = vk::GraphicsPipelineCreateInfo::default()
.stages(&shader_stage_create_infos) .stages(&shader_stage_create_infos)
.vertex_input_state(&vertex_input_state_info) .vertex_input_state(&vertex_input_state_info)
.input_assembly_state(&vertex_input_assembly_state_info) .input_assembly_state(&vertex_input_assembly_state_info)
@ -341,11 +341,7 @@ fn main() {
let graphics_pipelines = base let graphics_pipelines = base
.device .device
.create_graphics_pipelines( .create_graphics_pipelines(vk::PipelineCache::null(), &[graphic_pipeline_info], None)
vk::PipelineCache::null(),
&[graphic_pipeline_info.build()],
None,
)
.expect("Unable to create graphics pipeline"); .expect("Unable to create graphics pipeline");
let graphic_pipeline = graphics_pipelines[0]; let graphic_pipeline = graphics_pipelines[0];
@ -374,7 +370,7 @@ fn main() {
}, },
]; ];
let render_pass_begin_info = vk::RenderPassBeginInfo::builder() let render_pass_begin_info = vk::RenderPassBeginInfo::default()
.render_pass(renderpass) .render_pass(renderpass)
.framebuffer(framebuffers[present_index as usize]) .framebuffer(framebuffers[present_index as usize])
.render_area(base.surface_resolution.into()) .render_area(base.surface_resolution.into())
@ -430,7 +426,7 @@ fn main() {
let wait_semaphors = [base.rendering_complete_semaphore]; let wait_semaphors = [base.rendering_complete_semaphore];
let swapchains = [base.swapchain]; let swapchains = [base.swapchain];
let image_indices = [present_index]; let image_indices = [present_index];
let present_info = vk::PresentInfoKHR::builder() let present_info = vk::PresentInfoKHR::default()
.wait_semaphores(&wait_semaphors) // &base.rendering_complete_semaphore) .wait_semaphores(&wait_semaphors) // &base.rendering_complete_semaphore)
.swapchains(&swapchains) .swapchains(&swapchains)
.image_indices(&image_indices); .image_indices(&image_indices);

View file

@ -63,7 +63,7 @@ pub fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
) )
.expect("Reset command buffer failed."); .expect("Reset command buffer failed.");
let command_buffer_begin_info = vk::CommandBufferBeginInfo::builder() let command_buffer_begin_info = vk::CommandBufferBeginInfo::default()
.flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT); .flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT);
device device
@ -76,18 +76,14 @@ pub fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(
let command_buffers = vec![command_buffer]; let command_buffers = vec![command_buffer];
let submit_info = vk::SubmitInfo::builder() let submit_info = vk::SubmitInfo::default()
.wait_semaphores(wait_semaphores) .wait_semaphores(wait_semaphores)
.wait_dst_stage_mask(wait_mask) .wait_dst_stage_mask(wait_mask)
.command_buffers(&command_buffers) .command_buffers(&command_buffers)
.signal_semaphores(signal_semaphores); .signal_semaphores(signal_semaphores);
device device
.queue_submit( .queue_submit(submit_queue, &[submit_info], command_buffer_reuse_fence)
submit_queue,
&[submit_info.build()],
command_buffer_reuse_fence,
)
.expect("queue submit failed."); .expect("queue submit failed.");
} }
} }
@ -233,14 +229,14 @@ impl ExampleBase {
.to_vec(); .to_vec();
extension_names.push(DebugUtils::name().as_ptr()); extension_names.push(DebugUtils::name().as_ptr());
let appinfo = vk::ApplicationInfo::builder() let appinfo = vk::ApplicationInfo::default()
.application_name(app_name) .application_name(app_name)
.application_version(0) .application_version(0)
.engine_name(app_name) .engine_name(app_name)
.engine_version(0) .engine_version(0)
.api_version(vk::make_api_version(0, 1, 0, 0)); .api_version(vk::make_api_version(0, 1, 0, 0));
let create_info = vk::InstanceCreateInfo::builder() let create_info = vk::InstanceCreateInfo::default()
.application_info(&appinfo) .application_info(&appinfo)
.enabled_layer_names(&layers_names_raw) .enabled_layer_names(&layers_names_raw)
.enabled_extension_names(&extension_names); .enabled_extension_names(&extension_names);
@ -249,7 +245,7 @@ impl ExampleBase {
.create_instance(&create_info, None) .create_instance(&create_info, None)
.expect("Instance creation error"); .expect("Instance creation error");
let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::builder() let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::default()
.message_severity( .message_severity(
vk::DebugUtilsMessageSeverityFlagsEXT::ERROR vk::DebugUtilsMessageSeverityFlagsEXT::ERROR
| vk::DebugUtilsMessageSeverityFlagsEXT::WARNING | vk::DebugUtilsMessageSeverityFlagsEXT::WARNING
@ -304,11 +300,11 @@ impl ExampleBase {
}; };
let priorities = [1.0]; let priorities = [1.0];
let queue_info = vk::DeviceQueueCreateInfo::builder() let queue_info = vk::DeviceQueueCreateInfo::default()
.queue_family_index(queue_family_index) .queue_family_index(queue_family_index)
.queue_priorities(&priorities); .queue_priorities(&priorities);
let device_create_info = vk::DeviceCreateInfo::builder() let device_create_info = vk::DeviceCreateInfo::default()
.queue_create_infos(std::slice::from_ref(&queue_info)) .queue_create_infos(std::slice::from_ref(&queue_info))
.enabled_extension_names(&device_extension_names_raw) .enabled_extension_names(&device_extension_names_raw)
.enabled_features(&features); .enabled_features(&features);
@ -357,7 +353,7 @@ impl ExampleBase {
.unwrap_or(vk::PresentModeKHR::FIFO); .unwrap_or(vk::PresentModeKHR::FIFO);
let swapchain_loader = Swapchain::new(&instance, &device); let swapchain_loader = Swapchain::new(&instance, &device);
let swapchain_create_info = vk::SwapchainCreateInfoKHR::builder() let swapchain_create_info = vk::SwapchainCreateInfoKHR::default()
.surface(surface) .surface(surface)
.min_image_count(desired_image_count) .min_image_count(desired_image_count)
.image_color_space(surface_format.color_space) .image_color_space(surface_format.color_space)
@ -375,13 +371,13 @@ impl ExampleBase {
.create_swapchain(&swapchain_create_info, None) .create_swapchain(&swapchain_create_info, None)
.unwrap(); .unwrap();
let pool_create_info = vk::CommandPoolCreateInfo::builder() let pool_create_info = vk::CommandPoolCreateInfo::default()
.flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER) .flags(vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER)
.queue_family_index(queue_family_index); .queue_family_index(queue_family_index);
let pool = device.create_command_pool(&pool_create_info, None).unwrap(); let pool = device.create_command_pool(&pool_create_info, None).unwrap();
let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::builder() let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::default()
.command_buffer_count(2) .command_buffer_count(2)
.command_pool(pool) .command_pool(pool)
.level(vk::CommandBufferLevel::PRIMARY); .level(vk::CommandBufferLevel::PRIMARY);
@ -396,7 +392,7 @@ impl ExampleBase {
let present_image_views: Vec<vk::ImageView> = present_images let present_image_views: Vec<vk::ImageView> = present_images
.iter() .iter()
.map(|&image| { .map(|&image| {
let create_view_info = vk::ImageViewCreateInfo::builder() let create_view_info = vk::ImageViewCreateInfo::default()
.view_type(vk::ImageViewType::TYPE_2D) .view_type(vk::ImageViewType::TYPE_2D)
.format(surface_format.format) .format(surface_format.format)
.components(vk::ComponentMapping { .components(vk::ComponentMapping {
@ -417,7 +413,7 @@ impl ExampleBase {
}) })
.collect(); .collect();
let device_memory_properties = instance.get_physical_device_memory_properties(pdevice); let device_memory_properties = instance.get_physical_device_memory_properties(pdevice);
let depth_image_create_info = vk::ImageCreateInfo::builder() let depth_image_create_info = vk::ImageCreateInfo::default()
.image_type(vk::ImageType::TYPE_2D) .image_type(vk::ImageType::TYPE_2D)
.format(vk::Format::D16_UNORM) .format(vk::Format::D16_UNORM)
.extent(surface_resolution.into()) .extent(surface_resolution.into())
@ -437,7 +433,7 @@ impl ExampleBase {
) )
.expect("Unable to find suitable memory index for depth image."); .expect("Unable to find suitable memory index for depth image.");
let depth_image_allocate_info = vk::MemoryAllocateInfo::builder() let depth_image_allocate_info = vk::MemoryAllocateInfo::default()
.allocation_size(depth_image_memory_req.size) .allocation_size(depth_image_memory_req.size)
.memory_type_index(depth_image_memory_index); .memory_type_index(depth_image_memory_index);
@ -450,7 +446,7 @@ impl ExampleBase {
.expect("Unable to bind depth image memory"); .expect("Unable to bind depth image memory");
let fence_create_info = let fence_create_info =
vk::FenceCreateInfo::builder().flags(vk::FenceCreateFlags::SIGNALED); vk::FenceCreateInfo::default().flags(vk::FenceCreateFlags::SIGNALED);
let draw_commands_reuse_fence = device let draw_commands_reuse_fence = device
.create_fence(&fence_create_info, None) .create_fence(&fence_create_info, None)
@ -468,7 +464,7 @@ impl ExampleBase {
&[], &[],
&[], &[],
|device, setup_command_buffer| { |device, setup_command_buffer| {
let layout_transition_barriers = vk::ImageMemoryBarrier::builder() let layout_transition_barriers = vk::ImageMemoryBarrier::default()
.image(depth_image) .image(depth_image)
.dst_access_mask( .dst_access_mask(
vk::AccessFlags::DEPTH_STENCIL_ATTACHMENT_READ vk::AccessFlags::DEPTH_STENCIL_ATTACHMENT_READ
@ -477,11 +473,10 @@ impl ExampleBase {
.new_layout(vk::ImageLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL) .new_layout(vk::ImageLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL)
.old_layout(vk::ImageLayout::UNDEFINED) .old_layout(vk::ImageLayout::UNDEFINED)
.subresource_range( .subresource_range(
vk::ImageSubresourceRange::builder() vk::ImageSubresourceRange::default()
.aspect_mask(vk::ImageAspectFlags::DEPTH) .aspect_mask(vk::ImageAspectFlags::DEPTH)
.layer_count(1) .layer_count(1)
.level_count(1) .level_count(1),
.build(),
); );
device.cmd_pipeline_barrier( device.cmd_pipeline_barrier(
@ -491,18 +486,17 @@ impl ExampleBase {
vk::DependencyFlags::empty(), vk::DependencyFlags::empty(),
&[], &[],
&[], &[],
&[layout_transition_barriers.build()], &[layout_transition_barriers],
); );
}, },
); );
let depth_image_view_info = vk::ImageViewCreateInfo::builder() let depth_image_view_info = vk::ImageViewCreateInfo::default()
.subresource_range( .subresource_range(
vk::ImageSubresourceRange::builder() vk::ImageSubresourceRange::default()
.aspect_mask(vk::ImageAspectFlags::DEPTH) .aspect_mask(vk::ImageAspectFlags::DEPTH)
.level_count(1) .level_count(1)
.layer_count(1) .layer_count(1),
.build(),
) )
.image(depth_image) .image(depth_image)
.format(depth_image_create_info.format) .format(depth_image_create_info.format)

View file

@ -1375,7 +1375,7 @@ fn is_static_array(field: &vkxml::Field) -> bool {
.map(|ty| matches!(ty, vkxml::ArrayType::Static)) .map(|ty| matches!(ty, vkxml::ArrayType::Static))
.unwrap_or(false) .unwrap_or(false)
} }
pub fn derive_default(_struct: &vkxml::Struct) -> Option<TokenStream> { pub fn derive_default(_struct: &vkxml::Struct, has_lifetime: bool) -> Option<TokenStream> {
let name = name_to_tokens(&_struct.name); let name = name_to_tokens(&_struct.name);
let members = _struct let members = _struct
.elements .elements
@ -1427,20 +1427,27 @@ pub fn derive_default(_struct: &vkxml::Struct) -> Option<TokenStream> {
} }
} }
}); });
let lifetime = has_lifetime.then(|| quote!(<'_>));
let marker = has_lifetime.then(|| quote!(_marker: PhantomData,));
let q = quote! { let q = quote! {
impl ::std::default::Default for #name { impl ::std::default::Default for #name #lifetime {
fn default() -> Self { fn default() -> Self {
Self { Self {
#( #(
#default_fields #default_fields,
),* )*
#marker
} }
} }
} }
}; };
Some(q) Some(q)
} }
pub fn derive_debug(_struct: &vkxml::Struct, union_types: &HashSet<&str>) -> Option<TokenStream> { pub fn derive_debug(
_struct: &vkxml::Struct,
union_types: &HashSet<&str>,
has_lifetime: bool,
) -> Option<TokenStream> {
let name = name_to_tokens(&_struct.name); let name = name_to_tokens(&_struct.name);
let members = _struct let members = _struct
.elements .elements
@ -1487,9 +1494,10 @@ pub fn derive_debug(_struct: &vkxml::Struct, union_types: &HashSet<&str>) -> Opt
} }
}); });
let name_str = name.to_string(); let name_str = name.to_string();
let lifetime = has_lifetime.then(|| quote!(<'_>));
let q = quote! { let q = quote! {
#[cfg(feature = "debug")] #[cfg(feature = "debug")]
impl fmt::Debug for #name { impl fmt::Debug for #name #lifetime {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct(#name_str) fmt.debug_struct(#name_str)
#(#debug_fields)* #(#debug_fields)*
@ -1503,6 +1511,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,
root_structs: &HashSet<Ident>, root_structs: &HashSet<Ident>,
has_lifetimes: &HashSet<Ident>,
) -> Option<TokenStream> { ) -> Option<TokenStream> {
if &struct_.name == "VkBaseInStructure" if &struct_.name == "VkBaseInStructure"
|| &struct_.name == "VkBaseOutStructure" || &struct_.name == "VkBaseOutStructure"
@ -1513,7 +1522,6 @@ 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 members = struct_ let members = struct_
.elements .elements
@ -1576,9 +1584,10 @@ pub fn derive_setters(
// Unique cases // Unique cases
if name == "pCode" { if name == "pCode" {
return Some(quote!{ return Some(quote!{
#[inline]
pub fn code(mut self, code: &'a [u32]) -> Self { pub fn code(mut self, code: &'a [u32]) -> Self {
self.inner.code_size = code.len() * 4; self.code_size = code.len() * 4;
self.inner.p_code = code.as_ptr(); self.p_code = code.as_ptr();
self self
} }
}); });
@ -1591,8 +1600,9 @@ pub fn derive_setters(
/// ///
/// See <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkPipelineMultisampleStateCreateInfo.html#_description> /// See <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkPipelineMultisampleStateCreateInfo.html#_description>
/// for more details. /// for more details.
#[inline]
pub fn sample_mask(mut self, sample_mask: &'a [SampleMask]) -> Self { pub fn sample_mask(mut self, sample_mask: &'a [SampleMask]) -> Self {
self.inner.p_sample_mask = if sample_mask.is_empty() { self.p_sample_mask = if sample_mask.is_empty() {
std::ptr::null() std::ptr::null()
} else { } else {
sample_mask.as_ptr() sample_mask.as_ptr()
@ -1604,9 +1614,10 @@ pub fn derive_setters(
if name == "ppGeometries" { if name == "ppGeometries" {
return Some(quote!{ return Some(quote!{
pub fn geometries_ptrs(mut self, geometries: &'a [&'a AccelerationStructureGeometryKHR]) -> Self { #[inline]
self.inner.geometry_count = geometries.len() as _; pub fn geometries_ptrs(mut self, geometries: &'a [&'a AccelerationStructureGeometryKHR<'a>]) -> Self {
self.inner.pp_geometries = geometries.as_ptr() as *const *const _; self.geometry_count = geometries.len() as _;
self.pp_geometries = geometries.as_ptr() as *const *const _;
self self
} }
}); });
@ -1619,8 +1630,9 @@ pub fn derive_setters(
assert!(field.null_terminate); assert!(field.null_terminate);
assert_eq!(field.size, None); assert_eq!(field.size, None);
return Some(quote!{ return Some(quote!{
#[inline]
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.#param_ident = #param_ident_short.as_ptr();
self self
} }
}); });
@ -1665,15 +1677,16 @@ pub fn derive_setters(
quote!(as _) quote!(as _)
}; };
quote!(self.inner.#array_size_ident = #param_ident_short.len()#cast;) quote!(self.#array_size_ident = #param_ident_short.len()#cast;)
}; };
let mutable = if field.is_const { quote!() } else { quote!(mut) }; let mutable = if field.is_const { quote!() } else { quote!(mut) };
return Some(quote! { return Some(quote! {
#[inline]
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.#param_ident = #param_ident_short#ptr;
self self
} }
}); });
@ -1683,8 +1696,9 @@ pub fn derive_setters(
if field.basetype == "VkBool32" { if field.basetype == "VkBool32" {
return Some(quote!{ return Some(quote!{
#[inline]
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.#param_ident = #param_ident_short.into();
self self
} }
}); });
@ -1697,9 +1711,14 @@ pub fn derive_setters(
param_ty_tokens param_ty_tokens
}; };
let lifetime = has_lifetimes
.contains(&name_to_tokens(&field.basetype))
.then(|| quote!(<'a>));
Some(quote!{ Some(quote!{
pub fn #param_ident_short(mut self, #param_ident_short: #param_ty_tokens) -> Self { #[inline]
self.inner.#param_ident = #param_ident_short; pub fn #param_ident_short(mut self, #param_ident_short: #param_ty_tokens #lifetime) -> Self {
self.#param_ident = #param_ident_short;
self self
} }
}) })
@ -1722,7 +1741,7 @@ pub fn derive_setters(
/// Prepends the given extension struct between the root and the first pointer. This /// Prepends the given extension struct between the root and the first pointer. This
/// method only exists on structs that can be passed to a function directly. Only /// method only exists on structs that can be passed to a function directly. Only
/// valid extension structs can be pushed into the chain. /// valid extension structs can be pushed into the chain.
/// If the chain looks like `A -> B -> C`, and you call `builder.push_next(&mut D)`, then the /// If the chain looks like `A -> B -> C`, and you call `x.push_next(&mut D)`, then the
/// chain will look like `A -> D -> B -> C`. /// chain will look like `A -> D -> B -> C`.
pub fn push_next<T: #extends_name>(mut self, next: &'a mut T) -> Self { pub fn push_next<T: #extends_name>(mut self, next: &'a mut T) -> Self {
unsafe { unsafe {
@ -1737,8 +1756,8 @@ pub fn derive_setters(
// ^^^^^^ // ^^^^^^
// next chain // next chain
let last_next = ptr_chain_iter(next).last().unwrap(); let last_next = ptr_chain_iter(next).last().unwrap();
(*last_next).p_next = self.inner.p_next as _; (*last_next).p_next = self.p_next as _;
self.inner.p_next = next_ptr; self.p_next = next_ptr;
} }
self self
} }
@ -1755,6 +1774,8 @@ pub fn derive_setters(
quote!() quote!()
}; };
let lifetime = has_lifetimes.contains(&name).then(|| quote!(<'a>));
// If the struct extends something we need to implement the traits. // If the struct extends something we need to implement the traits.
let impl_extend_trait = struct_ let impl_extend_trait = struct_
.extends .extends
@ -1762,57 +1783,18 @@ pub fn derive_setters(
.flat_map(|extends| extends.split(',')) .flat_map(|extends| extends.split(','))
.map(|extends| format_ident!("Extends{}", name_to_tokens(extends))) .map(|extends| format_ident!("Extends{}", name_to_tokens(extends)))
.map(|extends| { .map(|extends| {
quote! { // Extension structs always have a pNext, and therefore always have a lifetime.
unsafe impl #extends for #name_builder<'_> {} quote!(unsafe impl #extends for #name<'_> {})
unsafe impl #extends for #name {}
}
}); });
let q = quote! { let q = quote! {
impl #name {
pub fn builder<'a>() -> #name_builder<'a> {
#name_builder {
inner: Self::default(),
marker: ::std::marker::PhantomData,
}
}
}
#[repr(transparent)]
pub struct #name_builder<'a> {
inner: #name,
marker: ::std::marker::PhantomData<&'a ()>,
}
#(#impl_extend_trait)* #(#impl_extend_trait)*
#next_trait #next_trait
impl #lifetime #name #lifetime {
impl<'a> ::std::ops::Deref for #name_builder<'a> {
type Target = #name;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl<'a> ::std::ops::DerefMut for #name_builder<'a> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl<'a> #name_builder<'a> {
#(#setters)* #(#setters)*
#next_function #next_function
/// Calling build will **discard** all the lifetime information. Only call this if
/// necessary! Builders implement `Deref` targeting their corresponding Vulkan struct,
/// so references to builders can be passed directly to Vulkan functions.
pub fn build(self) -> #name {
self.inner
}
} }
}; };
@ -1834,6 +1816,7 @@ pub fn generate_struct(
_struct: &vkxml::Struct, _struct: &vkxml::Struct,
root_structs: &HashSet<Ident>, root_structs: &HashSet<Ident>,
union_types: &HashSet<&str>, union_types: &HashSet<&str>,
has_lifetimes: &HashSet<Ident>,
) -> TokenStream { ) -> TokenStream {
let name = name_to_tokens(&_struct.name); let name = name_to_tokens(&_struct.name);
if &_struct.name == "VkTransformMatrixKHR" { if &_struct.name == "VkTransformMatrixKHR" {
@ -1916,14 +1899,24 @@ pub fn generate_struct(
.map(|r| r.to_tokens(field.is_const)); .map(|r| r.to_tokens(field.is_const));
quote!(#pointer Self) quote!(#pointer Self)
} else { } else {
field.type_tokens(false) let lifetime = has_lifetimes
.contains(&name_to_tokens(&field.basetype))
.then(|| quote!(<'a>));
let ty = field.type_tokens(false);
quote!(#ty #lifetime)
}; };
quote! {pub #param_ident: #param_ty_tokens} quote! {pub #param_ident: #param_ty_tokens}
}); });
let debug_tokens = derive_debug(_struct, union_types); let has_lifetime = has_lifetimes.contains(&name);
let default_tokens = derive_default(_struct); let (lifetimes, marker) = match has_lifetime {
let setter_tokens = derive_setters(_struct, root_structs); true => (quote!(<'a>), quote!(pub _marker: PhantomData<&'a ()>,)),
false => (quote!(), quote!()),
};
let debug_tokens = derive_debug(_struct, union_types, has_lifetime);
let default_tokens = derive_default(_struct, has_lifetime);
let setter_tokens = derive_setters(_struct, root_structs, has_lifetimes);
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))])
@ -1941,8 +1934,9 @@ pub fn generate_struct(
#dbg_str #dbg_str
#[derive(Copy, Clone, #default_str #manual_derive_tokens)] #[derive(Copy, Clone, #default_str #manual_derive_tokens)]
#[doc = #khronos_link] #[doc = #khronos_link]
pub struct #name { pub struct #name #lifetimes {
#(#params,)* #(#params,)*
#marker
} }
#debug_tokens #debug_tokens
#default_tokens #default_tokens
@ -1998,24 +1992,28 @@ fn generate_funcptr(fnptr: &vkxml::FunctionPointer) -> TokenStream {
} }
} }
fn generate_union(union: &vkxml::Union) -> TokenStream { fn generate_union(union: &vkxml::Union, has_lifetimes: &HashSet<Ident>) -> TokenStream {
let name = name_to_tokens(&union.name); let name = name_to_tokens(&union.name);
let fields = union.elements.iter().map(|field| { let fields = union.elements.iter().map(|field| {
let name = field.param_ident(); let name = field.param_ident();
let ty = field.type_tokens(false); let ty = field.type_tokens(false);
let lifetime = has_lifetimes
.contains(&name_to_tokens(&field.basetype))
.then(|| quote!(<'a>));
quote! { quote! {
pub #name: #ty pub #name: #ty #lifetime
} }
}); });
let khronos_link = khronos_link(&union.name); let khronos_link = khronos_link(&union.name);
let lifetime = has_lifetimes.contains(&name).then(|| quote!(<'a>));
quote! { quote! {
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[doc = #khronos_link] #[doc = #khronos_link]
pub union #name { pub union #name #lifetime {
#(#fields),* #(#fields),*
} }
impl ::std::default::Default for #name { impl #lifetime ::std::default::Default for #name #lifetime {
fn default() -> Self { fn default() -> Self {
unsafe { ::std::mem::zeroed() } unsafe { ::std::mem::zeroed() }
} }
@ -2039,6 +2037,7 @@ pub fn generate_definition(
definition: &vkxml::DefinitionsElement, definition: &vkxml::DefinitionsElement,
union_types: &HashSet<&str>, union_types: &HashSet<&str>,
root_structs: &HashSet<Ident>, root_structs: &HashSet<Ident>,
has_lifetimes: &HashSet<Ident>,
bitflags_cache: &mut HashSet<Ident>, bitflags_cache: &mut HashSet<Ident>,
const_values: &mut BTreeMap<Ident, ConstantTypeInfo>, const_values: &mut BTreeMap<Ident, ConstantTypeInfo>,
identifier_renames: &mut BTreeMap<String, Ident>, identifier_renames: &mut BTreeMap<String, Ident>,
@ -2048,15 +2047,18 @@ pub fn generate_definition(
Some(generate_define(define, identifier_renames)) Some(generate_define(define, identifier_renames))
} }
vkxml::DefinitionsElement::Typedef(ref typedef) => Some(generate_typedef(typedef)), vkxml::DefinitionsElement::Typedef(ref typedef) => Some(generate_typedef(typedef)),
vkxml::DefinitionsElement::Struct(ref _struct) => { vkxml::DefinitionsElement::Struct(ref _struct) => Some(generate_struct(
Some(generate_struct(_struct, root_structs, union_types)) _struct,
} root_structs,
union_types,
has_lifetimes,
)),
vkxml::DefinitionsElement::Bitmask(ref mask) => { vkxml::DefinitionsElement::Bitmask(ref mask) => {
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) => generate_handle(handle),
vkxml::DefinitionsElement::FuncPtr(ref fp) => Some(generate_funcptr(fp)), vkxml::DefinitionsElement::FuncPtr(ref fp) => Some(generate_funcptr(fp)),
vkxml::DefinitionsElement::Union(ref union) => Some(generate_union(union)), vkxml::DefinitionsElement::Union(ref union) => Some(generate_union(union, has_lifetimes)),
_ => None, _ => None,
} }
} }
@ -2309,6 +2311,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,
has_lifetimes: &HashSet<Ident>,
ty_cache: &mut HashSet<Ident>, ty_cache: &mut HashSet<Ident>,
) -> TokenStream { ) -> TokenStream {
let aliases = types let aliases = types
@ -2323,8 +2326,10 @@ pub fn generate_aliases_of_types(
return None; return None;
}; };
let alias_ident = name_to_tokens(alias); let alias_ident = name_to_tokens(alias);
let tokens = quote! { let tokens = if has_lifetimes.contains(&alias_ident) {
pub type #name_ident = #alias_ident; quote!(pub type #name_ident<'a> = #alias_ident<'a>;)
} else {
quote!(pub type #name_ident = #alias_ident;)
}; };
Some(tokens) Some(tokens)
}); });
@ -2343,13 +2348,6 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
.find_map(get_variant!(vk_parse::RegistryChild::Extensions)) .find_map(get_variant!(vk_parse::RegistryChild::Extensions))
.map(|ext| &ext.children) .map(|ext| &ext.children)
.expect("extension"); .expect("extension");
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, &mut ty_cache))
.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 let cmd_aliases: HashMap<String, String> = spec2
@ -2439,6 +2437,37 @@ 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();
// Identify structs that need a lifetime annotation
// Note that this relies on `vk.xml` defining types before they are used,
// as is required in C(++) too.
let mut has_lifetimes = definitions
.iter()
.filter_map(get_variant!(vkxml::DefinitionsElement::Struct))
.filter_map(|s| {
s.elements
.iter()
.filter_map(get_variant!(vkxml::StructElement::Member))
.any(|x| x.reference.is_some())
.then(|| name_to_tokens(&s.name))
})
.collect::<HashSet<Ident>>();
for def in &definitions {
match def {
vkxml::DefinitionsElement::Struct(s) => s
.elements
.iter()
.filter_map(get_variant!(vkxml::StructElement::Member))
.any(|field| has_lifetimes.contains(&name_to_tokens(&field.basetype)))
.then(|| has_lifetimes.insert(name_to_tokens(&s.name))),
vkxml::DefinitionsElement::Union(u) => u
.elements
.iter()
.any(|field| has_lifetimes.contains(&name_to_tokens(&field.basetype)))
.then(|| has_lifetimes.insert(name_to_tokens(&u.name))),
_ => continue,
};
}
let root_structs = root_structs(&definitions); let root_structs = root_structs(&definitions);
let definition_code: Vec<_> = definitions let definition_code: Vec<_> = definitions
.into_iter() .into_iter()
@ -2447,6 +2476,7 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
def, def,
&union_types, &union_types,
&root_structs, &root_structs,
&has_lifetimes,
&mut bitflags_cache, &mut bitflags_cache,
&mut const_values, &mut const_values,
&mut identifier_renames, &mut identifier_renames,
@ -2454,6 +2484,14 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
}) })
.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, &has_lifetimes, &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))
@ -2494,6 +2532,7 @@ pub fn write_source_code<P: AsRef<Path>>(vk_headers_dir: &Path, src_dir: P) {
}; };
let definition_code = quote! { let definition_code = quote! {
use std::marker::PhantomData;
use std::fmt; use std::fmt;
use std::os::raw::*; use std::os::raw::*;
use crate::vk::{Handle, ptr_chain_iter}; use crate::vk::{Handle, ptr_chain_iter};