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>
This commit is contained in:
Friedrich Vock 2023-07-09 21:09:11 +02:00 committed by Marge Bot
parent 34ef0c15db
commit a096cf784f

View file

@ -82,6 +82,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); */
@ -165,6 +168,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);
}
@ -174,6 +178,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] = {
@ -312,6 +319,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);
}