Mesa (gallium-llvmpipe): llvmpipe: Simpler variant of lp_build_broadcast_scalar.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Wed Aug 19 17:48:13 UTC 2009
Module: Mesa
Branch: gallium-llvmpipe
Commit: f426fb3704a30abd14764d86fab1cfa157eb4935
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f426fb3704a30abd14764d86fab1cfa157eb4935
Author: José Fonseca <jfonseca at vmware.com>
Date: Wed Aug 19 17:57:07 2009 +0100
llvmpipe: Simpler variant of lp_build_broadcast_scalar.
---
src/gallium/drivers/llvmpipe/lp_bld_swizzle.c | 19 +++++++++++++++++++
src/gallium/drivers/llvmpipe/lp_bld_swizzle.h | 6 ++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c
index 3402d4f..5204a85 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c
@@ -35,6 +35,25 @@
LLVMValueRef
+lp_build_broadcast(LLVMBuilderRef builder,
+ LLVMTypeRef vec_type,
+ LLVMValueRef scalar)
+{
+ const unsigned n = LLVMGetVectorSize(vec_type);
+ LLVMValueRef res;
+ unsigned i;
+
+ res = LLVMGetUndef(vec_type);
+ for(i = 0; i < n; ++i) {
+ LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+ res = LLVMBuildInsertElement(builder, res, scalar, index, "");
+ }
+
+ return res;
+}
+
+
+LLVMValueRef
lp_build_broadcast_scalar(struct lp_build_context *bld,
LLVMValueRef scalar)
{
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h
index ceaaabf..7a4aa88 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h
@@ -45,6 +45,12 @@ struct lp_build_context;
LLVMValueRef
+lp_build_broadcast(LLVMBuilderRef builder,
+ LLVMTypeRef vec_type,
+ LLVMValueRef scalar);
+
+
+LLVMValueRef
lp_build_broadcast_scalar(struct lp_build_context *bld,
LLVMValueRef scalar);
More information about the mesa-commit
mailing list