6 ms·
Is there any advantage at this point in time to port a game to WebGPU? Is it going to run faster, or have broader browser support in the future?
by NiekvdMaas 5y ago
Is there any advantage at this point in time to port a game to WebGPU? Is it going to run faster, or have broader browser support in the future?
- pjmlp 5y agoNot at all, it took 10 years for WebGL 2.0 to be generally available, and WebGPU is with luck reaching MVP 1.0 in 2022 on Chrome, let alone anywhere else.
- klodolph 5y agoIt's like a web version of Vulkan / Metal / DX12, in that it's designed to more directly represent how modern GPUs work. If you are happy with your WebGL performance, by all means, continue using it. However, it can sometimes be a bit hard to understand what is going wrong (performance-wise) in an OpenGL or WebGL application... the underlying implementation will sometimes paper over its limitations. You can accidentally stray from the high-performance paths. There are some feature differences, like how WebGPU has compute shaders.
- modeless 5y agoAt this time I would recommend WebGL 2. WebGL 2 is finally supported in all major browsers now that Safari 15 shipped. WebGL 2 has some of the benefits mentioned in the article for WebGPU, such as a reasonable minimum texture size (2048 vs 64 in WebGL 1) and the built-in ability to get the size of a texture in a shader. WebGPU will not ship in all browsers for some time, and when it does it will not have have wider hardware support than WebGL 2. It has the potential to be faster in some cases, but the difference is unlikely to matter for most. The big draw of WebGPU should be compute shader support, though it is definitely possible to do compute work in WebGL 2 either with transform feedback or just regular shaders.
- hajile 5y agoIt is currently shipping behind a flag in desktop versions of Chrome (and all its derivatives), Safari, and Firefox. It is also shipping behind a flag in Firefox for Android. I don't think it's too far out from finally shipping. The biggest boon would be for mobile devs to help avoid the 30% store tax, but this is also the reason why mobile Chrome and mobile Safari (especially Safari) tend to lag behind in major ways.
- modeless 5y agoWhat Safari is shipping behind a flag is not anything like the current version of WebGPU. I don't think it supports WGSL, for example. It's going to be a long time before all three browsers have shipped implementations that are interoperable and not behind flags. I don't think WebGPU is the biggest thing that's going to let mobile game devs start shipping on the web. WebGL 2 can do graphics well enough today. Other things hold the web back. Monetization is the big thing that people always talk about. The lucrative interstitial app install ads that mobile games have aren't on web, and in-app purchases have a lot more friction. Handling large binary assets is also a place where the web is lacking and WebGPU won't fix that. Finally, there's a lot of ecosystem and tools stuff that needs to happen too. The engines need to add web platform support which goes more than skin deep. Shipping a game as one giant binary is not good enough for web, you need to split your code into dynamically loadable modules and stream your assets. You need Basis Universal compressed textures. Etc. Fix all of the above and then web games can shine, with or without WebGPU. Realistically, fix monetization and the rest will follow. Big caveat though: I think many see the monetization techniques currently used by mobile games as exploitative. It's not clear that you could do web game monetization competitively without the same level of exploitation.
- pjmlp 5y agoWeb 3D APIs are castrated, they will never be able to match native APIs. Going for GL ES 3.0 subset, when devices do GL ES 3.2? Going for a MVP 1.0 with minimum overlap across Metal, Vulkan and DX12 instead of using their full blown capabilities? In both cases, having to use native GPU debugging tools anyway. Rather give the 30%.
- gnarbarian 5y agoassuming you are comparing it to webgl. WebGPU has better compute support. in practice this means you can more effectively use shaders to perform things like physics, math heavy computation, or algorithms that benefit from massive concurrency. this puts the advantages way beyond just games.
- fulafel 5y agoNo to first question, unless you count learning, as it's mot enabled in browsers yet. Maybe to second (depending on your game).