Slang: single-source shading language for cross-API shader authoring
Experience Slang, developed by The Slang Shading Language, a shading language and compiler infrastructure for large-scale shader development. The compiler ingests HLSL and adds generics, interfaces, modular compilation, and built-in automatic differentiation for neural graphics workflows. Its single-source model can generate code for Vulkan, Direct3D, Metal, WebGPU, and CUDA. Professional graphics programmers and engine architects gain cross-API portability and language-level abstractions that reduce duplicated shader variants and improve maintainability.
What does Slang do?
Slang is a modern shading language and compiler infrastructure that extends existing HLSL, adding generics, interfaces, and a module system with visibility controls. It targets single-source authoring, letting developers write one shader that can be emitted for multiple back ends. Key capabilities include a reflection API for runtime binding queries and the Slang.D automatic differentiation feature for producing derivative passes used in differentiable rendering.
Does it affect cross-API workflows?
The tool reduces the need to maintain separate shader variants by compiling one source to many targets, including Vulkan (SPIR-V), Direct3D, Metal, WebGPU, and CUDA. The compiler uses a capability system that verifies feature support per target before code generation, which helps prevent target mismatches. The implementation does not depend on LLVM, so it generates textual shader code and SPIR-V without requiring LLVM binaries.
Is Slang safe to use on production pipelines?
Safety is enforced at compile time through the module visibility controls (public, internal, private) and the capability checks that ensure used features exist on the target. The compiler generates concrete shader code rather than injecting runtime layers, and the reflection API exposes parameter and binding information for runtime validation. Slang.D integrates derivative generation as a language feature, so differentiation is part of the compilation flow rather than an external transform.
Do I need technical knowledge to adopt Slang?
The language targets professional graphics engineers: it is a superset of HLSL, so most HLSL code integrates with little modification, but exploiting generics, interfaces, and automatic differentiation requires shader expertise. In addition, the tool has proven production use in large codebases at companies such as Valve, Adobe, and NVIDIA, indicating it suits teams consolidating complex rendering pipelines and neural graphics experiments.
Slang suits professional graphics teams seeking cross-API shader consolidation
Slang is a capable option for professional graphics programmers who need single-source, cross-API shader authoring. Its language-level abstractions and native automatic differentiation help reduce duplicated shader variants and support neural graphics research. The main trade-off is that teams need existing shader and HLSL knowledge to unlock advanced features. For groups maintaining large shader libraries, Slang provides a practical path to unified shader tooling with that caveat.





