mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
cogl-program: Add private functions to check if have each shader type
This adds two internal functions: gboolean _cogl_program_has_fragment_shader (CoglHandle handle); gboolean _cogl_program_has_vertex_shader (CoglHandle handle); They just check whether any of the contained shaders are of that type.
This commit is contained in:
parent
7562a17685
commit
91132871ad
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user