Adds missing allocators for the extensions

This commit is contained in:
maik klein 2016-12-28 11:04:50 +01:00
parent e6415a91df
commit f01eb2d9d5
4 changed files with 24 additions and 19 deletions

View file

@ -79,7 +79,7 @@ pub fn record_submit_commandbuffer<F: FnOnce(&Device, vk::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<vk::SurfaceKHR, vk::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<vk::SurfaceKHR, vk::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);
}
}
}

View file

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

View file

@ -38,7 +38,10 @@ impl Instance {
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,

View file

@ -3708,6 +3708,7 @@ pub mod cmds {
use super::*;
#[allow(unused_imports)]
use super::libc_reexports::*;
vk_functions!{
StaticFn,
"vkGetInstanceProcAddr", get_instance_proc_addr(