Module: Mesa
Branch: staging/23.3
Commit: d927d714c6a22cb208c2b7faacf74951ef90d465
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d927d714c6a22cb208c2b7faacf74951ef90d465

Author: Friedrich Vock <[email protected]>
Date:   Fri Dec 15 17:40:35 2023 +0100

radv/rt: Initialize unused children in PLOC early-exit

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                     | 2 +-
 src/amd/vulkan/bvh/ploc_internal.comp | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 4a728277ff5..f81141b5f4f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -314,7 +314,7 @@
         "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
diff --git a/src/amd/vulkan/bvh/ploc_internal.comp 
b/src/amd/vulkan/bvh/ploc_internal.comp
index 267a914d89b..c7c8b5d394e 100644
--- a/src/amd/vulkan/bvh/ploc_internal.comp
+++ b/src/amd/vulkan/bvh/ploc_internal.comp
@@ -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;

Reply via email to