tests:Fix unexpected error
authorTobin Ehlis <tobine@google.com>
Mon, 4 Dec 2017 21:47:26 +0000 (14:47 -0700)
committerTobin Ehlis <tobine@google.com>
Wed, 6 Dec 2017 16:25:20 +0000 (09:25 -0700)
Update ClearDepthStencilImageErrors test to remove unexpected error.
Updated the error check to use VUID instead of text.
Also, this is the new name of the test in anticipation of testing at
least one more error condition in this same test.

layers/vk_validation_error_database.txt
tests/layer_validation_tests.cpp

index 40c6f38..ab2ec1d 100644 (file)
@@ -1856,7 +1856,7 @@ VALIDATION_ERROR_18a00010~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkC
 VALIDATION_ERROR_18a00012~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-image-00009~^~core~^~The spec valid usage text states 'image must have been created with VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-image-00009)~^~
 VALIDATION_ERROR_18a00014~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-image-00010~^~core~^~The spec valid usage text states 'If image is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-image-00010)~^~
 VALIDATION_ERROR_18a00016~^~Y~^~InvalidImageLayout~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-imageLayout-00011~^~core~^~The spec valid usage text states 'imageLayout must specify the layout of the image subresource ranges of image specified in pRanges at the time this command is executed on a VkDevice' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-imageLayout-00011)~^~
-VALIDATION_ERROR_18a00017~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-renderpass~^~core~^~The spec valid usage text states 'This command must only be called outside of a render pass instance' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-renderpass)~^~implicit
+VALIDATION_ERROR_18a00017~^~Y~^~ClearDepthStencilImageErrors~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-renderpass~^~core~^~The spec valid usage text states 'This command must only be called outside of a render pass instance' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-renderpass)~^~implicit
 VALIDATION_ERROR_18a00018~^~Y~^~InvalidImageLayout~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-imageLayout-00012~^~core~^~The spec valid usage text states 'imageLayout must be either of VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL or VK_IMAGE_LAYOUT_GENERAL' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-imageLayout-00012)~^~
 VALIDATION_ERROR_18a0001a~^~N~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-pRanges-00013~^~core~^~The spec valid usage text states 'The image range of any given element of pRanges must be an image subresource range that is contained within image' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-pRanges-00013)~^~
 VALIDATION_ERROR_18a0001c~^~Y~^~Unknown~^~vkCmdClearDepthStencilImage~^~VUID-vkCmdClearDepthStencilImage-image-00014~^~core~^~The spec valid usage text states 'image must have a depth/stencil format' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkCmdClearDepthStencilImage-image-00014)~^~
index e0ac47b..87170f9 100644 (file)
@@ -11005,10 +11005,10 @@ TEST_F(VkLayerTest, ClearColorImageWithinRenderPass) {
     m_errorMonitor->VerifyFound();
 }
 
-TEST_F(VkLayerTest, ClearDepthStencilImageWithinRenderPass) {
-    // Call CmdClearDepthStencilImage within an active RenderPass
-    m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
-                                         "It is invalid to issue this call inside an active render pass");
+TEST_F(VkLayerTest, ClearDepthStencilImageErrors) {
+    // Hit errors related to vkCmdClearDepthStencilImage()
+    // 1. Use an image that doesn't have VK_IMAGE_USAGE_TRANSFER_DST_BIT set
+    // 2. Call CmdClearDepthStencilImage within an active RenderPass
 
     ASSERT_NO_FATAL_FAILURE(Init());
     ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
@@ -11030,12 +11030,13 @@ TEST_F(VkLayerTest, ClearDepthStencilImageWithinRenderPass) {
     image_create_info.extent.width = 64;
     image_create_info.extent.height = 64;
     image_create_info.tiling = VK_IMAGE_TILING_OPTIMAL;
-    image_create_info.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
+    image_create_info.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
 
     vk_testing::Image dstImage;
     dstImage.init(*m_device, (const VkImageCreateInfo &)image_create_info, reqs);
 
     const VkImageSubresourceRange range = vk_testing::Image::subresource_range(image_create_info, VK_IMAGE_ASPECT_DEPTH_BIT);
+    m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_18a00017);
 
     vkCmdClearDepthStencilImage(m_commandBuffer->handle(), dstImage.handle(), VK_IMAGE_LAYOUT_GENERAL, &clear_value, 1, &range);