1 use crate::vk; 2 use crate::{Device, Instance}; 3 use std::ffi::CStr; 4 use std::mem; 5 6 #[derive(Clone)] 7 pub struct Maintenance1 { 8 handle: vk::Device, 9 fp: vk::KhrMaintenance1Fn, 10 } 11 12 impl Maintenance1 { new(instance: &Instance, device: &Device) -> Self13 pub fn new(instance: &Instance, device: &Device) -> Self { 14 let handle = device.handle(); 15 let fp = vk::KhrMaintenance1Fn::load(|name| unsafe { 16 mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) 17 }); 18 Self { handle, fp } 19 } 20 21 /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkTrimCommandPoolKHR.html> 22 #[inline] trim_command_pool( &self, command_pool: vk::CommandPool, flags: vk::CommandPoolTrimFlagsKHR, )23 pub unsafe fn trim_command_pool( 24 &self, 25 command_pool: vk::CommandPool, 26 flags: vk::CommandPoolTrimFlagsKHR, 27 ) { 28 (self.fp.trim_command_pool_khr)(self.handle, command_pool, flags); 29 } 30 31 #[inline] name() -> &'static CStr32 pub const fn name() -> &'static CStr { 33 vk::KhrMaintenance1Fn::name() 34 } 35 36 #[inline] fp(&self) -> &vk::KhrMaintenance1Fn37 pub fn fp(&self) -> &vk::KhrMaintenance1Fn { 38 &self.fp 39 } 40 41 #[inline] device(&self) -> vk::Device42 pub fn device(&self) -> vk::Device { 43 self.handle 44 } 45 } 46