radv/rt: Initialize unused children in PLOC early-exit
authorFriedrich Vock <friedrich.vock@gmx.de>
Fri, 15 Dec 2023 16:40:35 +0000 (17:40 +0100)
committerEric Engestrom <eric@engestrom.ch>
Sun, 17 Dec 2023 23:48:01 +0000 (23:48 +0000)
Bad things happen when these aren't initialized.

Fixes GPU hangs when loading Avatar: Frontiers of Pandora savegames.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26712>
(cherry picked from commit f9a394b753b55ccfc869568413b6fc6795dc1636)

.pick_status.json
src/amd/vulkan/bvh/ploc_internal.comp

index 4a72827..f81141b 100644 (file)
         "description": "radv/rt: Initialize unused children in PLOC early-exit",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
index 267a914..c7c8b5d 100644 (file)
@@ -249,7 +249,8 @@ main(void)
          total_bounds.min = vec3(INFINITY);
          total_bounds.max = vec3(-INFINITY);
 
-         for (uint32_t i = 0; i < DEREF(args.header).active_leaf_count; i++) {
+         uint32_t i = 0;
+         for (; i < DEREF(args.header).active_leaf_count; i++) {
             uint32_t child_id = DEREF(INDEX(key_id_pair, src_ids, i)).id;
 
             if (child_id != RADV_BVH_INVALID_NODE) {
@@ -263,6 +264,8 @@ main(void)
 
             DEREF(dst_node).children[i] = child_id;
          }
+         for (; i < 2; i++)
+            DEREF(dst_node).children[i] = RADV_BVH_INVALID_NODE;
 
          DEREF(dst_node).base.aabb = total_bounds;
          DEREF(dst_node).bvh_offset = RADV_UNKNOWN_BVH_OFFSET;