radv/bvh: Make sure internal nodes are collapsed when possible

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 <natalie.vock@gmx.de>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39640>
(cherry picked from commit 24a1e3d8c2)
This commit is contained in:
Konstantin Seurer 2026-02-01 18:22:35 +01:00 committed by Eric Engestrom
parent 4b86b5e53d
commit b32cd7c265
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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;
}