summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_fs_exec.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-09-17 08:11:42 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-09-17 08:14:09 -0600
commit05aeb92a092c26e7773beb95692fc72e70a40e56 (patch)
tree548de3677fba5b30fdf67b3709f70b4bf03a90d3 /src/gallium/drivers/softpipe/sp_fs_exec.c
parent858ced051551aa5d0ddd41936253d3a4ee5c142f (diff)
cell: dump generated code if CELL_DEBUG=asm
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_fs_exec.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_exec.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 701ee4c72f..ffc0c5e578 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -39,11 +39,20 @@
#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_parse.h"
-struct sp_exec_fragment_shader {
+struct sp_exec_fragment_shader
+{
struct sp_fragment_shader base;
+ struct tgsi_token *machine_tokens;
};
+/** cast wrapper */
+static INLINE struct sp_exec_fragment_shader *
+sp_exec_fragment_shader(struct sp_fragment_shader *base)
+{
+ return (struct sp_exec_fragment_shader *) base;
+}
+
/**
* Compute quad X,Y,Z,W for the four fragments in a quad.
@@ -86,10 +95,20 @@ exec_prepare( const struct sp_fragment_shader *base,
struct tgsi_exec_machine *machine,
struct tgsi_sampler *samplers )
{
- tgsi_exec_machine_bind_shader( machine,
- base->shader.tokens,
- PIPE_MAX_SAMPLERS,
- samplers );
+ struct sp_exec_fragment_shader *spefs =
+ sp_exec_fragment_shader(base);
+
+ /*
+ * Bind tokens/shader to the interpreter's machine state.
+ * Avoid redundant binding.
+ */
+ if (spefs->machine_tokens != base->shader.tokens) {
+ tgsi_exec_machine_bind_shader( machine,
+ base->shader.tokens,
+ PIPE_MAX_SAMPLERS,
+ samplers );
+ spefs->machine_tokens = base->shader.tokens;
+ }
}