summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/r300/r300_context.c1
-rw-r--r--src/gallium/drivers/r300/r300_context.h2
-rw-r--r--src/gallium/drivers/r300/r300_emit.c8
-rw-r--r--src/gallium/drivers/r300/r300_emit.h2
-rw-r--r--src/gallium/drivers/r300/r300_state.c6
5 files changed, 11 insertions, 8 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 5fc3a30804..5f50b60eab 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -128,6 +128,7 @@ static void r300_setup_atoms(struct r300_context* r300)
R300_INIT_ATOM(vertex_format_state, 26);
R300_INIT_ATOM(pvs_flush, 2);
R300_INIT_ATOM(vs_state, 1031);
+ R300_INIT_ATOM(texture_cache_inval, 2);
/* Some non-CSO atoms need explicit space to store the state locally. */
r300->blend_color_state.state = CALLOC_STRUCT(r300_blend_color_state);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 32b64b6b28..47f2aa5154 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -320,6 +320,8 @@ struct r300_context {
struct r300_atom ztop_state;
/* PVS flush. */
struct r300_atom pvs_flush;
+ /* Texture cache invalidate. */
+ struct r300_atom texture_cache_inval;
/* Invariant state. This must be emitted to get the engine started. */
struct r300_atom invariant_state;
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 6a0ede359b..ad19725e60 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -1002,7 +1002,7 @@ void r300_emit_ztop_state(struct r300_context* r300,
END_CS;
}
-void r300_flush_textures(struct r300_context* r300)
+void r300_emit_texture_cache_inval(struct r300_context* r300, unsigned size, void* state)
{
CS_LOCALS(r300);
@@ -1107,7 +1107,6 @@ void r300_emit_dirty_state(struct r300_context* r300)
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_atom* atom;
unsigned i;
- int dirty_tex = 0;
if (r300->dirty_state & R300_NEW_QUERY) {
r300_emit_query_start(r300);
@@ -1155,7 +1154,6 @@ void r300_emit_dirty_state(struct r300_context* r300)
r300->sampler_states[i],
r300->textures[i],
i);
- dirty_tex |= r300->dirty_state & (R300_NEW_TEXTURE << i);
}
r300->dirty_state &=
~((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i));
@@ -1164,10 +1162,6 @@ void r300_emit_dirty_state(struct r300_context* r300)
r300->dirty_state &= ~(R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES);
}
- if (dirty_tex) {
- r300_flush_textures(r300);
- }
-
if (r300->dirty_state & R300_NEW_VERTEX_SHADER_CONSTANTS) {
struct r300_vertex_shader* vs = r300->vs_state.state;
r300_emit_vs_constant_buffer(r300, &vs->code.constants);
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 5809bf4340..c73b016b76 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -98,7 +98,7 @@ void r300_emit_ztop_state(struct r300_context* r300,
void r300_emit_pvs_flush(struct r300_context* r300, unsigned size, void* state);
-void r300_flush_textures(struct r300_context* r300);
+void r300_emit_texture_cache_inval(struct r300_context* r300, unsigned size, void* state);
unsigned r300_get_num_dirty_dwords(struct r300_context *r300);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 79cd715af1..15e0a0ad35 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -922,6 +922,7 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
+ boolean dirty_tex = FALSE;
int i;
/* XXX magic num */
@@ -934,6 +935,7 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
texture[i]);
r300->dirty_state |= (R300_NEW_TEXTURE << i);
+ dirty_tex = TRUE;
/* R300-specific - set the texrect factor in a fragment shader */
if (!is_r500 && r300->textures[i]->is_npot) {
@@ -953,6 +955,10 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
}
r300->texture_count = count;
+
+ if (dirty_tex) {
+ r300->texture_cache_inval.dirty = TRUE;
+ }
}
static void r300_set_scissor_state(struct pipe_context* pipe,