tests: Don't try to exceed maxMipLevels with small extents
I tried bumping one of the extents to 2^maxMipLevels+1, but that
then exceeds the max extent limit for the format, so fall back
to just don't run the test.
Change-Id: I025186cfd48d0791ccf9e133e85efef20ac52c15
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 99f0684..7efb508 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -16709,12 +16709,17 @@
m_errorMonitor->VerifyFound();
image_create_info.extent.width = 1;
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "exceeds allowable maximum supported by format of");
- image_create_info.mipLevels = imgFmtProps.maxMipLevels + 1;
- // Expect INVALID_FORMAT_LIMITS_VIOLATION
- vkCreateImage(m_device->handle(), &image_create_info, NULL, &nullImg);
- m_errorMonitor->VerifyFound();
- image_create_info.mipLevels = 1;
+ uint32_t maxDim =
+ std::max(std::max(image_create_info.extent.width, image_create_info.extent.height), image_create_info.extent.depth);
+ // If max mip levels exceeds image extents, skip the max mip levels test
+ if ((imgFmtProps.maxMipLevels + 1) <= (floor(log2(maxDim)) + 1)) {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "exceeds allowable maximum supported by format of");
+ image_create_info.mipLevels = imgFmtProps.maxMipLevels + 1;
+ // Expect INVALID_FORMAT_LIMITS_VIOLATION
+ vkCreateImage(m_device->handle(), &image_create_info, NULL, &nullImg);
+ m_errorMonitor->VerifyFound();
+ image_create_info.mipLevels = 1;
+ }
m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "exceeds allowable maximum supported by format of");
image_create_info.arrayLayers = imgFmtProps.maxArrayLayers + 1;