diff options
author | José Fonseca <[email protected]> | 2009-08-11 13:09:54 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-08-29 09:21:29 +0100 |
commit | 4393ca7956bd03e07b4d7a019705fc62d4ac7155 (patch) | |
tree | 0427cf5d3b6141966e887e50254f904da96de134 /src/gallium | |
parent | 8422f293ab7bf1ff1adf105ed3240b1627538d34 (diff) |
llvmpipe: Scalar -> vector broadcasting.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_swizzle.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_swizzle.h | 5 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c index 1f83bf67828..3182573db29 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c @@ -34,6 +34,24 @@ LLVMValueRef +lp_build_broadcast_scalar(struct lp_build_context *bld, + LLVMValueRef scalar) +{ + const union lp_type type = bld->type; + LLVMValueRef res; + unsigned i; + + res = bld->undef; + for(i = 0; i < type.length; ++i) { + LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0); + res = LLVMBuildInsertElement(bld->builder, res, scalar, index, ""); + } + + return res; +} + + +LLVMValueRef lp_build_broadcast_aos(struct lp_build_context *bld, LLVMValueRef a, unsigned channel) diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h index aeb4f42fa8a..dede675e588 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h @@ -44,6 +44,11 @@ union lp_type type; struct lp_build_context; +LLVMValueRef +lp_build_broadcast_scalar(struct lp_build_context *bld, + LLVMValueRef scalar); + + /** * Broadcast one channel of a vector composed of arrays of XYZW structures into * all four channel. |