[mutter] cogl: Remove unused CoglShaderLanguage



commit 22d1febf3c40510ddb6ed2fd5e70b96c3382cb7a
Author: Adam Jackson <ajax redhat com>
Date:   Thu Oct 17 16:12:22 2019 -0400

    cogl: Remove unused CoglShaderLanguage
    
    There is only GLSL.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/819

 cogl/cogl/deprecated/cogl-program-private.h      |  3 --
 cogl/cogl/deprecated/cogl-program.c              | 41 ++++--------------------
 cogl/cogl/deprecated/cogl-shader-private.h       |  6 ----
 cogl/cogl/deprecated/cogl-shader.c               | 10 ------
 cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c | 11 -------
 5 files changed, 6 insertions(+), 65 deletions(-)
---
diff --git a/cogl/cogl/deprecated/cogl-program-private.h b/cogl/cogl/deprecated/cogl-program-private.h
index a692e2ebd..38b5f59d8 100644
--- a/cogl/cogl/deprecated/cogl-program-private.h
+++ b/cogl/cogl/deprecated/cogl-program-private.h
@@ -76,9 +76,6 @@ _cogl_program_flush_uniforms (CoglProgram *program,
                               GLuint gl_program,
                               gboolean gl_program_changed);
 
-CoglShaderLanguage
-_cogl_program_get_language (CoglHandle handle);
-
 gboolean
 _cogl_program_has_fragment_shader (CoglHandle handle);
 
diff --git a/cogl/cogl/deprecated/cogl-program.c b/cogl/cogl/deprecated/cogl-program.c
index d4d1cdd99..49fd9a281 100644
--- a/cogl/cogl/deprecated/cogl-program.c
+++ b/cogl/cogl/deprecated/cogl-program.c
@@ -96,7 +96,6 @@ cogl_program_attach_shader (CoglHandle program_handle,
                             CoglHandle shader_handle)
 {
   CoglProgram *program;
-  CoglShader *shader;
 
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
@@ -104,11 +103,6 @@ cogl_program_attach_shader (CoglHandle program_handle,
     return;
 
   program = program_handle;
-  shader = shader_handle;
-
-  if (shader->language == COGL_SHADER_LANGUAGE_GLSL)
-    g_return_if_fail (_cogl_program_get_language (program) ==
-                      COGL_SHADER_LANGUAGE_GLSL);
 
   program->attached_shaders
     = g_slist_prepend (program->attached_shaders,
@@ -355,26 +349,19 @@ _cogl_program_flush_uniforms (CoglProgram *program,
         {
           if (gl_program_changed || !uniform->location_valid)
             {
-              if (_cogl_program_get_language (program) ==
-                  COGL_SHADER_LANGUAGE_GLSL)
-                uniform->location =
-                  ctx->glGetUniformLocation (gl_program, uniform->name);
+               uniform->location =
+                 ctx->glGetUniformLocation (gl_program, uniform->name);
 
-              uniform->location_valid = TRUE;
+               uniform->location_valid = TRUE;
             }
 
           /* If the uniform isn't really in the program then there's
              no need to actually set it */
           if (uniform->location != -1)
             {
-              switch (_cogl_program_get_language (program))
-                {
-                case COGL_SHADER_LANGUAGE_GLSL:
-                  _cogl_boxed_value_set_uniform (ctx,
-                                                 uniform->location,
-                                                 &uniform->value);
-                  break;
-                }
+               _cogl_boxed_value_set_uniform (ctx,
+                                              uniform->location,
+                                              &uniform->value);
             }
 
           uniform->dirty = FALSE;
@@ -382,22 +369,6 @@ _cogl_program_flush_uniforms (CoglProgram *program,
     }
 }
 
-CoglShaderLanguage
-_cogl_program_get_language (CoglHandle handle)
-{
-  CoglProgram *program = handle;
-
-  /* Use the language of the first shader */
-
-  if (program->attached_shaders)
-    {
-      CoglShader *shader = program->attached_shaders->data;
-      return shader->language;
-    }
-  else
-    return COGL_SHADER_LANGUAGE_GLSL;
-}
-
 static gboolean
 _cogl_program_has_shader_type (CoglProgram *program,
                                CoglShaderType type)
diff --git a/cogl/cogl/deprecated/cogl-shader-private.h b/cogl/cogl/deprecated/cogl-shader-private.h
index 76eed7225..f19aaa22c 100644
--- a/cogl/cogl/deprecated/cogl-shader-private.h
+++ b/cogl/cogl/deprecated/cogl-shader-private.h
@@ -38,18 +38,12 @@
 
 typedef struct _CoglShader CoglShader;
 
-typedef enum
-{
-  COGL_SHADER_LANGUAGE_GLSL,
-} CoglShaderLanguage;
-
 struct _CoglShader
 {
   CoglHandleObject _parent;
   GLuint gl_handle;
   CoglPipeline *compilation_pipeline;
   CoglShaderType type;
-  CoglShaderLanguage language;
   char *source;
 };
 
diff --git a/cogl/cogl/deprecated/cogl-shader.c b/cogl/cogl/deprecated/cogl-shader.c
index 05f46e751..589850fd1 100644
--- a/cogl/cogl/deprecated/cogl-shader.c
+++ b/cogl/cogl/deprecated/cogl-shader.c
@@ -84,7 +84,6 @@ cogl_create_shader (CoglShaderType type)
     }
 
   shader = g_slice_new (CoglShader);
-  shader->language = COGL_SHADER_LANGUAGE_GLSL;
   shader->gl_handle = 0;
   shader->compilation_pipeline = NULL;
   shader->type = type;
@@ -114,7 +113,6 @@ cogl_shader_source (CoglHandle   handle,
                     const char  *source)
 {
   CoglShader *shader;
-  CoglShaderLanguage language;
 
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
@@ -122,16 +120,8 @@ cogl_shader_source (CoglHandle   handle,
     return;
 
   shader = handle;
-  language = COGL_SHADER_LANGUAGE_GLSL;
-
-  /* Delete the old object if the language is changing... */
-  if (G_UNLIKELY (language != shader->language) &&
-      shader->gl_handle)
-    delete_shader (shader);
 
   shader->source = g_strdup (source);
-
-  shader->language = language;
 }
 
 void
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c 
b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c
index df4a04b72..af7797ead 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c
@@ -638,15 +638,6 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglPipeline *pipeline,
 static gboolean
 _cogl_pipeline_progend_glsl_start (CoglPipeline *pipeline)
 {
-  CoglHandle user_program;
-
-  _COGL_GET_CONTEXT (ctx, FALSE);
-
-  user_program = cogl_pipeline_get_user_program (pipeline);
-  if (user_program &&
-      _cogl_program_get_language (user_program) != COGL_SHADER_LANGUAGE_GLSL)
-    return FALSE;
-
   return TRUE;
 }
 
@@ -742,8 +733,6 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
 
               _cogl_shader_compile_real (shader, pipeline);
 
-              g_assert (shader->language == COGL_SHADER_LANGUAGE_GLSL);
-
               GE( ctx, glAttachShader (program_state->program,
                                        shader->gl_handle) );
             }


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