radv: Implement VK_EXT_host_query_reset.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 17 Nov 2018 17:39:24 +0000 (18:39 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 18 Mar 2019 14:48:41 +0000 (14:48 +0000)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_extensions.py
src/amd/vulkan/radv_query.c

index 9570c15af02b7afb89b7d2de097e62e869717025..dc4346b749898f7aa137948ffb8b6fbb0450d185 100644 (file)
@@ -887,6 +887,12 @@ void radv_GetPhysicalDeviceFeatures2(
                        features->depthClipEnable = true;
                        break;
                }
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT: {
+                       VkPhysicalDeviceHostQueryResetFeaturesEXT *features =
+                               (VkPhysicalDeviceHostQueryResetFeaturesEXT *)ext;
+                       features->hostQueryReset = true;
+                       break;
+               }
                default:
                        break;
                }
index 0440a2ec9d95638f8c6c356dd05a2730416d7158..986ef26876d2d3353ca603fcc35a6b1bd0654043 100644 (file)
@@ -107,6 +107,7 @@ EXTENSIONS = [
     Extension('VK_EXT_external_memory_dma_buf',           1, True),
     Extension('VK_EXT_external_memory_host',              1, 'device->rad_info.has_userptr'),
     Extension('VK_EXT_global_priority',                   1, 'device->rad_info.has_ctx_priority'),
+    Extension('VK_EXT_host_query_reset',                  1, True),
     Extension('VK_EXT_memory_budget',                     1, True),
     Extension('VK_EXT_memory_priority',                   1, True),
     Extension('VK_EXT_pci_bus_info',                      2, True),
index cb279172922f5a170011627f4539659cc82896ca..e808aa65170c6ad86d1459146f6560e20ee21737 100644 (file)
@@ -1436,6 +1436,28 @@ void radv_CmdResetQueryPool(
        }
 }
 
+void radv_ResetQueryPoolEXT(
+       VkDevice                                   _device,
+       VkQueryPool                                 queryPool,
+       uint32_t                                    firstQuery,
+       uint32_t                                    queryCount)
+{
+       RADV_FROM_HANDLE(radv_query_pool, pool, queryPool);
+
+       uint32_t value = pool->type == VK_QUERY_TYPE_TIMESTAMP
+                        ? TIMESTAMP_NOT_READY : 0;
+       uint32_t *data =  (uint32_t*)(pool->ptr + firstQuery * pool->stride);
+       uint32_t *data_end = (uint32_t*)(pool->ptr + (firstQuery + queryCount) * pool->stride);
+
+       for(uint32_t *p = data; p != data_end; ++p)
+               *p = value;
+
+       if (pool->type == VK_QUERY_TYPE_PIPELINE_STATISTICS) {
+               memset(pool->ptr + pool->availability_offset + firstQuery * 4,
+                      0, queryCount * 4);
+       }
+}
+
 static unsigned event_type_for_stream(unsigned stream)
 {
        switch (stream) {