Module: Mesa
Branch: main
Commit: f9a394b753b55ccfc869568413b6fc6795dc1636
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9a394b753b55ccfc869568413b6fc6795dc1636

Author: Friedrich Vock <friedrich.v...@gmx.de>
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>

---

 src/amd/vulkan/bvh/ploc_internal.comp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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