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.
This commit is contained in:
Ian Romanick
2004-01-21 16:08:43 +00:00
parent 4d36f334c9
commit 20a17e42d7
17 changed files with 50 additions and 318 deletions

View File

@@ -110,7 +110,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->AlphaFunc = NULL; driver->AlphaFunc = NULL;
driver->BlendColor = NULL; driver->BlendColor = NULL;
driver->BlendEquation = NULL; driver->BlendEquation = NULL;
driver->BlendFunc = NULL;
driver->BlendFuncSeparate = NULL; driver->BlendFuncSeparate = NULL;
driver->ClearColor = NULL; driver->ClearColor = NULL;
driver->ClearDepth = NULL; driver->ClearDepth = NULL;

View File

@@ -102,14 +102,19 @@ static void ffbDDBlendEquation(GLcontext *ctx, GLenum mode)
FALLBACK( ctx, (mode != GL_FUNC_ADD_EXT), FFB_BADATTR_BLENDEQN); 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); ffbContextPtr fmesa = FFB_CONTEXT(ctx);
unsigned int blendc = 1 << 4; unsigned int blendc = 1 << 4;
#ifdef STATE_TRACE #ifdef STATE_TRACE
fprintf(stderr, "ffbDDBlendFunc: sfactor(%s) dfactor(%s)\n", fprintf(stderr, "ffbDDBlendFuncSeparate: sRGB(%s) dRGB(%s) sA(%s) dA(%s)\n",
_mesa_lookup_enum_by_nr(sfactor), _mesa_lookup_enum_by_nr(dfactor)); _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 #endif
switch (ctx->Color.BlendSrcRGB) { switch (ctx->Color.BlendSrcRGB) {
case GL_ZERO: 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) static void ffbDDDepthFunc(GLcontext *ctx, GLenum func)
{ {
ffbContextPtr fmesa = FFB_CONTEXT(ctx); ffbContextPtr fmesa = FFB_CONTEXT(ctx);
@@ -817,7 +807,7 @@ static void ffbDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
if (fmesa->ppc != tmp) { if (fmesa->ppc != tmp) {
fmesa->ppc = tmp; fmesa->ppc = tmp;
FFB_MAKE_DIRTY(fmesa, FFB_STATE_PPC, 1); FFB_MAKE_DIRTY(fmesa, FFB_STATE_PPC, 1);
ffbDDBlendFunc(ctx, 0, 0); ffbDDBlendFuncSeparate(ctx, 0, 0, 0, 0 );
} }
break; break;
@@ -1063,7 +1053,6 @@ void ffbDDInitStateFuncs(GLcontext *ctx)
ctx->Driver.Enable = ffbDDEnable; ctx->Driver.Enable = ffbDDEnable;
ctx->Driver.AlphaFunc = ffbDDAlphaFunc; ctx->Driver.AlphaFunc = ffbDDAlphaFunc;
ctx->Driver.BlendEquation = ffbDDBlendEquation; ctx->Driver.BlendEquation = ffbDDBlendEquation;
ctx->Driver.BlendFunc = ffbDDBlendFunc;
ctx->Driver.BlendFuncSeparate = ffbDDBlendFuncSeparate; ctx->Driver.BlendFuncSeparate = ffbDDBlendFuncSeparate;
ctx->Driver.DepthFunc = ffbDDDepthFunc; ctx->Driver.DepthFunc = ffbDDDepthFunc;
ctx->Driver.DepthMask = ffbDDDepthMask; ctx->Driver.DepthMask = ffbDDDepthMask;

View File

@@ -186,15 +186,6 @@ static void gammaDDBlendEquation( GLcontext *ctx, GLenum mode )
gmesa->new_state |= GAMMA_NEW_ALPHA; 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, static void gammaDDBlendFuncSeparate( GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA ) GLenum sfactorA, GLenum dfactorA )
@@ -1699,7 +1690,6 @@ void gammaDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.AlphaFunc = gammaDDAlphaFunc; ctx->Driver.AlphaFunc = gammaDDAlphaFunc;
ctx->Driver.BlendEquation = gammaDDBlendEquation; ctx->Driver.BlendEquation = gammaDDBlendEquation;
ctx->Driver.BlendFunc = gammaDDBlendFunc;
ctx->Driver.BlendFuncSeparate = gammaDDBlendFuncSeparate; ctx->Driver.BlendFuncSeparate = gammaDDBlendFuncSeparate;
ctx->Driver.ClearDepth = gammaDDClearDepth; ctx->Driver.ClearDepth = gammaDDClearDepth;
ctx->Driver.CullFace = gammaDDCullFace; ctx->Driver.CullFace = gammaDDCullFace;

View File

@@ -88,7 +88,9 @@ static void i810BlendEquation(GLcontext *ctx, GLenum mode)
ctx->Color.LogicOp != GL_COPY)); 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); i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint a = SDM_UPDATE_SRC_BLEND | SDM_UPDATE_DST_BLEND; 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) static void i810DepthFunc(GLcontext *ctx, GLenum func)
{ {
@@ -974,7 +962,6 @@ void i810InitStateFuncs(GLcontext *ctx)
*/ */
ctx->Driver.AlphaFunc = i810AlphaFunc; ctx->Driver.AlphaFunc = i810AlphaFunc;
ctx->Driver.BlendEquation = i810BlendEquation; ctx->Driver.BlendEquation = i810BlendEquation;
ctx->Driver.BlendFunc = i810BlendFunc;
ctx->Driver.BlendFuncSeparate = i810BlendFuncSeparate; ctx->Driver.BlendFuncSeparate = i810BlendFuncSeparate;
ctx->Driver.ClearColor = i810ClearColor; ctx->Driver.ClearColor = i810ClearColor;
ctx->Driver.ColorMask = i810ColorMask; ctx->Driver.ColorMask = i810ColorMask;

View File

@@ -398,109 +398,6 @@ static void i830BlendEquation(GLcontext *ctx, GLenum mode)
imesa->Setup[I830_CTXREG_STATE1]); 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, static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA ) GLenum dfactorA )
@@ -680,12 +577,15 @@ static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
I830_STATECHANGE(imesa, I830_UPLOAD_CTX); I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
imesa->Setup[I830_CTXREG_IALPHAB] &= ~SRC_DST_ABLEND_MASK; 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] &= ~SRC_DST_BLND_MASK;
imesa->Setup[I830_CTXREG_STATE1] |= funcRGB; imesa->Setup[I830_CTXREG_STATE1] |= funcRGB;
/* Insure Independant Alpha Blend is really enabled if if ( (dfactorRGB != dfactorA) || (sfactorRGB != sfactorA) ) {
* Blending is already enabled. 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); i830EvalLogicOpBlendState(ctx);
} }
@@ -1744,7 +1644,6 @@ void i830DDInitStateFuncs(GLcontext *ctx)
*/ */
ctx->Driver.AlphaFunc = i830AlphaFunc; ctx->Driver.AlphaFunc = i830AlphaFunc;
ctx->Driver.BlendEquation = i830BlendEquation; ctx->Driver.BlendEquation = i830BlendEquation;
ctx->Driver.BlendFunc = i830BlendFunc;
ctx->Driver.BlendFuncSeparate = i830BlendFuncSeparate; ctx->Driver.BlendFuncSeparate = i830BlendFuncSeparate;
ctx->Driver.BlendColor = i830BlendColor; ctx->Driver.BlendColor = i830BlendColor;
ctx->Driver.ClearColor = i830ClearColor; ctx->Driver.ClearColor = i830ClearColor;

View File

@@ -129,7 +129,9 @@ static void mgaDDBlendEquation(GLcontext *ctx, GLenum mode)
updateBlendLogicOp( ctx ); 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); mgaContextPtr mmesa = MGA_CONTEXT(ctx);
GLuint src; 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) ); 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 * Depth testing
*/ */
@@ -1199,7 +1194,6 @@ void mgaDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.LightModelfv = mgaDDLightModelfv; ctx->Driver.LightModelfv = mgaDDLightModelfv;
ctx->Driver.AlphaFunc = mgaDDAlphaFunc; ctx->Driver.AlphaFunc = mgaDDAlphaFunc;
ctx->Driver.BlendEquation = mgaDDBlendEquation; ctx->Driver.BlendEquation = mgaDDBlendEquation;
ctx->Driver.BlendFunc = mgaDDBlendFunc;
ctx->Driver.BlendFuncSeparate = mgaDDBlendFuncSeparate; ctx->Driver.BlendFuncSeparate = mgaDDBlendFuncSeparate;
ctx->Driver.DepthFunc = mgaDDDepthFunc; ctx->Driver.DepthFunc = mgaDDDepthFunc;
ctx->Driver.DepthMask = mgaDDDepthMask; ctx->Driver.DepthMask = mgaDDDepthMask;

View File

@@ -211,14 +211,6 @@ static void r128DDBlendEquation( GLcontext *ctx, GLenum mode )
rmesa->new_state |= R128_NEW_ALPHA; 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, static void r128DDBlendFuncSeparate( GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA ) GLenum sfactorA, GLenum dfactorA )
@@ -1196,7 +1188,6 @@ void r128DDInitStateFuncs( GLcontext *ctx )
ctx->Driver.ColorMask = r128DDColorMask; ctx->Driver.ColorMask = r128DDColorMask;
ctx->Driver.AlphaFunc = r128DDAlphaFunc; ctx->Driver.AlphaFunc = r128DDAlphaFunc;
ctx->Driver.BlendEquation = r128DDBlendEquation; ctx->Driver.BlendEquation = r128DDBlendEquation;
ctx->Driver.BlendFunc = r128DDBlendFunc;
ctx->Driver.BlendFuncSeparate = r128DDBlendFuncSeparate; ctx->Driver.BlendFuncSeparate = r128DDBlendFuncSeparate;
ctx->Driver.ClearDepth = r128DDClearDepth; ctx->Driver.ClearDepth = r128DDClearDepth;
ctx->Driver.CullFace = r128DDCullFace; ctx->Driver.CullFace = r128DDCullFace;

View File

@@ -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); r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & 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; 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 * Depth testing
@@ -2156,7 +2151,6 @@ void r200InitStateFuncs( struct dd_function_table *functions )
functions->AlphaFunc = r200AlphaFunc; functions->AlphaFunc = r200AlphaFunc;
functions->BlendEquation = r200BlendEquation; functions->BlendEquation = r200BlendEquation;
functions->BlendFunc = r200BlendFunc;
functions->BlendFuncSeparate = r200BlendFuncSeparate; functions->BlendFuncSeparate = r200BlendFuncSeparate;
functions->ClearColor = r200ClearColor; functions->ClearColor = r200ClearColor;
functions->ClearDepth = NULL; functions->ClearDepth = NULL;

View File

@@ -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); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & 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 * Depth testing
@@ -1686,8 +1681,10 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
*/ */
if (state) { if (state) {
ctx->Driver.BlendEquation( ctx, ctx->Color.BlendEquation ); ctx->Driver.BlendEquation( ctx, ctx->Color.BlendEquation );
ctx->Driver.BlendFunc( ctx, ctx->Color.BlendSrcRGB, ctx->Driver.BlendFuncSeparate( ctx, ctx->Color.BlendSrcRGB,
ctx->Color.BlendDstRGB ); ctx->Color.BlendDstRGB,
ctx->Color.BlendSrcRGB,
ctx->Color.BlendDstRGB );
} }
else { else {
FALLBACK( rmesa, RADEON_FALLBACK_BLEND_FUNC, GL_FALSE ); FALLBACK( rmesa, RADEON_FALLBACK_BLEND_FUNC, GL_FALSE );
@@ -2178,7 +2175,6 @@ void radeonInitStateFuncs( GLcontext *ctx )
ctx->Driver.AlphaFunc = radeonAlphaFunc; ctx->Driver.AlphaFunc = radeonAlphaFunc;
ctx->Driver.BlendEquation = radeonBlendEquation; ctx->Driver.BlendEquation = radeonBlendEquation;
ctx->Driver.BlendFunc = radeonBlendFunc;
ctx->Driver.BlendFuncSeparate = radeonBlendFuncSeparate; ctx->Driver.BlendFuncSeparate = radeonBlendFuncSeparate;
ctx->Driver.ClearColor = radeonClearColor; ctx->Driver.ClearColor = radeonClearColor;
ctx->Driver.ClearDepth = radeonClearDepth; ctx->Driver.ClearDepth = radeonClearDepth;

View File

@@ -98,7 +98,9 @@ sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref )
} }
static void 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); sisContextPtr smesa = SIS_CONTEXT(ctx);
@@ -109,7 +111,7 @@ sisDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
/* blending enable */ /* blending enable */
current->hwDstSrcBlend = 0x10000; /* Default destination alpha */ current->hwDstSrcBlend = 0x10000; /* Default destination alpha */
switch (dfactor) switch (dfactorRGB)
{ {
case GL_ZERO: case GL_ZERO:
current->hwDstSrcBlend |= SiS_D_ZERO; current->hwDstSrcBlend |= SiS_D_ZERO;
@@ -137,7 +139,7 @@ sisDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
break; break;
} }
switch (sfactor) switch (sfactorRGB)
{ {
case GL_ZERO: case GL_ZERO:
current->hwDstSrcBlend |= SiS_S_ZERO; current->hwDstSrcBlend |= SiS_S_ZERO;
@@ -847,7 +849,7 @@ void sisDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.AlphaFunc = sisDDAlphaFunc; ctx->Driver.AlphaFunc = sisDDAlphaFunc;
ctx->Driver.Bitmap = sisDDBitmap; ctx->Driver.Bitmap = sisDDBitmap;
ctx->Driver.BlendFunc = sisDDBlendFunc; ctx->Driver.BlendFuncSeparate = sisDDBlendFuncSeparate;
ctx->Driver.ColorMask = sisDDColorMask; ctx->Driver.ColorMask = sisDDColorMask;
ctx->Driver.CullFace = sisDDCullFace; ctx->Driver.CullFace = sisDDCullFace;
ctx->Driver.DepthMask = sisDDDepthMask; ctx->Driver.DepthMask = sisDDDepthMask;

View File

@@ -275,7 +275,9 @@ static void tdfxDDBlendEquation( GLcontext *ctx, GLenum mode )
fxMesa->new_state |= TDFX_NEW_ALPHA; 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 ); 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 * Stipple
*/ */
@@ -1396,7 +1388,6 @@ void tdfxDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.AlphaFunc = tdfxDDAlphaFunc; ctx->Driver.AlphaFunc = tdfxDDAlphaFunc;
ctx->Driver.BlendEquation = tdfxDDBlendEquation; ctx->Driver.BlendEquation = tdfxDDBlendEquation;
ctx->Driver.BlendFunc = tdfxDDBlendFunc;
ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate; ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate;
ctx->Driver.ClearDepth = tdfxDDClearDepth; ctx->Driver.ClearDepth = tdfxDDClearDepth;
ctx->Driver.CullFace = tdfxDDCullFace; ctx->Driver.CullFace = tdfxDDCullFace;

View File

@@ -1719,7 +1719,6 @@ fxSetupDDPointers(GLcontext * ctx)
ctx->Driver.IsTextureResident = fxDDIsTextureResident; ctx->Driver.IsTextureResident = fxDDIsTextureResident;
ctx->Driver.UpdateTexturePalette = fxDDTexPalette; ctx->Driver.UpdateTexturePalette = fxDDTexPalette;
ctx->Driver.AlphaFunc = fxDDAlphaFunc; ctx->Driver.AlphaFunc = fxDDAlphaFunc;
ctx->Driver.BlendFunc = fxDDBlendFunc;
ctx->Driver.BlendFuncSeparate = fxDDBlendFuncSeparate; ctx->Driver.BlendFuncSeparate = fxDDBlendFuncSeparate;
ctx->Driver.BlendEquation = fxDDBlendEquation; ctx->Driver.BlendEquation = fxDDBlendEquation;
ctx->Driver.DepthFunc = fxDDDepthFunc; ctx->Driver.DepthFunc = fxDDDepthFunc;

View File

@@ -621,7 +621,6 @@ extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean);
extern void fxDDEnable(GLcontext *, GLenum, GLboolean); extern void fxDDEnable(GLcontext *, GLenum, GLboolean);
extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat); extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat);
extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum);
extern void fxDDBlendFuncSeparate(GLcontext *, GLenum, GLenum, GLenum, GLenum); extern void fxDDBlendFuncSeparate(GLcontext *, GLenum, GLenum, GLenum, GLenum);
extern void fxDDBlendEquation(GLcontext *, GLenum); extern void fxDDBlendEquation(GLcontext *, GLenum);
extern void fxDDDepthMask(GLcontext *, GLboolean); extern void fxDDDepthMask(GLcontext *, GLboolean);

View File

@@ -1555,12 +1555,6 @@ which are drawn front-to-back.
} }
} }
void
fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor)
{
fxDDBlendFuncSeparate(ctx, sfactor, dfactor, sfactor, dfactor);
}
void void
fxDDBlendEquation(GLcontext * ctx, GLenum mode) fxDDBlendEquation(GLcontext * ctx, GLenum mode)
{ {

View File

@@ -44,94 +44,23 @@
* \param sfactor source factor operator. * \param sfactor source factor operator.
* \param dfactor destination factor operator. * \param dfactor destination factor operator.
* *
* \sa glBlendFunc(). * \sa glBlendFunc, glBlendFuncSeparateEXT
* *
* Verifies the parameters and updates gl_colorbuffer_attrib. On a change, * Swizzles the inputs and calls \c glBlendFuncSeparateEXT. This is done
* flushes the vertices and notifies the driver via * using the \c CurrentDispatch table in the context, so this same function
* dd_function_table::BlendFunc callback. * 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 void GLAPIENTRY
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) (*ctx->CurrentDispatch->BlendFuncSeparateEXT)( sfactor, dfactor,
_mesa_debug(ctx, "glBlendFunc %s %s\n", sfactor, dfactor );
_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 );
} }
#if _HAVE_FULL_GL
/** /**
* Process GL_EXT_blend_func_separate(). * 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! */ /* This is really an extension function! */
void GLAPIENTRY void GLAPIENTRY
_mesa_BlendEquation( GLenum mode ) _mesa_BlendEquation( GLenum mode )

View File

@@ -580,7 +580,6 @@ struct dd_function_table {
/** Set the blend equation */ /** Set the blend equation */
void (*BlendEquation)(GLcontext *ctx, GLenum mode); void (*BlendEquation)(GLcontext *ctx, GLenum mode);
/** Specify pixel arithmetic */ /** Specify pixel arithmetic */
void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
void (*BlendFuncSeparate)(GLcontext *ctx, void (*BlendFuncSeparate)(GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA); GLenum sfactorA, GLenum dfactorA);

View File

@@ -170,7 +170,6 @@ typedef enum {
OPCODE_BITMAP, OPCODE_BITMAP,
OPCODE_BLEND_COLOR, OPCODE_BLEND_COLOR,
OPCODE_BLEND_EQUATION, OPCODE_BLEND_EQUATION,
OPCODE_BLEND_FUNC,
OPCODE_BLEND_FUNC_SEPARATE, OPCODE_BLEND_FUNC_SEPARATE,
OPCODE_CALL_LIST, OPCODE_CALL_LIST,
OPCODE_CALL_LIST_OFFSET, OPCODE_CALL_LIST_OFFSET,
@@ -629,7 +628,6 @@ void _mesa_init_lists( void )
InstSize[OPCODE_BITMAP] = 8; InstSize[OPCODE_BITMAP] = 8;
InstSize[OPCODE_BLEND_COLOR] = 5; InstSize[OPCODE_BLEND_COLOR] = 5;
InstSize[OPCODE_BLEND_EQUATION] = 2; InstSize[OPCODE_BLEND_EQUATION] = 2;
InstSize[OPCODE_BLEND_FUNC] = 3;
InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5; InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5;
InstSize[OPCODE_CALL_LIST] = 2; InstSize[OPCODE_CALL_LIST] = 2;
InstSize[OPCODE_CALL_LIST_OFFSET] = 3; 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, static void GLAPIENTRY save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA) GLenum sfactorA, GLenum dfactorA)
{ {
@@ -5284,9 +5266,6 @@ execute_list( GLcontext *ctx, GLuint list )
case OPCODE_BLEND_EQUATION: case OPCODE_BLEND_EQUATION:
(*ctx->Exec->BlendEquation)( n[1].e ); (*ctx->Exec->BlendEquation)( n[1].e );
break; break;
case OPCODE_BLEND_FUNC:
(*ctx->Exec->BlendFunc)( n[1].e, n[2].e );
break;
case OPCODE_BLEND_FUNC_SEPARATE: case OPCODE_BLEND_FUNC_SEPARATE:
(*ctx->Exec->BlendFuncSeparateEXT)(n[1].e, n[2].e, n[3].e, n[4].e); (*ctx->Exec->BlendFuncSeparateEXT)(n[1].e, n[2].e, n[3].e, n[4].e);
break; break;
@@ -6994,7 +6973,6 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->Accum = save_Accum; table->Accum = save_Accum;
table->AlphaFunc = save_AlphaFunc; table->AlphaFunc = save_AlphaFunc;
table->Bitmap = save_Bitmap; table->Bitmap = save_Bitmap;
table->BlendFunc = save_BlendFunc;
table->CallList = _mesa_save_CallList; table->CallList = _mesa_save_CallList;
table->CallLists = _mesa_save_CallLists; table->CallLists = _mesa_save_CallLists;
table->Clear = save_Clear; table->Clear = save_Clear;