diff --git a/cogl/cogl-program-private.h b/cogl/cogl-program-private.h index f2d2e90b3..0474744a7 100644 --- a/cogl/cogl-program-private.h +++ b/cogl/cogl-program-private.h @@ -75,4 +75,10 @@ _cogl_program_flush_uniforms (CoglProgram *program, CoglShaderLanguage _cogl_program_get_language (CoglHandle handle); +gboolean +_cogl_program_has_fragment_shader (CoglHandle handle); + +gboolean +_cogl_program_has_vertex_shader (CoglHandle handle); + #endif /* __COGL_PROGRAM_H */ diff --git a/cogl/cogl-program.c b/cogl/cogl-program.c index 00d613ce8..a41c57797 100644 --- a/cogl/cogl-program.c +++ b/cogl/cogl-program.c @@ -681,3 +681,32 @@ _cogl_program_get_language (CoglHandle handle) else return COGL_SHADER_LANGUAGE_GLSL; } + +static gboolean +_cogl_program_has_shader_type (CoglProgram *program, + CoglShaderType type) +{ + GSList *l; + + for (l = program->attached_shaders; l; l = l->next) + { + CoglShader *shader = l->data; + + if (shader->type == type) + return TRUE; + } + + return FALSE; +} + +gboolean +_cogl_program_has_fragment_shader (CoglHandle handle) +{ + return _cogl_program_has_shader_type (handle, COGL_SHADER_TYPE_FRAGMENT); +} + +gboolean +_cogl_program_has_vertex_shader (CoglHandle handle) +{ + return _cogl_program_has_shader_type (handle, COGL_SHADER_TYPE_VERTEX); +}