[Commits] SDL: metal: Respect the vsync flag on macOS 10.13+.

libsdl.org revision control commits-owner at libsdl.org
Sat Dec 30 18:40:18 PST 2017


details:   https://hg.libsdl.org/SDL/rev/a5620934cf56
changeset: 11790:a5620934cf56
user:      Alex Szpakowski <slime73 at gmail.com>
date:      Sat Dec 30 22:39:55 2017 -0400
description:
metal: Respect the vsync flag on macOS 10.13+.

diffstat:

 src/render/metal/SDL_render_metal.m |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 01f9851b2c9d -r a5620934cf56 src/render/metal/SDL_render_metal.m
--- a/src/render/metal/SDL_render_metal.m	Sat Dec 30 20:32:22 2017 -0400
+++ b/src/render/metal/SDL_render_metal.m	Sat Dec 30 22:39:55 2017 -0400
@@ -356,8 +356,14 @@
     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;
 }


More information about the commits mailing list