diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-09-02 11:32:09 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-09-05 10:17:51 +0100 |
commit | 6ed726b8fc6210a41fe325591e1428d19f419108 (patch) | |
tree | a8f6a8d64f8a43d4d4095783e16e57e62512ed99 /src/gallium/auxiliary/gallivm/lp_bld_const.c | |
parent | 079763f74648fef051ee5b8f7d730f7fc1ba27d5 (diff) |
gallivm: Pass condition masks as an unsigned bitmask.
Much more convenient than boolean arrays.
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_const.c')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_const.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c index e42ff31ac7..dd839c0bea 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_const.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c @@ -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); } |