diff options
author | James Benton <[email protected]> | 2012-09-13 16:04:42 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2012-11-28 19:14:36 +0000 |
commit | fa1b481c09b14e01eca1b3db8e0854033f6dee3d (patch) | |
tree | 170810687d31e60041309682e8f923f409174077 /src/gallium/auxiliary/gallivm/lp_bld_logic.c | |
parent | 1d3789bccbbcc814fd7b339e9f5b5631e30d9f0e (diff) |
llvmpipe: Unswizzled rendering.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_logic.c')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_logic.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c index 8a77a43dae8..f56b61bf248 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c @@ -560,7 +560,8 @@ LLVMValueRef lp_build_select_aos(struct lp_build_context *bld, unsigned mask, LLVMValueRef a, - LLVMValueRef b) + LLVMValueRef b, + unsigned num_channels) { LLVMBuilderRef builder = bld->gallivm->builder; const struct lp_type type = bld->type; @@ -594,8 +595,8 @@ lp_build_select_aos(struct lp_build_context *bld, LLVMTypeRef elem_type = LLVMInt32TypeInContext(bld->gallivm->context); LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH]; - for(j = 0; j < n; j += 4) - for(i = 0; i < 4; ++i) + for(j = 0; j < n; j += num_channels) + for(i = 0; i < num_channels; ++i) shuffles[j + i] = LLVMConstInt(elem_type, (mask & (1 << i) ? 0 : n) + j + i, 0); @@ -603,7 +604,7 @@ lp_build_select_aos(struct lp_build_context *bld, return LLVMBuildShuffleVector(builder, a, b, LLVMConstVector(shuffles, n), ""); } else { - LLVMValueRef mask_vec = lp_build_const_mask_aos(bld->gallivm, type, mask, 4); + LLVMValueRef mask_vec = lp_build_const_mask_aos(bld->gallivm, type, mask, num_channels); return lp_build_select(bld, mask_vec, a, b); } } |