r300g: atomize invalidation of texture caches
This commit is contained in:
parent
fe6d3b9222
commit
279715e76e
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue