Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPE][WebGL][Canvas][Compositing] Fix partially rendered WebGL canvas… #8520

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

neodesys
Copy link

@neodesys neodesys commented Jan 11, 2023

[WPE][WebGL][Canvas][Compositing] Fix partially rendered WebGL canvas composition
https://bugs.webkit.org/show_bug.cgi?id=250314

Reviewed by NOBODY (OOPS!).

When rendering heavy 3D scenes in a WebGL canvas using the WPE EGL
renderer, the compositor may use the element render target texture
BEFORE all the WebGL commands are correctly executed by the GPU.

Then, on most complex frames, the canvas appears totally blank or
partially rendered. This patch ensures that all GL commands from
the WebGL canvas context are finished before using the render target
texture in the compositor.

  • Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp:
    (WebCore::GraphicsContextGLGBM::prepareTexture):

Pull Request Template

File a Bug

All changes should be associated with a bug. The WebKit project is currently using Bugzilla as our bug tracker. Note that multiple changes may be associated with a single bug.

Provided Tooling

The WebKit Project strongly recommends contributors use Tools/Scripts/git-webkit to generate pull requests. See Setup and Contributing Code for how to do this.

Template

If a contributor wishes to file a pull request manually, the template is below. Manually-filed pull requests should contain their commit message as the pull request description, and their commit message should be formatted like the template below.

Additionally, the pull request should be mentioned on Bugzilla, labels applied to the pull request matching the component and version of the Bugzilla associated with the pull request and the pull request assigned to its author.

< bug title >
https://bugs.webkit.org/show_bug.cgi?id=#####

Reviewed by NOBODY (OOPS!).

Explanation of why this fixes the bug (OOPS!).

* path/changed.ext:
(function):
(class.function):

9d7fc9b

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ❌ 🛠 🧪 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🛠 gtk ✅ 🛠 wincairo
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 gtk-wk2
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-wk2
✅ 🛠 tv-sim ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 watch ✅ 🧪 mac-wk2-stress
✅ 🛠 watch-sim

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 11, 2023
@neodesys
Copy link
Author

I've added a comment in Bugzilla https://bugs.webkit.org/show_bug.cgi?id=250314#c5 about all possible solutions available to fix this issue. All possible solutions I can foresee for now have their advantages and drawbacks, none is perfect. It depends on the concrete use case.

This current implementation follows the solution 1a. It guaranties frame completeness in all conditions, but at the price of lower performances as it blocks the rendering thread (which may also be the webview main thread) until all WebGL commands have been executed for the corresponding canvas in the view.

We should discuss about which solution would be the best "all purposes" solution, knowing that if only glFinish is available (no fences), only current solution (1a) can be implemented.

@neodesys neodesys changed the title [WPE][WebGL][Canvas][Compositing] Fix partially rendered WebGL canvas… Draft: [WPE][WebGL][Canvas][Compositing] Fix partially rendered WebGL canvas… Jan 13, 2023
… composition

https://bugs.webkit.org/show_bug.cgi?id=250314

Reviewed by NOBODY (OOPS!).

When rendering heavy 3D scenes in a WebGL canvas using the WPE EGL
renderer, the compositor may use the element render target texture
BEFORE all the WebGL commands are correctly executed by the GPU.

Then, on most complex frames, the canvas appears totally blank or
partially rendered. This patch ensures that all GL commands from
the WebGL canvas context are finished before using the render target
texture in the compositor.

* Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp:
(WebCore::GraphicsContextGLGBM::prepareTexture):
@neodesys neodesys changed the title Draft: [WPE][WebGL][Canvas][Compositing] Fix partially rendered WebGL canvas… [WPE][WebGL][Canvas][Compositing] Fix partially rendered WebGL canvas… Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merging-blocked Applied to prevent a change from being merged
Projects
None yet
4 participants