diff --git a/intern/ghost/intern/GHOST_ContextVK.cc b/intern/ghost/intern/GHOST_ContextVK.cc index e127e2b9263..096d7a35068 100644 --- a/intern/ghost/intern/GHOST_ContextVK.cc +++ b/intern/ghost/intern/GHOST_ContextVK.cc @@ -733,13 +733,26 @@ static void requireExtension(const vector &extensions_ava } } -static GHOST_TSuccess selectPresentMode(VkPhysicalDevice /*device*/, - VkSurfaceKHR /*surface*/, +static GHOST_TSuccess selectPresentMode(VkPhysicalDevice device, + VkSurfaceKHR surface, VkPresentModeKHR *r_presentMode) { - /* FIFO present mode is always available and we prefer it as it will keep the main loop running - * along the monitor refresh rate. Mailbox and Fifo relaxed can generate a lot of frames that - * will never be displayed. */ + uint32_t present_count; + vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &present_count, nullptr); + vector presents(present_count); + vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &present_count, presents.data()); + /* MAILBOX is the lowest latency V-Sync enabled mode. We will use it if available as it fixes + * some lag on NVIDIA/Intel GPUs. */ + for (auto present_mode : presents) { + if (present_mode == VK_PRESENT_MODE_MAILBOX_KHR) { + *r_presentMode = present_mode; + return GHOST_kSuccess; + } + } + + /*FIFO present mode is always available and we (should) prefer it as it will keep the main loop + * running along the monitor refresh rate. Mailbox and Fifo relaxed can generate a lot of frames + * that will never be displayed. */ *r_presentMode = VK_PRESENT_MODE_FIFO_KHR; return GHOST_kSuccess; }