[mutter] cogl: Stop using glAlphaFunc in big-GL



commit 35f21c5bc07f54dfb28cbf833a291704d45084ae
Author: Adam Jackson <ajax redhat com>
Date:   Thu Dec 19 16:37:55 2019 -0500

    cogl: Stop using glAlphaFunc in big-GL
    
    We're always running through the GLSL pipeline so the fixed-function
    alpha test is never invoked. This change does not yet remove the
    alpha-test feture bit from the context because this bit of uniform
    handling is going to be simplified in a future commit.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/995

 cogl/cogl/cogl-pipeline.c                        |  6 ++----
 cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c |  5 +----
 cogl/cogl/driver/gl/cogl-pipeline-opengl.c       | 23 -----------------------
 cogl/cogl/driver/gl/gl/cogl-driver-gl.c          | 10 ----------
 4 files changed, 3 insertions(+), 41 deletions(-)
---
diff --git a/cogl/cogl/cogl-pipeline.c b/cogl/cogl/cogl-pipeline.c
index afbac1bb8..f90046d76 100644
--- a/cogl/cogl/cogl-pipeline.c
+++ b/cogl/cogl/cogl-pipeline.c
@@ -2832,10 +2832,8 @@ _cogl_pipeline_get_state_for_fragment_codegen (CoglContext *context)
 {
   CoglPipelineState state = (COGL_PIPELINE_STATE_LAYERS |
                              COGL_PIPELINE_STATE_USER_SHADER |
-                             COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS);
-
-  if (!_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST))
-    state |= COGL_PIPELINE_STATE_ALPHA_FUNC;
+                             COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS |
+                             COGL_PIPELINE_STATE_ALPHA_FUNC);
 
   return state;
 }
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c 
b/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
index 8a41e7f5d..0e95fb390 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
@@ -1022,10 +1022,7 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
         g_string_append (shader_state->source,
                          "  cogl_color_out = cogl_color_in;\n");
 
-#if defined(HAVE_COGL_GLES2) || defined (HAVE_COGL_GL)
-      if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEST))
-        add_alpha_test_snippet (pipeline, shader_state);
-#endif
+      add_alpha_test_snippet (pipeline, shader_state);
 
       /* Close the function surrounding the generated fragment processing */
       g_string_append (shader_state->source, "}\n");
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
index 2309a11a2..386f4aaaf 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
@@ -396,29 +396,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
     }
 #endif
 
-#ifdef HAVE_COGL_GL
-
-  if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEST))
-    {
-      /* Under GLES2 the alpha function is implemented as part of the
-         fragment shader */
-      if (pipelines_difference & (COGL_PIPELINE_STATE_ALPHA_FUNC |
-                                  COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE))
-        {
-          CoglPipeline *authority =
-            _cogl_pipeline_get_authority (pipeline,
-                                          COGL_PIPELINE_STATE_ALPHA_FUNC);
-          CoglPipelineAlphaFuncState *alpha_state =
-            &authority->big_state->alpha_state;
-
-          /* NB: Currently the Cogl defines are compatible with the GL ones: */
-          GE (ctx, glAlphaFunc (alpha_state->alpha_func,
-                                alpha_state->alpha_func_reference));
-        }
-    }
-
-#endif
-
   if (pipelines_difference & COGL_PIPELINE_STATE_DEPTH)
     {
       CoglPipeline *authority =
diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
index 534631708..04304aa59 100644
--- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -56,15 +56,6 @@ _cogl_driver_gl_context_init (CoglContext *context,
   context->active_texture_unit = 1;
   GE (context, glActiveTexture (GL_TEXTURE1));
 
-  if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST))
-    /* The default for GL_ALPHA_TEST is to always pass which is equivalent to
-     * the test being disabled therefore we assume that for all drivers there
-     * will be no performance impact if we always leave the test enabled which
-     * makes things a bit simpler for us. Under GLES2 the alpha test is
-     * implemented in the fragment shader so there is no enable for it
-     */
-    GE (context, glEnable (GL_ALPHA_TEST));
-
   if ((context->driver == COGL_DRIVER_GL3))
     {
       GLuint vertex_array;
@@ -504,7 +495,6 @@ _cogl_driver_update_features (CoglContext *ctx,
   if (ctx->driver == COGL_DRIVER_GL)
     {
       /* Features which are not available in GL 3 */
-      COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEST, TRUE);
       COGL_FLAGS_SET (private_features,
                       COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]