From a1482f926e476ee3a0331b7d753faaf6c8230656 Mon Sep 17 00:00:00 2001 From: Ravbug Date: Sun, 15 Oct 2023 22:44:08 -0400 Subject: [PATCH] Metal: implement vsync API --- src/MTLSwapchain.hpp | 2 ++ src/MTLSwapchain.mm | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/MTLSwapchain.hpp b/src/MTLSwapchain.hpp index 5d7dc25..1a62895 100644 --- a/src/MTLSwapchain.hpp +++ b/src/MTLSwapchain.hpp @@ -19,5 +19,7 @@ namespace RGL{ std::array activeTextures; uint32_t idx = 0; + + void SetVsyncMode(bool mode) final; }; } diff --git a/src/MTLSwapchain.mm b/src/MTLSwapchain.mm index a9b66d8..21ba39c 100644 --- a/src/MTLSwapchain.mm +++ b/src/MTLSwapchain.mm @@ -28,6 +28,13 @@ [activeTextures[config.imageIndex].drawable present]; } +void SwapchainMTL::SetVsyncMode(bool mode){ +#if TARGET_OS_IPHONE +#else + [surface->layer setDisplaySyncEnabled:mode]; +#endif +} + } #endif