The Slang Shading Language(shader-slang.com) |
The Slang Shading Language(shader-slang.com) |
The part about interface-typed values [1] is interesting. They do dynamic dispatch as a fallback when the function is too polymorphic to be be specialized.
In Rust terms it's as if it picks between `dyn` and `impl` automatically. It looks convenient, but also a bit of a non-obvious performance pitfall.
[1] https://shader-slang.com/slang/user-guide/interfaces-generic...
The main difference, with something like Cg, is that now it isn't NVidia only.
Can you elaborate?
- the frontend language is mostly compatible with HLSL, which is the defacto shader authoring standard in the gamedev industry
- it compiles to the 'shader language/bytecode zoo' of the different 3D APIs (since recently even WGSL/WebGPU)
So it lets you author your shaders in a single language that's already accepted by most of the industry, and target the various 3D APIs (D3D, Metal, GL, WebGPU, ...).
It is already possible to build such a tool yourself by glueing together existing libraries (like glslang, SPIRVTools, SPIRVCross and Tint), but it requires quite some work and there are little annoying details like SPIRVCross never supporting WGSL output for some non-technical reasons (so that you need a separate library like Tint just for the SPIRV-to-WGSL conversion). In fact there are tons of such engine-specific shader cross-compilers, all built around the same few Khronos libraries and doing more or less the same thing. Slang looks like it could be the standard replacement for all those custom solutions.
For my own needs, the main thing I'll need to investigate is how easy it is to add engine-specific custom annotations to Slang resources and then output those as part of the reflection information.
WGSL will also always only cover the WebGPU feature set, which is very conservative by definition (e.g. no modern features like mesh shaders, raytracing, etc...). Again, I don't know how much of this Slang provides though.
There's also WESL that aims to extend WGSL with modules and generics:
https://github.com/wgsl-tooling-wg/wesl-spec
and there's Naga project that can translate WGSL to other languages:
We're gonna have a problem here...
Slang had to make a change to its type system[2] to make this work. But they did it, and as a result Slang is appealing as an "apex" language - you can translate from that to anything, and also get advanced features lacking in WebGPU.
Slang provides a standard and open source solution that's better and more featureful than those custom solutions.
But one of their big contributors also worked on Vulkan and Slang/SPIR-V itself if I recall correctly (and works at ARM on GPU drivers), so there's that.
Of course, the f16 extension immediately weakens that, and demonstrates that this situation probably won’t last.
I for example really welcome Slang's support for automatic differentiation.
The guy who created Retroarch, Themaister, seems to work for Valve now, and continues to work on SPIRV-Cross among other things, making gaming on Linux actually viable.
Except texture formats in case of Mali and Exynos w/ RDNA. But QCOM (since quite a while) and Apple (E17+) have a unified set there including BC7 support.
So perhaps split things into profiles, with a more modern profile where the only thing varying is texture format support.
https://vulkan.org/user/pages/09.events/vulkanised-2024/vulk...
Omniverse, Portal RTX, RTX Remix, Source 2 shading infrastructure,
"Migrated" is past tense, not something yet to be planned.