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

Stop calling getNextDrawable on buffer swap to avoid CPU stalls #497

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

frenzibyte
Copy link
Contributor

getNextDrawable is a blocking call, which doesn't return until a metal drawable is available or timed out after a full second has passed (and returns null).

Calling the function after a buffer swap is a bad practice as the game may execute other logic that isn't related to rendering (more specifically, doesn't require a metal drawable).

Therefore I've moved the call to only happen on the first draw call of the frame (indicated by the buffer swap). This improves Metal performance quite a lot for our game.

Before:
image

After:
image

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.

None yet

1 participant