Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Handle cases where the max swapchain image count can be zero. #40776

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion impeller/renderer/backend/vulkan/swapchain_impl_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ SwapchainImplVK::SwapchainImplVK(const std::shared_ptr<Context>& context,
caps.maxImageExtent.height),
};
swapchain_info.minImageCount = std::clamp(
caps.minImageCount + 1u, caps.minImageCount, caps.maxImageCount);
caps.minImageCount + 1u, // preferred image count
caps.minImageCount, // min count cannot be zero
caps.maxImageCount == 0u ? caps.minImageCount + 1u
: caps.maxImageCount // max zero means no limit
);
swapchain_info.imageArrayLayers = 1u;
swapchain_info.imageUsage = vk::ImageUsageFlagBits::eColorAttachment;
swapchain_info.preTransform = caps.currentTransform;
Expand Down