summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-28 11:20:47 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-28 11:31:58 -0700
commita8590e097e965c01ede7df47ff752b0e7adabace (patch)
tree6c376b59f0e0fda785a63c75e91d9c8487c86673
parent3f8a8eada693c9501b3e52d47986e46028c172b0 (diff)
Cell: make sure state commands aren't split across batches
-rw-r--r--src/mesa/pipe/cell/ppu/cell_state_emit.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/mesa/pipe/cell/ppu/cell_state_emit.c b/src/mesa/pipe/cell/ppu/cell_state_emit.c
index dbca900c35..6776ec88c7 100644
--- a/src/mesa/pipe/cell/ppu/cell_state_emit.c
+++ b/src/mesa/pipe/cell/ppu/cell_state_emit.c
@@ -33,6 +33,17 @@
+static void
+emit_state_cmd(struct cell_context *cell, uint cmd,
+ const void *state, uint state_size)
+{
+ uint *dst = (uint *) cell_batch_alloc(cell, sizeof(uint) + state_size);
+ *dst = cmd;
+ memcpy(dst + 1, state, state_size);
+}
+
+
+
void
cell_emit_state(struct cell_context *cell)
{
@@ -51,22 +62,18 @@ cell_emit_state(struct cell_context *cell)
}
if (cell->dirty & CELL_NEW_DEPTH_STENCIL) {
- uint cmd = CELL_CMD_STATE_DEPTH_STENCIL;
- cell_batch_append(cell, &cmd, 4);
- cell_batch_append(cell, cell->depth_stencil,
- sizeof(struct pipe_depth_stencil_alpha_state));
+ emit_state_cmd(cell, CELL_CMD_STATE_DEPTH_STENCIL,
+ cell->depth_stencil,
+ sizeof(struct pipe_depth_stencil_alpha_state));
}
if (cell->dirty & CELL_NEW_SAMPLER) {
- uint cmd = CELL_CMD_STATE_SAMPLER;
- cell_batch_append(cell, &cmd, 4);
- cell_batch_append(cell, cell->sampler[0],
- sizeof(struct pipe_sampler_state));
+ emit_state_cmd(cell, CELL_CMD_STATE_SAMPLER,
+ cell->sampler[0], sizeof(struct pipe_sampler_state));
}
if (cell->dirty & CELL_NEW_VERTEX_INFO) {
- uint cmd = CELL_CMD_STATE_VERTEX_INFO;
- cell_batch_append(cell, &cmd, 4);
- cell_batch_append(cell, &cell->vertex_info, sizeof(struct vertex_info));
+ emit_state_cmd(cell, CELL_CMD_STATE_VERTEX_INFO,
+ &cell->vertex_info, sizeof(struct vertex_info));
}
}