[Mesa-dev] [PATCH 3/7] mesa: Remove support for GL_EXT_blend_logic_op

Ian Romanick idr at freedesktop.org
Fri Sep 9 15:39:17 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

Support is removed for four reasons:

1. The implementation was broken with respect to separate blend
equations.  The GL_EXT_blend_equation_separate spec says:

    "If EXT_blend_logic_op and EXT_blend_equation_separate are both
    supported, the logic op blend equation should be supported separately
    for RGB and alpha as with the other blend equation modes."

But Mesa's implementation of GL_LOGIC_OP specifically forbids this.

2. No hardware supported by Mesa can support separate blend equations
involving GL_LOGIC_OP.

3. No applications could be found that use this extension.

4. No other Linux OpenGL drivers support this extension.

Cc: Brian Paul <brianp at vmware.com>
Cc: Roland Scheidegger <sroland at vmware.com>
Cc: Marek Olšák <maraeo at gmail.com>
---
 src/mesa/main/blend.c      |   19 +++++++------------
 src/mesa/main/extensions.c |    2 --
 src/mesa/main/mtypes.h     |    1 -
 src/mesa/main/state.h      |    3 +--
 4 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 1856f00..a9c52db 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -285,8 +285,7 @@ _mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
  * \return GL_TRUE if legal, GL_FALSE otherwise.
  */
 static GLboolean
-legal_blend_equation(const struct gl_context *ctx,
-                     GLenum mode, GLboolean is_separate)
+legal_blend_equation(const struct gl_context *ctx, GLenum mode)
 {
    switch (mode) {
    case GL_FUNC_ADD:
@@ -294,10 +293,6 @@ legal_blend_equation(const struct gl_context *ctx,
    case GL_MIN:
    case GL_MAX:
       return ctx->Extensions.EXT_blend_minmax;
-   case GL_LOGIC_OP:
-      /* glBlendEquationSeparate cannot take GL_LOGIC_OP as a parameter.
-       */
-      return ctx->Extensions.EXT_blend_logic_op && !is_separate;
    case GL_FUNC_SUBTRACT:
    case GL_FUNC_REVERSE_SUBTRACT:
       return ctx->Extensions.EXT_blend_subtract;
@@ -320,7 +315,7 @@ _mesa_BlendEquation( GLenum mode )
       _mesa_debug(ctx, "glBlendEquation(%s)\n",
                   _mesa_lookup_enum_by_nr(mode));
 
-   if (!legal_blend_equation(ctx, mode, GL_FALSE)) {
+   if (!legal_blend_equation(ctx, mode)) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
       return;
    }
@@ -370,7 +365,7 @@ _mesa_BlendEquationi(GLuint buf, GLenum mode)
       return;
    }
 
-   if (!legal_blend_equation(ctx, mode, GL_FALSE)) {
+   if (!legal_blend_equation(ctx, mode)) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationi");
       return;
    }
@@ -408,12 +403,12 @@ _mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA )
       return;
    }
 
-   if (!legal_blend_equation(ctx, modeRGB, GL_TRUE)) {
+   if (!legal_blend_equation(ctx, modeRGB)) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeRGB)");
       return;
    }
 
-   if (!legal_blend_equation(ctx, modeA, GL_TRUE)) {
+   if (!legal_blend_equation(ctx, modeA)) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeA)");
       return;
    }
@@ -464,12 +459,12 @@ _mesa_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
       return;
    }
 
-   if (!legal_blend_equation(ctx, modeRGB, GL_TRUE)) {
+   if (!legal_blend_equation(ctx, modeRGB)) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeRGB)");
       return;
    }
 
-   if (!legal_blend_equation(ctx, modeA, GL_TRUE)) {
+   if (!legal_blend_equation(ctx, modeA)) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeA)");
       return;
    }
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 99942fa..f6eb7ec 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -151,7 +151,6 @@ static const struct extension extension_table[] = {
    { "GL_EXT_blend_color",                         o(EXT_blend_color),                         GL,             1995 },
    { "GL_EXT_blend_equation_separate",             o(EXT_blend_equation_separate),             GL,             2003 },
    { "GL_EXT_blend_func_separate",                 o(EXT_blend_func_separate),                 GL,             1999 },
-   { "GL_EXT_blend_logic_op",                      o(EXT_blend_logic_op),                      GL,             1995 },
    { "GL_EXT_blend_minmax",                        o(EXT_blend_minmax),                        GL | ES1 | ES2, 1995 },
    { "GL_EXT_blend_subtract",                      o(EXT_blend_subtract),                      GL,             1995 },
    { "GL_EXT_clip_volume_hint",                    o(EXT_clip_volume_hint),                    GL,             1996 },
@@ -469,7 +468,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
    ctx->Extensions.EXT_blend_color = GL_TRUE;
    ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
    ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
-   ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
    ctx->Extensions.EXT_blend_minmax = GL_TRUE;
    ctx->Extensions.EXT_blend_subtract = GL_TRUE;
    ctx->Extensions.EXT_depth_bounds_test = GL_TRUE;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ae500b4..a1fbf5f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2854,7 +2854,6 @@ struct gl_extensions
    GLboolean EXT_blend_color;
    GLboolean EXT_blend_equation_separate;
    GLboolean EXT_blend_func_separate;
-   GLboolean EXT_blend_logic_op;
    GLboolean EXT_blend_minmax;
    GLboolean EXT_blend_subtract;
    GLboolean EXT_clip_volume_hint;
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index a48c777..7ff1c5b 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -79,8 +79,7 @@ _mesa_need_secondary_color(const struct gl_context *ctx)
 static INLINE GLboolean
 _mesa_rgba_logicop_enabled(const struct gl_context *ctx)
 {
-   return ctx->Color.ColorLogicOpEnabled ||
-      (ctx->Color.BlendEnabled && ctx->Color.Blend[0].EquationRGB == GL_LOGIC_OP);
+   return ctx->Color.ColorLogicOpEnabled;
 }
 
 
-- 
1.7.6



More information about the mesa-dev mailing list