diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 2505594..419a4fd 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -79,7 +79,7 @@ pub fn record_submit_commandbuffer(device } #[cfg(all(unix, not(target_os = "android")))] -fn create_surface(instance: &Instance, +unsafe fn create_surface(instance: &Instance, entry: &Entry, window: &winit::Window) -> Result { @@ -95,11 +95,11 @@ fn create_surface(instance: &Instance, }; let xlib_surface_loader = XlibSurface::new(&entry, &instance) .expect("Unable to load xlib surface"); - xlib_surface_loader.create_xlib_surface_khr(&x11_create_info) + xlib_surface_loader.create_xlib_surface_khr(&x11_create_info, None) } #[cfg(windows)] -fn create_surface(instance: &Instance, +unsafe fn create_surface(instance: &Instance, entry: &Entry, window: &winit::Window) -> Result { @@ -254,7 +254,7 @@ impl ExampleBase { }; let debug_report_loader = DebugReport::new(&entry, &instance) .expect("Unable to load debug report"); - let debug_call_back = debug_report_loader.create_debug_report_callback_ext(&debug_info) + let debug_call_back = debug_report_loader.create_debug_report_callback_ext(&debug_info, None) .unwrap(); let surface = create_surface(&instance, &entry, &window).unwrap(); let pdevices = instance.enumerate_physical_devices().expect("Physical device error"); @@ -379,7 +379,7 @@ impl ExampleBase { p_queue_family_indices: ptr::null(), queue_family_index_count: 0, }; - let swapchain = swapchain_loader.create_swapchain_khr(&swapchain_create_info).unwrap(); + let swapchain = swapchain_loader.create_swapchain_khr(&swapchain_create_info, None).unwrap(); let pool_create_info = vk::CommandPoolCreateInfo { s_type: vk::StructureType::CommandPoolCreateInfo, p_next: ptr::null(), @@ -596,11 +596,11 @@ impl Drop for ExampleBase { self.device.destroy_image_view(image_view, None); } self.device.destroy_command_pool(self.pool, None); - self.swapchain_loader.destroy_swapchain_khr(self.swapchain); + self.swapchain_loader.destroy_swapchain_khr(self.swapchain, None); self.device.destroy_device(None); - self.surface_loader.destroy_surface_khr(self.surface); - self.debug_report_loader.destroy_debug_report_callback_ext(self.debug_call_back); - self.instance.destroy_instance(); + self.surface_loader.destroy_surface_khr(self.surface, None); + self.debug_report_loader.destroy_debug_report_callback_ext(self.debug_call_back, None); + self.instance.destroy_instance(None); } } } diff --git a/src/extensions/surface.rs b/src/extensions/surface.rs index 468579c..b3b939a 100644 --- a/src/extensions/surface.rs +++ b/src/extensions/surface.rs @@ -5,6 +5,7 @@ use instance::Instance; use entry::Entry; use vk; use std::ffi::CStr; +use ::RawPtr; pub struct Surface { pub handle: vk::Instance, @@ -108,7 +109,7 @@ impl Surface { } } - pub unsafe fn destroy_surface_khr(&self, surface: vk::SurfaceKHR) { - self.surface_fn.destroy_surface_khr(self.handle, surface, ptr::null()); + pub unsafe fn destroy_surface_khr(&self, surface: vk::SurfaceKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>) { + self.surface_fn.destroy_surface_khr(self.handle, surface, allocation_callbacks.as_raw_ptr()); } } diff --git a/src/instance.rs b/src/instance.rs index fe9699d..ba344c1 100644 --- a/src/instance.rs +++ b/src/instance.rs @@ -31,14 +31,17 @@ impl Instance { } pub unsafe fn create_device(&self, - physical_device: vk::PhysicalDevice, - create_info: &vk::DeviceCreateInfo, - allocation_callbacks: Option<&vk::AllocationCallbacks>) - -> Result { + physical_device: vk::PhysicalDevice, + create_info: &vk::DeviceCreateInfo, + allocation_callbacks: Option<&vk::AllocationCallbacks>) + -> Result { unsafe { let mut device: vk::Device = mem::uninitialized(); let err_code = self.instance_fn - .create_device(physical_device, create_info, allocation_callbacks.as_raw_ptr(), &mut device); + .create_device(physical_device, + create_info, + allocation_callbacks.as_raw_ptr(), + &mut device); if err_code != vk::Result::Success { return Err(DeviceError::VkError(err_code)); } @@ -56,8 +59,8 @@ impl Instance { unsafe { self.instance_fn.get_device_proc_addr(device, p_name) } } - pub unsafe fn destroy_instance(&self) { - self.instance_fn.destroy_instance(self.handle, ptr::null()); + pub unsafe fn destroy_instance(&self, allocation_callbacks: Option<&vk::AllocationCallbacks>) { + self.instance_fn.destroy_instance(self.handle, allocation_callbacks.as_raw_ptr()); } pub fn get_physical_device_format_properties(&self, diff --git a/src/vk.rs b/src/vk.rs index da9765d..8100893 100644 --- a/src/vk.rs +++ b/src/vk.rs @@ -3708,7 +3708,8 @@ pub mod cmds { use super::*; #[allow(unused_imports)] use super::libc_reexports::*; - vk_functions!{ + +vk_functions!{ StaticFn, "vkGetInstanceProcAddr", get_instance_proc_addr( instance: Instance,