I recently updated from RTX 2070 to RTX 3080. I found out that my Vulkan projects suddenly run very slowly. A profiling run revealed that vkQueuePresentKHR was taking 300ms every frame. After a couple hours of debugging I found out the settings that seem to have an effect in this:
- G-SYNC is enabled.
- Swapchain format is set to VK_FORMAT_A2B10G10R10_UNORM_PACK32 and color space is set to VK_COLOR_SPACE_SRGB_NONLINEAR_KHR.
- Swapchain format is set to VK_FORMAT_R16G16B16A16_SFLOAT and color space is set to VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT.
Non-8bit formats seem to cause slow vkQueuePresentKHR. Either setting swapchain format to an 8-bit format or disabling G-SYNC seem to fix the issue.
Interestingly, if the application window is unfocused, the slow presenting issues go away, even when all the settings above are enabled. The slow presents only happen the window is focused.
Since this feels like it is related to a problem in the swapchain, here are my other swapchain settings:
- Present mode: VK_PRESENT_MODE_FIFO_KHR
- Depth format: VK_FORMAT_D32_SFLOAT_S8_UINT
- MSAA samples: VK_SAMPLE_COUNT_8_BIT
- Min image count: 2
I am currently running the driver version 460.97 on Windows 10 20H2. Vulkan version is 1.2.164 and I have VK_LAYER_KHRONOS_validation enabled. The validation layer doesn’t seem to be complaining about anything.