diff -ru old/Mesa-6.5/include/GL/gl.h Mesa-6.5/include/GL/gl.h
--- old/Mesa-6.5/include/GL/gl.h	2006-03-31 20:31:46.000000000 +0300
+++ Mesa-6.5/include/GL/gl.h	2006-04-21 10:54:44.000000000 +0300
@@ -1624,6 +1624,10 @@
 #define GL_FUNC_REVERSE_SUBTRACT		0x800B
 #define GL_BLEND_COLOR				0x8005
 
+/* Extensions by Jaakko.Hyvatti@foreca.com */
+#define GL_SRC_ALPHA_RELATIVE_FORECA		0x8161
+#define GL_ONE_MINUS_SRC_ALPHA_RELATIVE_FORECA	0x8162
+
 
 GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat,
                                     GLsizei width, GLenum format,
diff -ru old/Mesa-6.5/src/mesa/main/blend.c Mesa-6.5/src/mesa/main/blend.c
--- old/Mesa-6.5/src/mesa/main/blend.c	2005-11-12 20:30:25.000000000 +0200
+++ Mesa-6.5/src/mesa/main/blend.c	2006-04-21 10:54:44.000000000 +0300
@@ -101,6 +101,8 @@
       case GL_ONE_MINUS_DST_COLOR:
       case GL_SRC_ALPHA:
       case GL_ONE_MINUS_SRC_ALPHA:
+      case GL_SRC_ALPHA_RELATIVE_FORECA:
+      case GL_ONE_MINUS_SRC_ALPHA_RELATIVE_FORECA:
       case GL_DST_ALPHA:
       case GL_ONE_MINUS_DST_ALPHA:
       case GL_SRC_ALPHA_SATURATE:
@@ -128,6 +130,8 @@
       case GL_ONE_MINUS_SRC_COLOR:
       case GL_SRC_ALPHA:
       case GL_ONE_MINUS_SRC_ALPHA:
+      case GL_SRC_ALPHA_RELATIVE_FORECA:
+      case GL_ONE_MINUS_SRC_ALPHA_RELATIVE_FORECA:
       case GL_DST_ALPHA:
       case GL_ONE_MINUS_DST_ALPHA:
       case GL_CONSTANT_COLOR:
diff -ru old/Mesa-6.5/src/mesa/main/extensions.c Mesa-6.5/src/mesa/main/extensions.c
--- old/Mesa-6.5/src/mesa/main/extensions.c	2006-03-29 17:03:03.000000000 +0300
+++ Mesa-6.5/src/mesa/main/extensions.c	2006-04-21 10:54:44.000000000 +0300
@@ -163,6 +163,7 @@
    { OFF, "GL_SGIX_shadow_ambient",            F(SGIX_shadow_ambient) },
    { OFF, "GL_SUN_multi_draw_arrays",          F(EXT_multi_draw_arrays) },
    { OFF, "GL_S3_s3tc",                        F(S3_s3tc) },
+   { OFF, "GL_FORECA_blend_relative",          F(FORECA_blend_relative) },
 };
 
 
@@ -278,6 +279,7 @@
    ctx->Extensions.SGIX_depth_texture = GL_TRUE;
    ctx->Extensions.SGIX_shadow = GL_TRUE;
    ctx->Extensions.SGIX_shadow_ambient = GL_TRUE;
+   ctx->Extensions.FORECA_blend_relative = GL_TRUE;
 }
 
 
diff -ru old/Mesa-6.5/src/mesa/main/mtypes.h Mesa-6.5/src/mesa/main/mtypes.h
--- old/Mesa-6.5/src/mesa/main/mtypes.h	2006-03-29 17:03:03.000000000 +0300
+++ Mesa-6.5/src/mesa/main/mtypes.h	2006-04-21 10:54:44.000000000 +0300
@@ -2417,6 +2417,7 @@
    GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */
    GLboolean TDFX_texture_compression_FXT1;
    GLboolean S3_s3tc;
+   GLboolean FORECA_blend_relative;
    /*@}*/
    /* The extension string */
    const GLubyte *String;
diff -ru old/Mesa-6.5/src/mesa/swrast/s_blend.c Mesa-6.5/src/mesa/swrast/s_blend.c
--- old/Mesa-6.5/src/mesa/swrast/s_blend.c	2005-10-10 22:15:55.000000000 +0300
+++ Mesa-6.5/src/mesa/swrast/s_blend.c	2006-04-21 10:54:44.000000000 +0300
@@ -181,6 +181,79 @@
 
 
 /*
+ * Correct transparency blending mode with FORECA extension.
+ * Jaakko.Hyvatti@foreca.com
+ *
+ * glBlendFuncSeparate
+ *   (/ * sfactorRGB * / GL_SRC_ALPHA_RELATIVE_FORECA,
+ *    / * dfactorRGB * / GL_ONE_MINUS_SRC_ALPHA_RELATIVE_FORECA,
+ *    / * sfactorA   * / GL_ONE,
+ *    / * dfactorA   * / GL_ONE_MINUS_SRC_ALPHA);
+ *
+ */
+static void _BLENDAPI
+blend_transparency_relative( GLcontext *ctx, GLuint n, const GLubyte mask[],
+                             GLchan rgba[][4], CONST GLchan dest[][4] )
+{
+   GLuint i;
+   ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD);
+   ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD);
+   ASSERT(ctx->Color.BlendSrcRGB==GL_SRC_ALPHA_RELATIVE_FORECA);
+   ASSERT(ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA_RELATIVE_FORECA);
+   ASSERT(ctx->Color.BlendSrcA==GL_ONE
+	  && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA
+	  || ctx->Color.BlendSrcA==GL_ONE_MINUS_DST_ALPHA
+	  && ctx->Color.BlendDstA==GL_ONE);
+   (void) ctx;
+
+   for (i=0;i<n;i++) {
+      if (mask[i]) {
+         const GLchan t = rgba[i][ACOMP];  /* t in [0, CHAN_MAX] */
+         if (t == 0) {
+            /* 0% alpha */
+            rgba[i][RCOMP] = dest[i][RCOMP];
+            rgba[i][GCOMP] = dest[i][GCOMP];
+            rgba[i][BCOMP] = dest[i][BCOMP];
+            rgba[i][ACOMP] = dest[i][ACOMP];
+         }
+         else if (t == CHAN_MAX) {
+            /* 100% alpha, no-op */
+         }
+         else {
+#if CHAN_TYPE == GL_FLOAT
+            const GLfloat tt = (GLfloat) t;
+            const GLfloat a = tt + (CHAN_MAXF - tt) * dest[i][ACOMP] / CHAN_MAXF;
+	    const GLfloat ts = tt / a;
+	    const GLfloat td = 1.0 - ts;
+            const GLfloat r = rgba[i][RCOMP] * ts + dest[i][RCOMP] * td;
+	    const GLfloat g = rgba[i][GCOMP] * ts + dest[i][GCOMP] * td;
+	    const GLfloat b = rgba[i][BCOMP] * ts + dest[i][BCOMP] * td;
+#else
+            const GLint tt = (GLint) t;
+            const GLint a = tt + (CHAN_MAX - tt) * dest[i][ACOMP] / CHAN_MAX;
+	    // No worries about a==0, that will not happen.
+	    const GLint ts = tt * CHAN_MAX / a;
+	    const GLint td = CHAN_MAX - ts;
+            const GLint r = (rgba[i][RCOMP] * ts + dest[i][RCOMP] * td) / CHAN_MAX;
+            const GLint g = (rgba[i][GCOMP] * ts + dest[i][GCOMP] * td) / CHAN_MAX;
+            const GLint b = (rgba[i][BCOMP] * ts + dest[i][BCOMP] * td) / CHAN_MAX;
+#endif
+            ASSERT(r <= CHAN_MAX);
+            ASSERT(g <= CHAN_MAX);
+            ASSERT(b <= CHAN_MAX);
+            ASSERT(a <= CHAN_MAX);
+            rgba[i][RCOMP] = (GLchan) r;
+            rgba[i][GCOMP] = (GLchan) g;
+            rgba[i][BCOMP] = (GLchan) b;
+            rgba[i][ACOMP] = (GLchan) a;
+         }
+      }
+   }
+}
+
+
+
+/*
  * Add src and dest.
  */
 static void _BLENDAPI
@@ -375,6 +448,175 @@
          Ad = MIN2(Ad, CHAN_MAXF);
 #endif
 
+	 /* Process Alpha factors first, as these results may be used */
+	 /* in the color channel processing later. */
+
+         /* Source Alpha factor */
+         switch (ctx->Color.BlendSrcA) {
+            case GL_ZERO:
+               sA = 0.0F;
+               break;
+            case GL_ONE:
+               sA = 1.0F;
+               break;
+            case GL_DST_COLOR:
+               sA = (GLfloat) Ad * ascale;
+               break;
+            case GL_ONE_MINUS_DST_COLOR:
+               sA = 1.0F - (GLfloat) Ad * ascale;
+               break;
+            case GL_SRC_ALPHA:
+               sA = (GLfloat) As * ascale;
+               break;
+            case GL_ONE_MINUS_SRC_ALPHA:
+               sA = 1.0F - (GLfloat) As * ascale;
+               break;
+            case GL_DST_ALPHA:
+               sA =(GLfloat) Ad * ascale;
+               break;
+            case GL_ONE_MINUS_DST_ALPHA:
+               sA = 1.0F - (GLfloat) Ad * ascale;
+               break;
+            case GL_SRC_ALPHA_SATURATE:
+               sA = 1.0;
+               break;
+            case GL_CONSTANT_COLOR:
+               sA = ctx->Color.BlendColor[3];
+               break;
+            case GL_ONE_MINUS_CONSTANT_COLOR:
+               sA = 1.0F - ctx->Color.BlendColor[3];
+               break;
+            case GL_CONSTANT_ALPHA:
+               sA = ctx->Color.BlendColor[3];
+               break;
+            case GL_ONE_MINUS_CONSTANT_ALPHA:
+               sA = 1.0F - ctx->Color.BlendColor[3];
+               break;
+            case GL_SRC_COLOR: /* GL_NV_blend_square */
+               sA = (GLfloat) As * ascale;
+               break;
+            case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */
+               sA = 1.0F - (GLfloat) As * ascale;
+               break;
+            default:
+               /* this should never happen */
+               sA = 0.0F;
+               _mesa_problem(ctx, "Bad blend source A factor in do_blend");
+         }
+
+         /* Dest Alpha factor */
+         switch (ctx->Color.BlendDstA) {
+            case GL_ZERO:
+               dA = 0.0F;
+               break;
+            case GL_ONE:
+               dA = 1.0F;
+               break;
+            case GL_SRC_COLOR:
+               dA = (GLfloat) As * ascale;
+               break;
+            case GL_ONE_MINUS_SRC_COLOR:
+               dA = 1.0F - (GLfloat) As * ascale;
+               break;
+            case GL_SRC_ALPHA:
+               dA = (GLfloat) As * ascale;
+               break;
+            case GL_ONE_MINUS_SRC_ALPHA:
+               dA = 1.0F - (GLfloat) As * ascale;
+               break;
+            case GL_DST_ALPHA:
+               dA = (GLfloat) Ad * ascale;
+               break;
+            case GL_ONE_MINUS_DST_ALPHA:
+               dA = 1.0F - (GLfloat) Ad * ascale;
+               break;
+            case GL_CONSTANT_COLOR:
+               dA = ctx->Color.BlendColor[3];
+               break;
+            case GL_ONE_MINUS_CONSTANT_COLOR:
+               dA = 1.0F - ctx->Color.BlendColor[3];
+               break;
+            case GL_CONSTANT_ALPHA:
+               dA = ctx->Color.BlendColor[3];
+               break;
+            case GL_ONE_MINUS_CONSTANT_ALPHA:
+               dA = 1.0F - ctx->Color.BlendColor[3];
+               break;
+            case GL_DST_COLOR: /* GL_NV_blend_square */
+               dA = (GLfloat) Ad * ascale;
+               break;
+            case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */
+               dA = 1.0F - (GLfloat) Ad * ascale;
+               break;
+            default:
+               /* this should never happen */
+               dA = 0.0F;
+               _mesa_problem(ctx, "Bad blend dest A factor in do_blend");
+               return;
+         }
+
+         /* Due to round-off problems we have to clamp against zero. */
+         /* Optimization: we don't have to do this for all src & dst factors */
+         if (dA < 0.0F)  dA = 0.0F;
+         if (sA < 0.0F)  sA = 0.0F;
+
+         ASSERT( sA <= 1.0 );
+         ASSERT( dA <= 1.0 );
+
+
+         /* compute blended alpha */
+	 /* This is done before any RGB handling, because some functions */
+	 /* there use this final alpha. */
+#if CHAN_TYPE == GL_FLOAT
+         if (ctx->Color.BlendEquationA==GL_FUNC_ADD) {
+            a = As * sA + Ad * dA;
+         }
+         else if (ctx->Color.BlendEquationA==GL_FUNC_SUBTRACT) {
+            a = As * sA - Ad * dA;
+         }
+         else if (ctx->Color.BlendEquationA==GL_FUNC_REVERSE_SUBTRACT) {
+            a = Ad * dA - As * sA;
+         }
+         else if (ctx->Color.BlendEquationA==GL_MIN) {
+	    a = MIN2( Ad, As );
+	 }
+         else if (ctx->Color.BlendEquationA==GL_MAX) {
+	    a = MAX2( Ad, As );
+	 }
+         else {
+            /* should never get here */
+            a = 0.0F;  /* silence uninitialized var warning */
+            _mesa_problem(ctx, "unexpected BlendEquation in blend_general()");
+         }
+
+         /* final clamping */
+         a = CLAMP( a, 0.0F, CHAN_MAXF );
+#else
+         if (ctx->Color.BlendEquationA==GL_FUNC_ADD) {
+            a = As * sA + Ad * dA + 0.5F;
+         }
+         else if (ctx->Color.BlendEquationA==GL_FUNC_SUBTRACT) {
+            a = As * sA - Ad * dA + 0.5F;
+         }
+         else if (ctx->Color.BlendEquationA==GL_FUNC_REVERSE_SUBTRACT) {
+            a = Ad * dA - As * sA + 0.5F;
+         }
+         else if (ctx->Color.BlendEquationA==GL_MIN) {
+	    a = MIN2( Ad, As );
+	 }
+         else if (ctx->Color.BlendEquationA==GL_MAX) {
+	    a = MAX2( Ad, As );
+	 }
+         else {
+            /* should never get here */
+            a = 0.0F;  /* silence uninitialized var warning */
+            _mesa_problem(ctx, "unexpected BlendEquation in blend_general()");
+         }
+
+         /* final clamping */
+         a = CLAMP( a, 0.0F, CHAN_MAXF );
+#endif
+
          /* Source RGB factor */
          switch (ctx->Color.BlendSrcRGB) {
             case GL_ZERO:
@@ -399,6 +641,19 @@
             case GL_ONE_MINUS_SRC_ALPHA:
                sR = sG = sB = 1.0F - (GLfloat) As * ascale;
                break;
+            case GL_SRC_ALPHA_RELATIVE_FORECA:
+	       // This is the usual function for SRC factor.
+	       if (0.0 == a)
+		  sR = sG = sB = 0.0F; /* This value usually has no effect. */
+	       else
+		  sR = sG = sB = (GLfloat) As / a;
+               break;
+            case GL_ONE_MINUS_SRC_ALPHA_RELATIVE_FORECA:
+	       if (0.0 == a)
+		  sR = sG = sB = 1.0F; /* This value usually has no effect. */
+	       else
+		  sR = sG = sB = 1.0F - (GLfloat) As / a;
+               break;
             case GL_DST_ALPHA:
                sR = sG = sB = (GLfloat) Ad * ascale;
                break;
@@ -445,59 +700,6 @@
                return;
          }
 
-         /* Source Alpha factor */
-         switch (ctx->Color.BlendSrcA) {
-            case GL_ZERO:
-               sA = 0.0F;
-               break;
-            case GL_ONE:
-               sA = 1.0F;
-               break;
-            case GL_DST_COLOR:
-               sA = (GLfloat) Ad * ascale;
-               break;
-            case GL_ONE_MINUS_DST_COLOR:
-               sA = 1.0F - (GLfloat) Ad * ascale;
-               break;
-            case GL_SRC_ALPHA:
-               sA = (GLfloat) As * ascale;
-               break;
-            case GL_ONE_MINUS_SRC_ALPHA:
-               sA = 1.0F - (GLfloat) As * ascale;
-               break;
-            case GL_DST_ALPHA:
-               sA =(GLfloat) Ad * ascale;
-               break;
-            case GL_ONE_MINUS_DST_ALPHA:
-               sA = 1.0F - (GLfloat) Ad * ascale;
-               break;
-            case GL_SRC_ALPHA_SATURATE:
-               sA = 1.0;
-               break;
-            case GL_CONSTANT_COLOR:
-               sA = ctx->Color.BlendColor[3];
-               break;
-            case GL_ONE_MINUS_CONSTANT_COLOR:
-               sA = 1.0F - ctx->Color.BlendColor[3];
-               break;
-            case GL_CONSTANT_ALPHA:
-               sA = ctx->Color.BlendColor[3];
-               break;
-            case GL_ONE_MINUS_CONSTANT_ALPHA:
-               sA = 1.0F - ctx->Color.BlendColor[3];
-               break;
-            case GL_SRC_COLOR: /* GL_NV_blend_square */
-               sA = (GLfloat) As * ascale;
-               break;
-            case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */
-               sA = 1.0F - (GLfloat) As * ascale;
-               break;
-            default:
-               /* this should never happen */
-               sA = 0.0F;
-               _mesa_problem(ctx, "Bad blend source A factor in do_blend");
-         }
-
          /* Dest RGB factor */
          switch (ctx->Color.BlendDstRGB) {
             case GL_ZERO:
@@ -522,6 +724,19 @@
             case GL_ONE_MINUS_SRC_ALPHA:
                dR = dG = dB = 1.0F - (GLfloat) As * ascale;
                break;
+            case GL_SRC_ALPHA_RELATIVE_FORECA:
+	       if (0.0 == a)
+		  dR = dG = dB = 0.0F; /* This value usually has no effect. */
+	       else
+		  dR = dG = dB = (GLfloat) As / a;
+               break;
+            case GL_ONE_MINUS_SRC_ALPHA_RELATIVE_FORECA:
+	       // This is the usual function for DST factor.
+	       if (0.0 == a)
+		  dR = dG = dB = 1.0F; /* This value usually has no effect. */
+	       else
+		  dR = dG = dB = 1.0F - (GLfloat) As / a;
+               break;
             case GL_DST_ALPHA:
                dR = dG = dB = (GLfloat) Ad * ascale;
                break;
@@ -560,64 +775,11 @@
                _mesa_problem(ctx, "Bad blend dest RGB factor in do_blend");
          }
 
-         /* Dest Alpha factor */
-         switch (ctx->Color.BlendDstA) {
-            case GL_ZERO:
-               dA = 0.0F;
-               break;
-            case GL_ONE:
-               dA = 1.0F;
-               break;
-            case GL_SRC_COLOR:
-               dA = (GLfloat) As * ascale;
-               break;
-            case GL_ONE_MINUS_SRC_COLOR:
-               dA = 1.0F - (GLfloat) As * ascale;
-               break;
-            case GL_SRC_ALPHA:
-               dA = (GLfloat) As * ascale;
-               break;
-            case GL_ONE_MINUS_SRC_ALPHA:
-               dA = 1.0F - (GLfloat) As * ascale;
-               break;
-            case GL_DST_ALPHA:
-               dA = (GLfloat) Ad * ascale;
-               break;
-            case GL_ONE_MINUS_DST_ALPHA:
-               dA = 1.0F - (GLfloat) Ad * ascale;
-               break;
-            case GL_CONSTANT_COLOR:
-               dA = ctx->Color.BlendColor[3];
-               break;
-            case GL_ONE_MINUS_CONSTANT_COLOR:
-               dA = 1.0F - ctx->Color.BlendColor[3];
-               break;
-            case GL_CONSTANT_ALPHA:
-               dA = ctx->Color.BlendColor[3];
-               break;
-            case GL_ONE_MINUS_CONSTANT_ALPHA:
-               dA = 1.0F - ctx->Color.BlendColor[3];
-               break;
-            case GL_DST_COLOR: /* GL_NV_blend_square */
-               dA = (GLfloat) Ad * ascale;
-               break;
-            case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */
-               dA = 1.0F - (GLfloat) Ad * ascale;
-               break;
-            default:
-               /* this should never happen */
-               dA = 0.0F;
-               _mesa_problem(ctx, "Bad blend dest A factor in do_blend");
-               return;
-         }
-
          /* Due to round-off problems we have to clamp against zero. */
          /* Optimization: we don't have to do this for all src & dst factors */
-         if (dA < 0.0F)  dA = 0.0F;
          if (dR < 0.0F)  dR = 0.0F;
          if (dG < 0.0F)  dG = 0.0F;
          if (dB < 0.0F)  dB = 0.0F;
-         if (sA < 0.0F)  sA = 0.0F;
          if (sR < 0.0F)  sR = 0.0F;
          if (sG < 0.0F)  sG = 0.0F;
          if (sB < 0.0F)  sB = 0.0F;
@@ -625,11 +787,9 @@
          ASSERT( sR <= 1.0 );
          ASSERT( sG <= 1.0 );
          ASSERT( sB <= 1.0 );
-         ASSERT( sA <= 1.0 );
          ASSERT( dR <= 1.0 );
          ASSERT( dG <= 1.0 );
          ASSERT( dB <= 1.0 );
-         ASSERT( dA <= 1.0 );
 
          /* compute blended color */
 #if CHAN_TYPE == GL_FLOAT
@@ -637,19 +797,16 @@
             r = Rs * sR + Rd * dR;
             g = Gs * sG + Gd * dG;
             b = Bs * sB + Bd * dB;
-            a = As * sA + Ad * dA;
          }
          else if (ctx->Color.BlendEquationRGB==GL_FUNC_SUBTRACT) {
             r = Rs * sR - Rd * dR;
             g = Gs * sG - Gd * dG;
             b = Bs * sB - Bd * dB;
-            a = As * sA - Ad * dA;
          }
          else if (ctx->Color.BlendEquationRGB==GL_FUNC_REVERSE_SUBTRACT) {
             r = Rd * dR - Rs * sR;
             g = Gd * dG - Gs * sG;
             b = Bd * dB - Bs * sB;
-            a = Ad * dA - As * sA;
          }
          else if (ctx->Color.BlendEquationRGB==GL_MIN) {
 	    r = MIN2( Rd, Rs );
@@ -667,32 +824,11 @@
             _mesa_problem(ctx, "unexpected BlendEquation in blend_general()");
          }
 
-         if (ctx->Color.BlendEquationA==GL_FUNC_ADD) {
-            a = As * sA + Ad * dA;
-         }
-         else if (ctx->Color.BlendEquationA==GL_FUNC_SUBTRACT) {
-            a = As * sA - Ad * dA;
-         }
-         else if (ctx->Color.BlendEquationA==GL_FUNC_REVERSE_SUBTRACT) {
-            a = Ad * dA - As * sA;
-         }
-         else if (ctx->Color.BlendEquationA==GL_MIN) {
-	    a = MIN2( Ad, As );
-	 }
-         else if (ctx->Color.BlendEquationA==GL_MAX) {
-	    a = MAX2( Ad, As );
-	 }
-         else {
-            /* should never get here */
-            a = 0.0F;  /* silence uninitialized var warning */
-            _mesa_problem(ctx, "unexpected BlendEquation in blend_general()");
-         }
-
          /* final clamping */
          rgba[i][RCOMP] = MAX2( r, 0.0F );
          rgba[i][GCOMP] = MAX2( g, 0.0F );
          rgba[i][BCOMP] = MAX2( b, 0.0F );
-         rgba[i][ACOMP] = CLAMP( a, 0.0F, CHAN_MAXF );
+         rgba[i][ACOMP] = a; /* clamping done earlier */
 #else
          if (ctx->Color.BlendEquationRGB==GL_FUNC_ADD) {
             r = Rs * sR + Rd * dR + 0.5F;
@@ -725,32 +861,11 @@
             _mesa_problem(ctx, "unexpected BlendEquation in blend_general()");
          }
 
-         if (ctx->Color.BlendEquationA==GL_FUNC_ADD) {
-            a = As * sA + Ad * dA + 0.5F;
-         }
-         else if (ctx->Color.BlendEquationA==GL_FUNC_SUBTRACT) {
-            a = As * sA - Ad * dA + 0.5F;
-         }
-         else if (ctx->Color.BlendEquationA==GL_FUNC_REVERSE_SUBTRACT) {
-            a = Ad * dA - As * sA + 0.5F;
-         }
-         else if (ctx->Color.BlendEquationA==GL_MIN) {
-	    a = MIN2( Ad, As );
-	 }
-         else if (ctx->Color.BlendEquationA==GL_MAX) {
-	    a = MAX2( Ad, As );
-	 }
-         else {
-            /* should never get here */
-            a = 0.0F;  /* silence uninitialized var warning */
-            _mesa_problem(ctx, "unexpected BlendEquation in blend_general()");
-         }
-
          /* final clamping */
          rgba[i][RCOMP] = (GLchan) (GLint) CLAMP( r, 0.0F, CHAN_MAXF );
          rgba[i][GCOMP] = (GLchan) (GLint) CLAMP( g, 0.0F, CHAN_MAXF );
          rgba[i][BCOMP] = (GLchan) (GLint) CLAMP( b, 0.0F, CHAN_MAXF );
-         rgba[i][ACOMP] = (GLchan) (GLint) CLAMP( a, 0.0F, CHAN_MAXF );
+         rgba[i][ACOMP] = (GLchan) (GLint) a; /* clamping done earlier */
 #endif
       }
    }
@@ -793,7 +908,15 @@
          SWRAST_CONTEXT(ctx)->BlendFunc = blend_max;
    }
    else if (srcRGB != srcA || dstRGB != dstA) {
-      SWRAST_CONTEXT(ctx)->BlendFunc = blend_general;
+      if ( eq == GL_FUNC_ADD
+	   && srcRGB == GL_SRC_ALPHA_RELATIVE_FORECA
+	   && dstRGB == GL_ONE_MINUS_SRC_ALPHA_RELATIVE_FORECA
+	   && ( (srcA == GL_ONE && dstA == GL_ONE_MINUS_SRC_ALPHA)
+		|| (srcA == GL_ONE_MINUS_SRC_ALPHA && dstA == GL_ONE))) {
+	 SWRAST_CONTEXT(ctx)->BlendFunc = blend_transparency_relative;
+      }
+      else
+	 SWRAST_CONTEXT(ctx)->BlendFunc = blend_general;
    }
    else if (eq==GL_FUNC_ADD && srcRGB==GL_SRC_ALPHA
             && dstRGB==GL_ONE_MINUS_SRC_ALPHA) {
