diff options
author | Ilia Mirkin <[email protected]> | 2015-04-25 15:37:24 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-04-27 20:17:07 -0400 |
commit | 52614f59b7a9c4ae5efeacba26fa811568818811 (patch) | |
tree | 1e38c82744fa00418774b59dc77e6eca85022d77 /src/gallium | |
parent | 9fc3f472784b2ba53655b715d602268bef5bf12e (diff) |
freedreno/a3xx: color masking works like a blend for some formats
When there is a colormask active that does not cover all the channels,
enable reading in the destination like with a combining blend
operation. This fixes fbo-blending-formats on a3xx.
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index af086963075..07cc2266d08 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -704,6 +704,8 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, for (i = 0; i < ARRAY_SIZE(blend->rb_mrt); i++) { enum pipe_format format = pipe_surface_format(ctx->framebuffer.cbufs[i]); + const struct util_format_description *desc = + util_format_description(format); bool is_float = util_format_is_float(format); bool is_int = util_format_is_pure_integer(format); bool has_alpha = util_format_has_alpha(format); @@ -726,6 +728,18 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, control &= ~A3XX_RB_MRT_CONTROL_BLEND2; } + if (format && util_format_get_component_bits( + format, UTIL_FORMAT_COLORSPACE_RGB, 0) < 8) { + const struct pipe_rt_blend_state *rt; + if (ctx->blend->independent_blend_enable) + rt = &ctx->blend->rt[i]; + else + rt = &ctx->blend->rt[0]; + + if (!util_format_colormask_full(desc, rt->colormask)) + control |= A3XX_RB_MRT_CONTROL_READ_DEST_ENABLE; + } + OUT_PKT0(ring, REG_A3XX_RB_MRT_CONTROL(i), 1); OUT_RING(ring, control); |