diff options
author | Zack Rusin <[email protected]> | 2008-02-13 00:21:24 -0500 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2008-02-13 00:21:24 -0500 |
commit | 9b6532f01b2e8a3ccc44d67d20a8f94f5de570e3 (patch) | |
tree | 1b36cf4cfb5735855b9164b961b6dc70708d61ba | |
parent | 8b054cd6eb0b64264d9cb8b61ce9df5135664368 (diff) |
add functiontype for the llvm native vs entry point
-rw-r--r-- | src/mesa/pipe/llvm/tgsitollvm.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 574e340f668..d4e9a21a139 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"); |