summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-05-13 15:09:28 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-05-13 17:17:10 +0100
commit25811dc7b7d1ad3fb01c31197d1ae1fe5b498975 (patch)
tree791ee5c03f6bc8ec2ea0fade17dd86211de46cda
parent0e726b85ca6013ae9dc51391aaa309203352b61e (diff)
i915: Force output alpha to 1. if dst has no alpha channel.
Ensure that garbage is not stored in the unused alpha channel so that we can rely on it being currently initialiased when used as a source or returning via GetImage. Partial fix for rendercheck -t blend
-rw-r--r--src/i915_render.c92
1 files changed, 64 insertions, 28 deletions
diff --git a/src/i915_render.c b/src/i915_render.c
index be89b55f..ad21a7cb 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -492,6 +492,7 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
uint32_t blendctl, tiling_bits;
Bool is_affine_src, is_affine_mask;
Bool is_solid_src, is_solid_mask;
+ Bool dst_has_alpha = PICT_FORMAT_A(dest_picture->format);
int tex_count, t;
intel->needs_render_state_emit = FALSE;
@@ -636,21 +637,40 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
}
}
- /* Load the source_picture texel */
- if (! is_solid_src) {
- if (is_affine_src) {
- i915_fs_texld(FS_R0, FS_S0, FS_T0);
- } else {
- i915_fs_texldp(FS_R0, FS_S0, FS_T0);
- }
-
- src_reg = FS_R0;
- }
-
if (!mask) {
- /* No mask, so move to output color */
- i915_fs_mov(out_reg, i915_fs_operand_reg(src_reg));
+ /* No mask, so load directly to output color */
+ if (! is_solid_src) {
+ if (dst_format == COLR_BUF_8BIT)
+ src_reg = FS_R0;
+ else if (dst_has_alpha)
+ src_reg = FS_OC;
+ else
+ src_reg = FS_R0;
+ if (is_affine_src)
+ i915_fs_texld(src_reg, FS_S0, FS_T0);
+ else
+ i915_fs_texldp(src_reg, FS_S0, FS_T0);
+ }
+ if (src_reg != FS_OC) {
+ if (dst_format == COLR_BUF_8BIT)
+ i915_fs_mov(FS_OC, i915_fs_operand(src_reg, W, W, W, W));
+ else if (dst_has_alpha)
+ i915_fs_mov(FS_OC, i915_fs_operand_reg(src_reg));
+ else
+ i915_fs_mov(FS_OC, i915_fs_operand(src_reg, X, Y, Z, ONE));
+ }
} else {
+ if (! is_solid_src) {
+ /* Load the source_picture texel */
+ if (is_affine_src) {
+ i915_fs_texld(FS_R0, FS_S0, FS_T0);
+ } else {
+ i915_fs_texldp(FS_R0, FS_S0, FS_T0);
+ }
+
+ src_reg = FS_R0;
+ }
+
if (! is_solid_mask) {
/* Load the mask_picture texel */
if (is_affine_mask) {
@@ -673,24 +693,40 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
* source value (src.X * mask.A).
*/
if (mask_picture->componentAlpha &&
- PICT_FORMAT_RGB(mask_picture->format)) {
- if (i915_blend_op[op].src_alpha) {
- i915_fs_mul(out_reg,
- i915_fs_operand(src_reg, W, W, W, W),
- i915_fs_operand_reg(mask_reg));
- } else {
- i915_fs_mul(out_reg,
- i915_fs_operand_reg(src_reg),
- i915_fs_operand_reg(mask_reg));
- }
+ PICT_FORMAT_RGB(mask_picture->format)) {
+ if (i915_blend_op[op].src_alpha) {
+ if (dst_has_alpha)
+ i915_fs_mul(out_reg,
+ i915_fs_operand(src_reg, W, W, W, W),
+ i915_fs_operand_reg(mask_reg));
+ else
+ i915_fs_mul(out_reg,
+ i915_fs_operand(src_reg, W, W, W, ONE),
+ i915_fs_operand(mask_reg, X, Y, Z, ONE));
+ } else {
+ if (dst_has_alpha)
+ i915_fs_mul(out_reg,
+ i915_fs_operand_reg(src_reg),
+ i915_fs_operand_reg(mask_reg));
+ else
+ i915_fs_mul(out_reg,
+ i915_fs_operand(src_reg, X, Y, Z, ONE),
+ i915_fs_operand(mask_reg, X, Y, Z, ONE));
+ }
} else {
- i915_fs_mul(out_reg,
- i915_fs_operand_reg(src_reg),
- i915_fs_operand(mask_reg, W, W, W, W));
+ if (dst_has_alpha)
+ i915_fs_mul(out_reg,
+ i915_fs_operand_reg(src_reg),
+ i915_fs_operand(mask_reg, W, W, W, W));
+ else
+ i915_fs_mul(out_reg,
+ i915_fs_operand(src_reg, X, Y, Z, ONE),
+ i915_fs_operand(mask_reg, W, W, W, ONE));
}
+
+ if (dst_format == COLR_BUF_8BIT)
+ i915_fs_mov(FS_OC, i915_fs_operand(out_reg, W, W, W, W));
}
- if (dst_format == COLR_BUF_8BIT)
- i915_fs_mov(FS_OC, i915_fs_operand(out_reg, W, W, W, W));
FS_END();
}