diff options
author | Zack Rusin <zack@tungstengraphics.com> | 2007-11-05 13:41:56 -0500 |
---|---|---|
committer | Zack Rusin <zack@tungstengraphics.com> | 2007-12-11 09:48:13 -0500 |
commit | 8681deddd7a7e749adaf43c7df4313ea54922e62 (patch) | |
tree | 8b67c83fd0819b73c8c4842929a833292a8ceefd /src/mesa/pipe/llvm/llvm_entry.c | |
parent | c3af68dc5022715cc8f126b7df12f3f5248aefe7 (diff) |
Rewrite argument passing to prepare for handling of the kil instruction.
Pass the inputs/outputs pointer in the structure instead of infinitely
expanding arguments to the functions.
Diffstat (limited to 'src/mesa/pipe/llvm/llvm_entry.c')
-rw-r--r-- | src/mesa/pipe/llvm/llvm_entry.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c index cbe4965ef6..6bdb311c2b 100644 --- a/src/mesa/pipe/llvm/llvm_entry.c +++ b/src/mesa/pipe/llvm/llvm_entry.c @@ -1,4 +1,4 @@ -/* clang --emit-llvm llvm_builtins.c |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -funcname=createBaseShader */ +/* clang --emit-llvm llvm_entry.c |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -funcname=createBaseShader */ /************************************************************************** * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. @@ -164,8 +164,17 @@ void to_array(float (*dests)[4], float4 *in, int num_attribs) } } -extern void execute_shader(float4 dests[16], float4 inputs[16], - float4 consts[32], float4 temps[128]); + +struct ShaderInput +{ + float4 *dests; + float4 *inputs; + float4 *temps; + float4 *consts; + int kilmask; +}; + +extern void execute_shader(struct ShaderInput *input); void run_vertex_shader(float (*ainputs)[16][4], float (*dests)[16][4], @@ -180,15 +189,18 @@ void run_vertex_shader(float (*ainputs)[16][4], float4 results[16*32*4][16]; float4 temps[128];//MAX_PROGRAM_TEMPS + struct ShaderInput args; /*printf("XXX LLVM run_vertex_shader vertices = %d, inputs = %d, attribs = %d, consts = %d\n", num_vertices, num_inputs, num_attribs, num_consts);*/ from_array(inputs, ainputs, num_vertices, num_inputs); from_consts(consts, aconsts, num_consts); + args.consts = consts; + args.temps = temps; for (int i = 0; i < num_vertices; ++i) { - float4 *in = inputs[i]; - float4 *res = results[i]; - execute_shader(res, in, consts, temps); - to_array(dests[i], res, num_attribs); + args.dests = results[i]; + args.inputs = inputs[i]; + execute_shader(&args); + to_array(dests[i], args.dests, num_attribs); } } @@ -213,6 +225,7 @@ struct tgsi_sampler struct softpipe_tile_cache *cache; }; + int run_fragment_shader(float x, float y, float (*dests)[16][4], float (*ainputs)[16][4], @@ -225,17 +238,19 @@ int run_fragment_shader(float x, float y, float4 consts[32]; float4 results[4][16]; float4 temps[128];//MAX_PROGRAM_TEMPS - int kilmask = 0; + struct ShaderInput args; from_array(inputs, ainputs, 4, num_inputs); from_consts(consts, aconsts, num_consts); + args.consts = consts; + args.temps = temps; //printf("AAAAAAAAAAAAAAAAAAAAAAA FRAGMENT SHADER %f %f\n", x, y); for (int i = 0; i < 4; ++i) { - float4 *in = inputs[i]; - float4 *res = results[i]; - execute_shader(res, in, consts, temps); - to_array(dests[i], res, 2); + args.inputs = inputs[i]; + args.dests = results[i]; + execute_shader(&args); + to_array(dests[i], args.dests, 2); } - return ~kilmask; + return ~args.kilmask; } |