aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_atom_fs.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-07-24 12:27:38 -0600
committerBrian <[email protected]>2007-07-24 12:27:38 -0600
commit43d7c1fe9d2544b851afa2f1c1e245a63860e670 (patch)
treef5580653e90f21ec86f721e4a1753e19d675adbb /src/mesa/state_tracker/st_atom_fs.c
parentef3849ffa0af7f2aad8a69a7d04a4dd780fa247b (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/st_atom_fs.c')
-rw-r--r--src/mesa/state_tracker/st_atom_fs.c25
1 files changed, 20 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)