105 points · by pjmlp · 6y ago · 115 comments
A text based language would be easier for beginners (since they wouldn't need to install a separate shader compiler) and would avoid sites that need dynamic shaders having to download and run a shader compiler in the browser.
Using SPIR-V bytecode would benefit from a large amount of work put into an existing standard and an open source compiler ecosystem that many companies are already using.
It looks like a decision has been made to accept a text based language, but one that is defined based on SPIR-V semantics and is easily convertible back and forth from SPIR-V. This seems like a great trade off since if it works out it should have the main advantages of both approaches.
That is more or less the official rationale, but it's pretty clear that the real reason is that Apple is organizationally opposed to SPIR-V (and Khronos generally). This is a tough needle to thread, so I'm glad forward progress is being made.
Khronos sat on their hands for years and only moved after Apple shipped Metal and AMD dumped Mantle in their laps (I'll note that Metal came first). SPIR-V is not the be-all end-all of shader programming. Personally I don't believe we should accept some lowest-common-denominator that puts the future of GPU development in the hands of an organization with the track record Khronos has wrt managing OpenGL. That goes double for the future of WebGPU. However I recognize those are just personal opinions and reasonable people may disagree.
To those offering opinions here: If you've never written a renderer or shader can I suggest you write a toy project using both then see if you still have the same opinion?
My enthusiasm for seeing yet another GPU language is very restricted. I simply cannot see the rational arguments in favour of this design. We were so close to having a standard IR for this stuff.
Interesting, what's the successor? I haven't heard of this.
https://webkit.org/blog/9528/webgpu-and-wsl-in-safari/
https://developers.google.com/web/updates/2019/08/get-starte...
https://doc.babylonjs.com/extensions/webgpu
Basically, the Web version of Metal, DirectX12, Vulkan, LibGNM, NVN.
You can see some of that contention here, https://github.com/gpuweb/gpuweb/issues/586 , along with other issues filed.
This is going to be a bumpy ride. I hope it turns out okay.
Sounds like a good thing at first blush, if shaders can be then decompiled to this in debuggers etc.
Such standards politicking, creation of unneeded entities/standards is basically a "tech sin". They are sinners!
But to generate SPIR-V you still need a high level language. So is this useful for it?
Besides, if JS interop were the driving concern, 64-bit doubles would be the default, since that's what JS numbers are.
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
BigInt is now available on Firefox and Chrome (with JSC/Safari support in the works). That gives arbitrarily-large integers (with the JIT deciding the best size.
None of the mobile GPU vendors (Apple, ARM Mali, Qualcomm, PVR, BroadCom) support it. You can see that here, where the only vendors supporting shaderFloat64 in Vulkan are desktop GPUs. http://vulkan.gpuinfo.org/listdevicescoverage.php?feature=sh...
Edit: and most of the rest are Intel.
https://webkit.org/blog/8482/web-high-level-shading-language...