vscode-glsllint
vscode-glsllint copied to clipboard
`gl_VertexIndex` not recognized as a builtin
I was following this vulkan tutorial, and in the sample shader code they are using gl_VertexIndex builtin global. I was surprized that glsl lint does not recognize this global, but upon looking it up in the GLSL specification I did find no such global.
When I supstituted gl_VertexIndex for gl_VertexID, as per spec, glslc complained:
glslc .\shaders\shader.vert -o assets/shader-vert.spv
.\shaders\shader.vert:18: error: 'gl_VertexID' : undeclared identifier (Did you mean gl_VertexIndex?)
.\shaders\shader.vert:18: error: '[]' : scalar integer expression required
.\shaders\shader.vert:19: error: '[]' : scalar integer expression required
3 errors generated.
Relevant line of the code (line 18):
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
So... whatever I do, I get a complaint from either the linter, that doesn't recognize gl_VertexIndex or from glslc that doesn't recognize gl_VertexID. It seems like gl_VertexIndex should be recognized by this linter, as it is recognized by tools that produce actual spirv code.