From b32cd7c2651ed297eb5945e5e403d2da0417ae46 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Sun, 1 Feb 2026 18:22:35 +0100 Subject: [PATCH] radv/bvh: Make sure internal nodes are collapsed when possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoiding NaNs should have the same effect but it's good practice to not rely on float OPs for correctness. Fixes: 95a89f7 ("radv: Report smaller bvh sizes when possible") Reviewed-by: Natalie Vock Reviewed-by: Timur Kristóf Part-of: (cherry picked from commit 24a1e3d8c28557ad6ff6603d3778edfd663855bb) --- .pick_status.json | 2 +- src/amd/vulkan/bvh/encode.comp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a0fe9d65d63..d11357f3496 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -384,7 +384,7 @@ "description": "radv/bvh: Make sure internal nodes are collapsed when possible", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "95a89f7b334479e9184eafa6289c3ea54a733933", "notes": null diff --git a/src/amd/vulkan/bvh/encode.comp b/src/amd/vulkan/bvh/encode.comp index 1fb4dc5d728..1b052540413 100644 --- a/src/amd/vulkan/bvh/encode.comp +++ b/src/amd/vulkan/bvh/encode.comp @@ -145,7 +145,7 @@ main() ir_id_to_offset(children[i]))).aabb; float surface_area = aabb_surface_area(bounds); - if (surface_area > largest_surface_area) { + if (surface_area > largest_surface_area || collapsed_child_index == -1) { largest_surface_area = surface_area; collapsed_child_index = i; }