cogl: Remove unused CoglShaderLanguage

There is only GLSL.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/819
This commit is contained in:
Adam Jackson 2019-10-17 16:12:22 -04:00
parent 5aa971b177
commit 22d1febf3c
5 changed files with 6 additions and 65 deletions

View File

@ -76,9 +76,6 @@ _cogl_program_flush_uniforms (CoglProgram *program,
GLuint gl_program, GLuint gl_program,
gboolean gl_program_changed); gboolean gl_program_changed);
CoglShaderLanguage
_cogl_program_get_language (CoglHandle handle);
gboolean gboolean
_cogl_program_has_fragment_shader (CoglHandle handle); _cogl_program_has_fragment_shader (CoglHandle handle);

View File

@ -96,7 +96,6 @@ cogl_program_attach_shader (CoglHandle program_handle,
CoglHandle shader_handle) CoglHandle shader_handle)
{ {
CoglProgram *program; CoglProgram *program;
CoglShader *shader;
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
@ -104,11 +103,6 @@ cogl_program_attach_shader (CoglHandle program_handle,
return; return;
program = program_handle; 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 program->attached_shaders
= g_slist_prepend (program->attached_shaders, = g_slist_prepend (program->attached_shaders,
@ -355,8 +349,6 @@ _cogl_program_flush_uniforms (CoglProgram *program,
{ {
if (gl_program_changed || !uniform->location_valid) if (gl_program_changed || !uniform->location_valid)
{ {
if (_cogl_program_get_language (program) ==
COGL_SHADER_LANGUAGE_GLSL)
uniform->location = uniform->location =
ctx->glGetUniformLocation (gl_program, uniform->name); ctx->glGetUniformLocation (gl_program, uniform->name);
@ -367,14 +359,9 @@ _cogl_program_flush_uniforms (CoglProgram *program,
no need to actually set it */ no need to actually set it */
if (uniform->location != -1) if (uniform->location != -1)
{ {
switch (_cogl_program_get_language (program))
{
case COGL_SHADER_LANGUAGE_GLSL:
_cogl_boxed_value_set_uniform (ctx, _cogl_boxed_value_set_uniform (ctx,
uniform->location, uniform->location,
&uniform->value); &uniform->value);
break;
}
} }
uniform->dirty = FALSE; 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 static gboolean
_cogl_program_has_shader_type (CoglProgram *program, _cogl_program_has_shader_type (CoglProgram *program,
CoglShaderType type) CoglShaderType type)

View File

@ -38,18 +38,12 @@
typedef struct _CoglShader CoglShader; typedef struct _CoglShader CoglShader;
typedef enum
{
COGL_SHADER_LANGUAGE_GLSL,
} CoglShaderLanguage;
struct _CoglShader struct _CoglShader
{ {
CoglHandleObject _parent; CoglHandleObject _parent;
GLuint gl_handle; GLuint gl_handle;
CoglPipeline *compilation_pipeline; CoglPipeline *compilation_pipeline;
CoglShaderType type; CoglShaderType type;
CoglShaderLanguage language;
char *source; char *source;
}; };

View File

@ -84,7 +84,6 @@ cogl_create_shader (CoglShaderType type)
} }
shader = g_slice_new (CoglShader); shader = g_slice_new (CoglShader);
shader->language = COGL_SHADER_LANGUAGE_GLSL;
shader->gl_handle = 0; shader->gl_handle = 0;
shader->compilation_pipeline = NULL; shader->compilation_pipeline = NULL;
shader->type = type; shader->type = type;
@ -114,7 +113,6 @@ cogl_shader_source (CoglHandle handle,
const char *source) const char *source)
{ {
CoglShader *shader; CoglShader *shader;
CoglShaderLanguage language;
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
@ -122,16 +120,8 @@ cogl_shader_source (CoglHandle handle,
return; return;
shader = handle; 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->source = g_strdup (source);
shader->language = language;
} }
void void

View File

@ -638,15 +638,6 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglPipeline *pipeline,
static gboolean static gboolean
_cogl_pipeline_progend_glsl_start (CoglPipeline *pipeline) _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; return TRUE;
} }
@ -742,8 +733,6 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
_cogl_shader_compile_real (shader, pipeline); _cogl_shader_compile_real (shader, pipeline);
g_assert (shader->language == COGL_SHADER_LANGUAGE_GLSL);
GE( ctx, glAttachShader (program_state->program, GE( ctx, glAttachShader (program_state->program,
shader->gl_handle) ); shader->gl_handle) );
} }