[Impeller] Fix Vulkan validation error when there is a blit directed at a swapchain image. (flutter/engine#43527)

This shows up in the the aiks test harness in the color wheel with advanced blends.

Fixes https://github.com/flutter/flutter/issues/129853
This commit is contained in:
Chinmay Garde
2023-07-10 15:02:52 -07:00
committed by GitHub
parent 260a9213b8
commit 18c0aeccd3
2 changed files with 6 additions and 3 deletions

View File

@@ -164,8 +164,8 @@ static constexpr vk::ImageUsageFlags ToVKImageUsageFlags(
}
if (mode != StorageMode::kDeviceTransient) {
// TODO (https://github.com/flutter/flutter/issues/121634):
// Add transfer usage flags to support blit passes
// Add transfer usage flags to support blit passes only if image isn't
// device transient.
vk_usage |= vk::ImageUsageFlagBits::eTransferSrc |
vk::ImageUsageFlagBits::eTransferDst;
}

View File

@@ -198,7 +198,10 @@ SwapchainImplVK::SwapchainImplVK(const std::shared_ptr<Context>& context,
: caps.maxImageCount // max zero means no limit
);
swapchain_info.imageArrayLayers = 1u;
swapchain_info.imageUsage = vk::ImageUsageFlagBits::eColorAttachment;
// Swapchain images are primarily used as color attachments (via resolve) or
// blit targets.
swapchain_info.imageUsage = vk::ImageUsageFlagBits::eColorAttachment |
vk::ImageUsageFlagBits::eTransferDst;
swapchain_info.preTransform = vk::SurfaceTransformFlagBitsKHR::eIdentity;
swapchain_info.compositeAlpha = composite.value();
// If we set the clipped value to true, Vulkan expects we will never read back