summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2004-01-21 16:08:43 +0000
committerIan Romanick <[email protected]>2004-01-21 16:08:43 +0000
commit20a17e42d7fc9fe65aabe612fe1e513c3103d121 (patch)
treeace6f8746d47c9a1f3f397dceebc6ce58e045c0a /src/mesa/main
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/mesa/main')
-rw-r--r--src/mesa/main/blend.c89
-rw-r--r--src/mesa/main/dd.h1
-rw-r--r--src/mesa/main/dlist.c22
3 files changed, 10 insertions, 102 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index e5032bf1bb6..a185fc97423 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 60b16db10f2..55383773744 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 8e3c8bcdb93..162920eb9be 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;