Improved glsl error messages

I run a preprocessor across my glsl source files to resolve includes, but that makes it difficult to report meaningful source information along with error messages.

I now keep a source-mapping for preprocessed glsl source files that allows reporting include-chains and source-lines for errors!

Here is what errors used to look like:

[exception in main_loop from Shader::Shader]: 0(73) : error C0000: syntax error, unexpected '}', expecting ',' or ';' at token "}"

And here is what they look like now!

[exception in main_loop from Shader::Shader]:
C:\...\fly_killer\raw\Shader\material_shim.glsl:4: includes
C:\...\fly_killer\raw\Shader\color.frag.glsl:13: error C0000: syntax error, unexpected '}', expecting ',' or ';' at token "}"

Note: Those file-names are CTRL+Click-able in IDEs.


Comments