3 ms·
I've busted my ass on webgl a few times, and I am not really seeing how WebGPU is a substantially better API looking at the samples in the wild: https://webkit
by bob1029 5y ago
I've busted my ass on webgl a few times, and I am not really seeing how WebGPU is a substantially better API looking at the samples in the wild:
https://webkit.org/demos/webgpu/scripts/hello-triangle.js https://webkit.org/demos/webgpu/scripts/hello-triangle.js
The advantages of WebGPU vs WebGL probably make sense to experts in this area, but I still find most of it to be completely impenetrable at first glance as a relative novice.
- mrpinc 5y agoI think one of the big changes will allow for async gpu uploads. Currently those happen on the main thread and lock UI.
- whatever_dude 5y agoWebGPU is better in many dimensions, but also worse in others people might care about. More appropriately, in this case, WebGPU is in many ways less approachable for novices. One of the expected advantages of WebGPU is exposing the inner workings of the hardware's GPU support in a more explicit manner. This leads to really verbose code. This is similar to API movements seen in DirectX, Vulkan, and Metal. WebGL was never exactly easy to read either, but you could get started more easily. It tried being something in-betweenm though, and ended up never being the best at either providing explicit behavior, nor being friendly. The idea of WebGPU going forward is that it will make it easier for other libraries to use it in a more deterministic fashion. If you know how the metal works, you'll be able to optimize the sh*t out of it. But for novices, you'll end up using some library or engine that abstracts away a lot of the hardcore functionality like "let's get an adapter that supports this specific texture extension" or "let's reuse a binding group layout to save 2ns when binding uniforms". In the same way most people on the web use Three.js (instead of WebGL), you'll see libraries like Babylon or Three.js making use of WebGPU without really having to know about all that stuff. And that's the right solution.
- kannanvijayan 5y agoAnecdotally, I had the opposite experience. I've wanted to dabble in parallel/gpu programming for a while but the fact that all the material forced me to care about triangles and matrix transforms for nontrivial case examples turned me off. I've recently been playing with WebGPU and while it's still a bit of a boilerplate nightmare (which I wouldn't presume to know how to do better).. it was far more approachable. Wrapping my head around buffers and layouts, and the fact that wgsl is a huge pain in the neck to debug, took a while. I've built myself a really rudimentary perlin noise generator using compute shaders, and managed to pipe that into a rendering shader that uses two triangles to render part of the noise field onto a canvas really smoothly. Trying to do some fancier compute stuff now, and overall the primitives are relatively straightforward. It's just that the documentation around the binding types and layouts, resource limits, and command-encoder/pipeline operational semantics are poor right now.
- ajconway 5y agoI’ve always been interested in CG. Back in the day, I played with OpenGL 1.x, D3D5, lived through the introduction of shaders. Now I’m toying with Vulkan and it’s incredible how simple it feels compared to the old-school APIs. Everything basically reflects what the GPU is really doing, you just acquire a drawing surface, set the state, bind some buffers and execute the shaders. There is very little hidden state. I admit this is a little bit more involved than calling glClear followed by glDrawTriangles, but once you reach the stage where you’re ready to apply textures and write shader code, the new way seems much more straightforward.
- moralestapia 5y ago>The advantages of WebGPU vs WebGL probably make sense to experts in this area Think of it as going much lower level like doing your stuff in x86 assembly language, so, sure it's going to be a PITA to get something running but for that very special need where every bit of performance matters it's going to work well.
- gmiller123456 5y agoI still find most of it to be completely impenetrable at first glance as a relative novice There's a lot of boilerplate code involved in setting up even the simplest of programs. I think one descent way to get started learning is to skip the boilerplate at the start and just play with the GPU part, like shadertoy.com lets you do.