2008-06-26 Emmanuele Bassi <ebassi@openedhand.com>
+ * clutter/clutter-shader.c (bind_glsl_shader): Verify that the
+ vertex shader has been successfully compiled, like we do with
+ the fragment shader.
+
+2008-06-26 Emmanuele Bassi <ebassi@openedhand.com>
+
* clutter/osx/clutter-backend-osx.c:
(clutter_backend_osx_get_display_size): Fix the allocation pool
macro name.
if (priv->vertex_is_glsl && priv->vertex_source != COGL_INVALID_HANDLE)
{
- priv->vertex_shader = cogl_create_shader (CGL_VERTEX_SHADER);
+ GLint compiled = CGL_FALSE;
+
+ priv->vertex_shader = cogl_create_shader (CGL_VERTEX_SHADER);
+
+ cogl_shader_source (priv->vertex_shader, priv->vertex_source);
+ cogl_shader_compile (priv->vertex_shader);
+
+ cogl_shader_get_parameteriv (priv->fragment_shader,
+ CGL_OBJECT_COMPILE_STATUS,
+ &compiled);
+ if (compiled != CGL_TRUE)
+ {
+ gchar error_buf[512];
- cogl_shader_source (priv->vertex_shader, priv->vertex_source);
- cogl_shader_compile (priv->vertex_shader);
- cogl_program_attach_shader (priv->program, priv->vertex_shader);
+ cogl_shader_get_info_log (priv->fragment_shader, 512, error_buf);
+
+ g_set_error (error, CLUTTER_SHADER_ERROR,
+ CLUTTER_SHADER_ERROR_COMPILE,
+ "Vertex shader compilation failed: %s",
+ error_buf);
+
+ return FALSE;
+ }
+ else
+ cogl_program_attach_shader (priv->program, priv->vertex_shader);
}
if (priv->fragment_is_glsl && priv->fragment_source != COGL_INVALID_HANDLE)
g_set_error (error, CLUTTER_SHADER_ERROR,
CLUTTER_SHADER_ERROR_COMPILE,
- "Shader compilation failed: %s",
+ "Fragment shader compilation failed: %s",
error_buf);
return FALSE;