Closed Bug 1708006 Opened 4 years ago Closed 7 months ago

WebGL Texture writing performance suddenly degraded

Categories

(Core :: Graphics: CanvasWebGL, defect, P3)

Firefox 88
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: asimental, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0

Steps to reproduce:

Open following link in Firefox and Chrome: https://playcanv.as/b/fZLdHIEt/

Profile: https://share.firefox.dev/2R7c2vy

Actual results:

Previous smooth performance using Video textures in Playcanvas suddenly degraded causing framerates to drop from 60 to 17fps. Framerate remains smooth 60fps in Chrome with same video.

Spec of testing Computer:

OS: Windows 10 Pro
CPU: AMD Ryzen 9 3900X
GPU: Nvidia RTX 2070 SUPER
RAM: 32GB
VRAM: 8GB
Resolution at Fullscreen: 1920x1080

Expected results:

Same performance in writing textures as Chrome

Texture writing was previously stable on Version 85.0.2 (64-bit)

The Bugbug bot thinks this bug should belong to the 'Core::Canvas: WebGL' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Canvas: WebGL
Product: Firefox → Core

Related to: https://bugzilla.mozilla.org/show_bug.cgi?id=1709077

Changing texture writing to RGBA instead of RGB restore performance

Related to: https://bugzilla.mozilla.org/show_bug.cgi?id=1708491 Changing writing to RGBA instead of RGB fixed performance issue

Has there been any work on this? This is a major issue for productions sites that use WebGL video (of which there are many). I just filed what is probably a duplicate bug - https://bugzilla.mozilla.org/show_bug.cgi?id=1736923

Here is a pure WebGL replication with a 4k 60fps video - https://jsfiddle.net/Lmy0b3xt

This plays back in latest Chrome at 60fps, and ~5fps in Firefox 93

Also, I don't believe this latest regression is specific to RGB vs RGBA. The replication in my previous post is with RGB.

No progress from what I have seen. Changing line 124 of your fiddle to:

gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA,

appeared to restore performance in Firefox 93. Looks like there's still some artificial CPU limitation on RGB, but not RGBA

Yah, sorry you are right. I misread your post. Same issue.

I posted a summary post here - https://github.com/MozillaReality/FirefoxReality/issues/3973 - Hope someone can take a look.

Flags: needinfo?(jgilbert)

It's probably possible to handle that, though RGB uploads are generally much slower than RGBA uploads (because RGB resources are actually RGB1/RGBX formats, and OpenGL's packed RGB/UNSIGNED_BYTE uploads are known-slow)
RGB8 is always color-renderable in ES3 though, so it might be safe.

Flags: needinfo?(jgilbert)

I have implemented the RGBA workaround for our production site, but I imagine there are many other production WebGL-based sites that use RGB textures and are unaware of this performance regression in Firefox (as RGB works fine in other browsers). Do you think this would be worth prioritizing for the next release?

(In reply to Jeff Gilbert [:jgilbert] from comment #10)

It's probably possible to handle that, though RGB uploads are generally much slower than RGBA uploads (because RGB resources are actually RGB1/RGBX formats, and OpenGL's packed RGB/UNSIGNED_BYTE uploads are known-slow)
RGB8 is always color-renderable in ES3 though, so it might be safe.

I could see why that might be slowing things down, but what made the way Version 85.0.2 (64-bit) processed RGB textures from the way it is now? It wasn't until after that version that things slowed down tremendously.

In case it might help for testing, I think this site might also be affected, as all I seem to see in a quick perf profile is time spent in uploadTexture for a WebGL context from a video element: https://www.rimac-automobili.com

Severity: -- → S3
Priority: -- → P3
See Also: → 1842735

(In reply to asimental from comment #3)

Related to: https://bugzilla.mozilla.org/show_bug.cgi?id=1709077

Changing texture writing to RGBA instead of RGB restore performance

Fixed by bug 1883225.

Status: UNCONFIRMED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.