Khronos Consortium Unveils Open Slang Shader Compiler

NVIDIA has officially passed the language of the shaders, known as Slang, and its associated compiler under the protection of the Khronos consortium, a group that focuses on developing graphic standards. This move is aimed at expanding the development of the Slang project and attracting new participants. Slang was created as a collaborative effort between NVIDIA and several leading US universities, including Carnegie-Mellon University, Stanford University, Massachusetts Institute of Technology, University of California at San Diego, and University of Washington. The compiler code is written in C++ and is open source under the Apache 2.0 license, with support for Linux, Windows, MacOS, and WebAssembly platforms.

The Slang language syntax closely resembles HLSL, which is used in Direct3D, and is known for its support for modules, domain-specific languages, and interfaces that aim to simplify the development of large code bases while optimizing performance for real-time applications. It also includes features like support for extensions for using graphic shaders in machine learning calculations and automatic differentiation.

The compiler follows the paradigm of “Write the shader once, run it anywhere,” allowing shaders written in Slang, HLSL, and GLSL to be converted into executable code for various graphic APIs such as Direct3D 11/12, Vulkan, Metal, OpenGL, WebGPU, OptiX C++, and CUDA C++. The compiler can also generate text source code in C++, MSL (Metal Shading Language), and CUDA while preserving the original identifiers and structure. It can also seamlessly compile existing HLSL code without significant modifications.

In addition to the Slang language, the compiler supports the compilation of HLSL and GLSL code with minimal changes, offering flexibility in generating code that leverages the latest features of Direct3D and Vulkan specifications. Users can customize parameters during compilation to optimize the generated code according to their needs. Notably, Valve was able to compile all Source 2 HLSL shaders in Slang with only minor code adjustments.

For GLSL compilation, a separate module is available to support most of the language’s syntax elements. Overall, the integration of Slang and its compiler under the Khronos consortium is expected to enhance the development and adoption of this powerful tool for graphics programming.

/Reports, release notes, official announcements.