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>
This commit is contained in:
Konstantin Seurer 2026-02-01 18:22:35 +01:00 committed by Marge Bot
parent 60c1e4e3e6
commit 24a1e3d8c2

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