This extension supports linting of GLS (OpenGL Shading Language). It uses the OpenGL and OpenGL ES shader validator Every shader type which is supported by the glslangValidator can be validated.
- Linting GLSL Shader files
- Supporting glslify
- Linting Shader code in string literals
- Visual Studio Code 1.34.0
- The Shader languages support for VS Code extension
- The OpenGL and OpenGL ES shader validator
This extension contributes the following settings:
glsllint.glslangValidatorPath
: The path to the glslangValidator executable, let it empty when have it in $PATHglsllint.glslangValidatorArgs
: Arguments for the glslangValidator executableglsllint.additionalStageAssociations
: Additonal file extension -> glslangValidator stage mapping. Format:".EXT": "STAGEID"
, example:supportedLangsWithStringLiterals
: VSCode language id"s to support for string literal validation
"glsllint.additionalStageAssociations": {
".fs": "frag",
".vs": "vert"
}
Built-in mappings:
{
".vert": "vert", // for a vertex shader
".vs": "vert", // for a vertex shader
".frag": "frag", // for a fragment shader
".fs": "frag", // for a fragment shader
".gs": "geom", // for a geometry shader
".geom": "geom", // for a geometry shader
".comp": "comp", // for a compute shader
".tesc": "tesc", // for a tessellation control shader
".tese": "tese", // for a tessellation evaluation shader
".rgen": "rgen", // for a ray generation shader
".rint": "rint", // for a ray intersection shader
".rahit": "rahit", // for a ray any hit shader
".rchit": "rchit", // for a ray closest shader
".rmiss": "rmiss", // for a ray miss shader
".rcall": "rcall", // for a ray callable shader
".mesh": "mesh", // for a mesh shader
".task": "task" // for a task shader
}
Available stages:
["vert", "frag", "geom", "comp", "tesc", "tese", "rgen", "rint", "rahit", "rchit", "rmiss", "rcall", "mesh", "task"]
- This is supported in .js, .jsx, .ts, .tsx
- Just write the shader code in string literals either single/double qoutes or backticks (no expression interpolation yet!)
- The stage is tried to detected automatically, if this fails then just put a #pragma into the shader string literal code:
#pragma vscode_glsllint_stage : STAGE
Example:
const shader_code = `
#version 460 core
#pragma vscode_glsllint_stage : frag //pragma to set STAGE to 'frag'
out vec4 FragColor;
in vec4 color;
void main(void) {
FragColor = color;
}
`;