mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
radv/bvh: Prevent NANs when computing node cost
Otherwise the degenerate geometry workaround never triggers, leading to bad performance. Fixes:6f45c98b("radv/bvh: Adjust sah cost based on depth") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20723> (cherry picked from commit684eee0748)
This commit is contained in:
parent
20f8f6ebc6
commit
e8dd7a275e
2 changed files with 4 additions and 1 deletions
|
|
@ -625,7 +625,7 @@
|
|||
"description": "radv/bvh: Prevent NANs when computing node cost",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "6f45c98b580de5a534ebb0a0644ac5514793a141"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -198,6 +198,9 @@ combined_node_cost(uint32_t lds_base, uint32_t i, uint32_t j)
|
|||
combined_bounds.max = max(shared_bounds[i - lds_base].max, shared_bounds[j - lds_base].max);
|
||||
float area = aabb_surface_area(combined_bounds);
|
||||
|
||||
if (area == 0.0)
|
||||
return 0.0;
|
||||
|
||||
/* p_a and p_b are the probabilities that i or j are hit by a ray:
|
||||
* Assuming that the current node is hit (p = 1) and the probability of hitting a node
|
||||
* is proportional to its surface area, p = area * c with p = 1 for the current node.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue