Skip to content

Commit

Permalink
[Impeller] Fix Vulkan validation error when there is a blit directed …
Browse files Browse the repository at this point in the history
…at a swapchain image. (#43527)

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

Fixes flutter/flutter#129853
  • Loading branch information
chinmaygarde committed Jul 10, 2023
1 parent 4df83ff commit 2a0dd9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions impeller/renderer/backend/vulkan/allocator_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion impeller/renderer/backend/vulkan/swapchain_impl_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a0dd9d

Please sign in to comment.