At least with WebGL you had C.
Without SPIR-V support this spec is just another tire on the fire that is the modern web.
At least with WebGL you had C.
Without SPIR-V support this spec is just another tire on the fire that is the modern web.
Huh? WebGL uses two (incompatible to each other) versions of GLSL, not C.
The topic of the WebGPU shading language has been discussed to death already, with no new insights brought to the discussion for a very long time.
If you have a SPIRV based shader pipeline, you can simply translate SPIRV to WGSL in an offline compilation step (and to get to SPIRV in the first place, you need an offline compilation step anyway).
If you use one of the native WebGPU libraries outside the browser, you can load SPIRV directly.
But is that language actually bad, or is it just not your favourite language?
What don't you like about it?
C++ is a safer, more expressive superset of C89.
Also those dialects aren't C++, they are based in C++, which isn't the same.
AFAIK: It's a mostly-but-not-100% textual equivalent of SPIR-V that, syntax-wise, is a weird hodgepodge of all the other shader languages. At the same time, it's rare it'll be actually written by hand by humans - it'll mostly be generated from another language at application build time, and then it'll have to be compiled back into bytecode by the browser, which feels like really redundant work.
Further, it's often said that the main reason the language exists in the first place is because Apple veto'd SPIR-V due to their legal disputes with Khronos. I'm assuming that's why the comment above called it "ad-hoc".
WebGL's shading language was not C.
http://kvark.github.io/spirv/2021/05/01/spirv-horrors.html
WebGPU would most likely have to create its own subset of SPIRV anyway to fulfill the additional safety and validation requirements of the web platform.
Wasn't Apple the originators of the propsal? https://webkit.org/blog/7380/next-generation-3d-graphics-on-... https://webkit.org/wp-content/uploads/webgpu-api-proposal.ht...
Also the original 3D API proposal from Apple was essentially a 1:1 Javascript shim for Metal, which looked quite different from WebGPU.
Apple also originally proposed a custom shading language which looked like - but wasn't quite - HLSL. Compared to that, WGSL is the saner solution (because translation from and to SPIRV is relatively straightforward).