Remove unused unsafe blocks

This commit is contained in:
Maik Klein 2018-11-12 11:25:47 +01:00
parent 03411ffbe0
commit 3544018bfd

View file

@ -14,10 +14,7 @@ pub struct Instance {
instance_fn_1_1: vk::InstanceFnV1_1, instance_fn_1_1: vk::InstanceFnV1_1,
} }
impl Instance { impl Instance {
pub unsafe fn load( pub unsafe fn load(static_fn: &vk::StaticFn, instance: vk::Instance) -> Self {
static_fn: &vk::StaticFn,
instance: vk::Instance,
) -> Self {
let instance_fn_1_0 = vk::InstanceFnV1_0::load(|name| { let instance_fn_1_0 = vk::InstanceFnV1_0::load(|name| {
mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr())) mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr()))
}); });
@ -84,7 +81,7 @@ pub trait InstanceV1_1: InstanceV1_0 {
fn enumerate_physical_device_groups( fn enumerate_physical_device_groups(
&self, &self,
out: &mut [vk::PhysicalDeviceGroupProperties] out: &mut [vk::PhysicalDeviceGroupProperties],
) -> VkResult<()> { ) -> VkResult<()> {
unsafe { unsafe {
let mut group_count = out.len() as u32; let mut group_count = out.len() as u32;
@ -95,7 +92,9 @@ pub trait InstanceV1_1: InstanceV1_0 {
); );
if err_code == vk::Result::SUCCESS { if err_code == vk::Result::SUCCESS {
Ok(()) Ok(())
} else { Err(err_code) } } else {
Err(err_code)
}
} }
} }
@ -114,13 +113,8 @@ pub trait InstanceV1_1: InstanceV1_0 {
format: vk::Format, format: vk::Format,
out: &mut vk::FormatProperties2, out: &mut vk::FormatProperties2,
) { ) {
unsafe { self.fp_v1_1()
self.fp_v1_1().get_physical_device_format_properties2( .get_physical_device_format_properties2(physical_device, format, out);
physical_device,
format,
out,
);
}
} }
unsafe fn get_physical_device_image_format_properties2( unsafe fn get_physical_device_image_format_properties2(
@ -172,11 +166,9 @@ pub trait InstanceV1_1: InstanceV1_0 {
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
out: &mut vk::PhysicalDeviceMemoryProperties2, out: &mut vk::PhysicalDeviceMemoryProperties2,
) { ) {
unsafe {
self.fp_v1_1() self.fp_v1_1()
.get_physical_device_memory_properties2(physical_device, out); .get_physical_device_memory_properties2(physical_device, out);
} }
}
unsafe fn get_physical_device_sparse_image_format_properties2_len( unsafe fn get_physical_device_sparse_image_format_properties2_len(
&self, &self,