Check against surface capability usage flags instead of format flags for setting additional swapchain usage flags
This commit is contained in:
parent
2d1287df75
commit
a60fa850f4
1 changed files with 7 additions and 4 deletions
|
|
@ -391,13 +391,16 @@ public:
|
||||||
swapchainCI.clipped = VK_TRUE;
|
swapchainCI.clipped = VK_TRUE;
|
||||||
swapchainCI.compositeAlpha = compositeAlpha;
|
swapchainCI.compositeAlpha = compositeAlpha;
|
||||||
|
|
||||||
// Set additional usage flag for blitting from the swapchain images if supported
|
// Enable transfer source on swap chain images if supported
|
||||||
VkFormatProperties formatProps;
|
if (surfCaps.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) {
|
||||||
vkGetPhysicalDeviceFormatProperties(physicalDevice, colorFormat, &formatProps);
|
|
||||||
if ((formatProps.optimalTilingFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR) || (formatProps.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT)) {
|
|
||||||
swapchainCI.imageUsage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
swapchainCI.imageUsage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable transfer destination on swap chain images if supported
|
||||||
|
if (surfCaps.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_DST_BIT) {
|
||||||
|
swapchainCI.imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||||
|
}
|
||||||
|
|
||||||
VK_CHECK_RESULT(fpCreateSwapchainKHR(device, &swapchainCI, nullptr, &swapChain));
|
VK_CHECK_RESULT(fpCreateSwapchainKHR(device, &swapchainCI, nullptr, &swapChain));
|
||||||
|
|
||||||
// If an existing swap chain is re-created, destroy the old swap chain
|
// If an existing swap chain is re-created, destroy the old swap chain
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue