From 5ee2965283eb47f2cfd81d026a975565be6054cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 15 Oct 2021 05:25:39 -0400 Subject: [PATCH] ac/llvm: accept primitives whose face culling determinant is Inf or NaN Based on https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13299/diffs Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/amd/llvm/ac_llvm_cull.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/amd/llvm/ac_llvm_cull.c b/src/amd/llvm/ac_llvm_cull.c index 5e7e0320802..681c186cd35 100644 --- a/src/amd/llvm/ac_llvm_cull.c +++ b/src/amd/llvm/ac_llvm_cull.c @@ -109,6 +109,14 @@ static LLVMValueRef ac_cull_face(struct ac_llvm_context *ctx, LLVMValueRef pos[3 } else if (cull_zero_area) { accepted = LLVMBuildFCmp(builder, LLVMRealONE, det, ctx->f32_0, ""); } + + if (accepted) { + /* Don't reject NaN and +/-infinity, these are tricky. + * Just trust fixed-function HW to handle these cases correctly. + */ + accepted = LLVMBuildOr(builder, accepted, ac_build_is_inf_or_nan(ctx, det), ""); + } + return accepted; }