X Tutup
Skip to content

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

Open
frenzibyte wants to merge 8 commits intoveldrid:masterfrom
frenzibyte:improve-mtl-drawable-retrieval
Open

Stop calling getNextDrawable on buffer swap to avoid CPU stalls#497
frenzibyte wants to merge 8 commits intoveldrid:masterfrom
frenzibyte:improve-mtl-drawable-retrieval

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.

1 participant

X Tutup