How to get the line number of a GLSL compiler error

I would like to know if there is a general way to get the line number of a GLSL compiler error. At first I thought I could parse glGetInfoLogARB, but then I read that its output is not standardized.

+3


source to share


1 answer


It is not standardized, but among individual vendors it is more or less.

For example, NVIDIA tends to display messages that reference the following lines:

<Shader String Index>:<Line Number>(<Character Number>): <warning|error|...>:

      



Not a perfect approach you could take if you needed to parse the info log for line numbers is line-based input preprocessing GL_VENDOR

. The information journal is usually used to interpret people, so I'm not sure how much effort it really costs.

Talking about non-standard things, it glGetInfoLogARB (...)

is archaic (it only exists in GL_ARB_shader_objects

).

When GLSL started working in GL 2.0, the function was split into glGetShaderInfoLog (...)

and glGetProgramInfoLog (...)

for compiler and linker information respectively. For portability, you shouldn't use the old ARB extension; target GL 2.0 as the minimum version and use main GLSL instead.

+5


source







All Articles