Added support for EXT_blend_equation_separate / ATI_blend_equation_separate.
The internal driver interface was also changed to use
BlendEquationSeparate instead of BlendEquation.
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 3c638be..8da537d 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -115,7 +115,7 @@
/* simple state commands */
driver->AlphaFunc = NULL;
driver->BlendColor = NULL;
- driver->BlendEquation = NULL;
+ driver->BlendEquationSeparate = NULL;
driver->BlendFuncSeparate = NULL;
driver->ClearColor = NULL;
driver->ClearDepth = NULL;
diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c
index ddda946..eef7af4 100644
--- a/src/mesa/drivers/dri/ffb/ffb_state.c
+++ b/src/mesa/drivers/dri/ffb/ffb_state.c
@@ -93,13 +93,16 @@
}
}
-static void ffbDDBlendEquation(GLcontext *ctx, GLenum mode)
+static void ffbDDBlendEquationSeparate(GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA)
{
#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDBlendEquation: mode(%s)\n", _mesa_lookup_enum_by_nr(mode));
+ fprintf(stderr, "ffbDDBlendEquation: mode(%s)\n",
+ _mesa_lookup_enum_by_nr(modeRGB));
#endif
- FALLBACK( ctx, (mode != GL_FUNC_ADD_EXT), FFB_BADATTR_BLENDEQN);
+ assert( modeRGB == modeA );
+ FALLBACK( ctx, (modeRGB != GL_FUNC_ADD), FFB_BADATTR_BLENDEQN);
}
static void ffbDDBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
@@ -1052,7 +1055,7 @@
ctx->Driver.Enable = ffbDDEnable;
ctx->Driver.AlphaFunc = ffbDDAlphaFunc;
- ctx->Driver.BlendEquation = ffbDDBlendEquation;
+ ctx->Driver.BlendEquationSeparate = ffbDDBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = ffbDDBlendFuncSeparate;
ctx->Driver.DepthFunc = ffbDDDepthFunc;
ctx->Driver.DepthMask = ffbDDDepthMask;
diff --git a/src/mesa/drivers/dri/gamma/gamma_state.c b/src/mesa/drivers/dri/gamma/gamma_state.c
index 519c707..813ced4 100644
--- a/src/mesa/drivers/dri/gamma/gamma_state.c
+++ b/src/mesa/drivers/dri/gamma/gamma_state.c
@@ -177,10 +177,12 @@
gmesa->new_state |= GAMMA_NEW_ALPHA;
}
-static void gammaDDBlendEquation( GLcontext *ctx, GLenum mode )
+static void gammaDDBlendEquationSeparate( GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA )
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
+ assert( modeRGB == modeA );
FLUSH_BATCH( gmesa );
gmesa->new_state |= GAMMA_NEW_ALPHA;
@@ -1689,7 +1691,7 @@
ctx->Driver.ColorMask = gammaDDColorMask;
ctx->Driver.AlphaFunc = gammaDDAlphaFunc;
- ctx->Driver.BlendEquation = gammaDDBlendEquation;
+ ctx->Driver.BlendEquationSeparate = gammaDDBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = gammaDDBlendFuncSeparate;
ctx->Driver.ClearDepth = gammaDDClearDepth;
ctx->Driver.CullFace = gammaDDCullFace;
diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c
index 9249d08..e00af65 100644
--- a/src/mesa/drivers/dri/i810/i810state.c
+++ b/src/mesa/drivers/dri/i810/i810state.c
@@ -75,10 +75,14 @@
imesa->Setup[I810_CTXREG_ZA] |= a;
}
-static void i810BlendEquation(GLcontext *ctx, GLenum mode)
+static void i810BlendEquationSeparate(GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA)
{
+ assert( modeRGB == modeA );
+
/* Can only do GL_ADD equation in hardware */
- FALLBACK( I810_CONTEXT(ctx), I810_FALLBACK_BLEND_EQ, mode != GL_FUNC_ADD_EXT);
+ FALLBACK( I810_CONTEXT(ctx), I810_FALLBACK_BLEND_EQ,
+ modeRGB != GL_FUNC_ADD);
/* BlendEquation sets ColorLogicOpEnabled in an unexpected
* manner.
@@ -961,7 +965,7 @@
/* API callbacks
*/
ctx->Driver.AlphaFunc = i810AlphaFunc;
- ctx->Driver.BlendEquation = i810BlendEquation;
+ ctx->Driver.BlendEquationSeparate = i810BlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = i810BlendFuncSeparate;
ctx->Driver.ClearColor = i810ClearColor;
ctx->Driver.ColorMask = i810ColorMask;
diff --git a/src/mesa/drivers/dri/i830/i830_state.c b/src/mesa/drivers/dri/i830/i830_state.c
index 9e8952f..7c80e8b 100644
--- a/src/mesa/drivers/dri/i830/i830_state.c
+++ b/src/mesa/drivers/dri/i830/i830_state.c
@@ -359,19 +359,22 @@
b);
}
-static void i830BlendEquation(GLcontext *ctx, GLenum mode)
+static void i830BlendEquationSeparate(GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA)
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
int func = ENABLE_ALPHA_BLENDFUNC;
if (I830_DEBUG&DEBUG_DRI)
fprintf(stderr, "%s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(mode));
+ _mesa_lookup_enum_by_nr(modeRGB));
+
+ assert( modeRGB == modeA );
/* This will catch a logicop blend equation */
i830EvalLogicOpBlendState(ctx);
- switch(mode) {
+ switch(modeRGB) {
case GL_FUNC_ADD_EXT:
func |= BLENDFUNC_ADD;
break;
@@ -1643,7 +1646,7 @@
/* API callbacks
*/
ctx->Driver.AlphaFunc = i830AlphaFunc;
- ctx->Driver.BlendEquation = i830BlendEquation;
+ ctx->Driver.BlendEquationSeparate = i830BlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = i830BlendFuncSeparate;
ctx->Driver.BlendColor = i830BlendColor;
ctx->Driver.ClearColor = i830ClearColor;
diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c
index 6e03918..47c425d 100644
--- a/src/mesa/drivers/dri/mga/mgastate.c
+++ b/src/mesa/drivers/dri/mga/mgastate.c
@@ -124,8 +124,10 @@
mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) );
}
-static void mgaDDBlendEquation(GLcontext *ctx, GLenum mode)
+static void mgaDDBlendEquationSeparate(GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA)
{
+ assert( modeRGB == modeA );
updateBlendLogicOp( ctx );
}
@@ -1193,7 +1195,7 @@
ctx->Driver.Enable = mgaDDEnable;
ctx->Driver.LightModelfv = mgaDDLightModelfv;
ctx->Driver.AlphaFunc = mgaDDAlphaFunc;
- ctx->Driver.BlendEquation = mgaDDBlendEquation;
+ ctx->Driver.BlendEquationSeparate = mgaDDBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = mgaDDBlendFuncSeparate;
ctx->Driver.DepthFunc = mgaDDDepthFunc;
ctx->Driver.DepthMask = mgaDDDepthMask;
diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c
index 0be7b1b..8ed63da 100644
--- a/src/mesa/drivers/dri/r128/r128_state.c
+++ b/src/mesa/drivers/dri/r128/r128_state.c
@@ -191,10 +191,12 @@
rmesa->new_state |= R128_NEW_ALPHA;
}
-static void r128DDBlendEquation( GLcontext *ctx, GLenum mode )
+static void r128DDBlendEquationSeparate( GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
+ assert( modeRGB == modeA );
FLUSH_BATCH( rmesa );
/* BlendEquation sets ColorLogicOpEnabled in an unexpected
@@ -206,7 +208,7 @@
/* Can only do blend addition, not min, max, subtract, etc. */
FALLBACK( R128_CONTEXT(ctx), R128_FALLBACK_BLEND_EQ,
- mode != GL_FUNC_ADD_EXT);
+ modeRGB != GL_FUNC_ADD);
rmesa->new_state |= R128_NEW_ALPHA;
}
@@ -1187,7 +1189,7 @@
ctx->Driver.IndexMask = NULL;
ctx->Driver.ColorMask = r128DDColorMask;
ctx->Driver.AlphaFunc = r128DDAlphaFunc;
- ctx->Driver.BlendEquation = r128DDBlendEquation;
+ ctx->Driver.BlendEquationSeparate = r128DDBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = r128DDBlendFuncSeparate;
ctx->Driver.ClearDepth = r128DDClearDepth;
ctx->Driver.CullFace = r128DDCullFace;
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 2326c75..2b61098 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -104,12 +104,15 @@
rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc;
}
-static void r200BlendEquation( GLcontext *ctx, GLenum mode )
+static void r200BlendEquationSeparate( GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & ~R200_COMB_FCN_MASK;
- switch ( mode ) {
+ assert( modeRGB == modeA );
+
+ switch ( modeRGB ) {
case GL_FUNC_ADD:
case GL_LOGIC_OP:
b |= R200_COMB_FCN_ADD_CLAMP;
@@ -2186,7 +2189,7 @@
functions->ReadBuffer = r200ReadBuffer;
functions->AlphaFunc = r200AlphaFunc;
- functions->BlendEquation = r200BlendEquation;
+ functions->BlendEquationSeparate = r200BlendEquationSeparate;
functions->BlendFuncSeparate = r200BlendFuncSeparate;
functions->ClearColor = r200ClearColor;
functions->ClearDepth = NULL;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 74e918f..25aa3fa 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -102,13 +102,16 @@
rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc;
}
-static void radeonBlendEquation( GLcontext *ctx, GLenum mode )
+static void radeonBlendEquationSeparate( GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & ~RADEON_COMB_FCN_MASK;
GLboolean fallback = GL_FALSE;
- switch ( mode ) {
+ assert( modeRGB == modeA );
+
+ switch ( modeRGB ) {
case GL_FUNC_ADD:
case GL_LOGIC_OP:
b |= RADEON_COMB_FCN_ADD_CLAMP;
@@ -1693,7 +1696,9 @@
/* Catch a possible fallback:
*/
if (state) {
- ctx->Driver.BlendEquation( ctx, ctx->Color.BlendEquation );
+ ctx->Driver.BlendEquationSeparate( ctx,
+ ctx->Color.BlendEquationRGB,
+ ctx->Color.BlendEquationA );
ctx->Driver.BlendFuncSeparate( ctx, ctx->Color.BlendSrcRGB,
ctx->Color.BlendDstRGB,
ctx->Color.BlendSrcRGB,
@@ -2186,7 +2191,7 @@
ctx->Driver.ReadBuffer = radeonReadBuffer;
ctx->Driver.AlphaFunc = radeonAlphaFunc;
- ctx->Driver.BlendEquation = radeonBlendEquation;
+ ctx->Driver.BlendEquationSeparate = radeonBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = radeonBlendFuncSeparate;
ctx->Driver.ClearColor = radeonClearColor;
ctx->Driver.ClearDepth = radeonClearDepth;
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c
index 6130698..7ef088c 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_state.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c
@@ -267,10 +267,12 @@
fxMesa->new_state |= TDFX_NEW_ALPHA;
}
-static void tdfxDDBlendEquation( GLcontext *ctx, GLenum mode )
+static void tdfxDDBlendEquationSeparate( GLcontext *ctx,
+ GLenum modeRGB, GLenum modeA )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
+ assert( modeRGB == modeA );
FLUSH_BATCH( fxMesa );
fxMesa->new_state |= TDFX_NEW_ALPHA;
}
@@ -1387,7 +1389,7 @@
ctx->Driver.ColorMask = tdfxDDColorMask;
ctx->Driver.AlphaFunc = tdfxDDAlphaFunc;
- ctx->Driver.BlendEquation = tdfxDDBlendEquation;
+ ctx->Driver.BlendEquationSeparate = tdfxDDBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate;
ctx->Driver.ClearDepth = tdfxDDClearDepth;
ctx->Driver.CullFace = tdfxDDCullFace;
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index bda11f9..ef73f79 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -1531,10 +1531,10 @@
}
if (ctx->Color.BlendEnabled) {
- if (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT) {
+ if (ctx->Color.BlendEquationRGB != GL_FUNC_ADD) {
if (!fxMesa->HavePixExt ||
- ((ctx->Color.BlendEquation != GL_FUNC_SUBTRACT_EXT) &&
- (ctx->Color.BlendEquation != GL_FUNC_REVERSE_SUBTRACT_EXT))) {
+ ((ctx->Color.BlendEquationRGB != GL_FUNC_SUBTRACT) &&
+ (ctx->Color.BlendEquationRGB != GL_FUNC_REVERSE_SUBTRACT))) {
return FX_FALLBACK_BLEND;
}
}
@@ -1702,7 +1702,7 @@
ctx->Driver.UpdateTexturePalette = fxDDTexPalette;
ctx->Driver.AlphaFunc = fxDDAlphaFunc;
ctx->Driver.BlendFuncSeparate = fxDDBlendFuncSeparate;
- ctx->Driver.BlendEquation = fxDDBlendEquation;
+ ctx->Driver.BlendEquationSeparate = fxDDBlendEquationSeparate;
ctx->Driver.DepthFunc = fxDDDepthFunc;
ctx->Driver.DepthMask = fxDDDepthMask;
ctx->Driver.ColorMask = fxDDColorMask;
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index 1b42be8..d48e3dd 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -620,7 +620,7 @@
extern void fxDDEnable(GLcontext *, GLenum, GLboolean);
extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat);
extern void fxDDBlendFuncSeparate(GLcontext *, GLenum, GLenum, GLenum, GLenum);
-extern void fxDDBlendEquation(GLcontext *, GLenum);
+extern void fxDDBlendEquationSeparate(GLcontext *, GLenum, GLenum);
extern void fxDDDepthMask(GLcontext *, GLboolean);
extern void fxDDDepthFunc(GLcontext *, GLenum);
extern void fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 4c08630..cb7c4e2 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -1527,20 +1527,21 @@
}
void
-fxDDBlendEquation(GLcontext * ctx, GLenum mode)
+fxDDBlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;
GrAlphaBlendOp_t q;
- switch (mode) {
- case GL_FUNC_ADD_EXT:
+ assert( modeRGB == modeA );
+ switch (modeRGB) {
+ case GL_FUNC_ADD:
q = GR_BLEND_OP_ADD;
break;
- case GL_FUNC_SUBTRACT_EXT:
+ case GL_FUNC_SUBTRACT:
q = GR_BLEND_OP_SUB;
break;
- case GL_FUNC_REVERSE_SUBTRACT_EXT:
+ case GL_FUNC_REVERSE_SUBTRACT:
q = GR_BLEND_OP_REVSUB;
break;
default:
diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c
index 3b82b57..846fd95 100644
--- a/src/mesa/drivers/glide/fxtris.c
+++ b/src/mesa/drivers/glide/fxtris.c
@@ -1407,7 +1407,7 @@
ctx->Texture.Unit[0]._ReallyEnabled = 0;
ctx->Texture.Unit[1]._ReallyEnabled = 0;
/* SUM the colors */
- fxDDBlendEquation(ctx, GL_FUNC_ADD_EXT);
+ fxDDBlendEquationSeparate(ctx, GL_FUNC_ADD, GL_FUNC_ADD);
fxDDBlendFuncSeparate(ctx, GL_ONE, GL_ONE, GL_ZERO, GL_ONE);
fxDDEnable(ctx, GL_BLEND, GL_TRUE);
/* make sure we draw only where we want to */