glslang
glslang copied to clipboard
[glslangValidator] Column of error report always zero
Installed the MSYS2 package mingw-w64-x86_64-glslang
in the MinGW64 environment to allow VSCode to lint Shaders via https://github.com/hsimpson/vscode-glsllint
I created GLSL errors and ran glslangValidator project.vert project.frag
in the Mingw64 environment of MSYS2. It outputs the column of an error as always zero. See screenshot of the Windows Terminal at the very bottom.
Sample output
$ glslangValidator project.vert project.frag
project.vert
ERROR: 0:4: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 1 compilation errors. No code generated.
project.frag
ERROR: 0:10: 'normze' : no matching overloaded function found
ERROR: 0:10: '=' : cannot convert from ' const float' to ' temp highp 3-component vector of float'
ERROR: 0:10: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.
glslangValidator --version
Glslang Version: 11:12.1.0
ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 12.1.0
GLSL Version: 4.60 glslang Khronos. 12.1.0
SPIR-V Version 0x00010600, Revision 1
GLSL.std.450 Version 100, Revision 1
Khronos Tool ID 8
SPIR-V Generator Version 11
GL_KHR_vulkan_glsl version 100
ARB_GL_gl_spirv version 100
This results in the linter always displaying error squiggles at the first token of the line, which is visually unpleasing and an extra workflow step of mouse-overing that squiggles to understand what's actually going on.
This is unfortunately a longstanding issue with the parser in glslang. By the time some errors are generated, some of the column information has already been lost. This is definitely a bug that we need to fix though.