KhronosGroup / MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Apache License 2.0
4.84k stars 429 forks source link

Presentmode do not what they are supposed to do. #823

Open kobutri opened 4 years ago

kobutri commented 4 years ago

In windowed mode VK_PRESENT_MODE_MAILBOX_KHR is locked to 60 fps. In fullscreen mode VK_PRESENT_MODE_FIFO_KHR is not locked to 60 fps.

MennoVink commented 4 years ago

Mailbox is not supported on my machine, perhaps you're silently falling back to fifo in that case?

In the case of using VK_PRESENT_MODE_FIFO_KHR I'm getting this issue as well, albeit only when the view is in the background. This present mode does not correctly throttle rendering down to 60fps when the vulkan view is in the background. Instead it starts spinning and renders as fast as it can. I'm waiting for the fence passed in to acquireNextImageKHR to enforce throttling, but that doesn't work. (on Windows it actually throttles in the presentKHR function when using a nvidia driver)

What may or may not be related to fifo throttling not working correctly is that I'm reliably getting a crash on a MVK thread inside the ___ZN31MVKQueueCommandBufferSubmission28commitActiveMTLCommandBufferEb_block_invoke function. There is a similar issue like this in OpenGL where swap interval isn't respected when the opengl view is in the background so this may actually be a platform issue rather than a driver / sdk issue.