From 940f84e04a3bcfa527230dbfdb985a37cb168b93 Mon Sep 17 00:00:00 2001 From: alpacahaircut <43284607+alpacahaircut@users.noreply.github.com> Date: Fri, 30 Apr 2021 08:21:41 -0700 Subject: [PATCH] added missing functions to V1_0 traits (#416) --- ash/src/device.rs | 34 +++++++++++++++++++++++++++ ash/src/instance.rs | 57 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) diff --git a/ash/src/device.rs b/ash/src/device.rs index ecc14e4..d25dc35 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -2090,4 +2090,38 @@ impl Device { ); granularity } + + #[doc = ""] + pub unsafe fn get_device_memory_commitment(&self, memory: vk::DeviceMemory) -> vk::DeviceSize { + let mut committed_memory_in_bytes = 0; + self.device_fn_1_0.get_device_memory_commitment( + self.handle(), + memory, + &mut committed_memory_in_bytes, + ); + committed_memory_in_bytes + } + + #[doc = ""] + pub unsafe fn get_image_sparse_memory_requirements( + &self, + image: vk::Image, + ) -> Vec { + let mut count = 0; + self.device_fn_1_0.get_image_sparse_memory_requirements( + self.handle(), + image, + &mut count, + ptr::null_mut(), + ); + let mut data = Vec::with_capacity(count as usize); + self.device_fn_1_0.get_image_sparse_memory_requirements( + self.handle(), + image, + &mut count, + data.as_mut_ptr(), + ); + data.set_len(count as usize); + data + } } diff --git a/ash/src/instance.rs b/ash/src/instance.rs index b74c65b..eb4d736 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -413,4 +413,61 @@ impl Instance { data.set_len(num as usize); err_code.result_with_success(data) } + + #[doc = ""] + pub unsafe fn enumerate_device_layer_properties( + &self, + device: vk::PhysicalDevice, + ) -> VkResult> { + let mut count = 0; + self.instance_fn_1_0 + .enumerate_device_layer_properties(device, &mut count, ptr::null_mut()) + .result()?; + let mut data = Vec::with_capacity(count as usize); + let err_code = self.instance_fn_1_0.enumerate_device_layer_properties( + device, + &mut count, + data.as_mut_ptr(), + ); + data.set_len(count as usize); + err_code.result_with_success(data) + } + + #[doc = ""] + pub unsafe fn get_physical_device_sparse_image_format_properties( + &self, + physical_device: vk::PhysicalDevice, + format: vk::Format, + typ: vk::ImageType, + samples: vk::SampleCountFlags, + usage: vk::ImageUsageFlags, + tiling: vk::ImageTiling, + ) -> Vec { + let mut count = 0; + self.instance_fn_1_0 + .get_physical_device_sparse_image_format_properties( + physical_device, + format, + typ, + samples, + usage, + tiling, + &mut count, + ptr::null_mut(), + ); + let mut data = Vec::with_capacity(count as usize); + self.instance_fn_1_0 + .get_physical_device_sparse_image_format_properties( + physical_device, + format, + typ, + samples, + usage, + tiling, + &mut count, + data.as_mut_ptr(), + ); + data.set_len(count as usize); + data + } }