Merge pull request #167 from MaikKlein/vendor-names

Move extensions into vendor specific modules
This commit is contained in:
Maik Klein 2018-12-05 15:16:52 +01:00 committed by GitHub
commit a0588c399a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 99 additions and 93 deletions

View file

@ -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,

View file

@ -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>,

View file

@ -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,

View file

@ -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;

View file

@ -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>,

View file

@ -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>,

View file

@ -0,0 +1,17 @@
pub use self::android_surface::AndroidSurface;
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 display_swapchain;
mod surface;
mod swapchain;
mod wayland_surface;
mod win32_surface;
mod xcb_surface;
mod xlib_surface;

View file

@ -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>,

View file

@ -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<Vec<vk::Image>> {

View file

@ -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>,

View file

@ -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>,

View file

@ -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>,

View file

@ -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>,

View file

@ -1,29 +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::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 ext;
pub mod khr;
pub mod mvk;
pub mod nv;

View file

@ -0,0 +1,5 @@
pub use self::ios_surface::IOSSurface;
pub use self::macos_surface::MacOSSurface;
mod ios_surface;
mod macos_surface;

View file

@ -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,

View file

@ -0,0 +1,3 @@
pub use self::mesh_shader::MeshShader;
mod mesh_shader;

View file

@ -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();

View file

@ -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();
});

View file

@ -21,18 +21,19 @@ use objc::runtime::YES;
#[cfg(target_os = "macos")]
use std::mem;
#[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};
use ash::extensions::khr::XlibSurface;
use ash::extensions::{
ext::DebugReport,
khr::{Surface, Swapchain},
};
#[cfg(target_os = "windows")]
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;
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<E: EntryV1_0, I: InstanceV1_0>(
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<E: EntryV1_0, I: InstanceV1_0>(
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<vk::ImageView> = 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);
}
}