Multi-string shaders: compiler diagnostics wrong?

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.

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.

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