summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_fs.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2007-07-19 20:24:55 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2007-07-19 20:24:55 +0100
commit4824c342c864e870251a7d343c95e51274e50d23 (patch)
tree483fa4e4aaf87d37fd5005032f27584110de595d /src/mesa/state_tracker/st_atom_fs.c
parent6101fe641cd506422d0b2735dfcaa61174684ec4 (diff)
Trigger tgsi compilation for fragment programs.
Not sure the generated program looks correct though...
Diffstat (limited to 'src/mesa/state_tracker/st_atom_fs.c')
-rw-r--r--src/mesa/state_tracker/st_atom_fs.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c
index 9c6bc1ce2a..6fa4f53c73 100644
--- a/src/mesa/state_tracker/st_atom_fs.c
+++ b/src/mesa/state_tracker/st_atom_fs.c
@@ -32,15 +32,38 @@
#include "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
+#include "st_program.h"
+#include "pipe/tgsi/mesa/mesa_to_tgsi.h"
+#include "pipe/tgsi/core/tgsi_dump.h"
+
+static void compile_fs( struct st_context *st,
+ struct st_fragment_program *fs )
+{
+ /* XXX: fix static allocation of tokens:
+ */
+ tgsi_mesa_compile_fp_program( &fs->Base, fs->tokens, ST_FP_MAX_TOKENS );
+
+ tgsi_dump( fs->tokens, TGSI_DUMP_VERBOSE );
+}
static void update_fs( struct st_context *st )
{
struct pipe_fs_state fs;
+ struct st_fragment_program *fp = st_fragment_program(st->ctx->FragmentProgram._Current);
+
+ memset( &fs, 0, sizeof(fs) );
- fs.fp = st->ctx->FragmentProgram._Current;
+ if (fp->dirty)
+ compile_fs( st, fp );
+
+ fs.inputs_read = fp->Base.Base.InputsRead;
+ fs.tokens = &fp->tokens[0];
- if (memcmp(&fs, &st->state.fs, sizeof(fs)) != 0) {
+ if (memcmp(&fs, &st->state.fs, sizeof(fs)) != 0 ||
+ fp->dirty)
+ {
+ fp->dirty = 0;
st->state.fs = fs;
st->pipe->set_fs_state(st->pipe, &fs);
}