-
Notifications
You must be signed in to change notification settings - Fork 187
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
Conversation
let data_size = mem::size_of::<T>() * data_length; | ||
let data_size = mem::size_of_val(data); |
There was a problem hiding this comment.
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.
…ith `data.len()` A slice is designed to be a cheap view into a continuous segment of memory and easily recreated with a different offset and size. This can be used to our advantage to let the user set exactly how many items they want to request, while ensuring all returned slots are filled on success or otherwise return `NOT_READY` if not enough query results could be copied to user memory (or block if the `WAIT` flag is set). This also opens the door to accepting `MaybeUninit` in the future and returning the initialized slice in the `VkResult::Ok(here)` case.
a248c7a
to
f56fbbc
Compare
…y_pool_results()` Commit c66db26 ("device: Replace `query_count` parameter in `get_query_pool_results` with `data.len()` (#644)") removed this parameter in favour of using `data.len()` to make it more obvious to use an appropriate element type that matches the kind of request (see also #639) so that the stride is filled in correctly, but it was not mentioned in the changelog yet.
…y_pool_results()` (#710) Commit c66db26 ("device: Replace `query_count` parameter in `get_query_pool_results` with `data.len()` (#644)") removed this parameter in favour of using `data.len()` to make it more obvious to use an appropriate element type that matches the kind of request (see also #639) so that the stride is filled in correctly, but it was not mentioned in the changelog yet.
Supersedes #640
A slice is designed to be a cheap view into a continuous segment of memory and easily recreated with a different offset and size. This can be used to our advantage to let the user set exactly how many items they want to request, while ensuring all returned slots are filled on success or otherwise return
NOT_READY
if not enough query results could be copied to user memory (or block if theWAIT
flag is set).This also opens the door to accepting
MaybeUninit
in the future and returning the initialized slice in theVkResult::Ok(here)
case.