bug fixes for VK_EXT_debug_utils wrapper
This commit is contained in:
parent
898e9791b7
commit
a10935eaf7
|
@ -22,7 +22,7 @@ impl DebugReport {
|
||||||
})?;
|
})?;
|
||||||
Ok(DebugReport {
|
Ok(DebugReport {
|
||||||
handle: instance.handle(),
|
handle: instance.handle(),
|
||||||
debug_report_fn: debug_report_fn,
|
debug_report_fn,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,24 +2,26 @@
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use version::{DeviceV1_0, InstanceV1_0};
|
use version::{EntryV1_0, InstanceV1_0};
|
||||||
use {vk, RawPtr};
|
use {vk, RawPtr};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct DebugUtils {
|
pub struct DebugUtils {
|
||||||
|
handle: vk::Instance,
|
||||||
debug_utils_fn: vk::ExtDebugUtilsFn,
|
debug_utils_fn: vk::ExtDebugUtilsFn,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DebugUtils {
|
impl DebugUtils {
|
||||||
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(
|
pub fn new<E: EntryV1_0, I: InstanceV1_0>(
|
||||||
|
entry: &E,
|
||||||
instance: &I,
|
instance: &I,
|
||||||
device: &D,
|
|
||||||
) -> Result<DebugUtils, Vec<&'static str>> {
|
) -> Result<DebugUtils, Vec<&'static str>> {
|
||||||
let debug_utils_fn = vk::ExtDebugUtilsFn::load(|name| unsafe {
|
let debug_utils_fn = vk::ExtDebugUtilsFn::load(|name| unsafe {
|
||||||
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
|
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
|
||||||
})?;
|
})?;
|
||||||
Ok(DebugUtils {
|
Ok(DebugUtils {
|
||||||
debug_utils_fn: debug_utils_fn,
|
handle: instance.handle(),
|
||||||
|
debug_utils_fn,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,13 +100,12 @@ impl DebugUtils {
|
||||||
|
|
||||||
pub unsafe fn create_debug_utils_messenger_ext(
|
pub unsafe fn create_debug_utils_messenger_ext(
|
||||||
&self,
|
&self,
|
||||||
instance: vk::Instance,
|
|
||||||
create_info: &vk::DebugUtilsMessengerCreateInfoEXT,
|
create_info: &vk::DebugUtilsMessengerCreateInfoEXT,
|
||||||
allocator: Option<&vk::AllocationCallbacks>,
|
allocator: Option<&vk::AllocationCallbacks>,
|
||||||
) -> VkResult<vk::DebugUtilsMessengerEXT> {
|
) -> VkResult<vk::DebugUtilsMessengerEXT> {
|
||||||
let mut messenger = mem::uninitialized();
|
let mut messenger = mem::uninitialized();
|
||||||
let err_code = self.debug_utils_fn.create_debug_utils_messenger_ext(
|
let err_code = self.debug_utils_fn.create_debug_utils_messenger_ext(
|
||||||
instance,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocator.as_raw_ptr(),
|
allocator.as_raw_ptr(),
|
||||||
&mut messenger,
|
&mut messenger,
|
||||||
|
@ -117,12 +118,11 @@ impl DebugUtils {
|
||||||
|
|
||||||
pub unsafe fn destroy_debug_utils_messenger_ext(
|
pub unsafe fn destroy_debug_utils_messenger_ext(
|
||||||
&self,
|
&self,
|
||||||
instance: vk::Instance,
|
|
||||||
messenger: vk::DebugUtilsMessengerEXT,
|
messenger: vk::DebugUtilsMessengerEXT,
|
||||||
allocator: Option<&vk::AllocationCallbacks>,
|
allocator: Option<&vk::AllocationCallbacks>,
|
||||||
) {
|
) {
|
||||||
self.debug_utils_fn.destroy_debug_utils_messenger_ext(
|
self.debug_utils_fn.destroy_debug_utils_messenger_ext(
|
||||||
instance,
|
self.handle,
|
||||||
messenger,
|
messenger,
|
||||||
allocator.as_raw_ptr(),
|
allocator.as_raw_ptr(),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue