mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 20:08:06 +02:00
radv/bvh: Encode empty AS bounds as NaN
If there are no leaves, the root node bounds still span -inf/inf.
Making empty BLASs infinite-sized guarantees ray traversal needs to
enter the BLAS (and immediately exit because it's empty). Remove the
BLAS from the BVH entirely by marking its bounds as NaN. As a bonus,
this works around RADV encountering issues in Silent Hill 2 on RDNA4 due
to infinite-sized BVHs.
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37492>
(cherry picked from commit 52c7b0d20c)
This commit is contained in:
parent
42381cd0c6
commit
9d524bbd21
3 changed files with 11 additions and 3 deletions
|
|
@ -6024,7 +6024,7 @@
|
|||
"description": "radv/bvh: Encode empty AS bounds as NaN",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -243,10 +243,14 @@ main()
|
|||
}
|
||||
|
||||
if (is_root_node) {
|
||||
vk_aabb aabb = src.base.aabb;
|
||||
if (DEREF(args.header).active_leaf_count == 0)
|
||||
aabb = vk_aabb(vec3(NAN), vec3(NAN));
|
||||
|
||||
REF(radv_accel_struct_header) header = REF(radv_accel_struct_header)(args.output_bvh - args.output_bvh_offset);
|
||||
DEREF(header).bvh_offset = args.output_bvh_offset;
|
||||
DEREF(header).root_flags = src.flags;
|
||||
DEREF(header).aabb = src.base.aabb;
|
||||
DEREF(header).aabb = aabb;
|
||||
|
||||
set_parent(RADV_BVH_ROOT_NODE, RADV_BVH_INVALID_NODE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,8 +271,12 @@ encode_gfx12(uint32_t ir_leaf_node_size, REF(vk_ir_box_node) intermediate_intern
|
|||
}
|
||||
|
||||
if (is_root_node && cluster.invocation_index == 0) {
|
||||
vk_aabb aabb = src.base.aabb;
|
||||
if (DEREF(args.header).active_leaf_count == 0)
|
||||
aabb = vk_aabb(vec3(NAN), vec3(NAN));
|
||||
|
||||
REF(radv_accel_struct_header) header = REF(radv_accel_struct_header)(args.output_base);
|
||||
DEREF(header).aabb = src.base.aabb;
|
||||
DEREF(header).aabb = aabb;
|
||||
DEREF(header).bvh_offset = args.output_bvh_offset;
|
||||
|
||||
set_parent(RADV_BVH_ROOT_NODE, RADV_BVH_INVALID_NODE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue