From 6f5cd15f80d612e165078dfe2126cf44cf509d91 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 19 Aug 2009 17:57:07 +0100 Subject: llvmpipe: Simpler variant of lp_build_broadcast_scalar. --- src/gallium/drivers/llvmpipe/lp_bld_swizzle.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/gallium/drivers/llvmpipe/lp_bld_swizzle.c') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c index 3402d4f5d9..5204a851d6 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.c @@ -34,6 +34,25 @@ #include "lp_bld_swizzle.h" +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) -- cgit v1.2.3