diff options
author | Marek Olšák <[email protected]> | 2012-07-07 07:15:04 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-07-12 02:08:30 +0200 |
commit | 0ea76916e63f8fc556f5e8f5a46c196d317cd5ad (patch) | |
tree | 6601131d601467def4ef09a5db80fdb7678c6847 /src/gallium/drivers/r600/r600_state.c | |
parent | 5ba15d8d38d98cb7b625fa55e7d818ef9c6629ce (diff) |
r600g: move CB_TARGET_MASK setup into new cb_misc_state
to remove some overhead from draw_vbo. This is a derived state.
BTW, I've got no idea how compute interacts with 3D here, but it should
use cb_misc_state, so that 3D and compute don't conflict.
Reviewed-by: Alex Deucher <[email protected]>
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_state.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 0ba7fade043..a7eb7b62cb4 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1691,6 +1691,21 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, if (state->zsbuf) { r600_polygon_offset_update(rctx); } + + if (rctx->cb_misc_state.nr_cbufs != state->nr_cbufs) { + rctx->cb_misc_state.nr_cbufs = state->nr_cbufs; + r600_atom_dirty(rctx, &rctx->cb_misc_state.atom); + } +} + +static void r600_emit_cb_misc_state(struct r600_context *rctx, struct r600_atom *atom) +{ + struct radeon_winsys_cs *cs = rctx->cs; + struct r600_cb_misc_state *a = (struct r600_cb_misc_state*)atom; + unsigned fb_colormask = (1ULL << ((unsigned)a->nr_cbufs * 4)) - 1; + + r600_write_context_reg(cs, R_028238_CB_TARGET_MASK, + a->blend_colormask & fb_colormask); } static void r600_emit_db_misc_state(struct r600_context *rctx, struct r600_atom *atom) @@ -1818,6 +1833,8 @@ static void r600_emit_ps_constant_buffer(struct r600_context *rctx, struct r600_ void r600_init_state_functions(struct r600_context *rctx) { + r600_init_atom(&rctx->cb_misc_state.atom, r600_emit_cb_misc_state, 0, 0); + r600_atom_dirty(rctx, &rctx->cb_misc_state.atom); r600_init_atom(&rctx->db_misc_state.atom, r600_emit_db_misc_state, 4, 0); r600_atom_dirty(rctx, &rctx->db_misc_state.atom); r600_init_atom(&rctx->vertex_buffer_state, r600_emit_vertex_buffers, 0, 0); |