mirror of
https://github.com/revyos-package/mesa.git
synced 2026-04-28 09:13:36 +00: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> (cherry picked from commit f8ccf70c99bc921e50306cd48c62c9a47a8beb70)
This commit is contained in:
committed by
Eric Engestrom
parent
786aefca89
commit
026c70ef16
@@ -1264,7 +1264,7 @@
|
||||
"description": "anv: Properly fetch partial results in vkGetQueryPoolResults",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
||||
@@ -554,7 +554,8 @@ VkResult genX(GetQueryPoolResults)(
|
||||
while (statistics) {
|
||||
UNUSED uint32_t stat = u_bit_scan(&statistics);
|
||||
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);
|
||||
}
|
||||
idx++;
|
||||
@@ -565,11 +566,17 @@ VkResult genX(GetQueryPoolResults)(
|
||||
|
||||
case VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT: {
|
||||
uint64_t *slot = query_slot(pool, firstQuery + i);
|
||||
if (write_results)
|
||||
cpu_write_query_result(pData, flags, idx, slot[2] - slot[1]);
|
||||
if (write_results) {
|
||||
/* 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++;
|
||||
if (write_results)
|
||||
cpu_write_query_result(pData, flags, idx, slot[4] - slot[3]);
|
||||
if (write_results) {
|
||||
/* 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++;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user