layers: adjust extents for multiplane images
Change-Id: I9b0c2970ab32059ced1289f03bc5bef5ba754bb1
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp
index 9cb58b6..51d8491 100644
--- a/layers/buffer_validation.cpp
+++ b/layers/buffer_validation.cpp
@@ -1868,6 +1868,13 @@
// Don't allow mip adjustment to create 0 dim, but pass along a 0 if that's what subresource specified
VkExtent3D extent = img->createInfo.extent;
+ // If multi-plane, adjust per-plane extent
+ if (FormatIsMultiplane(img->createInfo.format)) {
+ VkExtent2D divisors = FindMultiplaneExtentDivisors(img->createInfo.format, subresource->aspectMask);
+ extent.width /= divisors.width;
+ extent.height /= divisors.height;
+ }
+
if (img->createInfo.flags & VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV) {
extent.width = (0 == extent.width ? 0 : std::max(2U, 1 + ((extent.width - 1) >> mip)));
extent.height = (0 == extent.height ? 0 : std::max(2U, 1 + ((extent.height - 1) >> mip)));