by pickdenis · 6y ago · 0 comments
Or even whole sites! Maybe it's the long-sought revenue model for journalism ;-)
Not really the same though, the purpose of WebGPU is exposing a sandboxed GPU hardware directly to the web, not exposing just a graphical API like WebGL exposes OpenGL variants.
It currently is looking at being SPIR-V compatible. As both Vulkan and OpenCL supports SPIR-V we might use WebGPU for GPGPU in the future.
sure there will be workarounds like building your own DSL to spriv compiler and including it on your page but I'd argue a standard high level text format leads to more collaboration / standardization / interop / knowledge sharing
I'm sure others would prefer the web had just started as sandboxed assembly
I think if you want to compile shaders from source, you are free to include your favorite transpiler as WebAssembly, like glslang. That's currently what I'm doing for my WebGPU prototype project.
The thing is, a text format is the worst format for interoperability between consoles, desktop and web. Having something like SPIR-V is more akin to LLVM for programming languages. LLVM doesn't preclude the existence of C, C++, etc, but it strictly benefits the ecosystem (which now includes Rust, Haskell, etc). In the same way, I see SPIR-V having the same potential as the interchange format for all the major IHVs.
Human readability of the shader shipped from the page is a different argument, and it can have some merit, but the same could be argued against using WebAssembly for instance which is not very human readable in comparison with JavaScript. I don't think it's a strong argument against using it.
An advantage of SPIR-V is that unlike both text-based programming languages and traditional machine code, SPIR-V is very very easy for machines to read and write — even for JS code — and it has a structure designed to be (mostly) cleanly extensible.
WebGL1 : DirectX9 :: WebGPU : DirectX12
Or
WebGL1 : OpenGLES1 :: WebGPU : Vulkan