Skip to content

Commit

Permalink
metal: Respect the vsync flag on macOS 10.13+.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Dec 31, 2017
1 parent e24dc90 commit 42b19c9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/render/metal/SDL_render_metal.m
Expand Up @@ -356,8 +356,14 @@ @implementation METAL_TextureData
renderer->info = METAL_RenderDriver.info;
renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);

// !!! FIXME: how do you control this in Metal?
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
#if defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13)
if (@available(macOS 10.13, *)) {
layer.displaySyncEnabled = (flags & SDL_RENDERER_PRESENTVSYNC) != 0;
} else
#endif
{
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
}

return renderer;
}
Expand Down

0 comments on commit 42b19c9

Please sign in to comment.