From 0a091a48242513e53a99976239405e8cb72d96be Mon Sep 17 00:00:00 2001 From: Christian König Date: Tue, 17 Jul 2012 14:31:57 +0200 Subject: radeonsi: move blend color to new state handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- src/gallium/drivers/radeonsi/evergreen_hw_context.c | 4 ---- src/gallium/drivers/radeonsi/evergreen_state.c | 21 --------------------- src/gallium/drivers/radeonsi/radeonsi_pipe.h | 1 - src/gallium/drivers/radeonsi/si_state.c | 18 ++++++++++++++++++ src/gallium/drivers/radeonsi/si_state.h | 1 + 5 files changed, 19 insertions(+), 26 deletions(-) (limited to 'src/gallium/drivers/radeonsi') diff --git a/src/gallium/drivers/radeonsi/evergreen_hw_context.c b/src/gallium/drivers/radeonsi/evergreen_hw_context.c index 68d53d47104..4971a60356a 100644 --- a/src/gallium/drivers/radeonsi/evergreen_hw_context.c +++ b/src/gallium/drivers/radeonsi/evergreen_hw_context.c @@ -107,10 +107,6 @@ static const struct r600_reg si_context_reg_list[] = { {R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0}, {R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0}, {GROUP_FORCE_NEW_BLOCK, 0}, - {R_028414_CB_BLEND_RED, 0}, - {R_028418_CB_BLEND_GREEN, 0}, - {R_02841C_CB_BLEND_BLUE, 0}, - {R_028420_CB_BLEND_ALPHA, 0}, {R_028430_DB_STENCILREFMASK, 0}, {R_028434_DB_STENCILREFMASK_BF, 0}, {R_02843C_PA_CL_VPORT_XSCALE_0, 0}, diff --git a/src/gallium/drivers/radeonsi/evergreen_state.c b/src/gallium/drivers/radeonsi/evergreen_state.c index 62f138a1404..23d7297a1d7 100644 --- a/src/gallium/drivers/radeonsi/evergreen_state.c +++ b/src/gallium/drivers/radeonsi/evergreen_state.c @@ -763,26 +763,6 @@ boolean si_is_format_supported(struct pipe_screen *screen, return retval == usage; } -static void evergreen_set_blend_color(struct pipe_context *ctx, - const struct pipe_blend_color *state) -{ - struct r600_context *rctx = (struct r600_context *)ctx; - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - - if (rstate == NULL) - return; - - rstate->id = R600_PIPE_STATE_BLEND_COLOR; - r600_pipe_state_add_reg(rstate, R_028414_CB_BLEND_RED, fui(state->color[0]), NULL, 0); - r600_pipe_state_add_reg(rstate, R_028418_CB_BLEND_GREEN, fui(state->color[1]), NULL, 0); - r600_pipe_state_add_reg(rstate, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), NULL, 0); - r600_pipe_state_add_reg(rstate, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), NULL, 0); - - free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]); - rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate; - r600_context_pipe_state_set(rctx, rstate); -} - static void *evergreen_create_dsa_state(struct pipe_context *ctx, const struct pipe_depth_stencil_alpha_state *state) { @@ -1755,7 +1735,6 @@ void cayman_init_state_functions(struct r600_context *rctx) rctx->context.delete_sampler_state = si_delete_sampler_state; rctx->context.delete_vertex_elements_state = r600_delete_vertex_element; rctx->context.delete_vs_state = r600_delete_vs_shader; - rctx->context.set_blend_color = evergreen_set_blend_color; rctx->context.set_clip_state = evergreen_set_clip_state; rctx->context.set_constant_buffer = r600_set_constant_buffer; rctx->context.set_fragment_sampler_views = evergreen_set_ps_sampler_view; diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h index df1b45b2f9e..30324b78f19 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h @@ -75,7 +75,6 @@ struct r600_atom_surface_sync { }; enum r600_pipe_state_id { - R600_PIPE_STATE_BLEND_COLOR, R600_PIPE_STATE_CONFIG, R600_PIPE_STATE_SEAMLESS_CUBEMAP, R600_PIPE_STATE_CLIP, diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 8373f423685..51ee5c593d0 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -176,9 +176,27 @@ static void si_delete_blend_state(struct pipe_context *ctx, void *state) si_pm4_delete_state(rctx, blend, (struct si_state_blend *)state); } +static void si_set_blend_color(struct pipe_context *ctx, + const struct pipe_blend_color *state) +{ + struct r600_context *rctx = (struct r600_context *)ctx; + struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state); + + if (pm4 == NULL) + return; + + si_pm4_set_reg(pm4, R_028414_CB_BLEND_RED, fui(state->color[0])); + si_pm4_set_reg(pm4, R_028418_CB_BLEND_GREEN, fui(state->color[1])); + si_pm4_set_reg(pm4, R_02841C_CB_BLEND_BLUE, fui(state->color[2])); + si_pm4_set_reg(pm4, R_028420_CB_BLEND_ALPHA, fui(state->color[3])); + + si_pm4_set_state(rctx, blend_color, pm4); +} + void si_init_state_functions(struct r600_context *rctx) { rctx->context.create_blend_state = si_create_blend_state; rctx->context.bind_blend_state = si_bind_blend_state; rctx->context.delete_blend_state = si_delete_blend_state; + rctx->context.set_blend_color = si_set_blend_color; } diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index ed880d6c916..f02bb5b1b64 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -38,6 +38,7 @@ struct si_state_blend { union si_state { struct { struct si_state_blend *blend; + struct si_pm4_state *blend_color; } named; struct si_pm4_state *array[0]; }; -- cgit v1.2.3