llvmpipe: Scalar -> vector broadcasting.

This commit is contained in:
José Fonseca
2009-08-11 13:09:54 +01:00
parent 8422f293ab
commit 4393ca7956
2 changed files with 23 additions and 0 deletions
@@ -33,6 +33,24 @@
#include "lp_bld_swizzle.h"
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,
@@ -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.