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
This commit is contained in:
Adam Jackson 2019-12-19 16:37:55 -05:00 committed by Georges Basile Stavracas Neto
parent 9f2662c7f8
commit 35f21c5bc0
4 changed files with 3 additions and 41 deletions

View File

@ -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;
}

View File

@ -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");

View File

@ -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 =

View File

@ -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);
}