radv/rt: Write inactive node data in ALWAYS_ACTIVE workaround

Fixes: a9831caa ("radv/rt: Add workaround to make leaves always active")
(cherry picked from commit f66055a6a6)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27341>
This commit is contained in:
Friedrich Vock
2024-01-29 19:52:30 +01:00
committed by Eric Engestrom
parent 50d34ed642
commit 1ba1f0871e
2 changed files with 14 additions and 4 deletions

View File

@@ -794,7 +794,7 @@
"description": "radv/rt: Write inactive node data in ALWAYS_ACTIVE workaround", "description": "radv/rt: Write inactive node data in ALWAYS_ACTIVE workaround",
"nominated": true, "nominated": true,
"nomination_type": 1, "nomination_type": 1,
"resolution": 0, "resolution": 1,
"main_sha": null, "main_sha": null,
"because_sha": "a9831caa144f9944fec936608faf03d253e9bb7d", "because_sha": "a9831caa144f9944fec936608faf03d253e9bb7d",
"notes": null "notes": null

View File

@@ -187,6 +187,7 @@ TYPE(AccelerationStructureInstance, 8);
bool bool
build_triangle(inout radv_aabb bounds, VOID_REF dst_ptr, uint32_t global_id) build_triangle(inout radv_aabb bounds, VOID_REF dst_ptr, uint32_t global_id)
{ {
bool is_valid = true;
triangle_indices indices = load_indices(args.indices, args.index_format, global_id); triangle_indices indices = load_indices(args.indices, args.index_format, global_id);
triangle_vertices vertices = load_vertices(args.data, indices, args.vertex_format, args.stride); triangle_vertices vertices = load_vertices(args.data, indices, args.vertex_format, args.stride);
@@ -196,7 +197,11 @@ build_triangle(inout radv_aabb bounds, VOID_REF dst_ptr, uint32_t global_id)
* format does not have a NaN representation, then all triangles are considered active. * format does not have a NaN representation, then all triangles are considered active.
*/ */
if (isnan(vertices.vertex[0].x) || isnan(vertices.vertex[1].x) || isnan(vertices.vertex[2].x)) if (isnan(vertices.vertex[0].x) || isnan(vertices.vertex[1].x) || isnan(vertices.vertex[2].x))
#if ALWAYS_ACTIVE
is_valid = false;
#else
return false; return false;
#endif
if (args.transform != NULL) { if (args.transform != NULL) {
mat4 transform = mat4(1.0); mat4 transform = mat4(1.0);
@@ -228,12 +233,13 @@ build_triangle(inout radv_aabb bounds, VOID_REF dst_ptr, uint32_t global_id)
DEREF(node).geometry_id_and_flags = args.geometry_id; DEREF(node).geometry_id_and_flags = args.geometry_id;
DEREF(node).id = 9; DEREF(node).id = 9;
return true; return is_valid;
} }
bool bool
build_aabb(inout radv_aabb bounds, VOID_REF src_ptr, VOID_REF dst_ptr, uint32_t global_id) build_aabb(inout radv_aabb bounds, VOID_REF src_ptr, VOID_REF dst_ptr, uint32_t global_id)
{ {
bool is_valid = true;
REF(radv_ir_aabb_node) node = REF(radv_ir_aabb_node)(dst_ptr); REF(radv_ir_aabb_node) node = REF(radv_ir_aabb_node)(dst_ptr);
for (uint32_t vec = 0; vec < 2; vec++) for (uint32_t vec = 0; vec < 2; vec++)
@@ -250,14 +256,18 @@ build_aabb(inout radv_aabb bounds, VOID_REF src_ptr, VOID_REF dst_ptr, uint32_t
* NaN, and the first is not, the behavior is undefined. * NaN, and the first is not, the behavior is undefined.
*/ */
if (isnan(bounds.min.x)) if (isnan(bounds.min.x))
return false; #if ALWAYS_ACTIVE
is_valid = false;
#else
return false;
#endif
DEREF(node).base.aabb = bounds; DEREF(node).base.aabb = bounds;
DEREF(node).base.cost = 0.0; DEREF(node).base.cost = 0.0;
DEREF(node).primitive_id = global_id; DEREF(node).primitive_id = global_id;
DEREF(node).geometry_id_and_flags = args.geometry_id; DEREF(node).geometry_id_and_flags = args.geometry_id;
return true; return is_valid;
} }
bool bool