summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-11-05 17:05:20 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-11-05 19:44:07 +0000
commit67034b9efce43a7b83f79e44beb6d4e8f6dff22a (patch)
tree15f67fdf2cd002befc7224baf5be22e3ee5ed324
parente0590159ce68e0fc9bac21bcfddc9193f4ccdac5 (diff)
softpipe: Implement PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE for destination.
It is a valid and tested combination on D3D9.
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_blend.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index 0ad0b98654..fe6b6cec35 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -478,7 +478,15 @@ blend_quad(struct quad_stage *qs,
VEC4_MUL(dest[2], dest[2], dest[2]); /* B */
break;
case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
- assert(0); /* illegal */
+ {
+ const float *alpha = quadColor[3];
+ float diff[4], temp[4];
+ VEC4_SUB(diff, one, dest[3]);
+ VEC4_MIN(temp, alpha, diff);
+ VEC4_MUL(dest[0], quadColor[0], temp); /* R */
+ VEC4_MUL(dest[1], quadColor[1], temp); /* G */
+ VEC4_MUL(dest[2], quadColor[2], temp); /* B */
+ }
break;
case PIPE_BLENDFACTOR_CONST_COLOR:
{
@@ -600,7 +608,7 @@ blend_quad(struct quad_stage *qs,
VEC4_MUL(dest[3], dest[3], dest[3]); /* A */
break;
case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
- assert(0); /* illegal */
+ /* dest = dest * 1 NO-OP, leave dest as-is */
break;
case PIPE_BLENDFACTOR_CONST_COLOR:
/* fall-through */