[WebGPU] Very poor texture upload performance when passing canvas
Categories
(Core :: Graphics: WebGPU, defect, P4)
Tracking
()
People
(Reporter: ashley, Unassigned, NeedInfo)
References
(Blocks 1 open bug, )
Details
Steps to reproduce:
Visit repro URL and observe framerate: https://downloads.scirra.com/labs/textscaling/webgpu4/index.html
NOTE: this issue requires WebGPU support to reproduce which is currently only enabled in pre-release channels. Check that WebGPU is logged to the browser console to verify. This reproduces for me on Firefox Nightly 141.
The repro URL renders text at lots of different scales by drawing text to canvas2d and then uploading that as a texture. This is a way to get high-quality text rendering in WebGPU as it does not have any direct way to render text. It's used by our web-based game engine Construct (www.construct.net).
Actual results:
The performance of doing this is extremely poor. The test runs at around 8 FPS on a system with an NVIDIA GeForce RTX 3050.
Expected results:
On a high-end system this should be able to achieve a smooth 60 FPS. Indeed Chrome rendering with WebGL can achieve that. (Chrome with WebGPU is also slow - see https://issues.chromium.org/issues/40273077)
Firefox's WebGL renderer is also slow doing the same thing (see WebGL test: https://downloads.scirra.com/labs/textscaling/webgl/index.html). It would be nice if it was fixed for WebGL too, but for the future the main thing we care about is that it's fast in WebGPU.
Comment 1•6 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebGPU' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•6 months ago
|
||
Firefox: https://share.firefox.dev/3SV78i4
Updated•6 months ago
|
Comment 3•6 months ago
•
|
||
UPDATE: wrong Bug, sorry. Bug 1971296 is likely the same cause as this Bug, but that one started only recently. It's probably just a mis-attribution of the crash signature. I'll try to replicate on iCloud and when I have a fix for the other Bug, I'll see if it fixes the issue here.
Comment 4•6 months ago
|
||
Sorry, was on the wrong Bug page and I correlated these Bugs incorrectly.
Comment 5•6 months ago
|
||
The severity field is not set for this bug.
:jimb, could you have a look please?
For more information, please visit BugBot documentation.
Updated•3 months ago
|
FWIW I have an updated repro as we have made some changes to our WebGPU rendering code to try to handle this more efficiently: https://downloads.scirra.com/labs/textscaling/webgpu-batched/index.html
It no longer generates mipmaps, and it also batches all texture uploads together to avoid creating render passes in between every texture upload. In Firefox 143 on a high-end dev machine with a GeForce RTX 4070 this still runs so slowly as to appear to freeze.
Comment 7•2 months ago
|
||
We on the WebGPU team think that you might notice a significant improvement after we fix bug 1870699. We'll check in with you when that's resolved.
Updated•2 months ago
|
Here's an updated repro where we've further tried to optimize things on our side: https://downloads.scirra.com/labs/textscaling/webgpu-two-phase/index.html
This now updates all canvases, before proceeding to upload all canvases to WebGPU textures with consecutive calls to copyExternalImageToTexture(). However it does not appear to have improved performance much in Firefox (guessing we're still waiting on bug 1870699 anyway)
Description
•