Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing GLSL error messages

Tags:

opengl

glsl

When I compile a broken GLSL shader then the NVidia driver gives me error messages like this:

0(102) : error C1008: undefined variable "vec"

I know the number inside the brackets is the line number. I wonder what the 0 at the beginning of the error message means. I hoped it would be the index in the sources array which is passed to glShaderSource but that's not the case. It's always 0. Does someone know what this first number means?

And is there some official standard for the error message format so I'm able to parse the line number from it or do other OpenGL implementations use other formats? I only have access to NVidia hardware so I can't check how the error messages are looking like when using AMD or Intel hardware.

like image 960
kayahr Avatar asked Jul 30 '14 18:07

kayahr


1 Answers

It is a file name, which you can't specify via GL API, so it is 0.

You can set it with #line num filename preprocessor command right within shader code. Could be helpful if your shader is constructed from many files with #includes via external preprocessor (before passing source to GL).

There is no standard for messages. Everyone doing whatever they want.

like image 180
keltar Avatar answered Oct 17 '22 04:10

keltar