Compoiste alpha flag selection based on device support
This commit is contained in:
parent
de79a0d79a
commit
5443c01f07
1 changed files with 18 additions and 2 deletions
|
|
@ -379,6 +379,22 @@ public:
|
||||||
preTransform = surfCaps.currentTransform;
|
preTransform = surfCaps.currentTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find a supported composite alpha format (not all devices support alpha opaque)
|
||||||
|
VkCompositeAlphaFlagBitsKHR compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||||
|
// Simply select the first composite alpha format available
|
||||||
|
std::vector<VkCompositeAlphaFlagBitsKHR> compositeAlphaFlags = {
|
||||||
|
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
|
||||||
|
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR,
|
||||||
|
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR,
|
||||||
|
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR,
|
||||||
|
};
|
||||||
|
for (auto& compositeAlphaFlag : compositeAlphaFlags) {
|
||||||
|
if (surfCaps.supportedCompositeAlpha & compositeAlphaFlag) {
|
||||||
|
compositeAlpha = compositeAlphaFlag;
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
VkSwapchainCreateInfoKHR swapchainCI = {};
|
VkSwapchainCreateInfoKHR swapchainCI = {};
|
||||||
swapchainCI.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
swapchainCI.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||||
swapchainCI.pNext = NULL;
|
swapchainCI.pNext = NULL;
|
||||||
|
|
@ -397,7 +413,7 @@ public:
|
||||||
swapchainCI.oldSwapchain = oldSwapchain;
|
swapchainCI.oldSwapchain = oldSwapchain;
|
||||||
// Setting clipped to VK_TRUE allows the implementation to discard rendering outside of the surface area
|
// Setting clipped to VK_TRUE allows the implementation to discard rendering outside of the surface area
|
||||||
swapchainCI.clipped = VK_TRUE;
|
swapchainCI.clipped = VK_TRUE;
|
||||||
swapchainCI.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
swapchainCI.compositeAlpha = compositeAlpha;
|
||||||
|
|
||||||
// Set additional usage flag for blitting from the swapchain images if supported
|
// Set additional usage flag for blitting from the swapchain images if supported
|
||||||
VkFormatProperties formatProps;
|
VkFormatProperties formatProps;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue