diff options
author | José Fonseca <jfonseca@vmware.com> | 2009-08-11 13:09:54 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 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 1f83bf6782..3182573db2 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 aeb4f42fa8..dede675e58 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. |