radv/rt: Enable exact on software intersection functions

These functions need exact output, otherwise watertightness can't be
guaranteed in some cases.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24063>
(cherry picked from commit a096cf784f)
This commit is contained in:
Friedrich Vock 2023-07-09 21:09:11 +02:00 committed by Eric Engestrom
parent ca14c2d5bf
commit ef42db3631
2 changed files with 9 additions and 1 deletions

View file

@ -2002,7 +2002,7 @@
"description": "radv/rt: Enable exact on software intersection functions",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -95,6 +95,9 @@ intersect_ray_amd_software_box(struct radv_device *device, nir_builder *b, nir_s
const struct glsl_type *vec4_type = glsl_vector_type(GLSL_TYPE_FLOAT, 4);
const struct glsl_type *uvec4_type = glsl_vector_type(GLSL_TYPE_UINT, 4);
bool old_exact = b->exact;
b->exact = true;
nir_ssa_def *node_addr = build_node_to_addr(device, b, bvh_node, false);
/* vec4 distances = vec4(INF, INF, INF, INF); */
@ -186,6 +189,7 @@ intersect_ray_amd_software_box(struct radv_device *device, nir_builder *b, nir_s
nir_sort_hit_pair(b, distances, child_indices, 1, 3);
nir_sort_hit_pair(b, distances, child_indices, 1, 2);
b->exact = old_exact;
return nir_load_var(b, child_indices);
}
@ -196,6 +200,9 @@ intersect_ray_amd_software_tri(struct radv_device *device, nir_builder *b, nir_s
{
const struct glsl_type *vec4_type = glsl_vector_type(GLSL_TYPE_FLOAT, 4);
bool old_exact = b->exact;
b->exact = true;
nir_ssa_def *node_addr = build_node_to_addr(device, b, bvh_node, false);
const uint32_t coord_offsets[3] = {
@ -351,6 +358,7 @@ intersect_ray_amd_software_tri(struct radv_device *device, nir_builder *b, nir_s
}
nir_pop_if(b, NULL);
b->exact = old_exact;
return nir_load_var(b, result);
}