Use opaque composition if transparency is disabled
This commit is contained in:
parent
61051a44cc
commit
dca76957b2
1 changed files with 15 additions and 11 deletions
|
@ -1807,18 +1807,22 @@ Error VulkanContext::_update_swap_chain(Window *window) {
|
|||
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 compositeAlphaFlags[4] = {
|
||||
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR,
|
||||
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR,
|
||||
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR,
|
||||
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
|
||||
};
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(compositeAlphaFlags); i++) {
|
||||
if (surfCapabilities.supportedCompositeAlpha & compositeAlphaFlags[i]) {
|
||||
compositeAlpha = compositeAlphaFlags[i];
|
||||
break;
|
||||
|
||||
if (OS::get_singleton()->is_layered_allowed() || !(surfCapabilities.supportedCompositeAlpha & compositeAlpha)) {
|
||||
// Find a supported composite alpha mode - one of these is guaranteed to be set.
|
||||
VkCompositeAlphaFlagBitsKHR compositeAlphaFlags[4] = {
|
||||
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR,
|
||||
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR,
|
||||
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR,
|
||||
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(compositeAlphaFlags); i++) {
|
||||
if (surfCapabilities.supportedCompositeAlpha & compositeAlphaFlags[i]) {
|
||||
compositeAlpha = compositeAlphaFlags[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue