radv/rra: Fix copying accel structs that were not built yet
authorKonstantin Seurer <konstantin.seurer@gmail.com>
Wed, 16 Nov 2022 09:31:20 +0000 (10:31 +0100)
committerEric Engestrom <eric@engestrom.ch>
Wed, 23 Nov 2022 19:11:58 +0000 (19:11 +0000)
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 <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19772>
(cherry picked from commit f24bb8194b82052b207b5c5ca1c99f47ab73dce5)

.pick_status.json
src/amd/vulkan/radv_rra.c

index 944ac4a..70c01bd 100644 (file)
         "description": "radv/rra: Fix copying accel structs that were not built yet",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "574980675405e36d34519cb5cbd315b3582850ec"
     },
index 6f0ced7..b93aaa2 100644 (file)
@@ -1021,7 +1021,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));
@@ -1050,13 +1050,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)