Skip to content

Commit

Permalink
Metal: implement vsync API
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravbug committed Oct 16, 2023
1 parent 3316003 commit a1482f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/MTLSwapchain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ namespace RGL{

std::array<TextureMTL,3> activeTextures;
uint32_t idx = 0;

void SetVsyncMode(bool mode) final;
};
}
7 changes: 7 additions & 0 deletions src/MTLSwapchain.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a1482f9

Please sign in to comment.