SYSTEM Cited by 1 source
naga¶
naga is the shader translation library used by the Rust wgpu
project (and by other WebGPU tooling) to parse and emit shaders in
multiple formats. It's the de facto open-source pivot for converting
between shader languages in the WebGPU ecosystem.
Source: github.com/gfx-rs/wgpu/tree/trunk/naga
(lives inside the wgpu repo).
Supported formats¶
Can both parse and emit variants of:
- WGSL — the WebGPU Shading Language.
- GLSL — OpenGL / WebGL shading language.
- HLSL — D3D shading language.
- MSL — Metal shading language.
- SPIR-V — Vulkan's bytecode IR.
(Not every combination is fully supported; the wgpu project's
release notes track capability deltas.)
Role in a shader pipeline¶
naga is typically the translator step inside a larger shader translation pipeline — the application maintains shaders in one language and feeds them to naga to emit whatever target language the runtime backend needs.
Limitations (as of Figma's adoption)¶
The 2026-04-21 Figma rendering post notes naga does not support the older WebGL-1 GLSL dialect Figma originally wrote its shaders in. Figma's workaround: a custom preprocessor that parses the older GLSL and rewrites it to a newer GLSL dialect before handing it to naga. This is a common shape — naga is the IR-level translator, the application owns language-level upgrades upstream.
Seen in¶
- sources/2026-04-21-figma-rendering-powered-by-webgpu — Figma's GLSL → WGSL translation uses naga as the final conversion stage, preceded by a custom in-house preprocessor that normalizes older WebGL-1 GLSL to a naga-acceptable GLSL dialect.