summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r300/r300_context.c39
-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.c5
5 files changed, 29 insertions, 27 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 47883589a7..5fc3a30804 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -96,12 +96,12 @@ static void r300_flush_cb(void *data)
}
#define R300_INIT_ATOM(atomname, atomsize) \
- r300->atomname##_state.name = #atomname; \
- r300->atomname##_state.state = NULL; \
- r300->atomname##_state.size = atomsize; \
- r300->atomname##_state.emit = r300_emit_##atomname##_state; \
- r300->atomname##_state.dirty = FALSE; \
- insert_at_tail(&r300->atom_list, &r300->atomname##_state);
+ r300->atomname.name = #atomname; \
+ r300->atomname.state = NULL; \
+ r300->atomname.size = atomsize; \
+ r300->atomname.emit = r300_emit_##atomname; \
+ r300->atomname.dirty = FALSE; \
+ insert_at_tail(&r300->atom_list, &r300->atomname);
static void r300_setup_atoms(struct r300_context* r300)
{
@@ -114,19 +114,20 @@ static void r300_setup_atoms(struct r300_context* r300)
* an upper bound on each atom, to keep the emission machinery from
* underallocating space. */
make_empty_list(&r300->atom_list);
- R300_INIT_ATOM(invariant, 71);
- R300_INIT_ATOM(ztop, 2);
- R300_INIT_ATOM(blend, 8);
- R300_INIT_ATOM(blend_color, 3);
- R300_INIT_ATOM(clip, 29);
- R300_INIT_ATOM(dsa, 8);
- R300_INIT_ATOM(fb, 56);
- R300_INIT_ATOM(rs, 25);
- R300_INIT_ATOM(scissor, 3);
- R300_INIT_ATOM(viewport, 9);
- R300_INIT_ATOM(rs_block, 21);
- R300_INIT_ATOM(vertex_format, 26);
- R300_INIT_ATOM(vs, 1031);
+ R300_INIT_ATOM(invariant_state, 71);
+ R300_INIT_ATOM(ztop_state, 2);
+ R300_INIT_ATOM(blend_state, 8);
+ R300_INIT_ATOM(blend_color_state, 3);
+ R300_INIT_ATOM(clip_state, 29);
+ R300_INIT_ATOM(dsa_state, 8);
+ R300_INIT_ATOM(fb_state, 56);
+ R300_INIT_ATOM(rs_state, 25);
+ R300_INIT_ATOM(scissor_state, 3);
+ R300_INIT_ATOM(viewport_state, 9);
+ R300_INIT_ATOM(rs_block_state, 21);
+ R300_INIT_ATOM(vertex_format_state, 26);
+ R300_INIT_ATOM(pvs_flush, 2);
+ R300_INIT_ATOM(vs_state, 1031);
/* 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 e3ad586921..32b64b6b28 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -318,6 +318,8 @@ struct r300_context {
struct r300_atom viewport_state;
/* ZTOP state. */
struct r300_atom ztop_state;
+ /* PVS flush. */
+ struct r300_atom pvs_flush;
/* 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 a17ebb3ea8..6a0ede359b 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -853,7 +853,7 @@ void r300_emit_vertex_format_state(struct r300_context* r300,
END_CS;
}
-static void r300_flush_pvs(struct r300_context* r300)
+void r300_emit_pvs_flush(struct r300_context* r300, unsigned size, void* state)
{
CS_LOCALS(r300);
@@ -887,8 +887,6 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
return;
}
- r300_flush_pvs(r300);
-
BEGIN_CS(9 + code->length);
/* R300_VAP_PVS_CODE_CNTL_0
* R300_VAP_PVS_CONST_CNTL
@@ -1170,10 +1168,6 @@ void r300_emit_dirty_state(struct r300_context* r300)
r300_flush_textures(r300);
}
- if (r300->dirty_state & R300_NEW_VERTEX_SHADER_CONSTANTS || r300->vs_state.dirty) {
- r300_flush_pvs(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 a9b75d5b37..5809bf4340 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -96,6 +96,8 @@ void r300_emit_texture_count(struct r300_context* r300);
void r300_emit_ztop_state(struct r300_context* r300,
unsigned size, void* state);
+void r300_emit_pvs_flush(struct r300_context* r300, unsigned size, void* state);
+
void r300_flush_textures(struct r300_context* r300);
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 f1f0de1a46..79cd715af1 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1109,6 +1109,7 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
r300->vs_state.dirty = TRUE;
r300->vertex_format_state.dirty = TRUE;
+ r300->pvs_flush.dirty = TRUE;
if (r300->fs) {
r300_vertex_shader_setup_wpos(r300);
@@ -1186,8 +1187,10 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
r300->shader_constants[shader].count = buf->size / (4 * sizeof(float));
pipe_buffer_unmap(pipe->screen, buf);
- if (shader == PIPE_SHADER_VERTEX)
+ if (shader == PIPE_SHADER_VERTEX) {
r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
+ r300->pvs_flush.dirty = TRUE;
+ }
else if (shader == PIPE_SHADER_FRAGMENT)
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
}