WebGPU Prototype and Demos
webkit.org
webkit.org
https://www.khronos.org/3dportability
In the meantime, Mozilla has proposed its own low-level web graphics API that the other browser vendors can back:
https://github.com/KhronosGroup/WebGLNext-Proposals/tree/mas...
Submissions so far include:
Apple's WebGPU proposal: https://github.com/gpuweb/proposals/tree/master/WebGPU-Apple
Google's NXT proposal: https://github.com/gpuweb/nxt-chromium
We expect Mozilla to be submitting their proposal to gpuweb soon too.
Khronos only has two of four browser vendors on board. It remains to be seen what will happen, but I doubt it will lead to a cross-browser standard. Browsers are more relevant for web standards than 3d graphics drivers.
Just watch them rubberstamp a web spec for DRM...
Vulcan cannot be implemented on top of DirectX12 or Metal.
So it's never going to happen.
People said the same about WebGL. Today Microsoft is a member of Khronos.
Vulkan can be implemented on anything. It's just a matter of performance. And since Microsoft defines DirectX, they can add any features they need to improve the performance of a Vulkan implementation if they so choose.
Also Windows GPU drivers already support Vulkan (all the way back to the 600 series in Nvidia's case IIRC), so I don't see why that would be a technical deal breaker. And it definitely won't be a "political" deal breaker for Firefox or Chromium on Windows.
Ehh I don't believe this for a second; somewhat more correctly, "Vulcan may not be able to be efficiently implemented on top of other APIs."
I also believe that Apple has a vested interest in keeping Metal around, so of course they're going to push hard and fast for their standard...
We're planning to post new Compute demos as soon as this makes it into Safari Technology Preview.
https://github.com/nraynaud/webgcode/blob/gh-pages/webapp/cn...
Three.JS spends a lot of time in just housekeeping operations, and it is complex in part because of that.
Using latest WebKit Nightly, after enabling WebGPU in Experimental Features, I'm getting:
TypeError: null is not an object (evaluating 'gpu.createCommandQueue')
I'm guessing it's because I'm on a 2011 MBP that Metal doesn't support, so WebGPU won't work either. Or is it something else?In any case, the error handling should be improved to detect and handle the case when canvas.getContext("webgpu") returns null.
Edit: Here are some of the source files, they call into `shared.js`
https://webkit.org/demos/webgpu/hello.js
https://webkit.org/demos/webgpu/2d.js
Since this is a prototype, they're just going with the shader language they prefer for now.
[0]https://webkit.org/blog/7380/next-generation-3d-graphics-on-...
SPIR-V is known usable as a shader format and can be used directly with some APIs (which then translate into the native format for the GPU at some level), but WebAssembly has no such proof of concept.
So on these two paths, the big challenges would be:
- For WebAssembly: translate into an underlying format understood by the driver (could be SPIR-V or directly to something closer to the metal); and possibly add some primitives, e.g. for SIMD
- For SPIR-V: invent a set of restrictions plus an efficient runtime validation mechanism to guarantee memory safety, plus translators on systems that don't natively support SPIR-V. (Even Web-safe SPIR-V to Vulkan-native SPIR-V might need translation, e.g. to remove bounds checks that have to be there to pass validation but that can be proven to be safely removable for efficiency.)
Either way you need to produce a toolchain to produce the special format as well, a vanilla SPIR-V toolchain won't necessarily guarantee you can output web-safe SPIR-V. So in fact you won't be able to just use the same shader binary.
An additional consideration: given the approach of modern GPU APIs, you're very likely to want to deal with the same data structures in the same memory layout from both your CPU code and your GPU code. It could be convenient to arrange this by targeting WebAssembly for both your CPU code and your GPU code.
That said, we're very very early in exploring this question.
https://github.com/KhronosGroup/WebGLNext-Proposals/tree/mas...
Anyways, the API in the samples looks strikingly similar to Metal.