Limit protected swapchain images based on memory
A surface's maxImageCount isn't based on the swapchain image extents
or format, so it's valid for swapchain creation to fail for
out-of-memory reasons even when the image count is within the
supported range.
This is particularly problematic for protected swapchains, since many
implementations have a limit on the total amount of protected memory
that can be allocated which is much smaller than total device memory.
This change estimates how much memory is used by protected swapchain
images, compares that to the size of heaps that support protected
memory types, and doesn't try to create swapchains that would have
more images than would fit within that size.
Components: Vulkan
VK-GL-CTS Issue: 1167
Affects:
dEQP-VK.protected_memory.interaction.wsi.*.swapchain.create.min_image_count
Bug:
77319653
Test: dEQP-VK.protected_memory.interaction.wsi.android.swapchain.create.min_image_count
Change-Id: I6cc3bd25f7f22de8424f9e3375ade35fac26a884