mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 02:20:11 +01:00
anv: Properly fetch partial results in vkGetQueryPoolResults
Currently for an "unavailable" query, if VK_QUERY_RESULT_PARTIAL_BIT is set, anv will return (slot.end - slot.begin). This can cause underflow because slot.end might still be at the initial value of 0. This commit fixes the issue by returning 0 in that situation. Cc: mesa-stable Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29447>
This commit is contained in:
parent
7bdcbe11ac
commit
f8ccf70c99
1 changed files with 12 additions and 5 deletions
|
|
@ -558,7 +558,8 @@ VkResult genX(GetQueryPoolResults)(
|
||||||
while (statistics) {
|
while (statistics) {
|
||||||
UNUSED uint32_t stat = u_bit_scan(&statistics);
|
UNUSED uint32_t stat = u_bit_scan(&statistics);
|
||||||
if (write_results) {
|
if (write_results) {
|
||||||
uint64_t result = slot[idx * 2 + 2] - slot[idx * 2 + 1];
|
/* If a query is not available but VK_QUERY_RESULT_PARTIAL_BIT is set, write 0. */
|
||||||
|
uint64_t result = available ? slot[idx * 2 + 2] - slot[idx * 2 + 1] : 0;
|
||||||
cpu_write_query_result(pData, flags, idx, result);
|
cpu_write_query_result(pData, flags, idx, result);
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
|
|
@ -569,11 +570,17 @@ VkResult genX(GetQueryPoolResults)(
|
||||||
|
|
||||||
case VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT: {
|
case VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT: {
|
||||||
uint64_t *slot = query_slot(pool, firstQuery + i);
|
uint64_t *slot = query_slot(pool, firstQuery + i);
|
||||||
if (write_results)
|
if (write_results) {
|
||||||
cpu_write_query_result(pData, flags, idx, slot[2] - slot[1]);
|
/* If a query is not available but VK_QUERY_RESULT_PARTIAL_BIT is set, write 0. */
|
||||||
|
uint64_t result = available ? slot[2] - slot[1] : 0;
|
||||||
|
cpu_write_query_result(pData, flags, idx, result);
|
||||||
|
}
|
||||||
idx++;
|
idx++;
|
||||||
if (write_results)
|
if (write_results) {
|
||||||
cpu_write_query_result(pData, flags, idx, slot[4] - slot[3]);
|
/* If a query is not available but VK_QUERY_RESULT_PARTIAL_BIT is set, write 0. */
|
||||||
|
uint64_t result = available ? slot[4] - slot[3] : 0;
|
||||||
|
cpu_write_query_result(pData, flags, idx, result);
|
||||||
|
}
|
||||||
idx++;
|
idx++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue