tests: VU 732, 733, 739, 740 tests
Create ExerciseGetImageSubresourceLayout() for varioud VU tests
of vkGetImageSubresourceLayout().
Update VU database to indicate implemented tests for those VUs.
Change-Id: I961d9ab54f35d307a87dedcc550d4d72af927dac
diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt
index fad8cc0..96a1544 100644
--- a/layers/vk_validation_error_database.txt
+++ b/layers/vk_validation_error_database.txt
@@ -720,15 +720,15 @@
VALIDATION_ERROR_00729~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'usage must not be 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~implicit
VALIDATION_ERROR_00730~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'sharingMode must be a valid VkSharingMode value' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~implicit
VALIDATION_ERROR_00731~^~Y~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'initialLayout must be a valid VkImageLayout value' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~implicit
-VALIDATION_ERROR_00732~^~Y~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'image must have been created with tiling equal to VK_IMAGE_TILING_LINEAR' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~
-VALIDATION_ERROR_00733~^~Y~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'The aspectMask member of pSubresource must only have a single bit set' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~
+VALIDATION_ERROR_00732~^~Y~^~ExerciseGetImageSubresourceLayout~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'image must have been created with tiling equal to VK_IMAGE_TILING_LINEAR' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~
+VALIDATION_ERROR_00733~^~Y~^~ExerciseGetImageSubresourceLayout~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'The aspectMask member of pSubresource must only have a single bit set' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~
VALIDATION_ERROR_00734~^~Y~^~None~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'device must be a valid VkDevice handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~implicit
VALIDATION_ERROR_00735~^~Y~^~None~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'image must be a valid VkImage handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~implicit
VALIDATION_ERROR_00736~^~N~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'pSubresource must be a pointer to a valid VkImageSubresource structure' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~implicit
VALIDATION_ERROR_00737~^~N~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'pLayout must be a pointer to a VkSubresourceLayout structure' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~implicit
VALIDATION_ERROR_00738~^~N~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'image must have been created, allocated, or retrieved from device' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~implicit
-VALIDATION_ERROR_00739~^~Y~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'mipLevel must be less than the mipLevels specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~
-VALIDATION_ERROR_00740~^~Y~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'arrayLayer must be less than the arrayLayers specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~
+VALIDATION_ERROR_00739~^~Y~^~ExerciseGetImageSubresourceLayout~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'mipLevel must be less than the mipLevels specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~
+VALIDATION_ERROR_00740~^~Y~^~ExerciseGetImageSubresourceLayout~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'arrayLayer must be less than the arrayLayers specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~
VALIDATION_ERROR_00741~^~Y~^~InvalidImageViewAspect~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'aspectMask must be a valid combination of VkImageAspectFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~implicit, Multi-purposing this enum for various invalid aspect usage. There is some "must" language in spec at VkImageAspectFlagBits definition that we need specific enums for. Also need more tests for these cases.
VALIDATION_ERROR_00742~^~N~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'aspectMask must not be 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~implicit
VALIDATION_ERROR_00743~^~Y~^~FramebufferImageInUseDestroyedSignaled~^~vkDestroyImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'All submitted commands that refer to image, either directly or via a VkImageView, must have completed execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyImage)~^~
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 8ce58a2..d293fbf 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -15554,6 +15554,79 @@
m_errorMonitor->VerifyFound();
}
+TEST_F(VkLayerTest, ExerciseGetImageSubresourceLayout) {
+ TEST_DESCRIPTION("Test vkGetImageSubresourceLayout() valid usages");
+
+ ASSERT_NO_FATAL_FAILURE(InitState());
+ VkSubresourceLayout subres_layout = {};
+
+ // VU 00732: image must have been created with tiling equal to VK_IMAGE_TILING_LINEAR
+ {
+ const VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL; // ERROR: violates VU 00732
+ VkImageObj img(m_device);
+ img.init_no_layout(32, 32, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_TRANSFER_SRC_BIT, tiling);
+ ASSERT_TRUE(img.initialized());
+
+ VkImageSubresource subres = {};
+ subres.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ subres.mipLevel = 0;
+ subres.arrayLayer = 0;
+
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00732);
+ vkGetImageSubresourceLayout(m_device->device(), img.image(), &subres, &subres_layout);
+ m_errorMonitor->VerifyFound();
+ }
+
+ // VU 00733: The aspectMask member of pSubresource must only have a single bit set
+ {
+ VkImageObj img(m_device);
+ img.init_no_layout(32, 32, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
+ ASSERT_TRUE(img.initialized());
+
+ VkImageSubresource subres = {};
+ subres.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_METADATA_BIT; // ERROR: triggers VU 00733
+ subres.mipLevel = 0;
+ subres.arrayLayer = 0;
+
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00733);
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00741);
+ vkGetImageSubresourceLayout(m_device->device(), img.image(), &subres, &subres_layout);
+ m_errorMonitor->VerifyFound();
+ }
+
+ // 00739 mipLevel must be less than the mipLevels specified in VkImageCreateInfo when the image was created
+ {
+ VkImageObj img(m_device);
+ img.init_no_layout(32, 32, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
+ ASSERT_TRUE(img.initialized());
+
+ VkImageSubresource subres = {};
+ subres.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ subres.mipLevel = 1; // ERROR: triggers VU 00739
+ subres.arrayLayer = 0;
+
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00739);
+ vkGetImageSubresourceLayout(m_device->device(), img.image(), &subres, &subres_layout);
+ m_errorMonitor->VerifyFound();
+ }
+
+ // 00740 arrayLayer must be less than the arrayLayers specified in VkImageCreateInfo when the image was created
+ {
+ VkImageObj img(m_device);
+ img.init_no_layout(32, 32, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
+ ASSERT_TRUE(img.initialized());
+
+ VkImageSubresource subres = {};
+ subres.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
+ subres.mipLevel = 0;
+ subres.arrayLayer = 1; // ERROR: triggers VU 00740
+
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00740);
+ vkGetImageSubresourceLayout(m_device->device(), img.image(), &subres, &subres_layout);
+ m_errorMonitor->VerifyFound();
+ }
+}
+
TEST_F(VkLayerTest, CopyImageLayerCountMismatch) {
VkResult err;
bool pass;