diff options
author | Brian <[email protected]> | 2007-07-24 12:27:38 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-07-24 12:27:38 -0600 |
commit | 43d7c1fe9d2544b851afa2f1c1e245a63860e670 (patch) | |
tree | f5580653e90f21ec86f721e4a1753e19d675adbb /src/mesa/state_tracker | |
parent | ef3849ffa0af7f2aad8a69a7d04a4dd780fa247b (diff) |
Basic fragment programs run now.
Handling of constants might change. For now, the st_fragment_program struct
contains a pipe_constant_buffer (not a pointer).
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_fs.c | 25 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.h | 1 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c index 2397828e4c0..9ca1807913c 100644 --- a/src/mesa/state_tracker/st_atom_fs.c +++ b/src/mesa/state_tracker/st_atom_fs.c @@ -29,6 +29,7 @@ * Keith Whitwell <[email protected]> */ +#include "shader/prog_parameter.h" #include "st_context.h" #include "pipe/p_context.h" #include "st_atom.h" @@ -50,23 +51,37 @@ static void compile_fs( struct st_context *st, static void update_fs( struct st_context *st ) { struct pipe_fs_state fs; - struct st_fragment_program *fp; + struct st_fragment_program *fp = NULL; + struct gl_program_parameter_list *params = NULL; if (st->ctx->Shader.CurrentProgram && - st->ctx->Shader.CurrentProgram->LinkStatus) { - fp = st_fragment_program(st->ctx->Shader.CurrentProgram->FragmentProgram); + st->ctx->Shader.CurrentProgram->LinkStatus && + st->ctx->Shader.CurrentProgram->FragmentProgram) { + struct gl_fragment_program *f + = st->ctx->Shader.CurrentProgram->FragmentProgram; + fp = st_fragment_program(f); + params = f->Base.Parameters; } else if (st->ctx->FragmentProgram._Current) { fp = st_fragment_program(st->ctx->FragmentProgram._Current); + params = st->ctx->FragmentProgram._Current->Base.Parameters; } - memset( &fs, 0, sizeof(fs) ); + if (fp && params) { + /* load program's constants array */ + fp->constants.nr_constants = params->NumParameters; + memcpy(fp->constants.constant, + params->ParameterValues, + params->NumParameters * sizeof(GLfloat) * 4); + } if (fp->dirty) compile_fs( st, fp ); - + + memset( &fs, 0, sizeof(fs) ); fs.inputs_read = fp->Base.Base.InputsRead; fs.tokens = &fp->tokens[0]; + fs.constants = &fp->constants; if (memcmp(&fs, &st->state.fs, sizeof(fs)) != 0 || fp->dirty) diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index b28887946d5..f6d5f6d76ce 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -53,6 +53,7 @@ struct st_fragment_program struct tgsi_token tokens[ST_FP_MAX_TOKENS]; GLboolean dirty; + struct pipe_constant_buffer constants; #if 0 GLfloat (*cbuffer)[4]; |