I'm sure people will objected but I'd argue WebGPU is easier to understand, has better errors, has no state machine, works C++, Rust, JS/TS and other languages, and closer to modern GPU programming if you want to move to Metal or D3D12 or Vulkan later.
Further, OpenGL (and ES) are a nightmare of bugs and incompatibilities students might run into that WebGPU fixes.
That said, the article mentions Apple platforms where you can use ANGLE if you happened to have students stuck there.
[–] flohofwoe 3 days ago
[–] whatthejesus 2 days ago
Re. the boilerplate just have students clone a pre-fabbed repo with the boilerplate handled for them.
The real question should be whether you want students to know how to program in a low programming language or not. Whether they should see what the reality of programming is or not.
If they can’t program in C/C++ and debug the error messages how are they going to survive in the wild? I guess they’ll use an LLM.
[–] flohofwoe 2 days ago
The problem is that you don't get *any* error messages from native GL in the first place (unless you wire up a debug-message callback via the optional KHR_debug extension which isn't available everywhere), and the builtin error system via glGetError() is pretty much completely useless.
Other APIs don't suffer from this problem, D3D, Vulkan and Metal all have excellent validation layers which give very helpful messages, and WebGL or WebGPU running in browsers basically implement such a validation layer out of the box.
[–] Pannoniae 2 days ago
[–] lightedman 2 days ago
The beauty of OpenGL versus say Direct3D is that OpenGL is extensible and thus you can add that feature should you so choose.
[–] flohofwoe 2 days ago
[–] klodolph 2 days ago
[–] pjmlp 3 days ago
Better than OpenGL, but don't expect that much improvements coming into their way, other than what the Chrome team might feel like pushing, as I doubt Firefox or Safari teams have much left to say about where it goes beyond version 1.0.
[–] criddell 2 days ago
What improvements are needed? It sees pretty much complete to me and I think it's a good thing for it to be in maintenance mode (ie stable).
[–] flohofwoe 2 days ago
This was a restriction of the Vulkan 1.0 API and modelling the WebGPU resource binding model around that was a quite predictable problem. It would have been better to come up with a slim abstraction that might cost some performance on Vulkan (which is only really relevant on Android phones and Linux desktops), but at least would not slow down WebGPU across all platforms.
And now even the Vulkan maintainers have realized the problem and are introducing the much more flexible descriptor-heap extension (about a decade late, but better late than never).
WebGPU is essentially the frozen cross-section of 3D APIs from about a decade ago, and the state of GPU hardware from about 15 to 20 years ago (but tbf, apart from the broken binding model there wasn't much that could be done, because most restrictions are coming from mobile GPUs which a browser 3D API simply must support).
[–] Pannoniae 2 days ago
2. WGSL, like come on
3. Hilariously outdated feature set, no mesh shaders, no HWRT, cooperative matrices/tensors, etc.
4. It's security-focused because web untrusted code:tm: so most of the calls are hilariously slow. Yes even the desktop implementations. There's no good webGPU implementation out there
5. it's also not simple to either implement or use. it's basically vulkan's difficulty without any of the advantages....
[–] CamperBob2 2 days ago
[–] Someone 2 days ago
Your mind cannot live with the idea that you spent many, many hours learning an ugly API, so it makes you think it is better than it is.
[–] genxy 2 days ago
[–] AnthonBerg 1 day ago
I've later come to suspect that this glittering is sometimes useful as… fuel? Feeling-of-progress hands-on motivation-fuel.
[–] Cloudef 2 days ago
Interacting with webgpu from wasm is also often slower than webgl because the api is lower level and causes more gc overhead on js side.
For teaching I would generally use the web browser via WebGL2 or WebGPU, just because those APIs require much less boilerplate in the browser environment to get to your first triangle and the edit-test-loop is pretty much instant.