summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc5/vc5_emit.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-10-27 15:52:22 -0700
committerEric Anholt <[email protected]>2017-10-30 13:31:32 -0700
commit2a77c763fe769b37d154585114b403b7755b9e17 (patch)
tree9a0fc52fe3d4bf061dfa938218508d00bd97bf08 /src/gallium/drivers/vc5/vc5_emit.c
parent61bb0df60e08d0b5707879c49beed899d46eaf9a (diff)
broadcom/vc5: Force blending to treat alpha as 1 for formats without alpha.
Fixes fbo-blending-formats on RGB8 and 565. We will still need to demote blending to shader code in the MRT case to fix it in general, but that can be added when we start doing 32F blending (which also needs to be done in the shader).
Diffstat (limited to 'src/gallium/drivers/vc5/vc5_emit.c')
-rw-r--r--src/gallium/drivers/vc5/vc5_emit.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gallium/drivers/vc5/vc5_emit.c b/src/gallium/drivers/vc5/vc5_emit.c
index 1368d34729a..83ea3c475b2 100644
--- a/src/gallium/drivers/vc5/vc5_emit.c
+++ b/src/gallium/drivers/vc5/vc5_emit.c
@@ -28,7 +28,7 @@
#include "broadcom/compiler/v3d_compiler.h"
static uint8_t
-vc5_factor(enum pipe_blendfactor factor)
+vc5_factor(enum pipe_blendfactor factor, bool dst_alpha_one)
{
/* We may get a bad blendfactor when blending is disabled. */
if (factor == 0)
@@ -52,9 +52,13 @@ vc5_factor(enum pipe_blendfactor factor)
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
return V3D_BLEND_FACTOR_INV_SRC_ALPHA;
case PIPE_BLENDFACTOR_DST_ALPHA:
- return V3D_BLEND_FACTOR_DST_ALPHA;
+ return (dst_alpha_one ?
+ V3D_BLEND_FACTOR_ONE :
+ V3D_BLEND_FACTOR_DST_ALPHA);
case PIPE_BLENDFACTOR_INV_DST_ALPHA:
- return V3D_BLEND_FACTOR_INV_DST_ALPHA;
+ return (dst_alpha_one ?
+ V3D_BLEND_FACTOR_ZERO :
+ V3D_BLEND_FACTOR_INV_DST_ALPHA);
case PIPE_BLENDFACTOR_CONST_COLOR:
return V3D_BLEND_FACTOR_CONST_COLOR;
case PIPE_BLENDFACTOR_INV_CONST_COLOR:
@@ -327,15 +331,19 @@ vc5_emit_state(struct pipe_context *pctx)
config.colour_blend_mode = rtblend->rgb_func;
config.colour_blend_dst_factor =
- vc5_factor(rtblend->rgb_dst_factor);
+ vc5_factor(rtblend->rgb_dst_factor,
+ vc5->blend_dst_alpha_one);
config.colour_blend_src_factor =
- vc5_factor(rtblend->rgb_src_factor);
+ vc5_factor(rtblend->rgb_src_factor,
+ vc5->blend_dst_alpha_one);
config.alpha_blend_mode = rtblend->alpha_func;
config.alpha_blend_dst_factor =
- vc5_factor(rtblend->alpha_dst_factor);
+ vc5_factor(rtblend->alpha_dst_factor,
+ vc5->blend_dst_alpha_one);
config.alpha_blend_src_factor =
- vc5_factor(rtblend->alpha_src_factor);
+ vc5_factor(rtblend->alpha_src_factor,
+ vc5->blend_dst_alpha_one);
}
cl_emit(&job->bcl, COLOUR_WRITE_MASKS, mask) {