summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_buffer.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-07-06 03:18:06 +0200
committerMarek Olšák <[email protected]>2012-07-17 21:22:14 +0200
commit585baac652ffa172fb3fbbdd4c7559d03b7c27ef (patch)
tree3985338ffda9d7a91e8126a38609802140f9ded4 /src/gallium/drivers/r600/r600_buffer.c
parentf4f2e8ebe1bad91b2c4339a8280d516738bd27d2 (diff)
r600g: do fine-grained vertex buffer updates
If only some buffers are changed, the other ones don't have to re-emitted. This uses bitmasks of enabled and dirty buffers just like emit_constant_buffers does.
Diffstat (limited to 'src/gallium/drivers/r600/r600_buffer.c')
-rw-r--r--src/gallium/drivers/r600/r600_buffer.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 8e2deb1ea7c..165427eddf4 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -93,7 +93,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
/* Check if mapping this buffer would cause waiting for the GPU. */
if (rctx->ws->cs_is_buffer_referenced(rctx->cs, rbuffer->cs_buf, RADEON_USAGE_READWRITE) ||
rctx->ws->buffer_is_busy(rbuffer->buf, RADEON_USAGE_READWRITE)) {
- unsigned i;
+ unsigned i, mask;
/* Discard the buffer. */
pb_reference(&rbuffer->buf, NULL);
@@ -105,13 +105,12 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
/* We changed the buffer, now we need to bind it where the old one was bound. */
/* Vertex buffers. */
- for (i = 0; i < rctx->nr_vertex_buffers; i++) {
- if (rctx->vertex_buffer[i].buffer == &rbuffer->b.b) {
- struct r600_vertexbuf_state * state =
- &rctx->vertex_buffer_state;
- state->dirty_mask |= 1 << i;
- r600_inval_vertex_cache(rctx);
- r600_atom_dirty(rctx, &state->atom);
+ mask = rctx->vertex_buffer_state.enabled_mask;
+ while (mask) {
+ i = u_bit_scan(&mask);
+ if (rctx->vertex_buffer_state.vb[i].buffer == &rbuffer->b.b) {
+ rctx->vertex_buffer_state.dirty_mask |= 1 << i;
+ r600_vertex_buffers_dirty(rctx);
}
}
/* Streamout buffers. */