radv: respect VK_QUERY_RESULT_WAIT_BIT in GetQueryPoolResults
authorYiwei Zhang <zzyiwei@chromium.org>
Mon, 1 May 2023 16:58:11 +0000 (16:58 +0000)
committerYiwei Zhang <zzyiwei@chromium.org>
Mon, 1 May 2023 18:07:24 +0000 (18:07 +0000)
The flag was ignored for VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT and
VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT.

Cc: mesa-stable
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22781>

src/amd/vulkan/radv_query.c

index 77851e2..1dbf3c2 100644 (file)
@@ -1384,11 +1384,13 @@ radv_GetQueryPoolResults(VkDevice _device, VkQueryPool queryPool, uint32_t first
           *    u64 PrimitiveStorageNeeded;
           * }
           */
-         available = 1;
-         for (int j = 0; j < 4; j++) {
-            if (!(p_atomic_read(src64 + j) & 0x8000000000000000UL))
-               available = 0;
-         }
+         do {
+            available = 1;
+            for (int j = 0; j < 4; j++) {
+               if (!(p_atomic_read(src64 + j) & 0x8000000000000000UL))
+                  available = 0;
+            }
+         } while (!available && (flags & VK_QUERY_RESULT_WAIT_BIT));
 
          if (!available && !(flags & VK_QUERY_RESULT_PARTIAL_BIT))
             result = VK_NOT_READY;
@@ -1423,11 +1425,13 @@ radv_GetQueryPoolResults(VkDevice _device, VkQueryPool queryPool, uint32_t first
           *    u64 PrimitiveStorageNeeded;
           * }
           */
-         available = 1;
-         if (!(p_atomic_read(src64 + 0) & 0x8000000000000000UL) ||
-             !(p_atomic_read(src64 + 2) & 0x8000000000000000UL)) {
-            available = 0;
-         }
+         do {
+            available = 1;
+            if (!(p_atomic_read(src64 + 0) & 0x8000000000000000UL) ||
+                !(p_atomic_read(src64 + 2) & 0x8000000000000000UL)) {
+               available = 0;
+            }
+         } while (!available && (flags & VK_QUERY_RESULT_WAIT_BIT));
 
          if (!available && !(flags & VK_QUERY_RESULT_PARTIAL_BIT))
             result = VK_NOT_READY;