Missing unsafe fn for the extension loaders
This commit is contained in:
parent
8c7a459b90
commit
f1b310a529
|
@ -116,4 +116,11 @@ impl Entry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_instance_proc_addr(&self,
|
||||||
|
instance: vk::Instance,
|
||||||
|
p_name: *const vk::c_char)
|
||||||
|
-> vk::PFN_vkVoidFunction {
|
||||||
|
unsafe { self.static_fn.get_instance_proc_addr(instance, p_name) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl DebugReport {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn destroy_debug_report_callback_ext(&self, debug: vk::DebugReportCallbackEXT) {
|
pub unsafe fn destroy_debug_report_callback_ext(&self, debug: vk::DebugReportCallbackEXT) {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.debug_report_fn.destroy_debug_report_callback_ext(self.handle, debug, ptr::null());
|
self.debug_report_fn.destroy_debug_report_callback_ext(self.handle, debug, ptr::null());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,7 @@ pub struct Surface {
|
||||||
impl Surface {
|
impl Surface {
|
||||||
pub fn new(entry: &Entry, instance: &Instance) -> Result<Surface, String> {
|
pub fn new(entry: &Entry, instance: &Instance) -> Result<Surface, String> {
|
||||||
let surface_fn = vk::SurfaceFn::load(|name| {
|
let surface_fn = vk::SurfaceFn::load(|name| {
|
||||||
unsafe {
|
unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle, name.as_ptr())) }
|
||||||
mem::transmute(entry.static_fn
|
|
||||||
.get_instance_proc_addr(instance.handle, name.as_ptr()))
|
|
||||||
}
|
|
||||||
})?;
|
})?;
|
||||||
Ok(Surface {
|
Ok(Surface {
|
||||||
handle: instance.handle,
|
handle: instance.handle,
|
||||||
|
@ -104,7 +101,7 @@ impl Surface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn destroy_surface_khr(&self, surface: vk::SurfaceKHR) {
|
pub unsafe fn destroy_surface_khr(&self, surface: vk::SurfaceKHR) {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.surface_fn.destroy_surface_khr(self.handle, surface, ptr::null());
|
self.surface_fn.destroy_surface_khr(self.handle, surface, ptr::null());
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,7 @@ impl Swapchain {
|
||||||
pub fn new(instance: &Instance, device: &Device) -> Result<Swapchain, String> {
|
pub fn new(instance: &Instance, device: &Device) -> Result<Swapchain, String> {
|
||||||
let swapchain_fn = vk::SwapchainFn::load(|name| {
|
let swapchain_fn = vk::SwapchainFn::load(|name| {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(instance.instance_fn
|
mem::transmute(instance.get_device_proc_addr(device.handle, name.as_ptr()))
|
||||||
.get_device_proc_addr(device.handle, name.as_ptr()))
|
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
Ok(Swapchain {
|
Ok(Swapchain {
|
||||||
|
|
|
@ -45,6 +45,13 @@ impl Instance {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_device_proc_addr(&self,
|
||||||
|
device: vk::Device,
|
||||||
|
p_name: *const vk::c_char)
|
||||||
|
-> vk::PFN_vkVoidFunction {
|
||||||
|
unsafe { self.instance_fn.get_device_proc_addr(device, p_name) }
|
||||||
|
}
|
||||||
|
|
||||||
pub unsafe fn destroy_instance(&self) {
|
pub unsafe fn destroy_instance(&self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.instance_fn.destroy_instance(self.handle, ptr::null());
|
self.instance_fn.destroy_instance(self.handle, ptr::null());
|
||||||
|
|
10
src/vk.rs
10
src/vk.rs
|
@ -3693,16 +3693,16 @@ macro_rules! vk_functions {
|
||||||
impl ::std::fmt::Debug for $struct_name {
|
impl ::std::fmt::Debug for $struct_name {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::result::Result<(), ::std::fmt::Error> {
|
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::result::Result<(), ::std::fmt::Error> {
|
||||||
writeln!(fmt, stringify!($struct_name)).unwrap();
|
writeln!(fmt, stringify!($struct_name))?;
|
||||||
$(
|
$(
|
||||||
if !(self.$name as *const c_void).is_null() {
|
if !(self.$name as *const c_void).is_null() {
|
||||||
write!(fmt," Is loaded => " ).unwrap();
|
write!(fmt," Is loaded => " )?;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
write!(fmt," Is not loaded => " ).unwrap();
|
write!(fmt," Is not loaded => " )?;
|
||||||
}
|
}
|
||||||
write!(fmt, $raw_name).unwrap();
|
write!(fmt, $raw_name)?;
|
||||||
writeln!(fmt, ", ").unwrap();
|
writeln!(fmt, ", ")?;
|
||||||
)+
|
)+
|
||||||
write!(fmt, "")
|
write!(fmt, "")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue