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

Low-latency rendering with the desynchronized hint #6667

Closed
wants to merge 1 commit into from

Conversation

wdanilo
Copy link
Member

@wdanilo wdanilo commented May 12, 2023

Pull Request Description

This PR adds desynchronized hint to the WebGL context which invokes a different code path that bypasses the usual DOM update mechanism. To learn more, see: https://developer.chrome.com/blog/desynchronized/

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@wdanilo wdanilo added the CI: No changelog needed Do not require a changelog entry for this PR. label May 12, 2023
@wdanilo wdanilo marked this pull request as ready for review May 12, 2023 15:00
@wdanilo
Copy link
Member Author

wdanilo commented May 12, 2023

I did self-QA end everything seems to work.

Comment on lines +689 to +690
// See: https://developer.chrome.com/blog/desynchronized
Reflect::set(&options, &"desynchronized".into(), &true.into()).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the link, and I'm a bit unsure about it.

First, it does not explain directly what are drawbacks of setting this option. I guess there are some, as otherwise this would be default in every browser. We display both canvas as other HTML elements, so we may technically be affected.

Furthermore, I don't know why we do not add "preserveDrawingBuffer" option as described in https://developer.chrome.com/blog/desynchronized/#avoiding-flicker

Moreover, there is a warning in https://developer.chrome.com/blog/desynchronized/#alpha-channels that:

A translucent canvas element, one where alpha is set to true, can still be desynchronized, but it must not have any other DOM elements above it.

But we definitely have other DOM elements above our canvas, and it definitely has alpha.

I think these things should be discussed in the comment. Otherwise anyone else who will read the article may ask same questions.

@wdanilo
Copy link
Member Author

wdanilo commented May 12, 2023

We will not enable it for now. Why not is described here and here, and a good summary is here:

image

@wdanilo wdanilo closed this May 12, 2023
@farmaazon farmaazon deleted the wip/wd/low-latency branch May 9, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants