Khronos Group adopts the Slang shading language
khronos.org
khronos.org
However, I've already run into the problem that, while it's a clever name for a shading language, it's a terrible name when trying to find anything in a search engine.
Making sure that devs can search and find answers quickly is an extremely important aspect of developer ergonomics, and I hope this issue isn't reflected in other subtle design flaws throughout the project.
A much less clever name that isn't already a common English word is always preferable. Call it xyzSL or something boring like that, which is unique and will always return meaningful search results.
It's not just because Slang is new. If it was called xyzSL then right now I'd expect "normal maps xyzSL" to return at least a few results.
> - Interfaces and generics provide first-class alternative to hacky preprocessor-based or string-pasting shader specialization. Preprocessor hacks can be replaced with a well-understood language feature already used in Rust, Swift, C#, Java, and more.
> - Automatic differentiation greatly simplifies the implementation of learning-based techniques in shaders. Slang supports automatically generating both forward derivative and backward derivative propagation functions from forward computation code.
> - Slang supports a first class module system, which enables true separate compilation and semantic checking of shader code.
I am a total beginner at shaders, but when I've dabbled in them they are mostly surrounded by string concatenation and a variety of wild macros, so it's cool to see a "typescript for shaders" with such broad support, both of vendors, and of target shader languages.
[1]: https://shader-slang.com/slang/user-guide/introduction.html
YouTube videos on backpropagation might explain it better
(It's not particularly magical from a mathematic point of view, it's basically just an application of the chain rule, but it's something where you either need a fairly complex library or language support to implement, because you effectively need to take the function(s) you want the derivative of and transform them into a different set of calculations)
At first I thought it was S-lang used in jed.
The Slang Shading Language - https://news.ycombinator.com/item?id=42244472 - Nov 2024 (44 comments)
you either use like a game engine that generates all the platform specific gpu code and shaders for you, or you can take advantage of writing all the different gpu specific and shader code yourself (bc you need specific features or can make it faster or some such), i can’t really imagine something in between tbh
and a generalised tool like this is destined to not fit platform specific features that well; for example, i couldn’t find any mention of an interface to use tensor cores, and automatic differentiation w/o a relatively complex expression optimiser is kinda useless for machine learning, where tensor wrt tensor derivatives' dimensionality explodes w/o using an expression optimiser…
it’s kind of the same story as w/ cross platform gpu frameworks: they’re destined to just kind of do everything but badly bc different platforms have different architectures that you can’t map to w/ a single api… imo the best solution remains to have domain specific solutions that generate separate cross platform code solely in that domain...
The intended user _is_ game engines, and it's a damn good contender in its space. The average pipeline for shader translation right now is HLSL being fed into DXC to generate DXIL for D3D and SPIR-V for Vulkan. That SPIR-V will also get fed into another transpiler (SPIRV-Cross) to spit out shaders for other platforms like Metal. This pipeline is quite fragile, especially in the SPIRV-Cross step, and DXC is on life support with Microsoft integrating a DXIL target into Clang so they don't have to develop a pseudo-cpp frontend anymore.
is this supposed to take the place as the officially blessed frontend language for SPIR-V? or is this just another standard attempting to replace the other standards (insert XKCD)?
It's kind of both. It can generate High level shaders as well as SPIRV, according to the doc.
I interpret this announcement as more about the governance of the open source project than brand new anything. The project has been around for years and there are even some SIGGRAPH papers in this thing.
Slang the compiler is also very cool because it can directly target multiple different languages. Slang can compile to (among other things) HLSL, GLSL, SPIR-V, MSL and WGSL directly. The next closest game in town is DXC which compiles HLSL to DXIL or SPIR-V, with most game engines using a soup of SPIRV-Cross and other translators to convert the SPIR-V to other languages like MSL.
It's shaping up to be a solid choice for a single-source shader pipeline. Especially if you care about being portable to MSL as the current 'state of the art' for turning HLSL into MSL is a fragile chain of several tools.
It's not the first to do so though, Metal's shading language is C++14 with some restrictions and some enhancements (which IMHO is overkill though, except for the ability to stamp out different specializations from the same template code).