VulkanRenderer/VulkanSwapchain: Don't assume VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR is supported

This commit is contained in:
SirLynix 2023-02-26 13:49:04 +01:00
parent 20ad93f1c9
commit c560e552dc
1 changed files with 7 additions and 1 deletions

View File

@ -576,6 +576,12 @@ namespace Nz
swapchainPresentMode = VK_PRESENT_MODE_IMMEDIATE_KHR;
}
VkCompositeAlphaFlagBitsKHR compositeAlpha;
if (surfaceCapabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR)
compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
else
compositeAlpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
// Ensure all operations on the device have been finished before recreating the swapchain (this can be avoided but is more complicated)
m_device.WaitForIdle();
@ -593,7 +599,7 @@ namespace Nz
VK_SHARING_MODE_EXCLUSIVE,
0, nullptr,
surfaceCapabilities.currentTransform,
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
compositeAlpha,
swapchainPresentMode,
VK_TRUE,
m_swapchain