From f24bb8194b82052b207b5c5ca1c99f47ab73dce5 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Wed, 16 Nov 2022 10:31:20 +0100 Subject: [PATCH] radv/rra: Fix copying accel structs that were not built yet In the case that radv_GetEventStatus always returns true, the loop will never exit. Fixes: 5749806 ("radv: Add Radeon Raytracing Analyzer trace dumping utilities") Reviewed-by: Friedrich Vock Part-of: --- src/amd/vulkan/radv_rra.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_rra.c b/src/amd/vulkan/radv_rra.c index 788220aba8b..6e41a97f7c6 100644 --- a/src/amd/vulkan/radv_rra.c +++ b/src/amd/vulkan/radv_rra.c @@ -1019,7 +1019,7 @@ rra_copy_acceleration_structures(VkQueue vk_queue, struct rra_accel_struct_copy radv_BeginCommandBuffer(dst->cmd_buffer, &begin_info); uint64_t dst_offset = 0; - for (uint32_t i = 0; i < count;) { + for (uint32_t i = 0; i < count; i++) { struct hash_entry *entry = entries[i]; VkResult event_result = radv_GetEventStatus(vk_device, radv_event_to_handle(entry->data)); @@ -1048,13 +1048,12 @@ rra_copy_acceleration_structures(VkQueue vk_queue, struct rra_accel_struct_copy radv_buffer_finish(&tmp_buffer); - dst->copied_structures[i].handle = structure; - dst->copied_structures[i].data = dst->map_data + dst_offset; + dst->copied_structures[*copied_structure_count].handle = structure; + dst->copied_structures[*copied_structure_count].data = dst->map_data + dst_offset; dst_offset += accel_struct->size; ++(*copied_structure_count); - ++i; } result = radv_EndCommandBuffer(dst->cmd_buffer); if (result != VK_SUCCESS)