summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/i965/brw_context.h1
-rw-r--r--src/gallium/drivers/i965/brw_pipe_shader.c13
-rw-r--r--src/gallium/drivers/i965/brw_sf.c9
-rw-r--r--src/gallium/drivers/i965/brw_vs.c7
4 files changed, 20 insertions, 10 deletions
diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h
index 31e04b6e14..65859be0ec 100644
--- a/src/gallium/drivers/i965/brw_context.h
+++ b/src/gallium/drivers/i965/brw_context.h
@@ -233,6 +233,7 @@ struct brw_sampler {
#define PIPE_NEW_SCISSOR 0x100000
#define PIPE_NEW_BOUND_TEXTURES 0x200000
#define PIPE_NEW_NR_CBUFS 0x400000
+#define PIPE_NEW_FRAGMENT_SIGNATURE 0x800000
diff --git a/src/gallium/drivers/i965/brw_pipe_shader.c b/src/gallium/drivers/i965/brw_pipe_shader.c
index 02bc8fa130..c755fa6889 100644
--- a/src/gallium/drivers/i965/brw_pipe_shader.c
+++ b/src/gallium/drivers/i965/brw_pipe_shader.c
@@ -58,9 +58,20 @@ static GLboolean has_flow_control(const struct tgsi_shader_info *info)
static void brw_bind_fs_state( struct pipe_context *pipe, void *prog )
{
+ struct brw_fragment_shader *fs = (struct brw_fragment_shader *)prog;
struct brw_context *brw = brw_context(pipe);
+
+ if (brw->curr.fragment_shader == fs)
+ return;
+
+ if (brw->curr.fragment_shader == NULL ||
+ fs == NULL ||
+ memcmp(&brw->curr.fragment_shader->signature, &fs->signature,
+ brw_fs_signature_size(&fs->signature)) != 0) {
+ brw->state.dirty.mesa |= PIPE_NEW_FRAGMENT_SIGNATURE;
+ }
- brw->curr.fragment_shader = (struct brw_fragment_shader *)prog;
+ brw->curr.fragment_shader = fs;
brw->state.dirty.mesa |= PIPE_NEW_FRAGMENT_SHADER;
}
diff --git a/src/gallium/drivers/i965/brw_sf.c b/src/gallium/drivers/i965/brw_sf.c
index 6f4502da97..aa2ab5098c 100644
--- a/src/gallium/drivers/i965/brw_sf.c
+++ b/src/gallium/drivers/i965/brw_sf.c
@@ -125,11 +125,10 @@ static enum pipe_error upload_sf_prog(struct brw_context *brw)
/* Populate the key, noting state dependencies:
*/
- /* XXX: Add one to turn the max value into a count, then add
- * another one to account for the position input.
+ /* XXX: Add one to account for the position input.
*/
- /* PIPE_NEW_FRAGMENT_SHADER */
- key.nr_attrs = brw->curr.fragment_shader->info.file_max[TGSI_FILE_INPUT] + 2;
+ /* PIPE_NEW_FRAGMENT_SIGNATURE */
+ key.nr_attrs = brw->curr.fragment_shader->signature.nr_inputs + 1;
/* XXX: this is probably where the mapping between vertex shader
@@ -194,7 +193,7 @@ static enum pipe_error upload_sf_prog(struct brw_context *brw)
const struct brw_tracked_state brw_sf_prog = {
.dirty = {
- .mesa = (PIPE_NEW_RAST | PIPE_NEW_VERTEX_SHADER),
+ .mesa = (PIPE_NEW_RAST | PIPE_NEW_FRAGMENT_SIGNATURE),
.brw = (BRW_NEW_REDUCED_PRIMITIVE),
.cache = 0
},
diff --git a/src/gallium/drivers/i965/brw_vs.c b/src/gallium/drivers/i965/brw_vs.c
index 2668392919..25b51eb41e 100644
--- a/src/gallium/drivers/i965/brw_vs.c
+++ b/src/gallium/drivers/i965/brw_vs.c
@@ -101,7 +101,7 @@ static enum pipe_error brw_upload_vs_prog(struct brw_context *brw)
{
struct brw_vs_prog_key key;
struct brw_vertex_shader *vp = brw->curr.vertex_shader;
- struct brw_fragment_shader *fs = brw->curr.fragment_shader;
+ struct brw_fs_signature *sig = &brw->curr.fragment_shader->signature;
enum pipe_error ret;
memset(&key, 0, sizeof(key));
@@ -111,8 +111,7 @@ static enum pipe_error brw_upload_vs_prog(struct brw_context *brw)
key.copy_edgeflag = (brw->curr.rast->templ.fill_ccw != PIPE_POLYGON_MODE_FILL ||
brw->curr.rast->templ.fill_cw != PIPE_POLYGON_MODE_FILL);
- memcpy(&key.fs_signature, &fs->signature,
- brw_fs_signature_size(&fs->signature));
+ memcpy(&key.fs_signature, sig, brw_fs_signature_size(sig));
/* Make an early check for the key.
@@ -138,7 +137,7 @@ const struct brw_tracked_state brw_vs_prog = {
.dirty = {
.mesa = (PIPE_NEW_CLIP |
PIPE_NEW_RAST |
- PIPE_NEW_FRAGMENT_SHADER),
+ PIPE_NEW_FRAGMENT_SIGNATURE),
.brw = BRW_NEW_VERTEX_PROGRAM,
.cache = 0
},