Commit c6ce44d8 authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

render: Enable more componentAlpha support.

Actually only PictOpAtop,PictOpAtopReverse and PictOpXor
can't be implemented by using single source blending.
All the other can be easily support. Slightly change
the code to support them. Consider those three Ops
are not frequenly used in real application. We simply
fallback them currently.

PictOpAtop: 		s*mask*dst.a + (1 - s.a*mask)*dst
PictOpAtopReverse: 	s*mask*(1 - dst.a) + dst *s.a*mask
PictOpXor:		s*mask*(1 - dst.a) + dst * (1 - s.a*mask)

The two oprands in the above three ops are all reated to dst and
the blend factors are not constant (0 or 1), it's hardly to
convert it to single source blend.

Now, the rendercheck is runing more smoothly.
Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 3e9c35bd
......@@ -461,11 +461,6 @@ glamor_set_composite_op(ScreenPtr screen,
if (mask && mask->componentAlpha
&& PICT_FORMAT_RGB(mask->format) != 0 && op_info->source_alpha)
{
if (source_blend != GL_ZERO) {
glamor_fallback
("Dual-source composite blending not supported\n");
return GL_FALSE;
}
if (dest_blend == GL_SRC_ALPHA)
dest_blend = GL_SRC_COLOR;
else if (dest_blend == GL_ONE_MINUS_SRC_ALPHA)
......@@ -954,15 +949,17 @@ glamor_composite_with_shader(CARD8 op,
if (!mask->componentAlpha) {
key.in = SHADER_IN_NORMAL;
} else {
/* We only handle two CA modes. */
if (op == PictOpAdd)
if (op == PictOpClear)
key.mask = SHADER_MASK_NONE;
else if (op == PictOpSrc || op == PictOpAdd
|| op == PictOpIn || op == PictOpOut
|| op == PictOpOverReverse)
key.in = SHADER_IN_CA_SOURCE;
else if (op == PictOpOutReverse) {
else if (op == PictOpOutReverse || op == PictOpInReverse) {
key.in = SHADER_IN_CA_ALPHA;
} else {
glamor_fallback
("Unsupported component alpha op: %d\n",
op);
("Unsupported component alpha op: %d\n", op);
goto fail;
}
}
......@@ -2911,9 +2908,12 @@ _glamor_composite(CARD8 op,
x_dest, y_dest, width, height);
goto done;
} else if (op != PictOpAdd && op != PictOpOutReverse) {
} else if (op == PictOpAtop
|| op == PictOpAtopReverse
|| op == PictOpXor
|| op >= PictOpSaturate) {
glamor_fallback
("glamor_composite(): component alpha\n");
("glamor_composite(): component alpha op %x\n", op);
goto fail;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment