Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device: Replace query_count parameter in get_query_pool_results with data.len() #644

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions ash/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2016,21 +2016,15 @@ impl Device {
&self,
query_pool: vk::QueryPool,
first_query: u32,
query_count: u32,
data: &mut [T],
flags: vk::QueryResultFlags,
) -> VkResult<()> {
let data_length = query_count as usize;
assert!(
data_length <= data.len(),
"query_count was higher than the length of the slice"
);
let data_size = mem::size_of::<T>() * data_length;
let data_size = mem::size_of_val(data);
Comment on lines -2028 to +2022
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This effectively incorporates #640; not to fix a "bug" (there was no bug as far as I understood, the caller was using the wrong the type and doing it that way would still result in the wrong stride hence the wrong output for WITH_AVAILABILITY as result N+1 overwrites N), but simply because this otherwise reads mem::size_of::<T>() * data.len() which should be exactly what mem::size_of_val() returns.

(self.device_fn_1_0.get_query_pool_results)(
self.handle(),
query_pool,
first_query,
query_count,
data.len() as u32,
data_size,
data.as_mut_ptr() as *mut _,
mem::size_of::<T>() as _,
Expand Down