llvmpipe: fix occlusion queries on big-endian.
authorDave Airlie <airlied@redhat.com>
Mon, 29 Jun 2020 05:57:14 +0000 (15:57 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 30 Jun 2020 23:52:56 +0000 (09:52 +1000)
Casting to u8 arrays and picking the lowest byte is fairly LE specific
grab the other byte.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5679>

src/gallium/drivers/llvmpipe/lp_bld_depth.c

index ed28d212df3024e49c476d82109792ed4bc333f3..64cf72ae10152f6f6f93d759a4773c22fddf223b 100644 (file)
@@ -469,7 +469,11 @@ lp_build_occlusion_count(struct gallivm_state *gallivm,
       countv = LLVMBuildBitCast(builder, countv, i8vntype, "");
 
        for (i = 0; i < type.length; i++) {
+#if UTIL_ARCH_LITTLE_ENDIAN
           shuffles[i] = lp_build_const_int32(gallivm, 4*i);
+#else
+          shuffles[i] = lp_build_const_int32(gallivm, (4*i) + 3);
+#endif
        }
 
        shufflev = LLVMConstVector(shuffles, type.length);