diff options
author | José Fonseca <[email protected]> | 2009-08-04 12:09:52 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-08-29 09:21:23 +0100 |
commit | 1dd7bb17c7331f9ecd0bc830b61ada235a56fe6d (patch) | |
tree | 31508bde5eead960ba644ef4ef50d4bc526fc43d /src/gallium/drivers/llvmpipe/lp_bld_const.c | |
parent | a77084ea4b5801dc3ba52f33533176da926aed16 (diff) |
llvmpipe: Optimize blend swizzles by using bitmasks instead of shuffles for ubytes.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_const.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_const.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_const.c b/src/gallium/drivers/llvmpipe/lp_bld_const.c index 44fcc467f40..fe1c627eeeb 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_const.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_const.c @@ -143,3 +143,38 @@ lp_build_const_aos(union lp_type type, return LLVMConstVector(elems, type.length); } + + +LLVMValueRef +lp_build_const_shift(union lp_type type, + int c) +{ + LLVMTypeRef elem_type = LLVMIntType(type.width); + LLVMValueRef elems[LP_MAX_VECTOR_LENGTH]; + unsigned i; + + assert(type.length <= LP_MAX_VECTOR_LENGTH); + + for(i = 0; i < type.length; ++i) + elems[i] = LLVMConstInt(elem_type, c, 0); + + return LLVMConstVector(elems, type.length); +} + + +LLVMValueRef +lp_build_const_mask_aos(union lp_type type, + boolean cond[4]) +{ + LLVMTypeRef elem_type = LLVMIntType(type.width); + LLVMValueRef masks[LP_MAX_VECTOR_LENGTH]; + unsigned i, j; + + 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); + + return LLVMConstVector(masks, type.length); +} |