summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_fs.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-07-24 09:17:59 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-07-24 09:17:59 -0600
commit5b737b7df21b418c71f71af987a20c495b1133f8 (patch)
tree6aa3a54cb5d3c43f789488147f3b61b56e09c5fc /src/mesa/state_tracker/st_atom_fs.c
parentf0636d9653d142bdf71475d2d2066f5c7c436978 (diff)
parent98eaf5503d0d7c4f18fab6910a08aba7a3d08639 (diff)
Merge branch 'softpipe_0_1_branch' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa into softpipe_0_1_branch
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);
}