From 3cad93b8a201695339bd412e2f73d3ef52c9a3b2 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 29 Nov 2010 10:55:49 +0000 Subject: [PATCH] cogl-shader.c: Don't add the common boilerplate twice In 6246c2bd6 I moved the code to add the boilerplate to a shader to a separate function and also made it so that the common boilerplate is added as a separate string to glShaderSource. However I didn't notice that the #define for the vertex and fragment shaders already includes the common part so it was being added twice. Mesa seems to accept this but it was causing problems on the IMG driver because COGL_VERSION was defined twice. --- cogl/cogl-shader.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cogl/cogl-shader.c b/cogl/cogl-shader.c index e5b43138d..668b6adac 100644 --- a/cogl/cogl-shader.c +++ b/cogl/cogl-shader.c @@ -191,12 +191,11 @@ _cogl_shader_set_source_with_boilerplate (GLuint shader_gl_handle, const char **strings_in, const GLint *lengths_in) { - static const char common_boilerplate[] = _COGL_COMMON_SHADER_BOILERPLATE; static const char vertex_boilerplate[] = _COGL_VERTEX_SHADER_BOILERPLATE; static const char fragment_boilerplate[] = _COGL_FRAGMENT_SHADER_BOILERPLATE; - const char **strings = g_alloca (sizeof (char *) * (count_in + 3)); - GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 3)); + const char **strings = g_alloca (sizeof (char *) * (count_in + 2)); + GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 2)); int count = 0; #ifdef HAVE_COGL_GLES2 char *tex_coords_declaration = NULL; @@ -204,9 +203,6 @@ _cogl_shader_set_source_with_boilerplate (GLuint shader_gl_handle, GET_CONTEXT (ctx, NO_RETVAL); - strings[count] = common_boilerplate; - lengths[count++] = sizeof (common_boilerplate) - 1; - if (shader_gl_type == GL_VERTEX_SHADER) { strings[count] = vertex_boilerplate;