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

Commit 14e536b

Browse files
authored
[Impeller] Handle cases where the max swapchain image count can be zero. (#40776)
[Impeller] Handle cases where the max swapchain image count can be zero.
1 parent 4bc5ca5 commit 14e536b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

impeller/renderer/backend/vulkan/swapchain_impl_vk.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ SwapchainImplVK::SwapchainImplVK(const std::shared_ptr<Context>& context,
188188
caps.maxImageExtent.height),
189189
};
190190
swapchain_info.minImageCount = std::clamp(
191-
caps.minImageCount + 1u, caps.minImageCount, caps.maxImageCount);
191+
caps.minImageCount + 1u, // preferred image count
192+
caps.minImageCount, // min count cannot be zero
193+
caps.maxImageCount == 0u ? caps.minImageCount + 1u
194+
: caps.maxImageCount // max zero means no limit
195+
);
192196
swapchain_info.imageArrayLayers = 1u;
193197
swapchain_info.imageUsage = vk::ImageUsageFlagBits::eColorAttachment;
194198
swapchain_info.preTransform = caps.currentTransform;

0 commit comments

Comments
 (0)