Remove dd_function_table::BlendFunc. All drivers now use
authorIan Romanick <idr@us.ibm.com>
Wed, 21 Jan 2004 16:08:43 +0000 (16:08 +0000)
committerIan Romanick <idr@us.ibm.com>
Wed, 21 Jan 2004 16:08:43 +0000 (16:08 +0000)
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.

17 files changed:
src/mesa/drivers/common/driverfuncs.c
src/mesa/drivers/dri/ffb/ffb_state.c
src/mesa/drivers/dri/gamma/gamma_state.c
src/mesa/drivers/dri/i810/i810state.c
src/mesa/drivers/dri/i830/i830_state.c
src/mesa/drivers/dri/mga/mgastate.c
src/mesa/drivers/dri/r128/r128_state.c
src/mesa/drivers/dri/r200/r200_state.c
src/mesa/drivers/dri/radeon/radeon_state.c
src/mesa/drivers/dri/sis/sis_state.c
src/mesa/drivers/dri/tdfx/tdfx_state.c
src/mesa/drivers/glide/fxdd.c
src/mesa/drivers/glide/fxdrv.h
src/mesa/drivers/glide/fxsetup.c
src/mesa/main/blend.c
src/mesa/main/dd.h
src/mesa/main/dlist.c

index 2ab1b82cb50b6188dd6c41b98357cecab7d1b5ae..c3f4bb6516ea3bf7b8510dd44d389b85c1b15276 100644 (file)
@@ -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;
index ac753b922a13ed0df07c8ed190a0f20741e40c81..ddda946f4b0d525eee86314c53f54eda114689cd 100644 (file)
@@ -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;
index 8a767206782658edb79544f66019a0f913d701cc..519c707a5ab30c3ba68e260d3b8cf12e0ea7be32 100644 (file)
@@ -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;
index 23432b2c072414852c97a402ffe29b14f84cb11e..9249d0841a0f20a03e8b0cce6f183b7c7028de94 100644 (file)
@@ -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;
index 11f0fd79488417f8edc1efc9e02ff0263cee51f4..9e8952f09b12fee774829fb3d62576a989fc56e7 100644 (file)
@@ -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;
index becb08a20804db01db5958b41c2ff8281377be8a..6e039182aede075127c9784615c40411b51145e2 100644 (file)
@@ -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;
index 110a16a8316e4e9669e77ab51896cb97d970e0bd..0be7b1bfa8072462193a5b3a650e8978d7fd96ae 100644 (file)
@@ -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;
index f9501fd62b3e4e4d609aafe72481f1b56c566ecf..37da564986d5620cab9ca808415e768953de8275 100644 (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);
    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;
index 49d98a67e7facb493178bd7e60e4e8313585bc4c..e71f5adf271b820e71c6eec3db6590e5141407f8 100644 (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);
    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;
index 8ff067f56d74922c0ecf602de0ffaf23b24b9187..6dc002171d55c599d6b9b5e900d8af1442e4f6b3 100644 (file)
@@ -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;
index 53e331f69b6c3cbed1b1a509e31d9057ce316097..c5c2cdb6f85436b1aa526959ce43c13d3a64ea1a 100644 (file)
@@ -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;
index 0ee4216cb1f29209f6b40f52d554ba1613c05b1c..6e66f599aad55f479fe9a7149ed31ddb2f78d91e 100644 (file)
@@ -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;
index ff9e02b3eb23cc4e417e9a1e889243b312e95d6e..1f31f621604a164381d8f504ff1566823e5bf10f 100644 (file)
@@ -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);
index 17a4129eb6f70f9d66088b337f76da66de9d9f44..45883f465ba3003db8250bd17c76284b76ddfc6d 100644 (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
 fxDDBlendEquation(GLcontext * ctx, GLenum mode)
 {
index e5032bf1bb6aff421f071b5b5a5e904c0c9a386b..a185fc974232f0cfebf2028bbc5b56364fe315ad 100644 (file)
  * \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 )
index 60b16db10f27ccb529714694f42199be0e699058..55383773744af12830468d42bf7f2eb2f5643e15 100644 (file)
@@ -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);
index 8e3c8bcdb9356be35be9c55c82f1607f622ef6f6..162920eb9becb41f8ad36d62079acc0ec6991168 100644 (file)
@@ -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;