Use opaque composition if transparency is disabled

This commit is contained in:
Riteo 2022-10-19 11:01:53 +02:00
parent 61051a44cc
commit dca76957b2

View file

@ -1807,18 +1807,22 @@ Error VulkanContext::_update_swap_chain(Window *window) {
preTransform = surfCapabilities.currentTransform; preTransform = surfCapabilities.currentTransform;
} }
// Find a supported composite alpha mode - one of these is guaranteed to be set.
VkCompositeAlphaFlagBitsKHR compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; VkCompositeAlphaFlagBitsKHR compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
VkCompositeAlphaFlagBitsKHR compositeAlphaFlags[4] = {
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR, if (OS::get_singleton()->is_layered_allowed() || !(surfCapabilities.supportedCompositeAlpha & compositeAlpha)) {
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR, // Find a supported composite alpha mode - one of these is guaranteed to be set.
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR, VkCompositeAlphaFlagBitsKHR compositeAlphaFlags[4] = {
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR,
}; VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR,
for (uint32_t i = 0; i < ARRAY_SIZE(compositeAlphaFlags); i++) { VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR,
if (surfCapabilities.supportedCompositeAlpha & compositeAlphaFlags[i]) { VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
compositeAlpha = compositeAlphaFlags[i]; };
break;
for (uint32_t i = 0; i < ARRAY_SIZE(compositeAlphaFlags); i++) {
if (surfCapabilities.supportedCompositeAlpha & compositeAlphaFlags[i]) {
compositeAlpha = compositeAlphaFlags[i];
break;
}
} }
} }