gallivm: Pass condition masks as an unsigned bitmask.
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_const.c
index e42ff31ac7aaf08204c8d70bfe42a9b35f41c665..dd839c0bea56ce5f60bb01974140ef3f74dcef37 100644 (file)
@@ -382,9 +382,12 @@ lp_build_const_aos(struct lp_type type,
 }
 
 
+/**
+ * @param mask TGSI_WRITEMASK_xxx
+ */
 LLVMValueRef
 lp_build_const_mask_aos(struct lp_type type,
-                        const boolean cond[4])
+                        unsigned mask)
 {
    LLVMTypeRef elem_type = LLVMIntType(type.width);
    LLVMValueRef masks[LP_MAX_VECTOR_LENGTH];
@@ -392,9 +395,13 @@ lp_build_const_mask_aos(struct lp_type type,
 
    assert(type.length <= LP_MAX_VECTOR_LENGTH);
 
-   for(j = 0; j < type.length; j += 4)
-      for(i = 0; i < 4; ++i)
-         masks[j + i] = LLVMConstInt(elem_type, cond[i] ? ~0 : 0, 0);
+   for (j = 0; j < type.length; j += 4) {
+      for( i = 0; i < 4; ++i) {
+         masks[j + i] = LLVMConstInt(elem_type,
+                                     mask & (1 << i) ? ~0ULL : 0,
+                                     1);
+      }
+   }
 
    return LLVMConstVector(masks, type.length);
 }