v3d: Fix MRT blending with independent blending disabled.

We were only emitting the RT blend state for RT 0 and only enabling it for
RT 0, when the gallium API for !independent_blend is for rt0's state to
apply to all of them.

Fixes piglit fbo-drawbuffers-blend-add.
This commit is contained in:
Eric Anholt 2018-07-11 11:02:11 -07:00
parent e0dbbf9987
commit 97ddeed949
2 changed files with 14 additions and 6 deletions

View file

@ -286,7 +286,10 @@ emit_rt_blend(struct v3d_context *v3d, struct v3d_job *job,
cl_emit(&job->bcl, BLEND_CONFIG, config) {
#if V3D_VERSION >= 40
config.render_target_mask = 1 << rt;
if (blend->independent_blend_enable)
config.render_target_mask = 1 << rt;
else
config.render_target_mask = (1 << VC5_MAX_DRAW_BUFFERS) - 1;
#else
assert(rt == 0);
#endif

View file

@ -126,12 +126,17 @@ v3d_create_blend_state(struct pipe_context *pctx,
so->base = *cso;
for (int i = 0; i < VC5_MAX_DRAW_BUFFERS; i++) {
so->blend_enables |= cso->rt[i].blend_enable << i;
if (cso->independent_blend_enable) {
for (int i = 0; i < VC5_MAX_DRAW_BUFFERS; i++) {
so->blend_enables |= cso->rt[i].blend_enable << i;
/* V3D 4.x is when we got independent blend enables. */
assert(V3D_VERSION >= 40 ||
cso->rt[i].blend_enable == cso->rt[0].blend_enable);
/* V3D 4.x is when we got independent blend enables. */
assert(V3D_VERSION >= 40 ||
cso->rt[i].blend_enable == cso->rt[0].blend_enable);
}
} else {
if (cso->rt[0].blend_enable)
so->blend_enables = (1 << VC5_MAX_DRAW_BUFFERS) - 1;
}
return so;