ac/nir/cull: Accept NaN and +/- Inf in face culling.
When the determinant that we use for calculating triangle area
is NaN, it's not possible to decide the facing of the triangle.
This can happen when a coordinate of one of the triangle's vertices
is INFINITY. It's better to just accept these triangles in the shader
and let the PA deal with them.
Let's do the same for +/- Infinity too.
Though we haven't seen this yet, it may be troublesome as well.
Fixes: 651a3da1b5
Closes: #5470
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13299>
This commit is contained in:
@@ -75,7 +75,14 @@ cull_face(nir_builder *b, nir_ssa_def *pos[3][4], const position_w_info *w_info)
|
||||
nir_ssa_def *cull_front = nir_build_load_cull_front_face_enabled_amd(b);
|
||||
nir_ssa_def *cull_back = nir_build_load_cull_back_face_enabled_amd(b);
|
||||
|
||||
return nir_inot(b, nir_bcsel(b, front_facing, cull_front, cull_back));
|
||||
nir_ssa_def *face_culled = nir_bcsel(b, front_facing, cull_front, cull_back);
|
||||
|
||||
/* Don't reject NaN and +/-infinity, these are tricky.
|
||||
* Just trust fixed-function HW to handle these cases correctly.
|
||||
*/
|
||||
face_culled = nir_iand(b, face_culled, nir_fisfinite(b, det));
|
||||
|
||||
return nir_inot(b, face_culled);
|
||||
}
|
||||
|
||||
static nir_ssa_def *
|
||||
|
Reference in New Issue
Block a user