summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2008-02-13 00:21:24 -0500
committerZack Rusin <zack@tungstengraphics.com>2008-02-13 00:21:24 -0500
commit9b6532f01b2e8a3ccc44d67d20a8f94f5de570e3 (patch)
tree1b36cf4cfb5735855b9164b961b6dc70708d61ba /src/mesa/pipe
parent8b054cd6eb0b64264d9cb8b61ce9df5135664368 (diff)
add functiontype for the llvm native vs entry point
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/llvm/tgsitollvm.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp
index 574e340f66..d4e9a21a13 100644
--- a/src/mesa/pipe/llvm/tgsitollvm.cpp
+++ b/src/mesa/pipe/llvm/tgsitollvm.cpp
@@ -46,6 +46,38 @@
using namespace llvm;
#include "llvm_base_shader.cpp"
+static inline FunctionType *vertexShaderFunctionType()
+{
+ //Function takes three arguments,
+ // the calling code has to make sure the types it will
+ // pass are castable to the following:
+ // [4 x <4 x float>] inputs,
+ // [4 x <4 x float>] output,
+ // [4 x [4 x float]] consts
+ std::vector<const Type*> funcArgs;
+ {
+ VectorType *vectorType = VectorType::get(Type::FloatTy, 4);
+ ArrayType *vectorArray = ArrayType::get(vectorType, 4);
+ PointerType *vectorArrayPtr = PointerType::get(vectorArray, 0);
+
+ funcArgs.push_back(vectorArrayPtr);//inputs
+ funcArgs.push_back(vectorArrayPtr);//output
+ }
+ {
+ ArrayType *floatArray = ArrayType::get(Type::FloatTy, 4);
+ ArrayType *constsArray = ArrayType::get(floatArray, 4);
+ PointerType *constsArrayPtr = PointerType::get(constsArray, 0);
+
+ funcArgs.push_back(constsArrayPtr);//consts
+ }
+ FunctionType *functionType = FunctionType::get(
+ /*Result=*/Type::VoidTy,
+ /*Params=*/funcArgs,
+ /*isVarArg=*/false);
+
+ return functionType;
+}
+
static inline void
add_interpolator(struct gallivm_ir *ir,
struct gallivm_interpolate *interp)
@@ -1121,13 +1153,13 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir,
std::string func_name = stream.str();
Function *shader = llvm::cast<Function>(mod->getOrInsertFunction(
func_name.c_str(),
- (const llvm::FunctionType*)0));
+ vertexShaderFunctionType()));
Function::arg_iterator args = shader->arg_begin();
Value *input = args++;
- input->setName("input");
+ input->setName("inputs");
Value *output = args++;
- output->setName("output");
+ output->setName("outputs");
Value *consts = args++;
consts->setName("consts");