From bfd30935c996f453fff7345c79dcef4e83d89cfb Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 19 Sep 2013 10:17:09 -0400 Subject: [PATCH] freedreno/a3xx: add blend state Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a3xx/fd3_draw.c | 3 ++- src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c index 85c7441a84d..d808777a1fb 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c @@ -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)); diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index 3cff18c7e64..076d7de72b7 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -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); -- 2.30.2