在 VsCode 中设置 GLSLValidatorPath

7 glsl visual-studio-code

我开始阅读着色器的书,我想在 VsCode 中开发一些东西。

我安装了这些扩展:

  • GLSL 棉绒
  • glsl-canvas
  • Shaderc GLSL Linter
  • VS Code 的着色器语言支持
  • glsl-文字

当我保存*.frag文件时,我得到:

GLSL Lint: config.glslangValidatorPath is empty, please set it to the executable
Run Code Online (Sandbox Code Playgroud)

Shaderc Lint: config.glslcPath is empty, please set it to the executable
Run Code Online (Sandbox Code Playgroud)

我读到我必须使用glslang设置 GLSLValidator 路径,但我不明白如何。

有人能帮我吗?

小智 10

VSCode 插件GLSL lint不附带着色器文件验证器,因此您必须自己下载并在 VSCode 中设置路径。

您可以在此处为您的系统获取构建的二进制文件。只需将其下载并解压缩到系统上的某个位置,然后在 VSCode 设置中设置路径:

  • 在 Windows/Linux 上 - 文件 > 首选项 > 设置
  • 在 macOS 上 - 代码 > 首选项 > 设置

并将该行添加 config.glslangValidatorPath: /your/path/to/glslangbinary到其中。

希望它有帮助。

最好的,菲利普

  • 之后应该发生什么?我没有得到任何 linting,并且 vscode 抱怨没有为 `glsl` 文件安装格式化程序。 (2认同)

小智 6

按Ctrl+P,输入“settings.json”并回车,然后添加

"glsllint.glslangValidatorPath": "C:\\Path\\Goes\\Here\\glslangValidator.exe"

并保存。

这对我有用(使用 Windows 10 x64 和 VS Code 1.52.1)。