From fad6f51aaec2b9c28082bde479365226aaa0231b Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Tue, 4 Dec 2018 21:01:29 +0100 Subject: [PATCH 1/3] Move extensions into vendor specific modules --- .../extensions/{ => khr}/android_surface.rs | 0 ash/src/extensions/{ => khr}/debug_marker.rs | 0 ash/src/extensions/{ => khr}/debug_report.rs | 0 ash/src/extensions/{ => khr}/debug_utils.rs | 0 .../extensions/{ => khr}/display_swapchain.rs | 0 ash/src/extensions/khr/mod.rs | 23 +++++++++++++ ash/src/extensions/{ => khr}/surface.rs | 0 ash/src/extensions/{ => khr}/swapchain.rs | 0 .../extensions/{ => khr}/wayland_surface.rs | 0 ash/src/extensions/{ => khr}/win32_surface.rs | 0 ash/src/extensions/{ => khr}/xcb_surface.rs | 0 ash/src/extensions/{ => khr}/xlib_surface.rs | 0 ash/src/extensions/mod.rs | 32 ++----------------- ash/src/extensions/{ => mvk}/ios_surface.rs | 0 ash/src/extensions/{ => mvk}/macos_surface.rs | 0 ash/src/extensions/mvk/mod.rs | 5 +++ ash/src/extensions/{ => nv}/mesh_shader.rs | 0 ash/src/extensions/nv/mod.rs | 3 ++ examples/src/lib.rs | 6 ++-- 19 files changed, 37 insertions(+), 32 deletions(-) rename ash/src/extensions/{ => khr}/android_surface.rs (100%) rename ash/src/extensions/{ => khr}/debug_marker.rs (100%) rename ash/src/extensions/{ => khr}/debug_report.rs (100%) rename ash/src/extensions/{ => khr}/debug_utils.rs (100%) rename ash/src/extensions/{ => khr}/display_swapchain.rs (100%) create mode 100644 ash/src/extensions/khr/mod.rs rename ash/src/extensions/{ => khr}/surface.rs (100%) rename ash/src/extensions/{ => khr}/swapchain.rs (100%) rename ash/src/extensions/{ => khr}/wayland_surface.rs (100%) rename ash/src/extensions/{ => khr}/win32_surface.rs (100%) rename ash/src/extensions/{ => khr}/xcb_surface.rs (100%) rename ash/src/extensions/{ => khr}/xlib_surface.rs (100%) rename ash/src/extensions/{ => mvk}/ios_surface.rs (100%) rename ash/src/extensions/{ => mvk}/macos_surface.rs (100%) create mode 100644 ash/src/extensions/mvk/mod.rs rename ash/src/extensions/{ => nv}/mesh_shader.rs (100%) create mode 100644 ash/src/extensions/nv/mod.rs diff --git a/ash/src/extensions/android_surface.rs b/ash/src/extensions/khr/android_surface.rs similarity index 100% rename from ash/src/extensions/android_surface.rs rename to ash/src/extensions/khr/android_surface.rs diff --git a/ash/src/extensions/debug_marker.rs b/ash/src/extensions/khr/debug_marker.rs similarity index 100% rename from ash/src/extensions/debug_marker.rs rename to ash/src/extensions/khr/debug_marker.rs diff --git a/ash/src/extensions/debug_report.rs b/ash/src/extensions/khr/debug_report.rs similarity index 100% rename from ash/src/extensions/debug_report.rs rename to ash/src/extensions/khr/debug_report.rs diff --git a/ash/src/extensions/debug_utils.rs b/ash/src/extensions/khr/debug_utils.rs similarity index 100% rename from ash/src/extensions/debug_utils.rs rename to ash/src/extensions/khr/debug_utils.rs diff --git a/ash/src/extensions/display_swapchain.rs b/ash/src/extensions/khr/display_swapchain.rs similarity index 100% rename from ash/src/extensions/display_swapchain.rs rename to ash/src/extensions/khr/display_swapchain.rs diff --git a/ash/src/extensions/khr/mod.rs b/ash/src/extensions/khr/mod.rs new file mode 100644 index 0000000..7c4cfe2 --- /dev/null +++ b/ash/src/extensions/khr/mod.rs @@ -0,0 +1,23 @@ +pub use self::android_surface::AndroidSurface; +pub use self::debug_marker::DebugMarker; +pub use self::debug_report::DebugReport; +pub use self::debug_utils::DebugUtils; +pub use self::display_swapchain::DisplaySwapchain; +pub use self::surface::Surface; +pub use self::swapchain::Swapchain; +pub use self::wayland_surface::WaylandSurface; +pub use self::win32_surface::Win32Surface; +pub use self::xcb_surface::XcbSurface; +pub use self::xlib_surface::XlibSurface; + +mod android_surface; +mod debug_marker; +mod debug_report; +mod debug_utils; +mod display_swapchain; +mod surface; +mod swapchain; +mod wayland_surface; +mod win32_surface; +mod xcb_surface; +mod xlib_surface; diff --git a/ash/src/extensions/surface.rs b/ash/src/extensions/khr/surface.rs similarity index 100% rename from ash/src/extensions/surface.rs rename to ash/src/extensions/khr/surface.rs diff --git a/ash/src/extensions/swapchain.rs b/ash/src/extensions/khr/swapchain.rs similarity index 100% rename from ash/src/extensions/swapchain.rs rename to ash/src/extensions/khr/swapchain.rs diff --git a/ash/src/extensions/wayland_surface.rs b/ash/src/extensions/khr/wayland_surface.rs similarity index 100% rename from ash/src/extensions/wayland_surface.rs rename to ash/src/extensions/khr/wayland_surface.rs diff --git a/ash/src/extensions/win32_surface.rs b/ash/src/extensions/khr/win32_surface.rs similarity index 100% rename from ash/src/extensions/win32_surface.rs rename to ash/src/extensions/khr/win32_surface.rs diff --git a/ash/src/extensions/xcb_surface.rs b/ash/src/extensions/khr/xcb_surface.rs similarity index 100% rename from ash/src/extensions/xcb_surface.rs rename to ash/src/extensions/khr/xcb_surface.rs diff --git a/ash/src/extensions/xlib_surface.rs b/ash/src/extensions/khr/xlib_surface.rs similarity index 100% rename from ash/src/extensions/xlib_surface.rs rename to ash/src/extensions/khr/xlib_surface.rs diff --git a/ash/src/extensions/mod.rs b/ash/src/extensions/mod.rs index 8d28374..91b0897 100644 --- a/ash/src/extensions/mod.rs +++ b/ash/src/extensions/mod.rs @@ -1,29 +1,3 @@ -pub use self::android_surface::AndroidSurface; -pub use self::debug_marker::DebugMarker; -pub use self::debug_report::DebugReport; -pub use self::debug_utils::DebugUtils; -pub use self::display_swapchain::DisplaySwapchain; -pub use self::ios_surface::IOSSurface; -pub use self::macos_surface::MacOSSurface; -pub use self::mesh_shader::MeshShader; -pub use self::surface::Surface; -pub use self::swapchain::Swapchain; -pub use self::wayland_surface::WaylandSurface; -pub use self::win32_surface::Win32Surface; -pub use self::xcb_surface::XcbSurface; -pub use self::xlib_surface::XlibSurface; - -mod android_surface; -mod debug_marker; -mod debug_report; -mod debug_utils; -mod display_swapchain; -mod ios_surface; -mod macos_surface; -mod mesh_shader; -mod surface; -mod swapchain; -mod wayland_surface; -mod win32_surface; -mod xcb_surface; -mod xlib_surface; +pub mod khr; +pub mod nv; +pub mod mvk; diff --git a/ash/src/extensions/ios_surface.rs b/ash/src/extensions/mvk/ios_surface.rs similarity index 100% rename from ash/src/extensions/ios_surface.rs rename to ash/src/extensions/mvk/ios_surface.rs diff --git a/ash/src/extensions/macos_surface.rs b/ash/src/extensions/mvk/macos_surface.rs similarity index 100% rename from ash/src/extensions/macos_surface.rs rename to ash/src/extensions/mvk/macos_surface.rs diff --git a/ash/src/extensions/mvk/mod.rs b/ash/src/extensions/mvk/mod.rs new file mode 100644 index 0000000..e475d53 --- /dev/null +++ b/ash/src/extensions/mvk/mod.rs @@ -0,0 +1,5 @@ +pub use self::ios_surface::IOSSurface; +pub use self::macos_surface::MacOSSurface; + +mod ios_surface; +mod macos_surface; diff --git a/ash/src/extensions/mesh_shader.rs b/ash/src/extensions/nv/mesh_shader.rs similarity index 100% rename from ash/src/extensions/mesh_shader.rs rename to ash/src/extensions/nv/mesh_shader.rs diff --git a/ash/src/extensions/nv/mod.rs b/ash/src/extensions/nv/mod.rs new file mode 100644 index 0000000..4a8d1e5 --- /dev/null +++ b/ash/src/extensions/nv/mod.rs @@ -0,0 +1,3 @@ +pub use self::mesh_shader::MeshShader; + +mod mesh_shader; diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 195903c..df9c526 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -21,13 +21,13 @@ use objc::runtime::YES; #[cfg(target_os = "macos")] use std::mem; +#[cfg(all(unix, not(target_os = "android"), not(target_os = "macos")))] +use ash::extensions::khr::XlibSurface; +use ash::extensions::khr::{DebugReport, Surface, Swapchain}; #[cfg(target_os = "macos")] use ash::extensions::MacOSSurface; #[cfg(target_os = "windows")] use ash::extensions::Win32Surface; -#[cfg(all(unix, not(target_os = "android"), not(target_os = "macos")))] -use ash::extensions::XlibSurface; -use ash::extensions::{DebugReport, Surface, Swapchain}; pub use ash::version::{DeviceV1_0, EntryV1_0, InstanceV1_0}; use ash::vk; use ash::Device; From ab7f960ae80befab357402a3d066d5dc84b3be40 Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Tue, 4 Dec 2018 21:22:03 +0100 Subject: [PATCH 2/3] Remove all vendor tags from the fns --- .../extensions/{khr => ext}/debug_marker.rs | 8 ++-- .../extensions/{khr => ext}/debug_report.rs | 4 +- .../extensions/{khr => ext}/debug_utils.rs | 22 +++++------ ash/src/extensions/ext/mod.rs | 7 ++++ ash/src/extensions/khr/android_surface.rs | 2 +- ash/src/extensions/khr/display_swapchain.rs | 2 +- ash/src/extensions/khr/mod.rs | 6 --- ash/src/extensions/khr/surface.rs | 10 ++--- ash/src/extensions/khr/swapchain.rs | 10 ++--- ash/src/extensions/khr/wayland_surface.rs | 2 +- ash/src/extensions/khr/win32_surface.rs | 2 +- ash/src/extensions/khr/xcb_surface.rs | 2 +- ash/src/extensions/khr/xlib_surface.rs | 2 +- ash/src/extensions/mod.rs | 1 + ash/src/extensions/nv/mesh_shader.rs | 6 +-- examples/src/bin/texture.rs | 4 +- examples/src/bin/triangle.rs | 4 +- examples/src/lib.rs | 37 +++++++++---------- 18 files changed, 66 insertions(+), 65 deletions(-) rename ash/src/extensions/{khr => ext}/debug_marker.rs (87%) rename ash/src/extensions/{khr => ext}/debug_report.rs (94%) rename ash/src/extensions/{khr => ext}/debug_utils.rs (85%) create mode 100644 ash/src/extensions/ext/mod.rs diff --git a/ash/src/extensions/khr/debug_marker.rs b/ash/src/extensions/ext/debug_marker.rs similarity index 87% rename from ash/src/extensions/khr/debug_marker.rs rename to ash/src/extensions/ext/debug_marker.rs index 5483985..fe954e9 100644 --- a/ash/src/extensions/khr/debug_marker.rs +++ b/ash/src/extensions/ext/debug_marker.rs @@ -24,7 +24,7 @@ impl DebugMarker { CStr::from_bytes_with_nul(b"VK_EXT_debug_marker\0").expect("Wrong extension string") } - pub unsafe fn debug_marker_set_object_name_ext( + pub unsafe fn debug_marker_set_object_name( &self, device: vk::Device, name_info: &vk::DebugMarkerObjectNameInfoEXT, @@ -38,7 +38,7 @@ impl DebugMarker { } } - pub unsafe fn cmd_debug_marker_begin_ext( + pub unsafe fn cmd_debug_marker_begin( &self, command_buffer: vk::CommandBuffer, marker_info: &vk::DebugMarkerMarkerInfoEXT, @@ -47,12 +47,12 @@ impl DebugMarker { .cmd_debug_marker_begin_ext(command_buffer, marker_info); } - pub unsafe fn cmd_debug_marker_end_ext(&self, command_buffer: vk::CommandBuffer) { + pub unsafe fn cmd_debug_marker_end(&self, command_buffer: vk::CommandBuffer) { self.debug_marker_fn .cmd_debug_marker_end_ext(command_buffer); } - pub unsafe fn cmd_debug_marker_insert_ext( + pub unsafe fn cmd_debug_marker_insert( &self, command_buffer: vk::CommandBuffer, marker_info: &vk::DebugMarkerMarkerInfoEXT, diff --git a/ash/src/extensions/khr/debug_report.rs b/ash/src/extensions/ext/debug_report.rs similarity index 94% rename from ash/src/extensions/khr/debug_report.rs rename to ash/src/extensions/ext/debug_report.rs index 421b3a9..ec8e147 100644 --- a/ash/src/extensions/khr/debug_report.rs +++ b/ash/src/extensions/ext/debug_report.rs @@ -27,7 +27,7 @@ impl DebugReport { CStr::from_bytes_with_nul(b"VK_EXT_debug_report\0").expect("Wrong extension string") } - pub unsafe fn destroy_debug_report_callback_ext( + pub unsafe fn destroy_debug_report_callback( &self, debug: vk::DebugReportCallbackEXT, allocation_callbacks: Option<&vk::AllocationCallbacks>, @@ -39,7 +39,7 @@ impl DebugReport { ); } - pub unsafe fn create_debug_report_callback_ext( + pub unsafe fn create_debug_report_callback( &self, create_info: &vk::DebugReportCallbackCreateInfoEXT, allocation_callbacks: Option<&vk::AllocationCallbacks>, diff --git a/ash/src/extensions/khr/debug_utils.rs b/ash/src/extensions/ext/debug_utils.rs similarity index 85% rename from ash/src/extensions/khr/debug_utils.rs rename to ash/src/extensions/ext/debug_utils.rs index 67485a0..443e688 100644 --- a/ash/src/extensions/khr/debug_utils.rs +++ b/ash/src/extensions/ext/debug_utils.rs @@ -26,7 +26,7 @@ impl DebugUtils { CStr::from_bytes_with_nul(b"VK_EXT_debug_utils\0").expect("Wrong extension string") } - pub unsafe fn debug_utils_set_object_name_ext( + pub unsafe fn debug_utils_set_object_name( &self, device: vk::Device, name_info: &vk::DebugUtilsObjectNameInfoEXT, @@ -40,7 +40,7 @@ impl DebugUtils { } } - pub unsafe fn debug_utils_set_object_tag_ext( + pub unsafe fn debug_utils_set_object_tag( &self, device: vk::Device, tag_info: &vk::DebugUtilsObjectTagInfoEXT, @@ -54,7 +54,7 @@ impl DebugUtils { } } - pub unsafe fn cmd_begin_debug_utils_label_ext( + pub unsafe fn cmd_begin_debug_utils_label( &self, command_buffer: vk::CommandBuffer, label: &vk::DebugUtilsLabelEXT, @@ -63,12 +63,12 @@ impl DebugUtils { .cmd_begin_debug_utils_label_ext(command_buffer, label); } - pub unsafe fn cmd_end_debug_utils_label_ext(&self, command_buffer: vk::CommandBuffer) { + 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); } - pub unsafe fn cmd_insert_debug_utils_label_ext( + pub unsafe fn cmd_insert_debug_utils_label( &self, command_buffer: vk::CommandBuffer, label: &vk::DebugUtilsLabelEXT, @@ -77,7 +77,7 @@ impl DebugUtils { .cmd_insert_debug_utils_label_ext(command_buffer, label); } - pub unsafe fn queue_begin_debug_utils_label_ext( + pub unsafe fn queue_begin_debug_utils_label( &self, queue: vk::Queue, label: &vk::DebugUtilsLabelEXT, @@ -86,11 +86,11 @@ impl DebugUtils { .queue_begin_debug_utils_label_ext(queue, label); } - pub unsafe fn queue_end_debug_utils_label_ext(&self, queue: vk::Queue) { + pub unsafe fn queue_end_debug_utils_label(&self, queue: vk::Queue) { self.debug_utils_fn.queue_end_debug_utils_label_ext(queue); } - pub unsafe fn queue_insert_debug_utils_label_ext( + pub unsafe fn queue_insert_debug_utils_label( &self, queue: vk::Queue, label: &vk::DebugUtilsLabelEXT, @@ -99,7 +99,7 @@ impl DebugUtils { .queue_insert_debug_utils_label_ext(queue, label); } - pub unsafe fn create_debug_utils_messenger_ext( + pub unsafe fn create_debug_utils_messenger( &self, create_info: &vk::DebugUtilsMessengerCreateInfoEXT, allocator: Option<&vk::AllocationCallbacks>, @@ -117,7 +117,7 @@ impl DebugUtils { } } - pub unsafe fn destroy_debug_utils_messenger_ext( + pub unsafe fn destroy_debug_utils_messenger( &self, messenger: vk::DebugUtilsMessengerEXT, allocator: Option<&vk::AllocationCallbacks>, @@ -129,7 +129,7 @@ impl DebugUtils { ); } - pub unsafe fn submit_debug_utils_message_ext( + pub unsafe fn submit_debug_utils_message( &self, instance: vk::Instance, message_severity: vk::DebugUtilsMessageSeverityFlagsEXT, diff --git a/ash/src/extensions/ext/mod.rs b/ash/src/extensions/ext/mod.rs new file mode 100644 index 0000000..eba690f --- /dev/null +++ b/ash/src/extensions/ext/mod.rs @@ -0,0 +1,7 @@ +pub use self::debug_marker::DebugMarker; +pub use self::debug_report::DebugReport; +pub use self::debug_utils::DebugUtils; + +mod debug_marker; +mod debug_report; +mod debug_utils; diff --git a/ash/src/extensions/khr/android_surface.rs b/ash/src/extensions/khr/android_surface.rs index 9643d6b..0ceade6 100644 --- a/ash/src/extensions/khr/android_surface.rs +++ b/ash/src/extensions/khr/android_surface.rs @@ -27,7 +27,7 @@ impl AndroidSurface { CStr::from_bytes_with_nul(b"VK_KHR_android_surface\0").expect("Wrong extension string") } - pub unsafe fn create_android_surface_khr( + pub unsafe fn create_android_surface( &self, create_info: &vk::AndroidSurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, diff --git a/ash/src/extensions/khr/display_swapchain.rs b/ash/src/extensions/khr/display_swapchain.rs index 5cd0184..dfe1820 100644 --- a/ash/src/extensions/khr/display_swapchain.rs +++ b/ash/src/extensions/khr/display_swapchain.rs @@ -27,7 +27,7 @@ impl DisplaySwapchain { CStr::from_bytes_with_nul(b"VK_KHR_display_swapchain\0").expect("Wrong extension string") } - pub unsafe fn create_shared_swapchains_khr( + pub unsafe fn create_shared_swapchains( &self, create_infos: &[vk::SwapchainCreateInfoKHR], allocation_callbacks: Option<&vk::AllocationCallbacks>, diff --git a/ash/src/extensions/khr/mod.rs b/ash/src/extensions/khr/mod.rs index 7c4cfe2..8812674 100644 --- a/ash/src/extensions/khr/mod.rs +++ b/ash/src/extensions/khr/mod.rs @@ -1,7 +1,4 @@ pub use self::android_surface::AndroidSurface; -pub use self::debug_marker::DebugMarker; -pub use self::debug_report::DebugReport; -pub use self::debug_utils::DebugUtils; pub use self::display_swapchain::DisplaySwapchain; pub use self::surface::Surface; pub use self::swapchain::Swapchain; @@ -11,9 +8,6 @@ pub use self::xcb_surface::XcbSurface; pub use self::xlib_surface::XlibSurface; mod android_surface; -mod debug_marker; -mod debug_report; -mod debug_utils; mod display_swapchain; mod surface; mod swapchain; diff --git a/ash/src/extensions/khr/surface.rs b/ash/src/extensions/khr/surface.rs index 3f37bb7..bfcaca4 100644 --- a/ash/src/extensions/khr/surface.rs +++ b/ash/src/extensions/khr/surface.rs @@ -28,7 +28,7 @@ impl Surface { CStr::from_bytes_with_nul(b"VK_KHR_surface\0").expect("Wrong extension string") } - pub unsafe fn get_physical_device_surface_support_khr( + pub unsafe fn get_physical_device_surface_support( &self, physical_device: vk::PhysicalDevice, queue_index: u32, @@ -44,7 +44,7 @@ impl Surface { b > 0 } - pub unsafe fn get_physical_device_surface_present_modes_khr( + pub unsafe fn get_physical_device_surface_present_modes( &self, physical_device: vk::PhysicalDevice, surface: vk::SurfaceKHR, @@ -73,7 +73,7 @@ impl Surface { } } - pub unsafe fn get_physical_device_surface_capabilities_khr( + pub unsafe fn get_physical_device_surface_capabilities( &self, physical_device: vk::PhysicalDevice, surface: vk::SurfaceKHR, @@ -92,7 +92,7 @@ impl Surface { } } - pub unsafe fn get_physical_device_surface_formats_khr( + pub unsafe fn get_physical_device_surface_formats( &self, physical_device: vk::PhysicalDevice, surface: vk::SurfaceKHR, @@ -118,7 +118,7 @@ impl Surface { } } - pub unsafe fn destroy_surface_khr( + pub unsafe fn destroy_surface( &self, surface: vk::SurfaceKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, diff --git a/ash/src/extensions/khr/swapchain.rs b/ash/src/extensions/khr/swapchain.rs index 5841602..fb24d59 100644 --- a/ash/src/extensions/khr/swapchain.rs +++ b/ash/src/extensions/khr/swapchain.rs @@ -28,7 +28,7 @@ impl Swapchain { CStr::from_bytes_with_nul(b"VK_KHR_swapchain\0").expect("Wrong extension string") } - pub unsafe fn destroy_swapchain_khr( + pub unsafe fn destroy_swapchain( &self, swapchain: vk::SwapchainKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, @@ -41,7 +41,7 @@ impl Swapchain { } /// On success, returns the next image's index and whether the swapchain is suboptimal for the surface. - pub unsafe fn acquire_next_image_khr( + pub unsafe fn acquire_next_image( &self, swapchain: vk::SwapchainKHR, timeout: u64, @@ -64,7 +64,7 @@ impl Swapchain { } } - pub unsafe fn create_swapchain_khr( + pub unsafe fn create_swapchain( &self, create_info: &vk::SwapchainCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, @@ -83,7 +83,7 @@ impl Swapchain { } /// On success, returns whether the swapchain is suboptimal for the surface. - pub unsafe fn queue_present_khr( + pub unsafe fn queue_present( &self, queue: vk::Queue, create_info: &vk::PresentInfoKHR, @@ -96,7 +96,7 @@ impl Swapchain { } } - pub unsafe fn get_swapchain_images_khr( + pub unsafe fn get_swapchain_images( &self, swapchain: vk::SwapchainKHR, ) -> VkResult> { diff --git a/ash/src/extensions/khr/wayland_surface.rs b/ash/src/extensions/khr/wayland_surface.rs index 04cdd2f..7a1608c 100644 --- a/ash/src/extensions/khr/wayland_surface.rs +++ b/ash/src/extensions/khr/wayland_surface.rs @@ -27,7 +27,7 @@ impl WaylandSurface { CStr::from_bytes_with_nul(b"VK_KHR_wayland_surface\0").expect("Wrong extension string") } - pub unsafe fn create_wayland_surface_khr( + pub unsafe fn create_wayland_surface( &self, create_info: &vk::WaylandSurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, diff --git a/ash/src/extensions/khr/win32_surface.rs b/ash/src/extensions/khr/win32_surface.rs index 15339bd..86daec6 100644 --- a/ash/src/extensions/khr/win32_surface.rs +++ b/ash/src/extensions/khr/win32_surface.rs @@ -27,7 +27,7 @@ impl Win32Surface { CStr::from_bytes_with_nul(b"VK_KHR_win32_surface\0").expect("Wrong extension string") } - pub unsafe fn create_win32_surface_khr( + pub unsafe fn create_win32_surface( &self, create_info: &vk::Win32SurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, diff --git a/ash/src/extensions/khr/xcb_surface.rs b/ash/src/extensions/khr/xcb_surface.rs index 5575533..e3a662d 100644 --- a/ash/src/extensions/khr/xcb_surface.rs +++ b/ash/src/extensions/khr/xcb_surface.rs @@ -27,7 +27,7 @@ impl XcbSurface { CStr::from_bytes_with_nul(b"VK_KHR_xcb_surface\0").expect("Wrong extension string") } - pub unsafe fn create_xcb_surface_khr( + pub unsafe fn create_xcb_surface( &self, create_info: &vk::XcbSurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, diff --git a/ash/src/extensions/khr/xlib_surface.rs b/ash/src/extensions/khr/xlib_surface.rs index 79c3990..ffd9ab1 100644 --- a/ash/src/extensions/khr/xlib_surface.rs +++ b/ash/src/extensions/khr/xlib_surface.rs @@ -27,7 +27,7 @@ impl XlibSurface { CStr::from_bytes_with_nul(b"VK_KHR_xlib_surface\0").expect("Wrong extension string") } - pub unsafe fn create_xlib_surface_khr( + pub unsafe fn create_xlib_surface( &self, create_info: &vk::XlibSurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, diff --git a/ash/src/extensions/mod.rs b/ash/src/extensions/mod.rs index 91b0897..a967d84 100644 --- a/ash/src/extensions/mod.rs +++ b/ash/src/extensions/mod.rs @@ -1,3 +1,4 @@ pub mod khr; pub mod nv; pub mod mvk; +pub mod ext; diff --git a/ash/src/extensions/nv/mesh_shader.rs b/ash/src/extensions/nv/mesh_shader.rs index 988b34b..db08f83 100644 --- a/ash/src/extensions/nv/mesh_shader.rs +++ b/ash/src/extensions/nv/mesh_shader.rs @@ -16,7 +16,7 @@ impl MeshShader { }); MeshShader { mesh_shader_fn } } - pub unsafe fn cmd_draw_mesh_tasks_nv( + pub unsafe fn cmd_draw_mesh_tasks( &self, command_buffer: vk::CommandBuffer, task_count: u32, @@ -25,7 +25,7 @@ impl MeshShader { self.mesh_shader_fn .cmd_draw_mesh_tasks_nv(command_buffer, task_count, first_task); } - pub unsafe fn cmd_draw_mesh_tasks_indirect_nv( + pub unsafe fn cmd_draw_mesh_tasks_indirect( &self, command_buffer: vk::CommandBuffer, buffer: vk::Buffer, @@ -41,7 +41,7 @@ impl MeshShader { stride, ); } - pub unsafe fn cmd_draw_mesh_tasks_indirect_count_nv( + pub unsafe fn cmd_draw_mesh_tasks_indirect_count( &self, command_buffer: vk::CommandBuffer, buffer: vk::Buffer, diff --git a/examples/src/bin/texture.rs b/examples/src/bin/texture.rs index dc68c8d..db7dedd 100644 --- a/examples/src/bin/texture.rs +++ b/examples/src/bin/texture.rs @@ -867,7 +867,7 @@ fn main() { base.render_loop(|| { let (present_index, _) = base .swapchain_loader - .acquire_next_image_khr( + .acquire_next_image( base.swapchain, std::u64::MAX, base.present_complete_semaphore, @@ -964,7 +964,7 @@ fn main() { p_results: ptr::null_mut(), }; base.swapchain_loader - .queue_present_khr(base.present_queue, &present_info) + .queue_present(base.present_queue, &present_info) .unwrap(); }); base.device.device_wait_idle().unwrap(); diff --git a/examples/src/bin/triangle.rs b/examples/src/bin/triangle.rs index 213127c..733d83f 100644 --- a/examples/src/bin/triangle.rs +++ b/examples/src/bin/triangle.rs @@ -457,7 +457,7 @@ fn main() { base.render_loop(|| { let (present_index, _) = base .swapchain_loader - .acquire_next_image_khr( + .acquire_next_image( base.swapchain, std::u64::MAX, base.present_complete_semaphore, @@ -546,7 +546,7 @@ fn main() { p_results: ptr::null_mut(), }; base.swapchain_loader - .queue_present_khr(base.present_queue, &present_info) + .queue_present(base.present_queue, &present_info) .unwrap(); }); diff --git a/examples/src/lib.rs b/examples/src/lib.rs index df9c526..bddf547 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -23,16 +23,17 @@ use std::mem; #[cfg(all(unix, not(target_os = "android"), not(target_os = "macos")))] use ash::extensions::khr::XlibSurface; -use ash::extensions::khr::{DebugReport, Surface, Swapchain}; +use ash::extensions::{ + ext::DebugReport, + khr::{Surface, Swapchain}, +}; + #[cfg(target_os = "macos")] use ash::extensions::MacOSSurface; #[cfg(target_os = "windows")] use ash::extensions::Win32Surface; pub use ash::version::{DeviceV1_0, EntryV1_0, InstanceV1_0}; -use ash::vk; -use ash::Device; -use ash::Entry; -use ash::Instance; +use ash::{vk, Device, Entry, Instance}; use std::cell::RefCell; use std::default::Default; use std::ffi::{CStr, CString}; @@ -126,7 +127,7 @@ unsafe fn create_surface( dpy: x11_display as *mut vk::Display, }; let xlib_surface_loader = XlibSurface::new(entry, instance); - xlib_surface_loader.create_xlib_surface_khr(&x11_create_info, None) + xlib_surface_loader.create_xlib_surface(&x11_create_info, None) } #[cfg(target_os = "macos")] @@ -182,7 +183,7 @@ unsafe fn create_surface( hwnd: hwnd as *const c_void, }; let win32_surface_loader = Win32Surface::new(entry, instance); - win32_surface_loader.create_win32_surface_khr(&win32_create_info, None) + win32_surface_loader.create_win32_surface(&win32_create_info, None) } #[cfg(all(unix, not(target_os = "android"), not(target_os = "macos")))] @@ -375,7 +376,7 @@ impl ExampleBase { }; let debug_report_loader = DebugReport::new(&entry, &instance); let debug_call_back = debug_report_loader - .create_debug_report_callback_ext(&debug_info, None) + .create_debug_report_callback(&debug_info, None) .unwrap(); let surface = create_surface(&entry, &instance, &window).unwrap(); let pdevices = instance @@ -392,7 +393,7 @@ impl ExampleBase { .filter_map(|(index, ref info)| { let supports_graphic_and_surface = info.queue_flags.contains(vk::QueueFlags::GRAPHICS) - && surface_loader.get_physical_device_surface_support_khr( + && surface_loader.get_physical_device_surface_support( *pdevice, index as u32, surface, @@ -438,7 +439,7 @@ impl ExampleBase { let present_queue = device.get_device_queue(queue_family_index as u32, 0); let surface_formats = surface_loader - .get_physical_device_surface_formats_khr(pdevice, surface) + .get_physical_device_surface_formats(pdevice, surface) .unwrap(); let surface_format = surface_formats .iter() @@ -451,7 +452,7 @@ impl ExampleBase { }).nth(0) .expect("Unable to find suitable surface format."); let surface_capabilities = surface_loader - .get_physical_device_surface_capabilities_khr(pdevice, surface) + .get_physical_device_surface_capabilities(pdevice, surface) .unwrap(); let mut desired_image_count = surface_capabilities.min_image_count + 1; if surface_capabilities.max_image_count > 0 @@ -475,7 +476,7 @@ impl ExampleBase { surface_capabilities.current_transform }; let present_modes = surface_loader - .get_physical_device_surface_present_modes_khr(pdevice, surface) + .get_physical_device_surface_present_modes(pdevice, surface) .unwrap(); let present_mode = present_modes .iter() @@ -504,7 +505,7 @@ impl ExampleBase { queue_family_index_count: 0, }; let swapchain = swapchain_loader - .create_swapchain_khr(&swapchain_create_info, None) + .create_swapchain(&swapchain_create_info, None) .unwrap(); let pool_create_info = vk::CommandPoolCreateInfo { s_type: vk::StructureType::COMMAND_POOL_CREATE_INFO, @@ -526,9 +527,7 @@ impl ExampleBase { let setup_command_buffer = command_buffers[0]; let draw_command_buffer = command_buffers[1]; - let present_images = swapchain_loader - .get_swapchain_images_khr(swapchain) - .unwrap(); + let present_images = swapchain_loader.get_swapchain_images(swapchain).unwrap(); let present_image_views: Vec = present_images .iter() .map(|&image| { @@ -719,11 +718,11 @@ impl Drop for ExampleBase { } self.device.destroy_command_pool(self.pool, None); self.swapchain_loader - .destroy_swapchain_khr(self.swapchain, None); + .destroy_swapchain(self.swapchain, None); self.device.destroy_device(None); - self.surface_loader.destroy_surface_khr(self.surface, None); + self.surface_loader.destroy_surface(self.surface, None); self.debug_report_loader - .destroy_debug_report_callback_ext(self.debug_call_back, None); + .destroy_debug_report_callback(self.debug_call_back, None); self.instance.destroy_instance(None); } } From 911f7545b9beac065a66e7ab92b695bcf110601f Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Tue, 4 Dec 2018 21:48:45 +0100 Subject: [PATCH 3/3] Fix imports for win and mac --- ash/src/extensions/mod.rs | 6 +++--- examples/src/lib.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ash/src/extensions/mod.rs b/ash/src/extensions/mod.rs index a967d84..fe7443f 100644 --- a/ash/src/extensions/mod.rs +++ b/ash/src/extensions/mod.rs @@ -1,4 +1,4 @@ -pub mod khr; -pub mod nv; -pub mod mvk; pub mod ext; +pub mod khr; +pub mod mvk; +pub mod nv; diff --git a/examples/src/lib.rs b/examples/src/lib.rs index bddf547..a548bc3 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -28,10 +28,10 @@ use ash::extensions::{ khr::{Surface, Swapchain}, }; -#[cfg(target_os = "macos")] -use ash::extensions::MacOSSurface; #[cfg(target_os = "windows")] -use ash::extensions::Win32Surface; +use ash::extensions::khr::Win32Surface; +#[cfg(target_os = "macos")] +use ash::extensions::mvk::MacOSSurface; pub use ash::version::{DeviceV1_0, EntryV1_0, InstanceV1_0}; use ash::{vk, Device, Entry, Instance}; use std::cell::RefCell;