freedreno/a3xx: add blend state
authorRob Clark <robclark@freedesktop.org>
Thu, 19 Sep 2013 14:17:09 +0000 (10:17 -0400)
committerRob Clark <robclark@freedesktop.org>
Fri, 25 Oct 2013 00:21:08 +0000 (20:21 -0400)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/a3xx/fd3_draw.c
src/gallium/drivers/freedreno/a3xx/fd3_emit.c

index 85c7441a84d9f91a24178bb6a3706bda63080d30..d808777a1fb2653b4ec2c67172d59dc4da87734d 100644 (file)
@@ -108,7 +108,8 @@ fd3_clear(struct fd_context *ctx, unsigned buffers,
                        FD_DIRTY_FRAMEBUFFER | FD_DIRTY_SCISSOR));
 
        OUT_PKT0(ring, REG_A3XX_RB_BLEND_ALPHA, 1);
-       OUT_RING(ring, 0X3c0000ff);
+       OUT_RING(ring, A3XX_RB_BLEND_ALPHA_UINT(0xff) |
+                       A3XX_RB_BLEND_ALPHA_FLOAT(1.0));
 
        fd3_emit_rbrc_draw_state(ring,
                        A3XX_RB_RENDER_CONTROL_ALPHA_TEST_FUNC(FUNC_NEVER));
index 3cff18c7e640368bac2e52950651b0cd07dc99e7..076d7de72b7f343a569f7b44138b7764fcd5ed73 100644 (file)
@@ -460,6 +460,19 @@ fd3_emit_state(struct fd_context *ctx, uint32_t dirty)
                }
        }
 
+       if (dirty & FD_DIRTY_BLEND_COLOR) {
+               struct pipe_blend_color *bcolor = &ctx->blend_color;
+               OUT_PKT0(ring, REG_A3XX_RB_BLEND_RED, 4);
+               OUT_RING(ring, A3XX_RB_BLEND_RED_UINT(bcolor->color[0] * 255.0) |
+                               A3XX_RB_BLEND_RED_FLOAT(bcolor->color[0]));
+               OUT_RING(ring, A3XX_RB_BLEND_GREEN_UINT(bcolor->color[1] * 255.0) |
+                               A3XX_RB_BLEND_GREEN_FLOAT(bcolor->color[1]));
+               OUT_RING(ring, A3XX_RB_BLEND_BLUE_UINT(bcolor->color[2] * 255.0) |
+                               A3XX_RB_BLEND_BLUE_FLOAT(bcolor->color[2]));
+               OUT_RING(ring, A3XX_RB_BLEND_ALPHA_UINT(bcolor->color[3] * 255.0) |
+                               A3XX_RB_BLEND_ALPHA_FLOAT(bcolor->color[3]));
+       }
+
        if (dirty & FD_DIRTY_VERTTEX)
                emit_textures(ring, SB_VERT_TEX, &ctx->verttex);
 
@@ -574,10 +587,14 @@ fd3_emit_restore(struct fd_context *ctx)
                        A3XX_PA_SC_WINDOW_OFFSET_Y(0));
 
        OUT_PKT0(ring, REG_A3XX_RB_BLEND_RED, 4);
-       OUT_RING(ring, 0x00000000);        /* RB_BLEND_RED */
-       OUT_RING(ring, 0x00000000);        /* RB_BLEND_GREEN */
-       OUT_RING(ring, 0x00000000);        /* RB_BLEND_BLUE */
-       OUT_RING(ring, 0x3c0000ff);        /* RB_BLEND_ALPHA */
+       OUT_RING(ring, A3XX_RB_BLEND_RED_UINT(0) |
+                       A3XX_RB_BLEND_RED_FLOAT(0.0));
+       OUT_RING(ring, A3XX_RB_BLEND_GREEN_UINT(0) |
+                       A3XX_RB_BLEND_GREEN_FLOAT(0.0));
+       OUT_RING(ring, A3XX_RB_BLEND_BLUE_UINT(0) |
+                       A3XX_RB_BLEND_BLUE_FLOAT(0.0));
+       OUT_RING(ring, A3XX_RB_BLEND_ALPHA_UINT(0xff) |
+                       A3XX_RB_BLEND_ALPHA_FLOAT(1.0));
 
        for (i = 0; i < 6; i++) {
                OUT_PKT0(ring, REG_A3XX_GRAS_CL_USER_PLANE(i), 4);