llvmpipe: Fix translation of KIL with repeated swizzles.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 17 Aug 2009 06:51:16 +0000 (07:51 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sat, 29 Aug 2009 08:21:33 +0000 (09:21 +0100)
src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c

index 4ec1b9dbd854fe24b3ba9bf9ac25343d65918fde..7ef01c045149920d3eae125bd6f355242a7bef7a 100644 (file)
@@ -386,14 +386,16 @@ emit_kil(
    }
 
    FOR_EACH_CHANNEL( chan_index ) {
-      LLVMValueRef mask;
+      if(terms[chan_index]) {
+         LLVMValueRef mask;
 
-      mask = lp_build_cmp(&bld->base, PIPE_FUNC_GEQUAL, terms[chan_index], bld->base.zero);
-      
-      if(bld->mask)
-         bld->mask = LLVMBuildAnd(bld->base.builder, bld->mask, mask, "");
-      else
-         bld->mask = mask;
+         mask = lp_build_cmp(&bld->base, PIPE_FUNC_GEQUAL, terms[chan_index], bld->base.zero);
+
+         if(bld->mask)
+            bld->mask = LLVMBuildAnd(bld->base.builder, bld->mask, mask, "");
+         else
+            bld->mask = mask;
+      }
    }
 }