Add missing unsafe qualifiers
This commit is contained in:
parent
c62172bdf8
commit
445c72fa26
|
@ -652,15 +652,13 @@ pub trait DeviceV1_0 {
|
|||
}
|
||||
}
|
||||
|
||||
fn device_wait_idle(&self) -> VkResult<()> {
|
||||
unsafe {
|
||||
unsafe fn device_wait_idle(&self) -> VkResult<()> {
|
||||
let err_code = self.fp_v1_0().device_wait_idle(self.handle());
|
||||
match err_code {
|
||||
vk::Result::SUCCESS => Ok(()),
|
||||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn create_descriptor_pool(
|
||||
&self,
|
||||
|
@ -1604,12 +1602,11 @@ pub trait DeviceV1_0 {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_image_subresource_layout(
|
||||
unsafe fn get_image_subresource_layout(
|
||||
&self,
|
||||
image: vk::Image,
|
||||
subresource: vk::ImageSubresource,
|
||||
) -> vk::SubresourceLayout {
|
||||
unsafe {
|
||||
let mut layout = mem::uninitialized();
|
||||
self.fp_v1_0().get_image_subresource_layout(
|
||||
self.handle(),
|
||||
|
@ -1619,25 +1616,20 @@ pub trait DeviceV1_0 {
|
|||
);
|
||||
layout
|
||||
}
|
||||
}
|
||||
|
||||
fn get_image_memory_requirements(&self, image: vk::Image) -> vk::MemoryRequirements {
|
||||
unsafe {
|
||||
unsafe fn get_image_memory_requirements(&self, image: vk::Image) -> vk::MemoryRequirements {
|
||||
let mut mem_req = mem::uninitialized();
|
||||
self.fp_v1_0()
|
||||
.get_image_memory_requirements(self.handle(), image, &mut mem_req);
|
||||
mem_req
|
||||
}
|
||||
}
|
||||
|
||||
fn get_buffer_memory_requirements(&self, buffer: vk::Buffer) -> vk::MemoryRequirements {
|
||||
unsafe {
|
||||
unsafe fn get_buffer_memory_requirements(&self, buffer: vk::Buffer) -> vk::MemoryRequirements {
|
||||
let mut mem_req = mem::uninitialized();
|
||||
self.fp_v1_0()
|
||||
.get_buffer_memory_requirements(self.handle(), buffer, &mut mem_req);
|
||||
mem_req
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn allocate_memory(
|
||||
&self,
|
||||
|
|
|
@ -31,13 +31,12 @@ impl Surface {
|
|||
CStr::from_bytes_with_nul(b"VK_KHR_surface\0").expect("Wrong extension string")
|
||||
}
|
||||
|
||||
pub fn get_physical_device_surface_support_khr(
|
||||
pub unsafe fn get_physical_device_surface_support_khr(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
queue_index: u32,
|
||||
surface: vk::SurfaceKHR,
|
||||
) -> bool {
|
||||
unsafe {
|
||||
let mut b = mem::uninitialized();
|
||||
self.surface_fn.get_physical_device_surface_support_khr(
|
||||
physical_device,
|
||||
|
@ -47,13 +46,12 @@ impl Surface {
|
|||
);
|
||||
b > 0
|
||||
}
|
||||
}
|
||||
pub fn get_physical_device_surface_present_modes_khr(
|
||||
|
||||
pub unsafe fn get_physical_device_surface_present_modes_khr(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
surface: vk::SurfaceKHR,
|
||||
) -> VkResult<Vec<vk::PresentModeKHR>> {
|
||||
unsafe {
|
||||
let mut count = 0;
|
||||
self.surface_fn
|
||||
.get_physical_device_surface_present_modes_khr(
|
||||
|
@ -77,14 +75,12 @@ impl Surface {
|
|||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_physical_device_surface_capabilities_khr(
|
||||
pub unsafe fn get_physical_device_surface_capabilities_khr(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
surface: vk::SurfaceKHR,
|
||||
) -> VkResult<vk::SurfaceCapabilitiesKHR> {
|
||||
unsafe {
|
||||
let mut surface_capabilities = mem::uninitialized();
|
||||
let err_code = self
|
||||
.surface_fn
|
||||
|
@ -98,14 +94,12 @@ impl Surface {
|
|||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_physical_device_surface_formats_khr(
|
||||
pub unsafe fn get_physical_device_surface_formats_khr(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
surface: vk::SurfaceKHR,
|
||||
) -> VkResult<Vec<vk::SurfaceFormatKHR>> {
|
||||
unsafe {
|
||||
let mut count = 0;
|
||||
self.surface_fn.get_physical_device_surface_formats_khr(
|
||||
physical_device,
|
||||
|
@ -126,7 +120,6 @@ impl Surface {
|
|||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn destroy_surface_khr(
|
||||
&self,
|
||||
|
|
|
@ -95,11 +95,10 @@ impl Swapchain {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_swapchain_images_khr(
|
||||
pub unsafe fn get_swapchain_images_khr(
|
||||
&self,
|
||||
swapchain: vk::SwapchainKHR,
|
||||
) -> VkResult<Vec<vk::Image>> {
|
||||
unsafe {
|
||||
let mut count = 0;
|
||||
self.swapchain_fn.get_swapchain_images_khr(
|
||||
self.handle,
|
||||
|
@ -122,4 +121,3 @@ impl Swapchain {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,8 +87,7 @@ impl<V: FunctionPointers> Instance<V> {
|
|||
pub trait InstanceV1_1: InstanceV1_0 {
|
||||
fn fp_v1_1(&self) -> &vk::InstanceFnV1_1;
|
||||
|
||||
fn enumerate_physical_device_groups(&self) -> VkResult<Vec<vk::PhysicalDeviceGroupProperties>> {
|
||||
unsafe {
|
||||
unsafe fn enumerate_physical_device_groups(&self) -> VkResult<Vec<vk::PhysicalDeviceGroupProperties>> {
|
||||
let mut group_count = mem::uninitialized();
|
||||
self.fp_v1_1().enumerate_physical_device_groups(
|
||||
self.handle(),
|
||||
|
@ -107,7 +106,6 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_properties2(
|
||||
&self,
|
||||
|
@ -118,12 +116,11 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
.get_physical_device_properties2(physical_device, prop);
|
||||
}
|
||||
|
||||
fn get_physical_device_format_properties2(
|
||||
unsafe fn get_physical_device_format_properties2(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
format: vk::Format,
|
||||
) -> vk::FormatProperties2 {
|
||||
unsafe {
|
||||
let mut format_prop = mem::uninitialized();
|
||||
self.fp_v1_1().get_physical_device_format_properties2(
|
||||
physical_device,
|
||||
|
@ -132,7 +129,6 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
);
|
||||
format_prop
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_image_format_properties2(
|
||||
&self,
|
||||
|
@ -152,11 +148,10 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_physical_device_queue_family_properties2_len(
|
||||
unsafe fn get_physical_device_queue_family_properties2_len(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
) -> usize {
|
||||
unsafe {
|
||||
let mut queue_count = 0;
|
||||
self.fp_v1_1().get_physical_device_queue_family_properties2(
|
||||
physical_device,
|
||||
|
@ -165,7 +160,6 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
);
|
||||
queue_count as usize
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_queue_family_properties2(
|
||||
&self,
|
||||
|
@ -180,17 +174,15 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
);
|
||||
}
|
||||
|
||||
fn get_physical_device_memory_properties2(
|
||||
unsafe fn get_physical_device_memory_properties2(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
) -> vk::PhysicalDeviceMemoryProperties2 {
|
||||
unsafe {
|
||||
let mut memory_prop = mem::uninitialized();
|
||||
self.fp_v1_1()
|
||||
.get_physical_device_memory_properties2(physical_device, &mut memory_prop);
|
||||
memory_prop
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_sparse_image_format_properties2(
|
||||
&self,
|
||||
|
@ -291,12 +283,12 @@ pub trait InstanceV1_0 {
|
|||
Ok(Device::from_raw(device, device_fn))
|
||||
}
|
||||
|
||||
fn get_device_proc_addr(
|
||||
unsafe fn get_device_proc_addr(
|
||||
&self,
|
||||
device: vk::Device,
|
||||
p_name: *const c_char,
|
||||
) -> vk::PFN_vkVoidFunction {
|
||||
unsafe { self.fp_v1_0().get_device_proc_addr(device, p_name) }
|
||||
self.fp_v1_0().get_device_proc_addr(device, p_name)
|
||||
}
|
||||
|
||||
unsafe fn destroy_instance(&self, allocation_callbacks: Option<&vk::AllocationCallbacks>) {
|
||||
|
@ -304,12 +296,11 @@ pub trait InstanceV1_0 {
|
|||
.destroy_instance(self.handle(), allocation_callbacks.as_raw_ptr());
|
||||
}
|
||||
|
||||
fn get_physical_device_format_properties(
|
||||
unsafe fn get_physical_device_format_properties(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
format: vk::Format,
|
||||
) -> vk::FormatProperties {
|
||||
unsafe {
|
||||
let mut format_prop = mem::uninitialized();
|
||||
self.fp_v1_0().get_physical_device_format_properties(
|
||||
physical_device,
|
||||
|
@ -318,9 +309,8 @@ pub trait InstanceV1_0 {
|
|||
);
|
||||
format_prop
|
||||
}
|
||||
}
|
||||
|
||||
fn get_physical_device_image_format_properties(
|
||||
unsafe fn get_physical_device_image_format_properties(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
format: vk::Format,
|
||||
|
@ -329,7 +319,6 @@ pub trait InstanceV1_0 {
|
|||
usage: vk::ImageUsageFlags,
|
||||
flags: vk::ImageCreateFlags,
|
||||
) -> VkResult<vk::ImageFormatProperties> {
|
||||
unsafe {
|
||||
let mut image_format_prop = mem::uninitialized();
|
||||
let err_code = self.fp_v1_0().get_physical_device_image_format_properties(
|
||||
physical_device,
|
||||
|
@ -346,37 +335,31 @@ pub trait InstanceV1_0 {
|
|||
Err(err_code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_physical_device_memory_properties(
|
||||
unsafe fn get_physical_device_memory_properties(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
) -> vk::PhysicalDeviceMemoryProperties {
|
||||
unsafe {
|
||||
let mut memory_prop = mem::uninitialized();
|
||||
self.fp_v1_0()
|
||||
.get_physical_device_memory_properties(physical_device, &mut memory_prop);
|
||||
memory_prop
|
||||
}
|
||||
}
|
||||
|
||||
fn get_physical_device_properties(
|
||||
unsafe fn get_physical_device_properties(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
) -> vk::PhysicalDeviceProperties {
|
||||
unsafe {
|
||||
let mut prop = mem::uninitialized();
|
||||
self.fp_v1_0()
|
||||
.get_physical_device_properties(physical_device, &mut prop);
|
||||
prop
|
||||
}
|
||||
}
|
||||
|
||||
fn get_physical_device_queue_family_properties(
|
||||
unsafe fn get_physical_device_queue_family_properties(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
) -> Vec<vk::QueueFamilyProperties> {
|
||||
unsafe {
|
||||
let mut queue_count = 0;
|
||||
self.fp_v1_0().get_physical_device_queue_family_properties(
|
||||
physical_device,
|
||||
|
@ -392,22 +375,18 @@ pub trait InstanceV1_0 {
|
|||
queue_families_vec.set_len(queue_count as usize);
|
||||
queue_families_vec
|
||||
}
|
||||
}
|
||||
|
||||
fn get_physical_device_features(
|
||||
unsafe fn get_physical_device_features(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
) -> vk::PhysicalDeviceFeatures {
|
||||
unsafe {
|
||||
let mut prop = mem::uninitialized();
|
||||
self.fp_v1_0()
|
||||
.get_physical_device_features(physical_device, &mut prop);
|
||||
prop
|
||||
}
|
||||
}
|
||||
|
||||
fn enumerate_physical_devices(&self) -> VkResult<Vec<vk::PhysicalDevice>> {
|
||||
unsafe {
|
||||
unsafe fn enumerate_physical_devices(&self) -> VkResult<Vec<vk::PhysicalDevice>> {
|
||||
let mut num = mem::uninitialized();
|
||||
self.fp_v1_0()
|
||||
.enumerate_physical_devices(self.handle(), &mut num, ptr::null_mut());
|
||||
|
@ -423,13 +402,11 @@ pub trait InstanceV1_0 {
|
|||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn enumerate_device_extension_properties(
|
||||
unsafe fn enumerate_device_extension_properties(
|
||||
&self,
|
||||
device: vk::PhysicalDevice,
|
||||
) -> Result<Vec<vk::ExtensionProperties>, vk::Result> {
|
||||
unsafe {
|
||||
let mut num = 0;
|
||||
self.fp_v1_0().enumerate_device_extension_properties(
|
||||
device,
|
||||
|
@ -451,4 +428,3 @@ pub trait InstanceV1_0 {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue