Comment

Comment by raphlinus

This is still in transition, and the full story is complicated.

The official shader language for WebGPU is WGSL, and that will almost certainly be the only language supported for web deployment. Originally this was going to be a textual representation that had exactly the same semantics ("bijective") as SPIR-V, but that's been diverging a bit[1]. Only very recently have atomics been added to the spec, and implementations are still catching up.

Because WGSL is still under construction, for native deployment, wgpu supports SPIR-V shaders as well. On Vulkan, those are passed pretty much straight through to the GPU driver (with some validation). On DX12 and Metal, those are translated into HLSL and MSL, respectively. Until recently, in wgpu, all those translations were handled by spirv-cross. More recently, the new naga crate is doing those translations. Again, this is under construction and not everything works yet.

[1]: https://kvark.github.io/spirv/2021/05/01/spirv-horrors.html

parent raphlinus 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton