Skip to content
Permalink
Browse files

metal: Respect the vsync flag on macOS 10.13+.

  • Loading branch information
slime73 committed Dec 31, 2017
1 parent e24dc90 commit 42b19c9749b5ccd0c9602e47e2f3d148d2163ab8
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/render/metal/SDL_render_metal.m
@@ -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;
}

0 comments on commit 42b19c9

Please sign in to comment.