12

How do I use vsync in Vulkan? I'm on Windows, but the code should also work on Linux. Is it implemented by inserting a fence in vkAcquireNextImageKHR?

SurvivalMachine
  • 7,158
  • 13
  • 53
  • 74

1 Answers1

17

Though you could realize that by using a fence the correct way would be to use a presentation mode that waits for the vertical blank like VK_PRESENT_MODE_FIFO_KHR.

Intel has a great article that contains a detailed look at Vulkan's different presentation modes over here

Note that this mode may not be available on every device and that some drivers may ignore the v-sync even if you select a corresponding presentation mode. So if you use one of these modes and don't get v-sync you may have to wait for a newer driver.

But if it's implemented inside the driver this is the correct way of doing v-sync across all platforms supported by Vulkan.

Sascha Willems
  • 3,784
  • 1
  • 11
  • 15
  • 4
    FIFO is the one mode that is always available – ratchet freak Apr 28 '16 at 11:02
  • 4
    Technically yes, at is required to be supported by the specs. But you should still have a fallback and don't rely on the presence of VK_PRESENT_MODE_FIFO_KHR, e.g. if you're running on non-conformant drivers or implementations. – Sascha Willems Apr 28 '16 at 14:37