summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/evergreen_state.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/evergreen_state.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/evergreen_state.c')
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 0d2fa3045a4..72ddc0b6c7b 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1772,8 +1772,6 @@ static void evergreen_emit_db_misc_state(struct r600_context *rctx, struct r600_
static void evergreen_emit_vertex_buffers(struct r600_context *rctx,
struct r600_vertexbuf_state *state,
- struct pipe_vertex_buffer *vertex_buffers,
- unsigned vb_count,
unsigned resource_offset,
unsigned pkt_flags)
{
@@ -1784,13 +1782,11 @@ static void evergreen_emit_vertex_buffers(struct r600_context *rctx,
struct pipe_vertex_buffer *vb;
struct r600_resource *rbuffer;
uint64_t va;
- unsigned buffer_index = ffs(dirty_mask) - 1;
+ unsigned buffer_index = u_bit_scan(&dirty_mask);
- vb = &vertex_buffers[buffer_index];
+ vb = &state->vb[buffer_index];
rbuffer = (struct r600_resource*)vb->buffer;
- if (!rbuffer) {
- goto next;
- }
+ assert(rbuffer);
va = r600_resource_va(&rctx->screen->screen, &rbuffer->b.b);
va += vb->buffer_offset;
@@ -1816,26 +1812,19 @@ static void evergreen_emit_vertex_buffers(struct r600_context *rctx,
r600_write_value(cs, PKT3(PKT3_NOP, 0, 0) | pkt_flags);
r600_write_value(cs, r600_context_bo_reloc(rctx, rbuffer, RADEON_USAGE_READ));
-
-next:
- dirty_mask &= ~(1 << buffer_index);
}
state->dirty_mask = 0;
}
static void evergreen_fs_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom * atom)
{
- evergreen_emit_vertex_buffers(rctx, &rctx->vertex_buffer_state,
- rctx->vertex_buffer,
- rctx->nr_vertex_buffers, 992, 0);
+ evergreen_emit_vertex_buffers(rctx, &rctx->vertex_buffer_state, 992, 0);
}
static void evergreen_cs_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom * atom)
{
- evergreen_emit_vertex_buffers(rctx, &rctx->cs_vertex_buffer_state,
- rctx->cs_vertex_buffer,
- rctx->nr_cs_vertex_buffers, 816,
- RADEON_CP_PACKET3_COMPUTE_MODE);
+ evergreen_emit_vertex_buffers(rctx, &rctx->cs_vertex_buffer_state, 816,
+ RADEON_CP_PACKET3_COMPUTE_MODE);
}
static void evergreen_emit_constant_buffers(struct r600_context *rctx,