PDA

View Full Version : Multi-string shaders: compiler diagnostics wrong?



peeta
03-08-2011, 02:35 AM
I have decided to convert my fragment shaders into smaller modules that can be reused. Therefore I compile each shader from multiple strings (each corresponds to the contents of one file).

If glCompileShader fails, I use glGetShaderInfoLog to get the compiler log that indicates which source lines contain the error. For example, a message like "(0)83 : error ...." indicates there is an error on line 83 in source string 0. This works fine when the complete fragment shader is defined in one string (file), the string index is irrelevant in this case.

However, for shaders composed of multiple strings the string number seems not to be used (always 0) and the line numbering seems to refer to the concatenation of all sources strings.
This is not very useful.

From GLSL specs:
Diagnostic messages returned from compiling a shader must identify both the line number within a string and which source string the message applies to. Source strings are counted sequentially with the first
string being string 0.

Am I missing something or is this a bug?

Thanks in advance for any suggestions.

Alfonse Reinheart
03-08-2011, 09:53 AM
It is my understanding that this is a semi-longstanding NVIDIA compiler bug. Because of they way they compile GLSL shaders using their CG compiler, they lose the information on what source string was used.

There's not much you can do.