diff options
author | Marek Olšák <[email protected]> | 2012-09-10 00:56:45 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-13 20:18:44 +0200 |
commit | 1bce17ee01fb2ad77e37a600c2cacda57d0067ef (patch) | |
tree | 9fd51779ab7d541bd948698ed9c781f5dd148281 /src/gallium/drivers/r600/r600_buffer.c | |
parent | 3bffd8a5eb30d993c7f56a12b9936e17fb4523de (diff) |
r600g: put constant buffer state into an array indexed by shader type
to easily and robustly handle multiple shader stages
Reviewed-by: Jerome Glisse <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_buffer.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_buffer.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 88d67dfaf49..0b0ac3460e1 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -65,21 +65,25 @@ static struct pipe_transfer *r600_get_transfer(struct pipe_context *ctx, } static void r600_set_constants_dirty_if_bound(struct r600_context *rctx, - struct r600_constbuf_state *state, struct r600_resource *rbuffer) { - bool found = false; - uint32_t mask = state->enabled_mask; - - while (mask) { - unsigned i = u_bit_scan(&mask); - if (state->cb[i].buffer == &rbuffer->b.b) { - found = true; - state->dirty_mask |= 1 << i; + unsigned shader; + + for (shader = 0; shader < PIPE_SHADER_TYPES; shader++) { + struct r600_constbuf_state *state = &rctx->constbuf_state[shader]; + bool found = false; + uint32_t mask = state->enabled_mask; + + while (mask) { + unsigned i = u_bit_scan(&mask); + if (state->cb[i].buffer == &rbuffer->b.b) { + found = true; + state->dirty_mask |= 1 << i; + } + } + if (found) { + r600_constant_buffers_dirty(rctx, state); } - } - if (found) { - r600_constant_buffers_dirty(rctx, state); } } @@ -126,8 +130,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe, } } /* Constant buffers. */ - r600_set_constants_dirty_if_bound(rctx, &rctx->vs_constbuf_state, rbuffer); - r600_set_constants_dirty_if_bound(rctx, &rctx->ps_constbuf_state, rbuffer); + r600_set_constants_dirty_if_bound(rctx, rbuffer); } } #if 0 /* this is broken (see Bug 53130) */ |