Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change macOS OpenGL timing to use CVDisplayLink
When building with SOKOL_GLCORE33 on Mac, this commit adds the CoreVideo to the list of required frameworks: -framework CoreVideo This replaces the NSTimer with CVDisplayLink for driving the timing of rendering frames with OpenGL on macOS. CVDisplayLink can be used to receive a callback on a separate high-priority thread synchronized with the timing of a display device. Because sokol_app.h expects the rendering code to run on the main thread, we use: NSObject performSelectorOnMainThread: to trigger our code on the main thread. Without vertical sync enabled, this will cause tearing. Maybe because both the rendering time of a frame can't be guaranteed to meet the deadline, and maybe also because of the time spent going from one thread to another. However, it does give a consistent timer, and seems to be an improvement over NSTimer. In my measurements, CPU time waste from the high-frequency NSTimer was reduced.
- Loading branch information