Intermittent shader compile error with unhelpful info log

I’ve been getting occasional errors compiling a vertex shader. It’s the same vertex shader that usually works, on the same hardware, so I don’t think the GLSL code could really be bad. The info log usually shows this:

Vertex shader failed to compile with the following errors:

Yes, that’s the whole thing. It happens on Windows, with both ATI and NVidia GPUs. I haven’t seen it on the Mac, but since I haven’t figured out how to reproduce it, I’m not absolutely sure it doesn’t happen.

I know this is pretty vague, but any idea what could cause such an effect? Too many shaders floating around at once? Bad data passed to OpenGL in some completely different part of the code?

It could be any of the above. If it is not consistent, I would bet on an error else where in your code - possibly a string or array overflow that is corrupting the shader source

It could be of outdated graphics driver or outdated shader compiler.

For what it’s worth, when the error happens I read the source back with glGetShaderSource and write it to a log file, and it looks OK.

I’m still banging my head against this one. I have noticed that if I don’t call wglShareLists when I create my contexts, the error goes away. However, I’ve been trimming out stuff until there is not much that could be shared: No texture objects, display lists, VBOs, PBOs. The only things left that would be shared, as far as I know, would be shader and program objects.

Here’s a rough outline of the comings and goings of shaders and programs, omitting source, compilation, and render steps:

vertexShader = glCreateShader( GL_VERTEX_SHADER );
program = glCreateProgram();
glAttachShader( program, vertexShader );
fragmentShader = glCreateShader( GL_FRAGMENT_SHADER );
glAttachShader( program, fragmentShader );
glDeleteShader( fragmentShader );
glLinkProgram( program );
glDetachShader( program, fragmentShader );
glDetachShader( program, vertexShader );
glDeleteProgram( program );
glDeleteShader( vertexShader );
// that OpenGL context gets destroyed, and another gets created
vertexShader = glCreateShader( GL_VERTEX_SHADER );
// and the error happens when I try to load and compile this one

Is that sequence valid?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.