radeonsi: move blend color to new state handling
authorChristian König <deathsimple@vodafone.de>
Tue, 17 Jul 2012 12:31:57 +0000 (14:31 +0200)
committerChristian König <deathsimple@vodafone.de>
Tue, 24 Jul 2012 10:29:29 +0000 (12:29 +0200)
Signed-off-by: Christian König <deathsimple@vodafone.de>
src/gallium/drivers/radeonsi/evergreen_hw_context.c
src/gallium/drivers/radeonsi/evergreen_state.c
src/gallium/drivers/radeonsi/radeonsi_pipe.h
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h

index 68d53d471042c0091b7f02d8fe28a02d2a76bf42..4971a60356a7e4f6ed6183862db65e607b112720 100644 (file)
@@ -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},
index 62f138a140438482e70a9e7c7c386725c1e15592..23d7297a1d75bb106fa0455efeeddbd8ab2360ca 100644 (file)
@@ -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;
index df1b45b2f9e4962cbcccf5fec2780bfd8bf62a43..30324b78f19a06b61970d8a07479dfd9c0d05ec2 100644 (file)
@@ -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,
index 8373f42368564d6d1ee005a6d97cbe0da5ad4010..51ee5c593d014b97e48e5333ef5ae1cc5870233e 100644 (file)
@@ -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;
 }
index ed880d6c9160b65fe221e73e4257c1afb7d56029..f02bb5b1b6415a9e1768b27f97cce9baac8991bf 100644 (file)
@@ -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];
 };