But the main problem is not the shader language itself, but the binding model. It's a pretty big mess, and things change as you go in the direction of bindless (descriptor indexing). There are a few approaches to this, certainly reinventing WebGPU is one. Another intriguing approach is blade[1] by Dzmitry Malyshau.
I wish the authors well, but this is a hard road, especially if the goal is to enable more advanced features including compute.
Project authors, please don’t do this. It’s impossible to get a two-minute overview from a video. Browsing through tutorials and documentation is much more efficient.
If you really have never written anything about the project except conference slides, then at least put up that deck in addition to the YouTube link. Clicking through slides is not great, but it’s still a better browsing experience than seeking at random in a video.
What I'd like to know is why game developers can't provide a service / daemon that will perform shader compilation when shaders or drivers change so I don't need to waste 25 minutes of my precious gaming time when I load CoD and see they need compiling. My computer has been sitting there unused all week. Steam was smart enough to download game updates in that time, why isn't your game smart enough to recompile my shaders on an idle machine?
Also - and this may sound a little bonkers - some renderers are so complex and flexible that the actual set of required shaders is only discovered when it tries to render a frame and the full set of possible shader configuration permutations is so large that compiling them all in advance is pointless or borderline infeasible.
The main issue is that gpr allocation is static and worse case. So on the majority of hardware you hose your occupancy.
We take a slightly different approach: we don't do any up-front in the launcher but do as much as possible on the level loading screen; it's not perfect though: due to the way some legacy code works we can't always anticipate all permutations ahead of time so you get the occasional micro-stutter as missing shaders are sent to the driver.
You can get away with being lazier with modern drivers because they will cache the compiled result for you (if you don't cache the pipeline state object yourself in DirectX 12) but on older DirectX drivers for Intel IGPs there wasn't a cache at all so the first 30 seconds after loading into a level would be very busy.
With the wgpu and Google dawn implementations, the API isn't actually tied to the Web, and can be used in native applications.
Had WebAssembly already been there without being forced to go through JavaScript for Web APIs, and most likely they would be C APIs where everyone and their dog are writing bindings insteads.
Now, it is pretty much a ChromeOS only API still, and only available across macOS, Android and Windows.
Safari and Firefox have it as preview, and who knows when it will ever it stable at a scale that doesn't require "Works best on Chrome" banners.
Support on GNU/Linux, even from Chrome, is pretty much not there, at least for something to use in production.
And then we have the whole drama that after 15 years, there are still no usable developer tools on browsers for 3D debugging, one is forced to either guess what rendering calls are from the browser or which are from the application, GPU printf debugging, or having a native version that can be plugged into Renderdoc or similar.
With the switch to Chromium as browser engine, I don't think that Microsoft has any people working on WebGPU.
shmerl•1mo ago
GPU APIs landscape is stuck in the dumb NIH mentality of the '90s because stuck up lock-in proponents refuse to support Vulkan on their walled gardens.
The only recent somewhat positive development about that was MS deciding to use SPIR-V and eventually ditch DXIL. A small step in the right direction, but not really enough yet.
alexk101•1mo ago
raphlinus•1mo ago
gmueckl•1mo ago
shmerl•1mo ago
https://github.com/Rust-GPU/rust-gpu/
raphlinus•1mo ago
By all means if you're doing a game (or another app with similar build requirements), figure out a shader precompilation pipeline so you're able to compile down to the lowest portable IR for each target, and ship that in your app bundle. Slang is meant for that, and this pipeline will almost certainly contain other tools written in C++ or even without source available (DXC, the Apple shader compiler tools, etc).
There are two main use cases where we want different pieces of shaders to come from different sources of truth, and link them together downstream. One is integrating samplers for (vello_hybrid) sparse strip textures so those can be combined with user paint sources in the user's 2D or 3D app. The other is that we're trying to make the renderer more modular so we have separate libraries for color space conversion and image filters (blur etc). To get maximal performance, you don't want to write out the blur result to a full-resolution texture, but rather have a function that can sample from an intermediate result. See [1] for more context and discussion of that point.
Stitching together these separate pieces of shader is a major potential source of developer friction. There is a happy path in the Rust ecosystem, albeit with some compromises, which is to fully embrace WGSL as the source of truth. The pieces can be combined with string-pasting, though we're looking at WESL as a more systematic approach. With WGSL, you can either do all your shader compilation at runtime (using wgpu for native), or do a build.rs script invoking naga to precompile. See [2] for the main PR that implements the latter in vello_hybrid. In the former case, you can even have hot reloading of shaders; implemented in Vello main but not (yet) vello_hybrid.
To get the same quality of developer experience with Slang, you'd need an implementation in Rust. I think this would be a good thing for Slang.
I've consistently underestimated the importance of developer friction in the past. As a contrast, we're also doing a CPU-only version of Vello now, and it's absolutely night and day, both for development velocity and attracting users. I think it's possible the GPU world gets better, but at the moment it's quite painful. I personally believe doing a Rust implementation of the Slang compiler would be an important step in the right direction, and is worth funding. Whether the rest of the world agrees with me, we'll see.
[1]: https://xi.zulipchat.com/#narrow/channel/197075-vello/topic/...
[2]: https://github.com/linebender/vello/pull/1011
gmueckl•1mo ago
Rewriting the whole slang pipeline in rust is a fool's errand.
coffeeaddict1•1mo ago
> To get the same quality of developer experience with Slang, you'd need an implementation in Rust. I think this would be a good thing for Slang.
WESL has the opposite problem: it doesn't have a C++ implementation. IMO, the graphics world will largely remain C++ friendly for the forseeable future, so if an effort like WESL wants to succeed, they will need to provide a C++ implementation (even more so than the need for Slang to provide a Rust one).
raphlinus•1mo ago
flohofwoe•1mo ago
(fwiw I've been considering to write the custom parts of the Sokol shader compiler in Zig instead of C++, but that's just a couple of thousand lines of glue code on top of massive C++ libraries (SPIRVTools, SPIRVCross, glslang and Tint), and those C++ APIs are terrible to work with from non-C++ languages.
As far as developer friction for integration into asset workflows goes, that's exactly where I would prefer Zig over Rust (but a simple build.zig already goes most of the way without porting any code to Zig).
pjmlp•1mo ago
Khronos has been quite vocal that there is no further development on GLSL, they see that as a community effort, they only provide SPIR-V.
This is how vendor specific tooling eventually wins out, they kind of got lucky AMD decided to offer Mantle as basis for Vulkan, LunarG is doing the SDK, now NVidia contributed slang, otherwise they would still be arguing about OpenGL vNext.
socalgal2•1mo ago
socalgal2•1mo ago
I for one am glad Vulkan is not "it"
Also, it's not even portable on Windows. Sure, if you're making a game, you can expect your gamer audiences have it installed. If you're making an app and you expect businesses to use you it you'll find neither OpenGL nor Vulkan work on most business class machines view Remote Desktop. The point being, it's not portable by design nor in actuality
viraptor•1mo ago
pjmlp•1mo ago
How do you think those Azure VMs for game developers work?
https://learn.microsoft.com/en-us/azure/virtual-desktop/grap...
viraptor•1mo ago
pjmlp•1mo ago
https://www.khronos.org/news/permalink/nvidia-provides-openg...
Also on desktop side, Windows on ARM, and UWP don't have that great support for anything beyond DirectX.
There is a compatibility pack and another one Angle based, but they haven't been updated in a while.
shmerl•1mo ago
flohofwoe•1mo ago
There is no design vision, instead it's a cobbled together mess of adhoc vendor extensions that are eventually promoted to 'core'.