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

In MetalRedrawer, stop delaying rendering as soon as the window becomes non-occluded. #822

Merged
merged 4 commits into from
Nov 8, 2023

Conversation

m-sasha
Copy link
Member

@m-sasha m-sasha commented Nov 7, 2023

Occasionally, when the window is just getting show, isOccluded will return true while we're already trying to draw into it. This causes MetalRedrawer.draw to delay for 300ms in order to avoid wasting resources drawing while the window is occluded. But because this delay is not interrupted even when the window becomes non-occluded, we get a delay drawing the 2nd frame.

This PR adds a call from native code NSWindowDidChangeOcclusionStateNotification that interrupts the delay when the window becomes non-occluded, so that drawing can resume immediately.

skiko/src/awtMain/objectiveC/macos/MetalRedrawer.mm Outdated Show resolved Hide resolved
skiko/src/awtMain/objectiveC/macos/MetalRedrawer.mm Outdated Show resolved Hide resolved
@m-sasha m-sasha merged commit b2149d9 into master Nov 8, 2023
5 checks passed
@m-sasha m-sasha deleted the fix-2nd-frame-rendering-delay branch November 8, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants