virgl_encoder_write_dword(ctx->cbuf, tmp);
for (i = 0; i < VIRGL_MAX_COLOR_BUFS; i++) {
+ /* We use alpha src factor to pass the advanced blend equation value
+ * to the host. By doing so, we don't have to change the protocol.
+ */
+ uint32_t alpha = (i == 0 && blend_state->advanced_blend_func)
+ ? blend_state->advanced_blend_func
+ : blend_state->rt[i].alpha_src_factor;
tmp =
VIRGL_OBJ_BLEND_S2_RT_BLEND_ENABLE(blend_state->rt[i].blend_enable) |
VIRGL_OBJ_BLEND_S2_RT_RGB_FUNC(blend_state->rt[i].rgb_func) |
VIRGL_OBJ_BLEND_S2_RT_RGB_SRC_FACTOR(blend_state->rt[i].rgb_src_factor) |
VIRGL_OBJ_BLEND_S2_RT_RGB_DST_FACTOR(blend_state->rt[i].rgb_dst_factor)|
VIRGL_OBJ_BLEND_S2_RT_ALPHA_FUNC(blend_state->rt[i].alpha_func) |
- VIRGL_OBJ_BLEND_S2_RT_ALPHA_SRC_FACTOR(blend_state->rt[i].alpha_src_factor) |
+ VIRGL_OBJ_BLEND_S2_RT_ALPHA_SRC_FACTOR(alpha) |
VIRGL_OBJ_BLEND_S2_RT_ALPHA_DST_FACTOR(blend_state->rt[i].alpha_dst_factor) |
VIRGL_OBJ_BLEND_S2_RT_COLORMASK(blend_state->rt[i].colormask);
virgl_encoder_write_dword(ctx->cbuf, tmp);
unsigned alpha_to_coverage_dither:1;
unsigned alpha_to_one:1;
unsigned max_rt:3; /* index of max rt, Ie. # of cbufs minus 1 */
+ unsigned advanced_blend_func:4;
struct pipe_rt_blend_state rt[PIPE_MAX_COLOR_BUFS];
};
blend->logicop_enable = 1;
blend->logicop_func = ctx->Color._LogicOp;
}
+ else if (ctx->Color.BlendEnabled &&
+ ctx->Color._AdvancedBlendMode != BLEND_NONE) {
+ blend->advanced_blend_func = ctx->Color._AdvancedBlendMode;
+ }
else if (ctx->Color.BlendEnabled &&
ctx->Color._AdvancedBlendMode == BLEND_NONE) {
/* blending enabled */