View Full Version : Intermittent shader compile error with unhelpful info log

James W. Walker
01-08-2014, 07:32 PM
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?

01-08-2014, 08:30 PM
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

01-09-2014, 05:13 AM
It could be of outdated graphics driver or outdated shader compiler.

James W. Walker
01-09-2014, 11:09 AM
possibly a string or array overflow that is corrupting the shader source

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.

James W. Walker
02-27-2014, 08:20 PM
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?