Mesa (staging/20.1): draw/llvm: fix big-endian mask adjusting

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 2 14:36:40 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: ef77882b5c8eab49b5ae7ea1a972c8d4b82c7097
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef77882b5c8eab49b5ae7ea1a972c8d4b82c7097

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Jun 30 13:21:04 2020 +1000

draw/llvm: fix big-endian mask adjusting

This code was broken, but it worked by accident, as the
pad and the edgeflag were reversed, however when Roland
removed the cliptest field back in 2015, he stopped copying
the pad which actually stopped copy the edgeflag.

Fix the function to actually copy the edgeflag.

Fixes: 1b22815af624 ("draw: don't pretend have_clipdist is per-vertex")

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5679>
(cherry picked from commit 2bf2e6c83d2b97ecc84589ec94c17cb7beed2c53)

---

 .pick_status.json                      |  2 +-
 src/gallium/auxiliary/draw/draw_llvm.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index ddbac86789c..d7c21cbfd3a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -616,7 +616,7 @@
         "description": "draw/llvm: fix big-endian mask adjusting",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "1b22815af624b93bcfebc8069598349e151bc67f"
     },
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 765cd1d84e1..f87d4667eff 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1123,8 +1123,8 @@ store_aos(struct gallivm_state *gallivm,
  * {
  *   return (x >> 16) |              // vertex_id
  *          ((x & 0x3fff) << 18) |   // clipmask
- *          ((x & 0x4000) << 3) |    // pad
- *          ((x & 0x8000) << 1);     // edgeflag
+ *          ((x & 0x4000) << 3) |    // edgeflag
+ *          ((x & 0x8000) << 1);     // pad
  * }
  */
 static LLVMValueRef
@@ -1142,11 +1142,11 @@ adjust_mask(struct gallivm_state *gallivm,
    clipmask  = LLVMBuildAnd(builder, mask, lp_build_const_int32(gallivm, 0x3fff), "");
    clipmask  = LLVMBuildShl(builder, clipmask, lp_build_const_int32(gallivm, 18), "");
    if (0) {
-      pad = LLVMBuildAnd(builder, mask, lp_build_const_int32(gallivm, 0x4000), "");
-      pad = LLVMBuildShl(builder, pad, lp_build_const_int32(gallivm, 3), "");
+      pad = LLVMBuildAnd(builder, mask, lp_build_const_int32(gallivm, 0x8000), "");
+      pad = LLVMBuildShl(builder, pad, lp_build_const_int32(gallivm, 1), "");
    }
-   edgeflag = LLVMBuildAnd(builder, mask, lp_build_const_int32(gallivm, 0x8000), "");
-   edgeflag = LLVMBuildShl(builder, edgeflag, lp_build_const_int32(gallivm, 1), "");
+   edgeflag = LLVMBuildAnd(builder, mask, lp_build_const_int32(gallivm, 0x4000), "");
+   edgeflag = LLVMBuildShl(builder, edgeflag, lp_build_const_int32(gallivm, 3), "");
 
    mask = LLVMBuildOr(builder, vertex_id, clipmask, "");
    if (0) {



More information about the mesa-commit mailing list