OSDN Git Service

anv/query: Perform CmdResetQueryPool on the GPU
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 18 Feb 2017 23:21:04 +0000 (15:21 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 21 Feb 2017 20:26:35 +0000 (12:26 -0800)
This fixes a some rendering corruption in The Talos Principle

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
src/intel/vulkan/anv_query.c
src/intel/vulkan/genX_cmd_buffer.c

index da0deb8..6fe94b0 100644 (file)
@@ -169,25 +169,3 @@ VkResult anv_GetQueryPoolResults(
 
    return VK_SUCCESS;
 }
-
-void anv_CmdResetQueryPool(
-    VkCommandBuffer                             commandBuffer,
-    VkQueryPool                                 queryPool,
-    uint32_t                                    firstQuery,
-    uint32_t                                    queryCount)
-{
-   ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
-
-   for (uint32_t i = 0; i < queryCount; i++) {
-      switch (pool->type) {
-      case VK_QUERY_TYPE_OCCLUSION:
-      case VK_QUERY_TYPE_TIMESTAMP: {
-         struct anv_query_pool_slot *slot = pool->bo.map;
-         slot[firstQuery + i].available = 0;
-         break;
-      }
-      default:
-         assert(!"Invalid query type");
-      }
-   }
-}
index 40a72f4..12ff410 100644 (file)
@@ -2510,6 +2510,36 @@ emit_query_availability(struct anv_cmd_buffer *cmd_buffer,
    }
 }
 
+void genX(CmdResetQueryPool)(
+    VkCommandBuffer                             commandBuffer,
+    VkQueryPool                                 queryPool,
+    uint32_t                                    firstQuery,
+    uint32_t                                    queryCount)
+{
+   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
+   ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
+
+   for (uint32_t i = 0; i < queryCount; i++) {
+      switch (pool->type) {
+      case VK_QUERY_TYPE_OCCLUSION:
+      case VK_QUERY_TYPE_TIMESTAMP: {
+         anv_batch_emit(&cmd_buffer->batch, GENX(MI_STORE_DATA_IMM), sdm) {
+            sdm.Address = (struct anv_address) {
+               .bo = &pool->bo,
+               .offset = (firstQuery + i) * sizeof(struct anv_query_pool_slot) +
+                         offsetof(struct anv_query_pool_slot, available),
+            };
+            sdm.DataDWord0 = 0;
+            sdm.DataDWord1 = 0;
+         }
+         break;
+      }
+      default:
+         assert(!"Invalid query type");
+      }
+   }
+}
+
 void genX(CmdBeginQuery)(
     VkCommandBuffer                             commandBuffer,
     VkQueryPool                                 queryPool,