Mesa (main): ac/llvm: accept primitives whose face culling determinant is Inf or NaN

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 19 13:11:45 UTC 2021


Module: Mesa
Branch: main
Commit: 5ee2965283eb47f2cfd81d026a975565be6054cf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ee2965283eb47f2cfd81d026a975565be6054cf

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Oct 15 05:25:39 2021 -0400

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 <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13380>

---

 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;
 }
 



More information about the mesa-commit mailing list