diff options
author | Zack Rusin <[email protected]> | 2007-10-31 12:23:45 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-11-02 07:15:17 -0400 |
commit | 25d91c23ff834a129e537891ec3ad63197d37da5 (patch) | |
tree | 7c14a496c3095125d4f27e772a7165ac466566cf /src/mesa/pipe/llvm/llvm_entry.c | |
parent | 7ff0df6c2bf11a36bc6101e361484bde57595a79 (diff) |
Add basic entry points for fragment shaders.
Diffstat (limited to 'src/mesa/pipe/llvm/llvm_entry.c')
-rw-r--r-- | src/mesa/pipe/llvm/llvm_entry.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c index 67066455aed..99fa64057fd 100644 --- a/src/mesa/pipe/llvm/llvm_entry.c +++ b/src/mesa/pipe/llvm/llvm_entry.c @@ -191,3 +191,60 @@ void run_vertex_shader(float (*ainputs)[16][4], to_array(dests[i], res, num_attribs); } } + + +struct pipe_sampler_state; +struct pipe_mipmap_tree; +struct softpipe_tile_cache; + +#define NUM_CHANNELS 4 /* R,G,B,A */ +#define QUAD_SIZE 4 /* 4 pixel/quad */ + +struct tgsi_sampler +{ + const struct pipe_sampler_state *state; + struct pipe_mipmap_tree *texture; + /** Get samples for four fragments in a quad */ + void (*get_samples)(struct tgsi_sampler *sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]); + void *pipe; /*XXX temporary*/ + struct softpipe_tile_cache *cache; +}; + +struct tgsi_interp_coef +{ + float a0[NUM_CHANNELS]; /* in an xyzw layout */ + float dadx[NUM_CHANNELS]; + float dady[NUM_CHANNELS]; +}; + +int run_fragment_shader(float x, float y, + float (*dests)[32][4], + struct tgsi_interp_coef *coef, + float (*consts)[4], + int num_consts, + struct tgsi_sampler *samplers, + int num_samplers) +{ + float4 inputs[4][16]; + float4 consts[32]; + float4 results[4][16]; + float4 temps[128];//MAX_PROGRAM_TEMPS + + /*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); + 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, num_attribs); + } +} + |