From 30e77503aff190fa84401bdd4053a319216da214 Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Thu, 8 Mar 2018 21:13:47 +0100 Subject: [PATCH] Add get_query_pool_results --- ash/src/device.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ash/src/device.rs b/ash/src/device.rs index a79d076..bc748f0 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -803,11 +803,19 @@ pub trait DeviceV1_0 { query_pool: vk::QueryPool, first_query: vk::uint32_t, query_count: vk::uint32_t, + data: &mut [T], flags: vk::QueryResultFlags, - ) -> VkResult> { + ) -> VkResult<()> { let data_length = query_count as usize; + assert!( + mem::size_of::() <= mem::size_of::(), + "T can not be bigger than an u64" + ); + assert!( + data_length <= data.len(), + "query_count was higher than the length of the slice" + ); let data_size = mem::size_of::() * data_length; - let mut data = Vec::::with_capacity(data_length); let err_code = self.fp_v1_0().get_query_pool_results( self.handle(), query_pool, @@ -815,16 +823,16 @@ pub trait DeviceV1_0 { query_count, data_size, data.as_mut_ptr() as *mut _, - 0, - flags + mem::size_of::() as _, + flags, ); - data.set_len(data_length); match err_code { - vk::Result::Success => Ok(data), + vk::Result::Success => Ok(()), _ => Err(err_code), } } + unsafe fn cmd_begin_query( &self, command_buffer: vk::CommandBuffer,