You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling vkGetQueryPoolResults using the VK_QUERY_RESULT_WITH_AVAILABILITY_BIT bit, proper usage requires passing in twice the usual data size (and specifying twice the stride) in order to account for availability values. For example, this call (which doesn't use VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) works like a charm:
An equivalent example using VK_QUERY_RESULT_WITH_AVAILABILITY_BIT is below. Note the doubled vector length, inclusion of QueryResultFlags::WITH_AVAILABILITY, and checking availability prior to utilizing query results.
However, using ash, this call fails with a Vulkan validation message stating queryPool specified dataSize 16 which is incompatible with the specified query type and options.
The culprit is actually the stride parameter of vkGetQueryPoolResults. ash passes stride as mem::size_of::<T>() as _, which in this example is 8 (T is u64). With VK_QUERY_RESULT_WITH_AVAILABILITY_BIT, however, that stride should actually be 16, which accounts for interleaved query results and availabilities. This can be worked around by calling the relevant function directly:
let result = unsafe{(device.fp_v1_0().get_query_pool_results)(
device.handle(),
query_pool,0,2,
mem::size_of::<u64>()* data.len(),
data.as_mut_ptr()as*mut_,
mem::size_of::<u64>()*2,QueryResultFlags::TYPE_64 | QueryResultFlags::WITH_AVAILABILITY).result()};
A non-breaking solution would be to double the stride if QueryResultFlags::WITH_AVAILABILITY is set. A breaking solution would be to modify the get_query_pool_results signature to include stride.
The text was updated successfully, but these errors were encountered:
When calling vkGetQueryPoolResults using the
VK_QUERY_RESULT_WITH_AVAILABILITY_BIT
bit, proper usage requires passing in twice the usual data size (and specifying twice the stride) in order to account for availability values. For example, this call (which doesn't useVK_QUERY_RESULT_WITH_AVAILABILITY_BIT
) works like a charm:An equivalent example using
VK_QUERY_RESULT_WITH_AVAILABILITY_BIT
is below. Note the doubled vector length, inclusion ofQueryResultFlags::WITH_AVAILABILITY
, and checking availability prior to utilizing query results.However, using ash, this call fails with a Vulkan validation message stating
queryPool specified dataSize 16 which is incompatible with the specified query type and options.
The culprit is actually the
stride
parameter ofvkGetQueryPoolResults
. ash passesstride
asmem::size_of::<T>() as _
, which in this example is 8 (T
isu64
). WithVK_QUERY_RESULT_WITH_AVAILABILITY_BIT
, however, that stride should actually be 16, which accounts for interleaved query results and availabilities. This can be worked around by calling the relevant function directly:A non-breaking solution would be to double the stride if
QueryResultFlags::WITH_AVAILABILITY
is set. A breaking solution would be to modify theget_query_pool_results
signature to includestride
.The text was updated successfully, but these errors were encountered: