简体   繁体   中英

Metal on macOS – Monitor refresh sync?

I am in the process of converting some old OpenGL code to Metal.

At the moment I am using a MTKView to render a memory buffer to a window. I'm using it with paused = YES, enableSetNeedsDisplay = NO, and manual calls to draw() from my rendering loop.

Everything appears to be working, except for the fact that I am limited to 60 frames per second for no obvious reason. I suspect that Metal is synchronising to the monitor refresh when I don't want it to.

When I resize the window my frame rate temporarily jumps to 150+ frames per second, which tells me that the limit is not of my making.

Does anyone know how to stop this frame rate limit? I have tried setting preferredFramesPerSecond to different values (both lower and higher) but this seems to have no effect.

Thanks in advance for any pointers.

Typically enough I figured it out a few minutes after asking the question:

CAMetalLayer *c = self.layer;
c.displaySyncEnabled = NO;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM