From 8cac82318f23c967af3853e23c15d87cceceef62 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 7 Mar 2019 13:44:49 -0500 Subject: [PATCH] cogl: Remove unused CoglPipelineProgramType There is only GLSL. https://gitlab.gnome.org/GNOME/mutter/merge_requests/819 --- cogl/cogl/cogl-context-private.h | 2 - cogl/cogl/cogl-context.c | 2 - cogl/cogl/cogl-pipeline-private.h | 10 +- cogl/cogl/driver/gl/cogl-pipeline-opengl.c | 92 +------------------ .../driver/gl/cogl-pipeline-progend-glsl.c | 3 +- 5 files changed, 4 insertions(+), 105 deletions(-) diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h index 04040ce8c..e497c4451 100644 --- a/cogl/cogl/cogl-context-private.h +++ b/cogl/cogl/cogl-context-private.h @@ -249,8 +249,6 @@ struct _CoglContext /* Fragment processing programs */ CoglHandle current_program; - CoglPipelineProgramType current_fragment_program_type; - CoglPipelineProgramType current_vertex_program_type; GLuint current_gl_program; gboolean current_gl_dither_enabled; diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index f1a8bf2fc..0bc8163c7 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -299,8 +299,6 @@ cogl_context_new (CoglDisplay *display, context->max_texture_units = -1; context->max_activateable_texture_units = -1; - context->current_fragment_program_type = COGL_PIPELINE_PROGRAM_TYPE_GLSL; - context->current_vertex_program_type = COGL_PIPELINE_PROGRAM_TYPE_GLSL; context->current_gl_program = 0; context->current_gl_dither_enabled = TRUE; diff --git a/cogl/cogl/cogl-pipeline-private.h b/cogl/cogl/cogl-pipeline-private.h index 59f043b67..79e41d676 100644 --- a/cogl/cogl/cogl-pipeline-private.h +++ b/cogl/cogl/cogl-pipeline-private.h @@ -481,11 +481,6 @@ typedef struct void (* pre_paint) (CoglPipeline *pipeline, CoglFramebuffer *framebuffer); } CoglPipelineProgend; -typedef enum -{ - COGL_PIPELINE_PROGRAM_TYPE_GLSL = 1, -} CoglPipelineProgramType; - extern const CoglPipelineFragend * _cogl_pipeline_fragends[COGL_PIPELINE_N_FRAGENDS]; extern const CoglPipelineVertend * @@ -618,10 +613,7 @@ typedef struct _CoglPipelineFlushOptions } CoglPipelineFlushOptions; void -_cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type); - -void -_cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type); +cogl_use_program (GLuint gl_program); unsigned int _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func); diff --git a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c index adda93567..4ae5bea74 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c @@ -238,8 +238,8 @@ _cogl_pipeline_texture_storage_change_notify (CoglTexture *texture) } } -static void -set_glsl_program (GLuint gl_program) +void +cogl_use_program (GLuint gl_program) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -257,94 +257,6 @@ set_glsl_program (GLuint gl_program) } } -void -_cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - /* If we're changing program type... */ - if (type != ctx->current_fragment_program_type) - { - /* ... disable the old type */ - switch (ctx->current_fragment_program_type) - { - case COGL_PIPELINE_PROGRAM_TYPE_GLSL: - /* If the program contains a vertex shader then we shouldn't - disable it */ - if (ctx->current_vertex_program_type != - COGL_PIPELINE_PROGRAM_TYPE_GLSL) - set_glsl_program (0); - break; - } - - /* ... and enable the new type */ - switch (type) - { - case COGL_PIPELINE_PROGRAM_TYPE_GLSL: - /* don't need to to anything */ - break; - } - } - - if (type == COGL_PIPELINE_PROGRAM_TYPE_GLSL) - { -#ifdef COGL_PIPELINE_FRAGEND_GLSL - set_glsl_program (gl_program); - -#else - - g_warning ("Unexpected use of GLSL fragend!"); - -#endif /* COGL_PIPELINE_FRAGEND_GLSL */ - } - - ctx->current_fragment_program_type = type; -} - -void -_cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - /* If we're changing program type... */ - if (type != ctx->current_vertex_program_type) - { - /* ... disable the old type */ - switch (ctx->current_vertex_program_type) - { - case COGL_PIPELINE_PROGRAM_TYPE_GLSL: - /* If the program contains a fragment shader then we shouldn't - disable it */ - if (ctx->current_fragment_program_type != - COGL_PIPELINE_PROGRAM_TYPE_GLSL) - set_glsl_program (0); - break; - } - - /* ... and enable the new type */ - switch (type) - { - case COGL_PIPELINE_PROGRAM_TYPE_GLSL: - /* don't need to to anything */ - break; - } - } - - if (type == COGL_PIPELINE_PROGRAM_TYPE_GLSL) - { -#ifdef COGL_PIPELINE_VERTEND_GLSL - set_glsl_program (gl_program); - -#else - - g_warning ("Unexpected use of GLSL vertend!"); - -#endif /* COGL_PIPELINE_VERTEND_GLSL */ - } - - ctx->current_vertex_program_type = type; -} - #if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) static gboolean diff --git a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c index dfcd8ce8f..06d6afc22 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c @@ -773,8 +773,7 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline, gl_program = program_state->program; - _cogl_use_fragment_program (gl_program, COGL_PIPELINE_PROGRAM_TYPE_GLSL); - _cogl_use_vertex_program (gl_program, COGL_PIPELINE_PROGRAM_TYPE_GLSL); + cogl_use_program (gl_program); state.unit = 0; state.gl_program = gl_program;