summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2004-01-21 16:08:43 +0000
committerIan Romanick <idr@us.ibm.com>2004-01-21 16:08:43 +0000
commit20a17e42d7fc9fe65aabe612fe1e513c3103d121 (patch)
treeace6f8746d47c9a1f3f397dceebc6ce58e045c0a /src
parent4d36f334c9b3ab6b4e6901802e64ee7391a422ef (diff)
Remove dd_function_table::BlendFunc. All drivers now use
dd_function_table:BlendFuncSeparate. If a driver does not actually support EXT_blend_func_separate, it can assume that the RGB and alpha blend functions are the same.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/common/driverfuncs.c1
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_state.c29
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_state.c10
-rw-r--r--src/mesa/drivers/dri/i810/i810state.c19
-rw-r--r--src/mesa/drivers/dri/i830/i830_state.c113
-rw-r--r--src/mesa/drivers/dri/mga/mgastate.c12
-rw-r--r--src/mesa/drivers/dri/r128/r128_state.c9
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c12
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c18
-rw-r--r--src/mesa/drivers/dri/sis/sis_state.c10
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_state.c15
-rw-r--r--src/mesa/drivers/glide/fxdd.c1
-rw-r--r--src/mesa/drivers/glide/fxdrv.h1
-rw-r--r--src/mesa/drivers/glide/fxsetup.c6
-rw-r--r--src/mesa/main/blend.c89
-rw-r--r--src/mesa/main/dd.h1
-rw-r--r--src/mesa/main/dlist.c22
17 files changed, 50 insertions, 318 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 2ab1b82cb5..c3f4bb6516 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -110,7 +110,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->AlphaFunc = NULL;
driver->BlendColor = NULL;
driver->BlendEquation = NULL;
- driver->BlendFunc = 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 ac753b922a..ddda946f4b 100644
--- a/src/mesa/drivers/dri/ffb/ffb_state.c
+++ b/src/mesa/drivers/dri/ffb/ffb_state.c
@@ -102,14 +102,19 @@ static void ffbDDBlendEquation(GLcontext *ctx, GLenum mode)
FALLBACK( ctx, (mode != GL_FUNC_ADD_EXT), FFB_BADATTR_BLENDEQN);
}
-static void ffbDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
+static void ffbDDBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
+ GLenum dfactorRGB, GLenum sfactorA,
+ GLenum dfactorA)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
unsigned int blendc = 1 << 4;
#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDBlendFunc: sfactor(%s) dfactor(%s)\n",
- _mesa_lookup_enum_by_nr(sfactor), _mesa_lookup_enum_by_nr(dfactor));
+ fprintf(stderr, "ffbDDBlendFuncSeparate: sRGB(%s) dRGB(%s) sA(%s) dA(%s)\n",
+ _mesa_lookup_enum_by_nr(sfactorRGB),
+ _mesa_lookup_enum_by_nr(dfactorRGB),
+ _mesa_lookup_enum_by_nr(sfactorA),
+ _mesa_lookup_enum_by_nr(dfactorA));
#endif
switch (ctx->Color.BlendSrcRGB) {
case GL_ZERO:
@@ -179,21 +184,6 @@ static void ffbDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
}
}
-static void ffbDDBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA)
-{
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDBlendFuncSeparate: sRGB(%s) dRGB(%s) sA(%s) dA(%s)\n",
- _mesa_lookup_enum_by_nr(sfactorRGB),
- _mesa_lookup_enum_by_nr(dfactorRGB),
- _mesa_lookup_enum_by_nr(sfactorA),
- _mesa_lookup_enum_by_nr(dfactorA));
-#endif
-
- ffbDDBlendFunc(ctx, sfactorRGB, dfactorRGB);
-}
-
static void ffbDDDepthFunc(GLcontext *ctx, GLenum func)
{
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
@@ -817,7 +807,7 @@ static void ffbDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
if (fmesa->ppc != tmp) {
fmesa->ppc = tmp;
FFB_MAKE_DIRTY(fmesa, FFB_STATE_PPC, 1);
- ffbDDBlendFunc(ctx, 0, 0);
+ ffbDDBlendFuncSeparate(ctx, 0, 0, 0, 0 );
}
break;
@@ -1063,7 +1053,6 @@ void ffbDDInitStateFuncs(GLcontext *ctx)
ctx->Driver.Enable = ffbDDEnable;
ctx->Driver.AlphaFunc = ffbDDAlphaFunc;
ctx->Driver.BlendEquation = ffbDDBlendEquation;
- ctx->Driver.BlendFunc = ffbDDBlendFunc;
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 8a76720678..519c707a5a 100644
--- a/src/mesa/drivers/dri/gamma/gamma_state.c
+++ b/src/mesa/drivers/dri/gamma/gamma_state.c
@@ -186,15 +186,6 @@ static void gammaDDBlendEquation( GLcontext *ctx, GLenum mode )
gmesa->new_state |= GAMMA_NEW_ALPHA;
}
-static void gammaDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_ALPHA;
-}
-
static void gammaDDBlendFuncSeparate( GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
@@ -1699,7 +1690,6 @@ void gammaDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.AlphaFunc = gammaDDAlphaFunc;
ctx->Driver.BlendEquation = gammaDDBlendEquation;
- ctx->Driver.BlendFunc = gammaDDBlendFunc;
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 23432b2c07..9249d0841a 100644
--- a/src/mesa/drivers/dri/i810/i810state.c
+++ b/src/mesa/drivers/dri/i810/i810state.c
@@ -88,7 +88,9 @@ static void i810BlendEquation(GLcontext *ctx, GLenum mode)
ctx->Color.LogicOp != GL_COPY));
}
-static void i810BlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
+static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
+ GLenum dfactorRGB, GLenum sfactorA,
+ GLenum dfactorA )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint a = SDM_UPDATE_SRC_BLEND | SDM_UPDATE_DST_BLEND;
@@ -142,20 +144,6 @@ static void i810BlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
}
-/* Shouldn't be called as the extension is disabled.
- */
-static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- if (dfactorRGB != dfactorA || sfactorRGB != sfactorA) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glBlendEquation (disabled)");
- }
-
- i810BlendFunc( ctx, sfactorRGB, dfactorRGB );
-}
-
-
static void i810DepthFunc(GLcontext *ctx, GLenum func)
{
@@ -974,7 +962,6 @@ void i810InitStateFuncs(GLcontext *ctx)
*/
ctx->Driver.AlphaFunc = i810AlphaFunc;
ctx->Driver.BlendEquation = i810BlendEquation;
- ctx->Driver.BlendFunc = i810BlendFunc;
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 11f0fd7948..9e8952f09b 100644
--- a/src/mesa/drivers/dri/i830/i830_state.c
+++ b/src/mesa/drivers/dri/i830/i830_state.c
@@ -398,109 +398,6 @@ static void i830BlendEquation(GLcontext *ctx, GLenum mode)
imesa->Setup[I830_CTXREG_STATE1]);
}
-static void i830BlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int func = (ENABLE_SRC_BLND_FACTOR|ENABLE_DST_BLND_FACTOR);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s %s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(sfactor),
- _mesa_lookup_enum_by_nr(dfactor));
-
- switch(sfactor) {
- case GL_ZERO:
- func |= SRC_BLND_FACT(BLENDFACT_ZERO);
- break;
- case GL_SRC_ALPHA:
- func |= SRC_BLND_FACT(BLENDFACT_SRC_ALPHA);
- break;
- case GL_ONE:
- func |= SRC_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_DST_COLOR:
- func |= SRC_BLND_FACT(BLENDFACT_DST_COLR);
- break;
- case GL_ONE_MINUS_DST_COLOR:
- func |= SRC_BLND_FACT(BLENDFACT_INV_DST_COLR);
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- func |= SRC_BLND_FACT(BLENDFACT_INV_SRC_ALPHA);
- break;
- case GL_DST_ALPHA:
- func |= SRC_BLND_FACT(BLENDFACT_DST_ALPHA);
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- func |= SRC_BLND_FACT(BLENDFACT_INV_DST_ALPHA);
- break;
- case GL_SRC_ALPHA_SATURATE:
- func |= SRC_BLND_FACT(BLENDFACT_SRC_ALPHA_SATURATE);
- break;
- case GL_CONSTANT_COLOR_EXT:
- func |= SRC_BLND_FACT(BLENDFACT_CONST_COLOR);
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR_EXT:
- func |= SRC_BLND_FACT(BLENDFACT_INV_CONST_COLOR);
- break;
- case GL_CONSTANT_ALPHA_EXT:
- func |= SRC_BLND_FACT(BLENDFACT_CONST_ALPHA);
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA_EXT:
- func |= SRC_BLND_FACT(BLENDFACT_INV_CONST_ALPHA);
- break;
- default:
- return;
- }
-
- switch(dfactor) {
- case GL_SRC_ALPHA:
- func |= DST_BLND_FACT(BLENDFACT_SRC_ALPHA);
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- func |= DST_BLND_FACT(BLENDFACT_INV_SRC_ALPHA);
- break;
- case GL_ZERO:
- func |= DST_BLND_FACT(BLENDFACT_ZERO);
- break;
- case GL_ONE:
- func |= DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_SRC_COLOR:
- func |= DST_BLND_FACT(BLENDFACT_SRC_COLR);
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- func |= DST_BLND_FACT(BLENDFACT_INV_SRC_COLR);
- break;
- case GL_DST_ALPHA:
- func |= DST_BLND_FACT(BLENDFACT_DST_ALPHA);
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- func |= DST_BLND_FACT(BLENDFACT_INV_DST_ALPHA);
- break;
- case GL_CONSTANT_COLOR_EXT:
- func |= DST_BLND_FACT(BLENDFACT_CONST_COLOR);
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR_EXT:
- func |= DST_BLND_FACT(BLENDFACT_INV_CONST_COLOR);
- break;
- case GL_CONSTANT_ALPHA_EXT:
- func |= DST_BLND_FACT(BLENDFACT_CONST_ALPHA);
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA_EXT:
- func |= DST_BLND_FACT(BLENDFACT_INV_CONST_ALPHA);
- break;
- default:
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_IALPHAB] &= ~SRC_DST_ABLEND_MASK;
- imesa->Setup[I830_CTXREG_STATE1] &= ~SRC_DST_BLND_MASK;
- imesa->Setup[I830_CTXREG_STATE1] |= func;
- /* Insure Independant Alpha Blend is really disabled. */
- i830EvalLogicOpBlendState(ctx);
-}
-
static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA )
@@ -680,12 +577,15 @@ static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
imesa->Setup[I830_CTXREG_IALPHAB] &= ~SRC_DST_ABLEND_MASK;
- imesa->Setup[I830_CTXREG_IALPHAB] |= funcA;
imesa->Setup[I830_CTXREG_STATE1] &= ~SRC_DST_BLND_MASK;
imesa->Setup[I830_CTXREG_STATE1] |= funcRGB;
- /* Insure Independant Alpha Blend is really enabled if
- * Blending is already enabled.
+ if ( (dfactorRGB != dfactorA) || (sfactorRGB != sfactorA) ) {
+ imesa->Setup[I830_CTXREG_IALPHAB] |= funcA;
+ }
+
+ /* Ensure Independant Alpha Blend is really in the correct state (either
+ * enabled or disabled) if blending is already enabled.
*/
i830EvalLogicOpBlendState(ctx);
}
@@ -1744,7 +1644,6 @@ void i830DDInitStateFuncs(GLcontext *ctx)
*/
ctx->Driver.AlphaFunc = i830AlphaFunc;
ctx->Driver.BlendEquation = i830BlendEquation;
- ctx->Driver.BlendFunc = i830BlendFunc;
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 becb08a208..6e039182ae 100644
--- a/src/mesa/drivers/dri/mga/mgastate.c
+++ b/src/mesa/drivers/dri/mga/mgastate.c
@@ -129,7 +129,9 @@ static void mgaDDBlendEquation(GLcontext *ctx, GLenum mode)
updateBlendLogicOp( ctx );
}
-static void mgaDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
+static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
+ GLenum dfactorRGB, GLenum sfactorA,
+ GLenum dfactorA )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
GLuint src;
@@ -195,13 +197,6 @@ static void mgaDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) );
}
-static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- mgaDDBlendFunc( ctx, sfactorRGB, dfactorRGB );
-}
-
/* =============================================================
* Depth testing
*/
@@ -1199,7 +1194,6 @@ void mgaDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.LightModelfv = mgaDDLightModelfv;
ctx->Driver.AlphaFunc = mgaDDAlphaFunc;
ctx->Driver.BlendEquation = mgaDDBlendEquation;
- ctx->Driver.BlendFunc = mgaDDBlendFunc;
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 110a16a831..0be7b1bfa8 100644
--- a/src/mesa/drivers/dri/r128/r128_state.c
+++ b/src/mesa/drivers/dri/r128/r128_state.c
@@ -211,14 +211,6 @@ static void r128DDBlendEquation( GLcontext *ctx, GLenum mode )
rmesa->new_state |= R128_NEW_ALPHA;
}
-static void r128DDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
-}
-
static void r128DDBlendFuncSeparate( GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
@@ -1196,7 +1188,6 @@ void r128DDInitStateFuncs( GLcontext *ctx )
ctx->Driver.ColorMask = r128DDColorMask;
ctx->Driver.AlphaFunc = r128DDAlphaFunc;
ctx->Driver.BlendEquation = r128DDBlendEquation;
- ctx->Driver.BlendFunc = r128DDBlendFunc;
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 f9501fd62b..37da564986 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -144,7 +144,9 @@ static void r200BlendEquation( GLcontext *ctx, GLenum mode )
}
}
-static void r200BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
+static void r200BlendFuncSeparate( GLcontext *ctx,
+ GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] &
@@ -251,13 +253,6 @@ static void r200BlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b;
}
-static void r200BlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- r200BlendFunc( ctx, sfactorRGB, dfactorRGB );
-}
-
/* =============================================================
* Depth testing
@@ -2156,7 +2151,6 @@ void r200InitStateFuncs( struct dd_function_table *functions )
functions->AlphaFunc = r200AlphaFunc;
functions->BlendEquation = r200BlendEquation;
- functions->BlendFunc = r200BlendFunc;
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 49d98a67e7..e71f5adf27 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -138,7 +138,9 @@ static void radeonBlendEquation( GLcontext *ctx, GLenum mode )
}
}
-static void radeonBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
+static void radeonBlendFuncSeparate( GLcontext *ctx,
+ GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] &
@@ -243,13 +245,6 @@ static void radeonBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
}
}
-static void radeonBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- radeonBlendFunc( ctx, sfactorRGB, dfactorRGB );
-}
-
/* =============================================================
* Depth testing
@@ -1686,8 +1681,10 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
*/
if (state) {
ctx->Driver.BlendEquation( ctx, ctx->Color.BlendEquation );
- ctx->Driver.BlendFunc( ctx, ctx->Color.BlendSrcRGB,
- ctx->Color.BlendDstRGB );
+ ctx->Driver.BlendFuncSeparate( ctx, ctx->Color.BlendSrcRGB,
+ ctx->Color.BlendDstRGB,
+ ctx->Color.BlendSrcRGB,
+ ctx->Color.BlendDstRGB );
}
else {
FALLBACK( rmesa, RADEON_FALLBACK_BLEND_FUNC, GL_FALSE );
@@ -2178,7 +2175,6 @@ void radeonInitStateFuncs( GLcontext *ctx )
ctx->Driver.AlphaFunc = radeonAlphaFunc;
ctx->Driver.BlendEquation = radeonBlendEquation;
- ctx->Driver.BlendFunc = radeonBlendFunc;
ctx->Driver.BlendFuncSeparate = radeonBlendFuncSeparate;
ctx->Driver.ClearColor = radeonClearColor;
ctx->Driver.ClearDepth = radeonClearDepth;
diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c
index 8ff067f56d..6dc002171d 100644
--- a/src/mesa/drivers/dri/sis/sis_state.c
+++ b/src/mesa/drivers/dri/sis/sis_state.c
@@ -98,7 +98,9 @@ sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref )
}
static void
-sisDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
+sisDDBlendFuncSeparate( GLcontext *ctx,
+ GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
@@ -109,7 +111,7 @@ sisDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
/* blending enable */
current->hwDstSrcBlend = 0x10000; /* Default destination alpha */
- switch (dfactor)
+ switch (dfactorRGB)
{
case GL_ZERO:
current->hwDstSrcBlend |= SiS_D_ZERO;
@@ -137,7 +139,7 @@ sisDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
break;
}
- switch (sfactor)
+ switch (sfactorRGB)
{
case GL_ZERO:
current->hwDstSrcBlend |= SiS_S_ZERO;
@@ -847,7 +849,7 @@ void sisDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.AlphaFunc = sisDDAlphaFunc;
ctx->Driver.Bitmap = sisDDBitmap;
- ctx->Driver.BlendFunc = sisDDBlendFunc;
+ ctx->Driver.BlendFuncSeparate = sisDDBlendFuncSeparate;
ctx->Driver.ColorMask = sisDDColorMask;
ctx->Driver.CullFace = sisDDCullFace;
ctx->Driver.DepthMask = sisDDDepthMask;
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c
index 53e331f69b..c5c2cdb6f8 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_state.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c
@@ -275,7 +275,9 @@ static void tdfxDDBlendEquation( GLcontext *ctx, GLenum mode )
fxMesa->new_state |= TDFX_NEW_ALPHA;
}
-static void tdfxDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
+static void tdfxDDBlendFuncSeparate( GLcontext *ctx,
+ GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorA, GLenum dfactorA )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
@@ -289,16 +291,6 @@ static void tdfxDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
*/
}
-static void tdfxDDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
-}
-
/* =============================================================
* Stipple
*/
@@ -1396,7 +1388,6 @@ void tdfxDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.AlphaFunc = tdfxDDAlphaFunc;
ctx->Driver.BlendEquation = tdfxDDBlendEquation;
- ctx->Driver.BlendFunc = tdfxDDBlendFunc;
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 0ee4216cb1..6e66f599aa 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -1719,7 +1719,6 @@ fxSetupDDPointers(GLcontext * ctx)
ctx->Driver.IsTextureResident = fxDDIsTextureResident;
ctx->Driver.UpdateTexturePalette = fxDDTexPalette;
ctx->Driver.AlphaFunc = fxDDAlphaFunc;
- ctx->Driver.BlendFunc = fxDDBlendFunc;
ctx->Driver.BlendFuncSeparate = fxDDBlendFuncSeparate;
ctx->Driver.BlendEquation = fxDDBlendEquation;
ctx->Driver.DepthFunc = fxDDDepthFunc;
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index ff9e02b3eb..1f31f62160 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -621,7 +621,6 @@ extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean);
extern void fxDDEnable(GLcontext *, GLenum, GLboolean);
extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat);
-extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum);
extern void fxDDBlendFuncSeparate(GLcontext *, GLenum, GLenum, GLenum, GLenum);
extern void fxDDBlendEquation(GLcontext *, GLenum);
extern void fxDDDepthMask(GLcontext *, GLboolean);
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 17a4129eb6..45883f465b 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -1556,12 +1556,6 @@ which are drawn front-to-back.
}
void
-fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor)
-{
- fxDDBlendFuncSeparate(ctx, sfactor, dfactor, sfactor, dfactor);
-}
-
-void
fxDDBlendEquation(GLcontext * ctx, GLenum mode)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index e5032bf1bb..a185fc9742 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -44,94 +44,23 @@
* \param sfactor source factor operator.
* \param dfactor destination factor operator.
*
- * \sa glBlendFunc().
- *
- * Verifies the parameters and updates gl_colorbuffer_attrib. On a change,
- * flushes the vertices and notifies the driver via
- * dd_function_table::BlendFunc callback.
+ * \sa glBlendFunc, glBlendFuncSeparateEXT
+ *
+ * Swizzles the inputs and calls \c glBlendFuncSeparateEXT. This is done
+ * using the \c CurrentDispatch table in the context, so this same function
+ * can be used while compiling display lists. Therefore, there is no need
+ * for the display list code to save and restore this function.
*/
void GLAPIENTRY
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
{
-
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glBlendFunc %s %s\n",
- _mesa_lookup_enum_by_nr(sfactor),
- _mesa_lookup_enum_by_nr(dfactor));
-
- switch (sfactor) {
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- if (!ctx->Extensions.NV_blend_square) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" );
- return;
- }
- /* fall-through */
- case GL_ZERO:
- case GL_ONE:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_SRC_ALPHA_SATURATE:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" );
- return;
- }
-
- switch (dfactor) {
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- if (!ctx->Extensions.NV_blend_square) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" );
- return;
- }
- /* fall-through */
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" );
- return;
- }
- if (ctx->Color.BlendDstRGB == dfactor &&
- ctx->Color.BlendSrcRGB == sfactor &&
- ctx->Color.BlendDstA == dfactor &&
- ctx->Color.BlendSrcA == sfactor)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- ctx->Color.BlendDstRGB = ctx->Color.BlendDstA = dfactor;
- ctx->Color.BlendSrcRGB = ctx->Color.BlendSrcA = sfactor;
-
- if (ctx->Driver.BlendFunc)
- ctx->Driver.BlendFunc( ctx, sfactor, dfactor );
+ (*ctx->CurrentDispatch->BlendFuncSeparateEXT)( sfactor, dfactor,
+ sfactor, dfactor );
}
-#if _HAVE_FULL_GL
-
/**
* Process GL_EXT_blend_func_separate().
*
@@ -284,6 +213,8 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
}
+#if _HAVE_FULL_GL
+
/* This is really an extension function! */
void GLAPIENTRY
_mesa_BlendEquation( GLenum mode )
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 60b16db10f..5538377374 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -580,7 +580,6 @@ struct dd_function_table {
/** Set the blend equation */
void (*BlendEquation)(GLcontext *ctx, GLenum mode);
/** Specify pixel arithmetic */
- void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
void (*BlendFuncSeparate)(GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA);
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 8e3c8bcdb9..162920eb9b 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -170,7 +170,6 @@ typedef enum {
OPCODE_BITMAP,
OPCODE_BLEND_COLOR,
OPCODE_BLEND_EQUATION,
- OPCODE_BLEND_FUNC,
OPCODE_BLEND_FUNC_SEPARATE,
OPCODE_CALL_LIST,
OPCODE_CALL_LIST_OFFSET,
@@ -629,7 +628,6 @@ void _mesa_init_lists( void )
InstSize[OPCODE_BITMAP] = 8;
InstSize[OPCODE_BLEND_COLOR] = 5;
InstSize[OPCODE_BLEND_EQUATION] = 2;
- InstSize[OPCODE_BLEND_FUNC] = 3;
InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5;
InstSize[OPCODE_CALL_LIST] = 2;
InstSize[OPCODE_CALL_LIST_OFFSET] = 3;
@@ -958,22 +956,6 @@ static void GLAPIENTRY save_BlendEquation( GLenum mode )
}
-static void GLAPIENTRY save_BlendFunc( GLenum sfactor, GLenum dfactor )
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC, 2 );
- if (n) {
- n[1].e = sfactor;
- n[2].e = dfactor;
- }
- if (ctx->ExecuteFlag) {
- (*ctx->Exec->BlendFunc)( sfactor, dfactor );
- }
-}
-
-
static void GLAPIENTRY save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA)
{
@@ -5284,9 +5266,6 @@ execute_list( GLcontext *ctx, GLuint list )
case OPCODE_BLEND_EQUATION:
(*ctx->Exec->BlendEquation)( n[1].e );
break;
- case OPCODE_BLEND_FUNC:
- (*ctx->Exec->BlendFunc)( n[1].e, n[2].e );
- break;
case OPCODE_BLEND_FUNC_SEPARATE:
(*ctx->Exec->BlendFuncSeparateEXT)(n[1].e, n[2].e, n[3].e, n[4].e);
break;
@@ -6994,7 +6973,6 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->Accum = save_Accum;
table->AlphaFunc = save_AlphaFunc;
table->Bitmap = save_Bitmap;
- table->BlendFunc = save_BlendFunc;
table->CallList = _mesa_save_CallList;
table->CallLists = _mesa_save_CallLists;
table->Clear = save_Clear;