From 594b184c383115098277f4faaecbcb3d0658a8f9 Mon Sep 17 00:00:00 2001 From: Friz64 Date: Sun, 26 Jan 2020 09:27:26 +0100 Subject: [PATCH] Add high level wrappers for Vulkan 1.2 (#265) * Update doc links * Added `EntryV1_1` impl and notice about compatibility * Add missing `InstanceV1_1::get_physical_device_features2` function * Add Vulkan 1.2 wrapper for `Entry` * Add Vulkan 1.2 wrapper for `Instance` * Add Vulkan 1.2 wrapper for `Device` * Mark `enumerate_instance_version` as deprecated --- ash/src/device.rs | 460 ++++++++++++++------ ash/src/entry.rs | 38 +- ash/src/extensions/ext/debug_marker.rs | 8 +- ash/src/extensions/ext/debug_report.rs | 4 +- ash/src/extensions/ext/debug_utils.rs | 22 +- ash/src/extensions/khr/android_surface.rs | 2 +- ash/src/extensions/khr/display.rs | 14 +- ash/src/extensions/khr/display_swapchain.rs | 2 +- ash/src/extensions/khr/push_descriptor.rs | 4 +- ash/src/extensions/khr/surface.rs | 10 +- ash/src/extensions/khr/swapchain.rs | 10 +- ash/src/extensions/khr/wayland_surface.rs | 4 +- ash/src/extensions/khr/win32_surface.rs | 4 +- ash/src/extensions/khr/xcb_surface.rs | 4 +- ash/src/extensions/khr/xlib_surface.rs | 4 +- ash/src/extensions/mvk/ios_surface.rs | 2 +- ash/src/extensions/mvk/macos_surface.rs | 2 +- ash/src/extensions/nv/mesh_shader.rs | 6 +- ash/src/extensions/nv/ray_tracing.rs | 24 +- ash/src/instance.rs | 72 ++- ash/src/lib.rs | 2 +- ash/src/version.rs | 6 +- 22 files changed, 476 insertions(+), 228 deletions(-) diff --git a/ash/src/device.rs b/ash/src/device.rs index 12ce492..a2eeab7 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -6,11 +6,198 @@ use std::mem; use std::os::raw::c_void; use std::ptr; +#[allow(non_camel_case_types)] +pub trait DeviceV1_2: DeviceV1_1 { + fn fp_v1_2(&self) -> &vk::DeviceFnV1_2; + + #[doc = ""] + unsafe fn cmd_draw_indirect_count( + &self, + command_buffer: vk::CommandBuffer, + buffer: vk::Buffer, + offset: vk::DeviceSize, + count_buffer: vk::Buffer, + count_buffer_offset: vk::DeviceSize, + max_draw_count: u32, + stride: u32, + ) { + self.fp_v1_2().cmd_draw_indirect_count( + command_buffer, + buffer, + offset, + count_buffer, + count_buffer_offset, + max_draw_count, + stride, + ); + } + + #[doc = ""] + unsafe fn cmd_draw_indexed_indirect_count( + &self, + command_buffer: vk::CommandBuffer, + buffer: vk::Buffer, + offset: vk::DeviceSize, + count_buffer: vk::Buffer, + count_buffer_offset: vk::DeviceSize, + max_draw_count: u32, + stride: u32, + ) { + self.fp_v1_2().cmd_draw_indexed_indirect_count( + command_buffer, + buffer, + offset, + count_buffer, + count_buffer_offset, + max_draw_count, + stride, + ); + } + + #[doc = ""] + unsafe fn create_render_pass2( + &self, + create_info: &vk::RenderPassCreateInfo2, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) -> VkResult { + let mut renderpass = mem::zeroed(); + let err_code = self.fp_v1_2().create_render_pass2( + self.handle(), + create_info, + allocation_callbacks.as_raw_ptr(), + &mut renderpass, + ); + match err_code { + vk::Result::SUCCESS => Ok(renderpass), + _ => Err(err_code), + } + } + + #[doc = ""] + unsafe fn cmd_begin_render_pass2( + &self, + command_buffer: vk::CommandBuffer, + render_pass_begin_info: &vk::RenderPassBeginInfo, + subpass_begin_info: &vk::SubpassBeginInfo, + ) { + self.fp_v1_2().cmd_begin_render_pass2( + command_buffer, + render_pass_begin_info, + subpass_begin_info, + ); + } + + #[doc = ""] + unsafe fn cmd_next_subpass2( + &self, + command_buffer: vk::CommandBuffer, + subpass_begin_info: &vk::SubpassBeginInfo, + subpass_end_info: &vk::SubpassEndInfo, + ) { + self.fp_v1_2() + .cmd_next_subpass2(command_buffer, subpass_begin_info, subpass_end_info); + } + + #[doc = ""] + unsafe fn cmd_end_render_pass2( + &self, + command_buffer: vk::CommandBuffer, + subpass_end_info: &vk::SubpassEndInfo, + ) { + self.fp_v1_2() + .cmd_end_render_pass2(command_buffer, subpass_end_info); + } + + #[doc = ""] + unsafe fn reset_query_pool( + &self, + device: vk::Device, + query_pool: vk::QueryPool, + first_query: u32, + query_count: u32, + ) { + self.fp_v1_2() + .reset_query_pool(device, query_pool, first_query, query_count); + } + + #[doc = ""] + unsafe fn get_semaphore_counter_value( + &self, + device: vk::Device, + semaphore: vk::Semaphore, + ) -> VkResult { + let mut value = 0; + let err_code = self + .fp_v1_2() + .get_semaphore_counter_value(device, semaphore, &mut value); + match err_code { + vk::Result::SUCCESS => Ok(value), + _ => Err(err_code), + } + } + + #[doc = ""] + unsafe fn wait_semaphores( + &self, + device: vk::Device, + wait_info: &vk::SemaphoreWaitInfo, + timeout: u64, + ) -> VkResult<()> { + let err_code = self.fp_v1_2().wait_semaphores(device, wait_info, timeout); + match err_code { + vk::Result::SUCCESS => Ok(()), + _ => Err(err_code), + } + } + + #[doc = ""] + unsafe fn signal_semaphore( + &self, + device: vk::Device, + signal_info: &vk::SemaphoreSignalInfo, + ) -> VkResult<()> { + let err_code = self.fp_v1_2().signal_semaphore(device, signal_info); + match err_code { + vk::Result::SUCCESS => Ok(()), + _ => Err(err_code), + } + } + + #[doc = ""] + unsafe fn get_buffer_device_address( + &self, + device: vk::Device, + info: &vk::BufferDeviceAddressInfo, + ) -> vk::DeviceAddress { + self.fp_v1_2().get_buffer_device_address(device, info) + } + + #[doc = ""] + unsafe fn get_buffer_opaque_capture_address( + &self, + device: vk::Device, + info: &vk::BufferDeviceAddressInfo, + ) -> u64 { + self.fp_v1_2() + .get_buffer_opaque_capture_address(device, info) + } + + #[doc = ""] + unsafe fn get_device_memory_opaque_capture_address( + &self, + device: vk::Device, + info: &vk::DeviceMemoryOpaqueCaptureAddressInfo, + ) -> u64 { + self.fp_v1_2() + .get_device_memory_opaque_capture_address(device, info) + } +} + #[allow(non_camel_case_types)] pub trait DeviceV1_1: DeviceV1_0 { fn fp_v1_1(&self) -> &vk::DeviceFnV1_1; - #[doc = ""] + #[doc = ""] unsafe fn bind_buffer_memory2(&self, bind_infos: &[vk::BindBufferMemoryInfo]) -> VkResult<()> { let err_code = self.fp_v1_1().bind_buffer_memory2( self.handle(), @@ -23,7 +210,7 @@ pub trait DeviceV1_1: DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn bind_image_memory2(&self, bind_infos: &[vk::BindImageMemoryInfo]) -> VkResult<()> { let err_code = self.fp_v1_1().bind_image_memory2( self.handle(), @@ -36,7 +223,7 @@ pub trait DeviceV1_1: DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn get_device_group_peer_memory_features( &self, heap_index: u32, @@ -54,13 +241,13 @@ pub trait DeviceV1_1: DeviceV1_0 { peer_memory_features } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_device_mask(&self, command_buffer: vk::CommandBuffer, device_mask: u32) { self.fp_v1_1() .cmd_set_device_mask(command_buffer, device_mask); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_dispatch_base( &self, command_buffer: vk::CommandBuffer, @@ -82,7 +269,7 @@ pub trait DeviceV1_1: DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn get_image_memory_requirements2( &self, info: &vk::ImageMemoryRequirementsInfo2, @@ -92,7 +279,7 @@ pub trait DeviceV1_1: DeviceV1_0 { .get_image_memory_requirements2(self.handle(), info, out); } - #[doc = ""] + #[doc = ""] unsafe fn get_buffer_memory_requirements2( &self, info: &vk::BufferMemoryRequirementsInfo2, @@ -116,7 +303,7 @@ pub trait DeviceV1_1: DeviceV1_0 { count as usize } - #[doc = ""] + #[doc = ""] unsafe fn get_image_sparse_memory_requirements2( &self, info: &vk::ImageSparseMemoryRequirementsInfo2, @@ -131,7 +318,7 @@ pub trait DeviceV1_1: DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn trim_command_pool( &self, command_pool: vk::CommandPool, @@ -141,7 +328,7 @@ pub trait DeviceV1_1: DeviceV1_0 { .trim_command_pool(self.handle(), command_pool, flags); } - #[doc = ""] + #[doc = ""] unsafe fn create_sampler_ycbcr_conversion( &self, create_info: &vk::SamplerYcbcrConversionCreateInfo, @@ -160,7 +347,7 @@ pub trait DeviceV1_1: DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn destroy_sampler_ycbcr_conversion( &self, ycbcr_conversion: vk::SamplerYcbcrConversion, @@ -173,7 +360,7 @@ pub trait DeviceV1_1: DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn create_descriptor_update_template( &self, create_info: &vk::DescriptorUpdateTemplateCreateInfo, @@ -192,7 +379,7 @@ pub trait DeviceV1_1: DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn destroy_descriptor_update_template( &self, descriptor_update_template: vk::DescriptorUpdateTemplate, @@ -205,7 +392,7 @@ pub trait DeviceV1_1: DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn update_descriptor_set_with_template( &self, descriptor_set: vk::DescriptorSet, @@ -220,7 +407,7 @@ pub trait DeviceV1_1: DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn get_descriptor_set_layout_support( &self, create_info: &vk::DescriptorSetLayoutCreateInfo, @@ -235,13 +422,13 @@ pub trait DeviceV1_1: DeviceV1_0 { pub trait DeviceV1_0 { fn handle(&self) -> vk::Device; fn fp_v1_0(&self) -> &vk::DeviceFnV1_0; - #[doc = ""] + #[doc = ""] unsafe fn destroy_device(&self, allocation_callbacks: Option<&vk::AllocationCallbacks>) { self.fp_v1_0() .destroy_device(self.handle(), allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_sampler( &self, sampler: vk::Sampler, @@ -251,7 +438,7 @@ pub trait DeviceV1_0 { .destroy_sampler(self.handle(), sampler, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn free_memory( &self, memory: vk::DeviceMemory, @@ -261,7 +448,7 @@ pub trait DeviceV1_0 { .free_memory(self.handle(), memory, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn free_command_buffers( &self, command_pool: vk::CommandPool, @@ -275,7 +462,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn create_event( &self, create_info: &vk::EventCreateInfo, @@ -296,7 +483,7 @@ pub trait DeviceV1_0 { /// Returns true if the event was set, and false if the event was reset, otherwise it will /// return the error code. - #[doc = ""] + #[doc = ""] unsafe fn get_event_status(&self, event: vk::Event) -> VkResult { let err_code = self.fp_v1_0().get_event_status(self.handle(), event); match err_code { @@ -306,7 +493,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn set_event(&self, event: vk::Event) -> VkResult<()> { let err_code = self.fp_v1_0().set_event(self.handle(), event); match err_code { @@ -315,7 +502,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn reset_event(&self, event: vk::Event) -> VkResult<()> { let err_code = self.fp_v1_0().reset_event(self.handle(), event); match err_code { @@ -323,7 +510,7 @@ pub trait DeviceV1_0 { _ => Err(err_code), } } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_event( &self, command_buffer: vk::CommandBuffer, @@ -333,7 +520,7 @@ pub trait DeviceV1_0 { self.fp_v1_0() .cmd_set_event(command_buffer, event, stage_mask); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_reset_event( &self, command_buffer: vk::CommandBuffer, @@ -344,7 +531,7 @@ pub trait DeviceV1_0 { .cmd_reset_event(command_buffer, event, stage_mask); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_wait_events( &self, command_buffer: vk::CommandBuffer, @@ -370,7 +557,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_fence( &self, fence: vk::Fence, @@ -380,7 +567,7 @@ pub trait DeviceV1_0 { .destroy_fence(self.handle(), fence, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_event( &self, event: vk::Event, @@ -390,7 +577,7 @@ pub trait DeviceV1_0 { .destroy_event(self.handle(), event, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_image( &self, image: vk::Image, @@ -400,7 +587,7 @@ pub trait DeviceV1_0 { .destroy_image(self.handle(), image, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_command_pool( &self, pool: vk::CommandPool, @@ -410,7 +597,7 @@ pub trait DeviceV1_0 { .destroy_command_pool(self.handle(), pool, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_image_view( &self, image_view: vk::ImageView, @@ -423,7 +610,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_render_pass( &self, renderpass: vk::RenderPass, @@ -436,7 +623,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_framebuffer( &self, framebuffer: vk::Framebuffer, @@ -449,7 +636,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_pipeline_layout( &self, pipeline_layout: vk::PipelineLayout, @@ -462,7 +649,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_pipeline_cache( &self, pipeline_cache: vk::PipelineCache, @@ -475,7 +662,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_buffer( &self, buffer: vk::Buffer, @@ -485,7 +672,7 @@ pub trait DeviceV1_0 { .destroy_buffer(self.handle(), buffer, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_shader_module( &self, shader: vk::ShaderModule, @@ -498,7 +685,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_pipeline( &self, pipeline: vk::Pipeline, @@ -508,7 +695,7 @@ pub trait DeviceV1_0 { .destroy_pipeline(self.handle(), pipeline, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_semaphore( &self, semaphore: vk::Semaphore, @@ -521,7 +708,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_descriptor_pool( &self, pool: vk::DescriptorPool, @@ -534,7 +721,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_query_pool( &self, pool: vk::QueryPool, @@ -544,7 +731,7 @@ pub trait DeviceV1_0 { .destroy_query_pool(self.handle(), pool, allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn destroy_descriptor_set_layout( &self, layout: vk::DescriptorSetLayout, @@ -557,7 +744,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn free_descriptor_sets( &self, pool: vk::DescriptorPool, @@ -571,7 +758,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn update_descriptor_sets( &self, descriptor_writes: &[vk::WriteDescriptorSet], @@ -586,7 +773,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn create_sampler( &self, create_info: &vk::SamplerCreateInfo, @@ -605,7 +792,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn cmd_blit_image( &self, command_buffer: vk::CommandBuffer, @@ -628,7 +815,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_resolve_image( &self, command_buffer: vk::CommandBuffer, @@ -649,7 +836,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_fill_buffer( &self, command_buffer: vk::CommandBuffer, @@ -662,7 +849,7 @@ pub trait DeviceV1_0 { .cmd_fill_buffer(command_buffer, buffer, offset, size, data); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_update_buffer( &self, command_buffer: vk::CommandBuffer, @@ -679,7 +866,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_copy_buffer( &self, command_buffer: vk::CommandBuffer, @@ -696,7 +883,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_copy_image_to_buffer( &self, command_buffer: vk::CommandBuffer, @@ -715,7 +902,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_copy_buffer_to_image( &self, command_buffer: vk::CommandBuffer, @@ -734,7 +921,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_copy_image( &self, command_buffer: vk::CommandBuffer, @@ -755,7 +942,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn allocate_descriptor_sets( &self, create_info: &vk::DescriptorSetAllocateInfo, @@ -774,7 +961,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_descriptor_set_layout( &self, create_info: &vk::DescriptorSetLayoutCreateInfo, @@ -793,7 +980,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn device_wait_idle(&self) -> VkResult<()> { let err_code = self.fp_v1_0().device_wait_idle(self.handle()); match err_code { @@ -802,7 +989,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_descriptor_pool( &self, create_info: &vk::DescriptorPoolCreateInfo, @@ -821,7 +1008,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn reset_descriptor_pool( &self, pool: vk::DescriptorPool, @@ -836,7 +1023,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn reset_command_pool( &self, command_pool: vk::CommandPool, @@ -851,7 +1038,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn reset_command_buffer( &self, command_buffer: vk::CommandBuffer, @@ -864,7 +1051,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn reset_fences(&self, fences: &[vk::Fence]) -> VkResult<()> { let err_code = self.fp_v1_0() @@ -875,7 +1062,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn cmd_bind_index_buffer( &self, command_buffer: vk::CommandBuffer, @@ -887,7 +1074,7 @@ pub trait DeviceV1_0 { .cmd_bind_index_buffer(command_buffer, buffer, offset, index_type); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_clear_color_image( &self, command_buffer: vk::CommandBuffer, @@ -906,7 +1093,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_clear_depth_stencil_image( &self, command_buffer: vk::CommandBuffer, @@ -925,7 +1112,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_clear_attachments( &self, command_buffer: vk::CommandBuffer, @@ -941,7 +1128,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_draw_indexed( &self, command_buffer: vk::CommandBuffer, @@ -961,7 +1148,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_draw_indexed_indirect( &self, command_buffer: vk::CommandBuffer, @@ -979,7 +1166,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_execute_commands( &self, primary_command_buffer: vk::CommandBuffer, @@ -992,7 +1179,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_bind_descriptor_sets( &self, command_buffer: vk::CommandBuffer, @@ -1014,7 +1201,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_copy_query_pool_results( &self, command_buffer: vk::CommandBuffer, @@ -1038,7 +1225,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_push_constants( &self, command_buffer: vk::CommandBuffer, @@ -1057,7 +1244,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_begin_render_pass( &self, command_buffer: vk::CommandBuffer, @@ -1068,7 +1255,7 @@ pub trait DeviceV1_0 { .cmd_begin_render_pass(command_buffer, create_info, contents); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_next_subpass( &self, command_buffer: vk::CommandBuffer, @@ -1077,7 +1264,7 @@ pub trait DeviceV1_0 { self.fp_v1_0().cmd_next_subpass(command_buffer, contents); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_bind_pipeline( &self, command_buffer: vk::CommandBuffer, @@ -1088,7 +1275,7 @@ pub trait DeviceV1_0 { .cmd_bind_pipeline(command_buffer, pipeline_bind_point, pipeline); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_scissor( &self, command_buffer: vk::CommandBuffer, @@ -1103,13 +1290,13 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_line_width(&self, command_buffer: vk::CommandBuffer, line_width: f32) { self.fp_v1_0() .cmd_set_line_width(command_buffer, line_width); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_bind_vertex_buffers( &self, command_buffer: vk::CommandBuffer, @@ -1127,12 +1314,12 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_end_render_pass(&self, command_buffer: vk::CommandBuffer) { self.fp_v1_0().cmd_end_render_pass(command_buffer); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_draw( &self, command_buffer: vk::CommandBuffer, @@ -1150,7 +1337,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_draw_indirect( &self, command_buffer: vk::CommandBuffer, @@ -1163,7 +1350,7 @@ pub trait DeviceV1_0 { .cmd_draw_indirect(command_buffer, buffer, offset, draw_count, stride); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_dispatch( &self, command_buffer: vk::CommandBuffer, @@ -1175,7 +1362,7 @@ pub trait DeviceV1_0 { .cmd_dispatch(command_buffer, group_count_x, group_count_y, group_count_z); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_dispatch_indirect( &self, command_buffer: vk::CommandBuffer, @@ -1186,7 +1373,7 @@ pub trait DeviceV1_0 { .cmd_dispatch_indirect(command_buffer, buffer, offset); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_viewport( &self, command_buffer: vk::CommandBuffer, @@ -1201,7 +1388,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_depth_bias( &self, command_buffer: vk::CommandBuffer, @@ -1213,7 +1400,7 @@ pub trait DeviceV1_0 { .cmd_set_depth_bias(command_buffer, constant_factor, clamp, slope_factor); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_blend_constants( &self, command_buffer: vk::CommandBuffer, @@ -1223,7 +1410,7 @@ pub trait DeviceV1_0 { .cmd_set_blend_constants(command_buffer, blend_constants); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_depth_bounds( &self, command_buffer: vk::CommandBuffer, @@ -1234,7 +1421,7 @@ pub trait DeviceV1_0 { .cmd_set_depth_bounds(command_buffer, min_depth_bounds, max_depth_bounds); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_stencil_compare_mask( &self, command_buffer: vk::CommandBuffer, @@ -1245,7 +1432,7 @@ pub trait DeviceV1_0 { .cmd_set_stencil_compare_mask(command_buffer, face_mask, compare_mask); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_stencil_write_mask( &self, command_buffer: vk::CommandBuffer, @@ -1256,7 +1443,7 @@ pub trait DeviceV1_0 { .cmd_set_stencil_write_mask(command_buffer, face_mask, write_mask); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_set_stencil_reference( &self, command_buffer: vk::CommandBuffer, @@ -1267,7 +1454,7 @@ pub trait DeviceV1_0 { .cmd_set_stencil_reference(command_buffer, face_mask, reference); } - #[doc = ""] + #[doc = ""] unsafe fn get_query_pool_results( &self, query_pool: vk::QueryPool, @@ -1303,7 +1490,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn cmd_begin_query( &self, command_buffer: vk::CommandBuffer, @@ -1315,7 +1502,7 @@ pub trait DeviceV1_0 { .cmd_begin_query(command_buffer, query_pool, query, flags); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_end_query( &self, command_buffer: vk::CommandBuffer, @@ -1326,7 +1513,7 @@ pub trait DeviceV1_0 { .cmd_end_query(command_buffer, query_pool, query); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_reset_query_pool( &self, command_buffer: vk::CommandBuffer, @@ -1338,7 +1525,7 @@ pub trait DeviceV1_0 { .cmd_reset_query_pool(command_buffer, pool, first_query, query_count); } - #[doc = ""] + #[doc = ""] unsafe fn cmd_write_timestamp( &self, command_buffer: vk::CommandBuffer, @@ -1350,7 +1537,7 @@ pub trait DeviceV1_0 { .cmd_write_timestamp(command_buffer, pipeline_stage, query_pool, query); } - #[doc = ""] + #[doc = ""] unsafe fn create_semaphore( &self, create_info: &vk::SemaphoreCreateInfo, @@ -1369,7 +1556,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_graphics_pipelines( &self, pipeline_cache: vk::PipelineCache, @@ -1392,7 +1579,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_compute_pipelines( &self, pipeline_cache: vk::PipelineCache, @@ -1415,7 +1602,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_buffer( &self, create_info: &vk::BufferCreateInfo, @@ -1434,7 +1621,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_pipeline_layout( &self, create_info: &vk::PipelineLayoutCreateInfo, @@ -1453,7 +1640,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_pipeline_cache( &self, create_info: &vk::PipelineCacheCreateInfo, @@ -1473,7 +1660,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn get_pipeline_cache_data( &self, pipeline_cache: vk::PipelineCache, @@ -1502,7 +1689,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn map_memory( &self, memory: vk::DeviceMemory, @@ -1520,12 +1707,12 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn unmap_memory(&self, memory: vk::DeviceMemory) { self.fp_v1_0().unmap_memory(self.handle(), memory); } - #[doc = ""] + #[doc = ""] unsafe fn invalidate_mapped_memory_ranges( &self, ranges: &[vk::MappedMemoryRange], @@ -1541,7 +1728,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn flush_mapped_memory_ranges(&self, ranges: &[vk::MappedMemoryRange]) -> VkResult<()> { let err_code = self.fp_v1_0().flush_mapped_memory_ranges( self.handle(), @@ -1554,7 +1741,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_framebuffer( &self, create_info: &vk::FramebufferCreateInfo, @@ -1573,7 +1760,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn get_device_queue(&self, queue_family_index: u32, queue_index: u32) -> vk::Queue { let mut queue = mem::zeroed(); self.fp_v1_0() @@ -1581,7 +1768,7 @@ pub trait DeviceV1_0 { queue } - #[doc = ""] + #[doc = ""] unsafe fn cmd_pipeline_barrier( &self, command_buffer: vk::CommandBuffer, @@ -1606,7 +1793,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn create_render_pass( &self, create_info: &vk::RenderPassCreateInfo, @@ -1625,7 +1812,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn begin_command_buffer( &self, command_buffer: vk::CommandBuffer, @@ -1640,7 +1827,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn end_command_buffer(&self, command_buffer: vk::CommandBuffer) -> VkResult<()> { let err_code = self.fp_v1_0().end_command_buffer(command_buffer); match err_code { @@ -1649,7 +1836,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn wait_for_fences( &self, fences: &[vk::Fence], @@ -1669,7 +1856,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn get_fence_status(&self, fence: vk::Fence) -> VkResult { let err_code = self.fp_v1_0().get_fence_status(self.handle(), fence); match err_code { @@ -1679,7 +1866,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn queue_wait_idle(&self, queue: vk::Queue) -> VkResult<()> { let err_code = self.fp_v1_0().queue_wait_idle(queue); match err_code { @@ -1688,7 +1875,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn queue_submit( &self, queue: vk::Queue, @@ -1704,7 +1891,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_buffer_view( &self, create_info: &vk::BufferViewCreateInfo, @@ -1723,7 +1910,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn destroy_buffer_view( &self, buffer_view: vk::BufferView, @@ -1736,7 +1923,7 @@ pub trait DeviceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn create_image_view( &self, create_info: &vk::ImageViewCreateInfo, @@ -1755,7 +1942,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn allocate_command_buffers( &self, create_info: &vk::CommandBufferAllocateInfo, @@ -1773,7 +1960,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_command_pool( &self, create_info: &vk::CommandPoolCreateInfo, @@ -1792,7 +1979,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_query_pool( &self, create_info: &vk::QueryPoolCreateInfo, @@ -1811,7 +1998,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_image( &self, create_info: &vk::ImageCreateInfo, @@ -1830,7 +2017,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn get_image_subresource_layout( &self, image: vk::Image, @@ -1846,7 +2033,7 @@ pub trait DeviceV1_0 { layout } - #[doc = ""] + #[doc = ""] unsafe fn get_image_memory_requirements(&self, image: vk::Image) -> vk::MemoryRequirements { let mut mem_req = mem::zeroed(); self.fp_v1_0() @@ -1854,7 +2041,7 @@ pub trait DeviceV1_0 { mem_req } - #[doc = ""] + #[doc = ""] unsafe fn get_buffer_memory_requirements(&self, buffer: vk::Buffer) -> vk::MemoryRequirements { let mut mem_req = mem::zeroed(); self.fp_v1_0() @@ -1862,7 +2049,7 @@ pub trait DeviceV1_0 { mem_req } - #[doc = ""] + #[doc = ""] unsafe fn allocate_memory( &self, create_info: &vk::MemoryAllocateInfo, @@ -1881,7 +2068,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_shader_module( &self, create_info: &vk::ShaderModuleCreateInfo, @@ -1900,7 +2087,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn create_fence( &self, create_info: &vk::FenceCreateInfo, @@ -1919,7 +2106,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn bind_buffer_memory( &self, buffer: vk::Buffer, @@ -1935,7 +2122,7 @@ pub trait DeviceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn bind_image_memory( &self, image: vk::Image, @@ -1952,12 +2139,13 @@ pub trait DeviceV1_0 { } } -#[doc = ""] +#[doc = ""] #[derive(Clone)] pub struct Device { handle: vk::Device, device_fn_1_0: vk::DeviceFnV1_0, device_fn_1_1: vk::DeviceFnV1_1, + device_fn_1_2: vk::DeviceFnV1_2, } impl Device { pub unsafe fn load(instance_fn: &vk::InstanceFnV1_0, device: vk::Device) -> Self { @@ -1967,10 +2155,14 @@ impl Device { let device_fn_1_1 = vk::DeviceFnV1_1::load(|name| { mem::transmute(instance_fn.get_device_proc_addr(device, name.as_ptr())) }); + let device_fn_1_2 = vk::DeviceFnV1_2::load(|name| { + mem::transmute(instance_fn.get_device_proc_addr(device, name.as_ptr())) + }); Device { handle: device, device_fn_1_0, device_fn_1_1, + device_fn_1_2, } } } @@ -1991,6 +2183,12 @@ impl DeviceV1_1 for Device { } } +impl DeviceV1_2 for Device { + fn fp_v1_2(&self) -> &vk::DeviceFnV1_2 { + &self.device_fn_1_2 + } +} + impl Device { pub fn handle(&self) -> vk::Device { self.handle diff --git a/ash/src/entry.rs b/ash/src/entry.rs index 1e141f3..eb3ab82 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -36,6 +36,7 @@ pub struct EntryCustom { static_fn: vk::StaticFn, entry_fn_1_0: vk::EntryFnV1_0, entry_fn_1_1: vk::EntryFnV1_1, + entry_fn_1_2: vk::EntryFnV1_2, lib: L, } @@ -76,14 +77,14 @@ pub trait EntryV1_0 { type Instance; fn fp_v1_0(&self) -> &vk::EntryFnV1_0; fn static_fn(&self) -> &vk::StaticFn; - #[doc = ""] + #[doc = ""] unsafe fn create_instance( &self, create_info: &vk::InstanceCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> Result; - #[doc = ""] + #[doc = ""] fn enumerate_instance_layer_properties(&self) -> VkResult> { unsafe { let mut num = 0; @@ -102,7 +103,7 @@ pub trait EntryV1_0 { } } - #[doc = ""] + #[doc = ""] fn enumerate_instance_extension_properties(&self) -> VkResult> { unsafe { let mut num = 0; @@ -125,7 +126,7 @@ pub trait EntryV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn get_instance_proc_addr( &self, instance: vk::Instance, @@ -137,7 +138,7 @@ pub trait EntryV1_0 { impl EntryV1_0 for EntryCustom { type Instance = Instance; - #[doc = ""] + #[doc = ""] unsafe fn create_instance( &self, create_info: &vk::InstanceCreateInfo, @@ -166,7 +167,8 @@ impl EntryV1_0 for EntryCustom { pub trait EntryV1_1: EntryV1_0 { fn fp_v1_1(&self) -> &vk::EntryFnV1_1; - #[doc = ""] + #[deprecated = "This function is unavailable and therefore panics on Vulkan 1.0, please use `try_enumerate_instance_version` instead"] + #[doc = ""] fn enumerate_instance_version(&self) -> VkResult { unsafe { let mut api_version = 0; @@ -179,6 +181,23 @@ pub trait EntryV1_1: EntryV1_0 { } } +impl EntryV1_1 for EntryCustom { + fn fp_v1_1(&self) -> &vk::EntryFnV1_1 { + &self.entry_fn_1_1 + } +} + +#[allow(non_camel_case_types)] +pub trait EntryV1_2: EntryV1_1 { + fn fp_v1_2(&self) -> &vk::EntryFnV1_2; +} + +impl EntryV1_2 for EntryCustom { + fn fp_v1_2(&self) -> &vk::EntryFnV1_2 { + &self.entry_fn_1_2 + } +} + impl EntryCustom> { /// ```rust,no_run /// use ash::{vk, Entry, version::EntryV1_0}; @@ -228,15 +247,20 @@ impl EntryCustom { mem::transmute(static_fn.get_instance_proc_addr(vk::Instance::null(), name.as_ptr())) }); + let entry_fn_1_2 = vk::EntryFnV1_2::load(|name| unsafe { + mem::transmute(static_fn.get_instance_proc_addr(vk::Instance::null(), name.as_ptr())) + }); + Ok(EntryCustom { static_fn, entry_fn_1_0, entry_fn_1_1, + entry_fn_1_2, lib, }) } - #[doc = ""] + #[doc = ""] /// ```rust,no_run /// # use ash::{Entry, vk}; /// # fn main() -> Result<(), Box> { diff --git a/ash/src/extensions/ext/debug_marker.rs b/ash/src/extensions/ext/debug_marker.rs index 5e090a8..626f23a 100755 --- a/ash/src/extensions/ext/debug_marker.rs +++ b/ash/src/extensions/ext/debug_marker.rs @@ -22,7 +22,7 @@ impl DebugMarker { vk::ExtDebugMarkerFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn debug_marker_set_object_name( &self, device: vk::Device, @@ -37,7 +37,7 @@ impl DebugMarker { } } - #[doc = ""] + #[doc = ""] pub unsafe fn cmd_debug_marker_begin( &self, command_buffer: vk::CommandBuffer, @@ -47,13 +47,13 @@ impl DebugMarker { .cmd_debug_marker_begin_ext(command_buffer, marker_info); } - #[doc = ""] + #[doc = ""] pub unsafe fn cmd_debug_marker_end(&self, command_buffer: vk::CommandBuffer) { self.debug_marker_fn .cmd_debug_marker_end_ext(command_buffer); } - #[doc = ""] + #[doc = ""] pub unsafe fn cmd_debug_marker_insert( &self, command_buffer: vk::CommandBuffer, diff --git a/ash/src/extensions/ext/debug_report.rs b/ash/src/extensions/ext/debug_report.rs index 3235a7d..56dce80 100755 --- a/ash/src/extensions/ext/debug_report.rs +++ b/ash/src/extensions/ext/debug_report.rs @@ -27,7 +27,7 @@ impl DebugReport { vk::ExtDebugReportFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn destroy_debug_report_callback( &self, debug: vk::DebugReportCallbackEXT, @@ -40,7 +40,7 @@ impl DebugReport { ); } - #[doc = ""] + #[doc = ""] pub unsafe fn create_debug_report_callback( &self, create_info: &vk::DebugReportCallbackCreateInfoEXT, diff --git a/ash/src/extensions/ext/debug_utils.rs b/ash/src/extensions/ext/debug_utils.rs index 0314505..fdafd3d 100755 --- a/ash/src/extensions/ext/debug_utils.rs +++ b/ash/src/extensions/ext/debug_utils.rs @@ -26,7 +26,7 @@ impl DebugUtils { vk::ExtDebugUtilsFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn debug_utils_set_object_name( &self, device: vk::Device, @@ -41,7 +41,7 @@ impl DebugUtils { } } - #[doc = ""] + #[doc = ""] pub unsafe fn debug_utils_set_object_tag( &self, device: vk::Device, @@ -56,7 +56,7 @@ impl DebugUtils { } } - #[doc = ""] + #[doc = ""] pub unsafe fn cmd_begin_debug_utils_label( &self, command_buffer: vk::CommandBuffer, @@ -66,13 +66,13 @@ impl DebugUtils { .cmd_begin_debug_utils_label_ext(command_buffer, label); } - #[doc = ""] + #[doc = ""] pub unsafe fn cmd_end_debug_utils_label(&self, command_buffer: vk::CommandBuffer) { self.debug_utils_fn .cmd_end_debug_utils_label_ext(command_buffer); } - #[doc = ""] + #[doc = ""] pub unsafe fn cmd_insert_debug_utils_label( &self, command_buffer: vk::CommandBuffer, @@ -82,7 +82,7 @@ impl DebugUtils { .cmd_insert_debug_utils_label_ext(command_buffer, label); } - #[doc = ""] + #[doc = ""] pub unsafe fn queue_begin_debug_utils_label( &self, queue: vk::Queue, @@ -92,12 +92,12 @@ impl DebugUtils { .queue_begin_debug_utils_label_ext(queue, label); } - #[doc = ""] + #[doc = ""] pub unsafe fn queue_end_debug_utils_label(&self, queue: vk::Queue) { self.debug_utils_fn.queue_end_debug_utils_label_ext(queue); } - #[doc = ""] + #[doc = ""] pub unsafe fn queue_insert_debug_utils_label( &self, queue: vk::Queue, @@ -107,7 +107,7 @@ impl DebugUtils { .queue_insert_debug_utils_label_ext(queue, label); } - #[doc = ""] + #[doc = ""] pub unsafe fn create_debug_utils_messenger( &self, create_info: &vk::DebugUtilsMessengerCreateInfoEXT, @@ -126,7 +126,7 @@ impl DebugUtils { } } - #[doc = ""] + #[doc = ""] pub unsafe fn destroy_debug_utils_messenger( &self, messenger: vk::DebugUtilsMessengerEXT, @@ -139,7 +139,7 @@ impl DebugUtils { ); } - #[doc = ""] + #[doc = ""] pub unsafe fn submit_debug_utils_message( &self, instance: vk::Instance, diff --git a/ash/src/extensions/khr/android_surface.rs b/ash/src/extensions/khr/android_surface.rs index ec9fb0a..0a22d47 100755 --- a/ash/src/extensions/khr/android_surface.rs +++ b/ash/src/extensions/khr/android_surface.rs @@ -27,7 +27,7 @@ impl AndroidSurface { vk::KhrAndroidSurfaceFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn create_android_surface( &self, create_info: &vk::AndroidSurfaceCreateInfoKHR, diff --git a/ash/src/extensions/khr/display.rs b/ash/src/extensions/khr/display.rs index 380b72d..8ea5e62 100755 --- a/ash/src/extensions/khr/display.rs +++ b/ash/src/extensions/khr/display.rs @@ -27,7 +27,7 @@ impl Display { vk::KhrDisplayFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn get_physical_device_display_properties( &self, physical_device: vk::PhysicalDevice, @@ -51,7 +51,7 @@ impl Display { } } - #[doc = ""] + #[doc = ""] pub unsafe fn get_physical_device_display_plane_properties( &self, physical_device: vk::PhysicalDevice, @@ -78,7 +78,7 @@ impl Display { } } - #[doc = ""] + #[doc = ""] pub unsafe fn get_display_plane_supported_displays( &self, physical_device: vk::PhysicalDevice, @@ -105,7 +105,7 @@ impl Display { } } - #[doc = ""] + #[doc = ""] pub unsafe fn get_display_mode_properties( &self, physical_device: vk::PhysicalDevice, @@ -132,7 +132,7 @@ impl Display { } } - #[doc = ""] + #[doc = ""] pub unsafe fn create_display_mode( &self, physical_device: vk::PhysicalDevice, @@ -154,7 +154,7 @@ impl Display { } } - #[doc = ""] + #[doc = ""] pub unsafe fn get_display_plane_capabilities( &self, physical_device: vk::PhysicalDevice, @@ -174,7 +174,7 @@ impl Display { } } - #[doc = ""] + #[doc = ""] pub unsafe fn create_display_plane_surface( &self, create_info: &vk::DisplaySurfaceCreateInfoKHR, diff --git a/ash/src/extensions/khr/display_swapchain.rs b/ash/src/extensions/khr/display_swapchain.rs index d0079f3..bb4cfe2 100755 --- a/ash/src/extensions/khr/display_swapchain.rs +++ b/ash/src/extensions/khr/display_swapchain.rs @@ -27,7 +27,7 @@ impl DisplaySwapchain { vk::KhrDisplaySwapchainFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn create_shared_swapchains( &self, create_infos: &[vk::SwapchainCreateInfoKHR], diff --git a/ash/src/extensions/khr/push_descriptor.rs b/ash/src/extensions/khr/push_descriptor.rs index dc38bfa..152568e 100644 --- a/ash/src/extensions/khr/push_descriptor.rs +++ b/ash/src/extensions/khr/push_descriptor.rs @@ -27,7 +27,7 @@ impl PushDescriptor { vk::KhrPushDescriptorFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn cmd_push_descriptor_set( &self, command_buffer: vk::CommandBuffer, @@ -46,7 +46,7 @@ impl PushDescriptor { ); } - #[doc = ""] + #[doc = ""] pub unsafe fn cmd_push_descriptor_set_with_template( &self, command_buffer: vk::CommandBuffer, diff --git a/ash/src/extensions/khr/surface.rs b/ash/src/extensions/khr/surface.rs index c194e81..7cde5aa 100755 --- a/ash/src/extensions/khr/surface.rs +++ b/ash/src/extensions/khr/surface.rs @@ -28,7 +28,7 @@ impl Surface { vk::KhrSurfaceFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn get_physical_device_surface_support( &self, physical_device: vk::PhysicalDevice, @@ -49,7 +49,7 @@ impl Surface { } } - #[doc = ""] + #[doc = ""] pub unsafe fn get_physical_device_surface_present_modes( &self, physical_device: vk::PhysicalDevice, @@ -79,7 +79,7 @@ impl Surface { } } - #[doc = ""] + #[doc = ""] pub unsafe fn get_physical_device_surface_capabilities( &self, physical_device: vk::PhysicalDevice, @@ -99,7 +99,7 @@ impl Surface { } } - #[doc = ""] + #[doc = ""] pub unsafe fn get_physical_device_surface_formats( &self, physical_device: vk::PhysicalDevice, @@ -126,7 +126,7 @@ impl Surface { } } - #[doc = ""] + #[doc = ""] pub unsafe fn destroy_surface( &self, surface: vk::SurfaceKHR, diff --git a/ash/src/extensions/khr/swapchain.rs b/ash/src/extensions/khr/swapchain.rs index cd0129b..266b987 100755 --- a/ash/src/extensions/khr/swapchain.rs +++ b/ash/src/extensions/khr/swapchain.rs @@ -28,7 +28,7 @@ impl Swapchain { vk::KhrSwapchainFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn destroy_swapchain( &self, swapchain: vk::SwapchainKHR, @@ -42,7 +42,7 @@ impl Swapchain { } /// On success, returns the next image's index and whether the swapchain is suboptimal for the surface. - #[doc = ""] + #[doc = ""] pub unsafe fn acquire_next_image( &self, swapchain: vk::SwapchainKHR, @@ -66,7 +66,7 @@ impl Swapchain { } } - #[doc = ""] + #[doc = ""] pub unsafe fn create_swapchain( &self, create_info: &vk::SwapchainCreateInfoKHR, @@ -86,7 +86,7 @@ impl Swapchain { } /// On success, returns whether the swapchain is suboptimal for the surface. - #[doc = ""] + #[doc = ""] pub unsafe fn queue_present( &self, queue: vk::Queue, @@ -100,7 +100,7 @@ impl Swapchain { } } - #[doc = ""] + #[doc = ""] pub unsafe fn get_swapchain_images( &self, swapchain: vk::SwapchainKHR, diff --git a/ash/src/extensions/khr/wayland_surface.rs b/ash/src/extensions/khr/wayland_surface.rs index 3a22b1d..d705f38 100755 --- a/ash/src/extensions/khr/wayland_surface.rs +++ b/ash/src/extensions/khr/wayland_surface.rs @@ -27,7 +27,7 @@ impl WaylandSurface { vk::KhrWaylandSurfaceFn::name() } - #[doc = ""] + #[doc = ""] pub unsafe fn create_wayland_surface( &self, create_info: &vk::WaylandSurfaceCreateInfoKHR, @@ -46,7 +46,7 @@ impl WaylandSurface { } } - #[doc = " VkResult<()> { let err_code = self .ray_tracing_fn diff --git a/ash/src/instance.rs b/ash/src/instance.rs index be39540..4599a00 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -7,12 +7,13 @@ use std::mem; use std::os::raw::c_char; use std::ptr; -#[doc = ""] +#[doc = ""] #[derive(Clone)] pub struct Instance { handle: vk::Instance, instance_fn_1_0: vk::InstanceFnV1_0, instance_fn_1_1: vk::InstanceFnV1_1, + instance_fn_1_2: vk::InstanceFnV1_2, } impl Instance { pub unsafe fn load(static_fn: &vk::StaticFn, instance: vk::Instance) -> Self { @@ -22,18 +23,22 @@ impl Instance { let instance_fn_1_1 = vk::InstanceFnV1_1::load(|name| { mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr())) }); + let instance_fn_1_2 = vk::InstanceFnV1_2::load(|name| { + mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr())) + }); Instance { handle: instance, instance_fn_1_0, instance_fn_1_1, + instance_fn_1_2, } } } impl InstanceV1_0 for Instance { type Device = Device; - #[doc = ""] + #[doc = ""] unsafe fn create_device( &self, physical_device: vk::PhysicalDevice, @@ -67,6 +72,17 @@ impl InstanceV1_1 for Instance { } } +impl InstanceV1_2 for Instance { + fn fp_v1_2(&self) -> &vk::InstanceFnV1_2 { + &self.instance_fn_1_2 + } +} + +#[allow(non_camel_case_types)] +pub trait InstanceV1_2: InstanceV1_1 { + fn fp_v1_2(&self) -> &vk::InstanceFnV1_2; +} + #[allow(non_camel_case_types)] pub trait InstanceV1_1: InstanceV1_0 { fn fp_v1_1(&self) -> &vk::InstanceFnV1_1; @@ -81,7 +97,7 @@ pub trait InstanceV1_1: InstanceV1_0 { group_count as usize } - #[doc = ""] + #[doc = ""] fn enumerate_physical_device_groups( &self, out: &mut [vk::PhysicalDeviceGroupProperties], @@ -101,7 +117,17 @@ pub trait InstanceV1_1: InstanceV1_0 { } } - #[doc = ""] + #[doc = ""] + unsafe fn get_physical_device_features2( + &self, + physical_device: vk::PhysicalDevice, + features: &mut vk::PhysicalDeviceFeatures2, + ) { + self.fp_v1_1() + .get_physical_device_features2(physical_device, features); + } + + #[doc = ""] unsafe fn get_physical_device_properties2( &self, physical_device: vk::PhysicalDevice, @@ -111,7 +137,7 @@ pub trait InstanceV1_1: InstanceV1_0 { .get_physical_device_properties2(physical_device, prop); } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_format_properties2( &self, physical_device: vk::PhysicalDevice, @@ -122,7 +148,7 @@ pub trait InstanceV1_1: InstanceV1_0 { .get_physical_device_format_properties2(physical_device, format, out); } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_image_format_properties2( &self, physical_device: vk::PhysicalDevice, @@ -154,7 +180,7 @@ pub trait InstanceV1_1: InstanceV1_0 { queue_count as usize } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_queue_family_properties2( &self, physical_device: vk::PhysicalDevice, @@ -168,7 +194,7 @@ pub trait InstanceV1_1: InstanceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_memory_properties2( &self, physical_device: vk::PhysicalDevice, @@ -194,7 +220,7 @@ pub trait InstanceV1_1: InstanceV1_0 { format_count as usize } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_sparse_image_format_properties2( &self, physical_device: vk::PhysicalDevice, @@ -211,7 +237,7 @@ pub trait InstanceV1_1: InstanceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_external_buffer_properties( &self, physical_device: vk::PhysicalDevice, @@ -226,7 +252,7 @@ pub trait InstanceV1_1: InstanceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_external_fence_properties( &self, physical_device: vk::PhysicalDevice, @@ -241,7 +267,7 @@ pub trait InstanceV1_1: InstanceV1_0 { ); } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_external_semaphore_properties( &self, physical_device: vk::PhysicalDevice, @@ -262,7 +288,7 @@ pub trait InstanceV1_0 { type Device; fn handle(&self) -> vk::Instance; fn fp_v1_0(&self) -> &vk::InstanceFnV1_0; - #[doc = ""] + #[doc = ""] unsafe fn create_device( &self, physical_device: vk::PhysicalDevice, @@ -270,7 +296,7 @@ pub trait InstanceV1_0 { allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> Result; - #[doc = ""] + #[doc = ""] unsafe fn get_device_proc_addr( &self, device: vk::Device, @@ -279,13 +305,13 @@ pub trait InstanceV1_0 { self.fp_v1_0().get_device_proc_addr(device, p_name) } - #[doc = ""] + #[doc = ""] unsafe fn destroy_instance(&self, allocation_callbacks: Option<&vk::AllocationCallbacks>) { self.fp_v1_0() .destroy_instance(self.handle(), allocation_callbacks.as_raw_ptr()); } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_format_properties( &self, physical_device: vk::PhysicalDevice, @@ -300,7 +326,7 @@ pub trait InstanceV1_0 { format_prop } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_image_format_properties( &self, physical_device: vk::PhysicalDevice, @@ -327,7 +353,7 @@ pub trait InstanceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_memory_properties( &self, physical_device: vk::PhysicalDevice, @@ -338,7 +364,7 @@ pub trait InstanceV1_0 { memory_prop } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_properties( &self, physical_device: vk::PhysicalDevice, @@ -349,7 +375,7 @@ pub trait InstanceV1_0 { prop } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_queue_family_properties( &self, physical_device: vk::PhysicalDevice, @@ -370,7 +396,7 @@ pub trait InstanceV1_0 { queue_families_vec } - #[doc = ""] + #[doc = ""] unsafe fn get_physical_device_features( &self, physical_device: vk::PhysicalDevice, @@ -381,7 +407,7 @@ pub trait InstanceV1_0 { prop } - #[doc = ""] + #[doc = ""] unsafe fn enumerate_physical_devices(&self) -> VkResult> { let mut num = mem::zeroed(); self.fp_v1_0() @@ -399,7 +425,7 @@ pub trait InstanceV1_0 { } } - #[doc = ""] + #[doc = ""] unsafe fn enumerate_device_extension_properties( &self, device: vk::PhysicalDevice, diff --git a/ash/src/lib.rs b/ash/src/lib.rs index 392e405..3b7f72d 100644 --- a/ash/src/lib.rs +++ b/ash/src/lib.rs @@ -1,7 +1,7 @@ #![allow(clippy::too_many_arguments, clippy::missing_safety_doc)] //! # Vulkan API //! -//! +//! //! //! ## Examples //! diff --git a/ash/src/version.rs b/ash/src/version.rs index e6121a8..18dd2c9 100644 --- a/ash/src/version.rs +++ b/ash/src/version.rs @@ -1,3 +1,3 @@ -pub use crate::device::{DeviceV1_0, DeviceV1_1}; -pub use crate::entry::{EntryV1_0, EntryV1_1}; -pub use crate::instance::{InstanceV1_0, InstanceV1_1}; +pub use crate::device::{DeviceV1_0, DeviceV1_1, DeviceV1_2}; +pub use crate::entry::{EntryV1_0, EntryV1_1, EntryV1_2}; +pub use crate::instance::{InstanceV1_0, InstanceV1_1, InstanceV1_2};