Updated swapchain image count selection algorithm.
The previous version was correct from Vulkan spec standpoint but due to bug in AMD drivers we can not safely use surface_caps.minImageCount for the number of images in the swapchain for fullscreen window. Now we request at least 2 images for immediate and fifo mode.
This commit is contained in:
parent
c30a4b867f
commit
abe1efe3aa
|
|
@ -198,16 +198,14 @@ static VkSwapchainKHR create_swapchain(VkPhysicalDevice physical_device, VkDevic
|
||||||
if (mailbox_supported) {
|
if (mailbox_supported) {
|
||||||
present_mode = VK_PRESENT_MODE_MAILBOX_KHR;
|
present_mode = VK_PRESENT_MODE_MAILBOX_KHR;
|
||||||
image_count = std::max(3u, surface_caps.minImageCount);
|
image_count = std::max(3u, surface_caps.minImageCount);
|
||||||
|
} else {
|
||||||
|
present_mode = immediate_supported ? VK_PRESENT_MODE_IMMEDIATE_KHR : VK_PRESENT_MODE_FIFO_KHR;
|
||||||
|
image_count = std::max(2u, surface_caps.minImageCount);
|
||||||
|
}
|
||||||
|
|
||||||
if (surface_caps.maxImageCount > 0) {
|
if (surface_caps.maxImageCount > 0) {
|
||||||
image_count = std::min(image_count, surface_caps.maxImageCount);
|
image_count = std::min(image_count, surface_caps.maxImageCount);
|
||||||
}
|
}
|
||||||
} else if (immediate_supported) {
|
|
||||||
present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR;
|
|
||||||
image_count = surface_caps.minImageCount;
|
|
||||||
} else {
|
|
||||||
present_mode = VK_PRESENT_MODE_FIFO_KHR;
|
|
||||||
image_count = surface_caps.minImageCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create swap chain
|
// create swap chain
|
||||||
VkSwapchainCreateInfoKHR desc;
|
VkSwapchainCreateInfoKHR desc;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user