Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>modkit bgfx shadersNew to Visual Studio Code? Get it now.
modkit bgfx shaders

modkit bgfx shaders

SeemsIndie

|
1 install
| (0) | Free
Syntax highlighting, snippets, IntelliSense and shaderc diagnostics for bgfx/modkit shaders (.sc, .def.sc, .sh).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

modkit bgfx shaders

First-class editor support for bgfx/modkit shaders in VS Code: syntax highlighting, snippets, IntelliSense, and inline shaderc diagnostics for .sc, .def.sc, and bgfx .sh include files.

Features

  • Syntax highlighting
    • .sc — vertex / fragment / compute shaders ($input/$output, SAMPLER2D(...), GLSL types, bgfx & modkit functions, gl_* / u_* built-ins, the C preprocessor).
    • .def.sc — varying / attribute definitions with their : SEMANTIC bindings and defaults.
    • bgfx .sh — shader includes (header guards, #define, mk* helpers).
  • Snippets — vertex/fragment/compute skeletons, SAMPLER2D, uniform, include guards, and varying templates.
  • Hover & completion — documentation for bgfx built-ins (mul, texture2DLod, SAMPLER2D, u_modelViewProj, …) and modkit helpers (mkD_GGX, mkF_Schlick, mkTonemapApply, …), scraped from the engine's shaders/include/*.sh.
  • Navigation — #include "…" go-to-definition and a document-symbol outline.
  • Diagnostics — compile the current shader with your local shaderc and see errors inline (lint-on-save, a command, and a shaderc task with a $shaderc problem matcher).

The .sh problem (and how this handles it)

bgfx uses .sh for shader headers, but .sh normally means shell script. To avoid hijacking real shell scripts, this extension does not claim .sh globally. Instead it uses two complementary mechanisms:

  1. Content detection — a .sh file whose first non-blank line looks like a shader header (#ifndef, #include, #define, $input, …) is treated as a bgfx shader. Shell scripts start with #!/bin/sh, which is deliberately not matched.
  2. Scoped association — a default files.associations maps .sh under **/shaders/**, **/shaders/include/**, and **/deps/bgfx/** to the shader language. Shell scripts elsewhere stay shell.

You can always override per workspace:

// .vscode/settings.json
"files.associations": { "**/my/shaders/**/*.sh": "bgfx-shader" }

Note on .sc: the .sc extension is also used by Scala (Metals) and SuperCollider. Inside a modkit workspace this extension's association wins; if you mix ecosystems, pin the language with files.associations.

shaderc settings

Setting Default Description
modkit.shaderc.path "" Path to shaderc. Empty = auto-find tools/bin/shaderc, then PATH.
modkit.shaderc.platform auto --platform (auto-detected from the host OS).
modkit.shaderc.profile spirv --profile used for validation.
modkit.shaderc.includeDirs [] Extra -i dirs (${workspaceFolder} supported). Empty = auto.
modkit.shaderc.varyingDef auto auto derives varying_<name>.def.sc; or set an explicit path.
modkit.lint.enable true Surface shaderc errors as diagnostics.
modkit.lint.onSave true Re-run on save.

Commands

  • modkit: Compile Current Shader (shaderc) — validates the active .sc and reports success/errors.
  • modkit: Check Current Shader for Errors — silent validation; publishes diagnostics only.

Maintaining the built-in docs

Hover/completion data lives in data/builtins.json. Regenerate it from a modkit checkout:

npm run gen:builtins -- /path/to/modkit/shaders/include

Development

npm install
npm run build      # bundle to dist/extension.js
npm test           # type-check and run local unit tests
npm run watch      # incremental rebuilds
npm run package    # produce a .vsix (vsce)

Press F5 in VS Code to launch an Extension Development Host.

License

MIT — see LICENSE.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft