feat: bring back CAMetalDisplayLink

This reverts commit 6f381362dd.
This commit is contained in:
Acaki committed 2025-08-25 15:29:29 +08:00
1 parent 0582655954
commit b6c029df38
9 files changed
+144 -80

No files matched your search

+5 -2
View File
@@ -42,6 +42,9 @@
_plots = [ImGuiPlots sharedInstance].plots;
// Store stream FPS to synchronize MTKView
_streamFps = streamFps;
return self;
}
@@ -90,7 +93,7 @@
self.mtkView.device = self.device;
self.mtkView.delegate = self;
self.mtkView.preferredFramesPerSecond = 60; // ImGui overlay will always render at this rate
self.mtkView.preferredFramesPerSecond = _streamFps; // Synchronize with stream framerate
self.mtkView.opaque = NO;
self.mtkView.enableSetNeedsDisplay = NO;
@@ -179,7 +182,7 @@
#if TARGET_OS_SIMULATOR
[commandBuffer presentDrawable:view.currentDrawable];
#else
[commandBuffer presentDrawable:view.currentDrawable afterMinimumDuration:1.0 / view.preferredFramesPerSecond];
[commandBuffer presentDrawable:view.currentDrawable afterMinimumDuration:1.0 / _streamFps];
#endif
[commandBuffer commit];
#endif