radv: add support for VK_QUERY_POOL_CREATE_RESET_BIT_KHR
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35423>
This commit is contained in:
committed by
Marge Bot
parent
4ff66b4343
commit
4e46cabb75
+37
-27
@@ -1862,6 +1862,39 @@ radv_query_shader(struct radv_cmd_buffer *cmd_buffer, VkQueryType query_type, st
|
||||
radv_meta_restore(&saved_state, cmd_buffer);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
query_clear_value(VkQueryType type)
|
||||
{
|
||||
switch (type) {
|
||||
case VK_QUERY_TYPE_TIMESTAMP:
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR:
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR:
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR:
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SIZE_KHR:
|
||||
return (uint32_t)TIMESTAMP_NOT_READY;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
radv_reset_query_pool(struct radv_device *device, struct radv_query_pool *pool, uint32_t first_query,
|
||||
uint32_t query_count)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
uint32_t value = query_clear_value(pool->vk.query_type);
|
||||
uint32_t *data = (uint32_t *)(pool->ptr + first_query * pool->stride);
|
||||
uint32_t *data_end = (uint32_t *)(pool->ptr + (first_query + query_count) * pool->stride);
|
||||
|
||||
for (uint32_t *p = data; p != data_end; ++p)
|
||||
*p = value;
|
||||
|
||||
if (pool->vk.query_type == VK_QUERY_TYPE_PIPELINE_STATISTICS ||
|
||||
(pool->vk.query_type == VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT && pdev->info.gfx_level >= GFX11)) {
|
||||
memset(pool->ptr + pool->availability_offset + first_query * 4, 0, query_count * 4);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
radv_destroy_query_pool(struct radv_device *device, const VkAllocationCallbacks *pAllocator,
|
||||
struct radv_query_pool *pool)
|
||||
@@ -1991,6 +2024,9 @@ radv_create_query_pool(struct radv_device *device, const VkQueryPoolCreateInfo *
|
||||
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
}
|
||||
|
||||
if (pCreateInfo->flags & VK_QUERY_POOL_CREATE_RESET_BIT_KHR)
|
||||
radv_reset_query_pool(device, pool, 0, pool->vk.query_count);
|
||||
|
||||
*pQueryPool = radv_query_pool_to_handle(pool);
|
||||
radv_rmv_log_query_pool_create(device, *pQueryPool);
|
||||
return VK_SUCCESS;
|
||||
@@ -2493,21 +2529,6 @@ radv_CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPoo
|
||||
radv_resume_conditional_rendering(cmd_buffer);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
query_clear_value(VkQueryType type)
|
||||
{
|
||||
switch (type) {
|
||||
case VK_QUERY_TYPE_TIMESTAMP:
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR:
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR:
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR:
|
||||
case VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SIZE_KHR:
|
||||
return (uint32_t)TIMESTAMP_NOT_READY;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
radv_CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
|
||||
{
|
||||
@@ -2550,19 +2571,8 @@ radv_ResetQueryPool(VkDevice _device, VkQueryPool queryPool, uint32_t firstQuery
|
||||
{
|
||||
VK_FROM_HANDLE(radv_device, device, _device);
|
||||
VK_FROM_HANDLE(radv_query_pool, pool, queryPool);
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
|
||||
uint32_t value = query_clear_value(pool->vk.query_type);
|
||||
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->vk.query_type == VK_QUERY_TYPE_PIPELINE_STATISTICS ||
|
||||
(pool->vk.query_type == VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT && pdev->info.gfx_level >= GFX11)) {
|
||||
memset(pool->ptr + pool->availability_offset + firstQuery * 4, 0, queryCount * 4);
|
||||
}
|
||||
radv_reset_query_pool(device, pool, firstQuery, queryCount);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user