tests: GH1182, Add buffer/image copy test cases
authorMark Lobodzinski <mark@lunarg.com>
Tue, 22 Nov 2016 21:48:36 +0000 (14:48 -0700)
committerMark Lobodzinski <mark@lunarg.com>
Wed, 23 Nov 2016 14:56:43 +0000 (07:56 -0700)
Added cases to MiscImageLayerTest and updated the VE database.

Change-Id: Ic76d9c5aafc1532cc761c92feaffbf5745e86f93

layers/vk_validation_error_database.txt
tests/layer_validation_tests.cpp

index e0d31fb..ffdafa9 100644 (file)
@@ -1259,7 +1259,7 @@ VALIDATION_ERROR_01265~^~Y~^~MiscImageLayerTests~^~vkCmdCopyImageToBuffer~^~For
 VALIDATION_ERROR_01266~^~Y~^~MiscImageLayerTests~^~vkCmdCopyImageToBuffer~^~For more information refer to Vulkan Spec Section '18.4. Copying Data Between Buffers and Images' which states 'bufferImageHeight must be 0, or greater than or equal to the height member of imageExtent' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferImageCopy)~^~
 VALIDATION_ERROR_01267~^~U~^~Unknown~^~vkCmdCopyImageToBuffer~^~For more information refer to Vulkan Spec Section '18.4. Copying Data Between Buffers and Images' which states 'imageOffset.x and (imageExtent.width + imageOffset.x) must both be greater than or equal to 0 and less than or equal to the image subresource width' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferImageCopy)~^~
 VALIDATION_ERROR_01268~^~U~^~Unknown~^~vkCmdCopyImageToBuffer~^~For more information refer to Vulkan Spec Section '18.4. Copying Data Between Buffers and Images' which states 'imageOffset.y and (imageExtent.height + imageOffset.y) must both be greater than or equal to 0 and less than or equal to the image subresource heightIf the calling commands srcImage (vkCmdCopyImageToBuffer) or dstImage (vkCmdCopyBufferToImage) is of type VK_IMAGE_TYPE_1D, then imageOffset.y must be 0 and imageExtent.height must be 1.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferImageCopy)~^~
-VALIDATION_ERROR_01269~^~U~^~Unknown~^~vkCmdCopyImageToBuffer~^~For more information refer to Vulkan Spec Section '18.4. Copying Data Between Buffers and Images' which states 'imageOffset.z and (imageExtent.depth + imageOffset.z) must both be greater than or equal to 0 and less than or equal to the image subresource depthIf the calling commands srcImage (vkCmdCopyImageToBuffer) or dstImage (vkCmdCopyBufferToImage) is of type VK_IMAGE_TYPE_1D or VK_IMAGE_TYPE_2D, then imageOffset.z must be 0 and imageExtent.depth must be 1.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferImageCopy)~^~
+VALIDATION_ERROR_01269~^~Y~^~MiscImageLayerTests~^~vkCmdCopyImageToBuffer~^~For more information refer to Vulkan Spec Section '18.4. Copying Data Between Buffers and Images' which states 'imageOffset.z and (imageExtent.depth + imageOffset.z) must both be greater than or equal to 0 and less than or equal to the image subresource depthIf the calling commands srcImage (vkCmdCopyImageToBuffer) or dstImage (vkCmdCopyBufferToImage) is of type VK_IMAGE_TYPE_1D or VK_IMAGE_TYPE_2D, then imageOffset.z must be 0 and imageExtent.depth must be 1.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferImageCopy)~^~This VU has two distinct conditions and the implemented check looks at both, but there are two distinct test cases for this enum
 VALIDATION_ERROR_01270~^~U~^~Unknown~^~vkCmdCopyImageToBuffer~^~For more information refer to Vulkan Spec Section '18.4. Copying Data Between Buffers and Images' which states 'If the calling commands VkImage parameter is a compressed format image:bufferRowLength must be a multiple of the compressed texel block widthbufferImageHeight must be a multiple of the compressed texel block heightall members of imageOffset must be a multiple of the corresponding dimensions of the compressed texel blockbufferOffset must be a multiple of the compressed texel block size in bytesimageExtent.width must be a multiple of the compressed texel block width or (imageExtent.width + imageOffset.x) must equal the image subresource widthimageExtent.height must be a multiple of the compressed texel block height or (imageExtent.height + imageOffset.y) must equal the image subresource heightimageExtent.depth must be a multiple of the compressed texel block depth or (imageExtent.depth + imageOffset.z) must equal the image subresource depth' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferImageCopy)~^~
 VALIDATION_ERROR_01271~^~U~^~Unknown~^~vkCmdCopyImageToBuffer~^~For more information refer to Vulkan Spec Section '18.4. Copying Data Between Buffers and Images' which states 'bufferRowLength must be a multiple of the compressed texel block width' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferImageCopy)~^~
 VALIDATION_ERROR_01272~^~U~^~Unknown~^~vkCmdCopyImageToBuffer~^~For more information refer to Vulkan Spec Section '18.4. Copying Data Between Buffers and Images' which states 'bufferImageHeight must be a multiple of the compressed texel block height' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkBufferImageCopy)~^~
index da74816..1c86f6d 100644 (file)
@@ -14233,6 +14233,25 @@ TEST_F(VkLayerTest, MiscImageLayerTests) {
     region.imageExtent.depth = 1;
     m_commandBuffer->BeginCommandBuffer();
 
+    // Image must have offset.z of 0 and extent.depth of 1
+    // Introduce failure by setting imageExtent.depth to 0
+    region.imageExtent.depth = 0;
+    m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_01269);
+    vkCmdCopyBufferToImage(m_commandBuffer->GetBufferHandle(), buffer.handle(), image.handle(),
+        VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
+    m_errorMonitor->VerifyFound();
+
+    region.imageExtent.depth = 1;
+
+    // Image must have offset.z of 0 and extent.depth of 1
+    // Introduce failure by setting imageOffset.z to 4
+    region.imageOffset.z = 4;
+    m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_01269);
+    vkCmdCopyBufferToImage(m_commandBuffer->GetBufferHandle(), buffer.handle(), image.handle(),
+        VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
+    m_errorMonitor->VerifyFound();
+
+    region.imageOffset.z = 0;
     // BufferOffset must be a multiple of the calling command's VkImage parameter's texel size
     // Introduce failure by setting bufferOffset to 1 and 1/2 texels
     region.bufferOffset = 6;