ac: handle undefined EQAA samples in ac_apply_fmask_to_sample
authorMarek Olšák <marek.olsak@amd.com>
Fri, 18 May 2018 03:23:24 +0000 (23:23 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 14 Jun 2018 02:00:12 +0000 (22:00 -0400)
RADV might wanna use this helper too.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/amd/common/ac_llvm_build.c

index 133003b779ab8876ad16ee8897aad1b8b7ce39a6..93ae273f900bb436594ff042ca71ac017326c5e2 100644 (file)
@@ -2747,11 +2747,13 @@ void ac_apply_fmask_to_sample(struct ac_llvm_context *ac, LLVMValueRef fmask,
        final_sample = LLVMBuildMul(ac->builder, addr[sample_chan],
                                    LLVMConstInt(ac->i32, 4, 0), "");
        final_sample = LLVMBuildLShr(ac->builder, fmask_value, final_sample, "");
+       /* Mask the sample index by 0x7, because 0x8 means an unknown value
+        * with EQAA, so those will map to 0. */
        final_sample = LLVMBuildAnd(ac->builder, final_sample,
-                                   LLVMConstInt(ac->i32, 0xF, 0), "");
+                                   LLVMConstInt(ac->i32, 0x7, 0), "");
 
        /* Don't rewrite the sample index if WORD1.DATA_FORMAT of the FMASK
-        * resource descriptor is 0 (invalid),
+        * resource descriptor is 0 (invalid).
         */
        LLVMValueRef tmp;
        tmp = LLVMBuildBitCast(ac->builder, fmask, ac->v8i32, "");