Implement trim() for command pools

This commit is contained in:
Nicolas Koch 2017-03-07 16:46:32 +01:00
parent d2b9379d3b
commit 705cff5edc
2 changed files with 14 additions and 0 deletions

View File

@ -106,6 +106,19 @@ impl UnsafeCommandPool {
Ok(())
}
/// Trims a command pool, which recycles unused internal memory from the command pool back to the system.
///
/// Command buffers allocated from the pool are not affected by trimming.
#[inline]
pub fn trim(&self) -> () {
assert!(self.device.loaded_extensions().khr_maintenance1); //TODO return error?
unsafe {
let flags = 0;
let vk = self.device.pointers();
vk.TrimCommandPoolKHR(self.device.internal_object(), self.pool, flags);
}
}
/// Allocates `count` command buffers.
///
/// If `secondary` is true, allocates secondary command buffers. Otherwise, allocates primary

View File

@ -210,6 +210,7 @@ device_extensions! {
khr_swapchain => b"VK_KHR_swapchain",
khr_display_swapchain => b"VK_KHR_display_swapchain",
khr_sampler_mirror_clamp_to_edge => b"VK_KHR_sampler_mirror_clamp_to_edge",
khr_maintenance1 => b"VK_KHR_maintenance1",
}
/// Error that can happen when loading the list of layers.