1
0
Fork 0

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.
This commit is contained in:
Neil Roberts 2010-11-29 10:55:49 +00:00
parent 84dc0ad2eb
commit 3cad93b8a2

View file

@ -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;