diff options
author | Mark Lobodzinski <mark@lunarg.com> | 2016-10-14 10:59:42 -0600 |
---|---|---|
committer | Mark Lobodzinski <mark@lunarg.com> | 2016-10-14 14:52:32 -0600 |
commit | 9bcf596933852a8b08652d0d9b95958b8cd24fa9 (patch) | |
tree | 8a50f2652550fefd539c9df9a6e3926da957d67a /tests | |
parent | 552629c51458e1985defbb4c1cf126b7f1668410 (diff) |
tests: Add CmdCopyImage region extents checks
Added two tests to check validation of regionsize against src and
dest image sizes.
Change-Id: Ic3afbc32a63b791a6ad302c91bdcc60a86ae5ace
Diffstat (limited to 'tests')
-rw-r--r-- | tests/layer_validation_tests.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp index d54250c1..87ba507a 100644 --- a/tests/layer_validation_tests.cpp +++ b/tests/layer_validation_tests.cpp @@ -17781,6 +17781,83 @@ TEST_F(VkLayerTest, ImageFormatLimits) { image_create_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; } +TEST_F(VkLayerTest, CopyImageSrcSizeExceeded) { + + // Image copy with source region specified greater than src image size + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, + "exceeds extents srcImage was created with"); + + ASSERT_NO_FATAL_FAILURE(InitState()); + + VkImageObj src_image(m_device); + src_image.init(32, 32, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_IMAGE_TILING_LINEAR, 0); + VkImageObj dst_image(m_device); + dst_image.init(64, 64, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_TRANSFER_DST_BIT, VK_IMAGE_TILING_LINEAR, 0); + + BeginCommandBuffer(); + VkImageCopy copy_region; + copy_region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + copy_region.srcSubresource.mipLevel = 0; + copy_region.srcSubresource.baseArrayLayer = 0; + copy_region.srcSubresource.layerCount = 0; + copy_region.srcOffset.x = 0; + copy_region.srcOffset.y = 0; + copy_region.srcOffset.z = 0; + copy_region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + copy_region.dstSubresource.mipLevel = 0; + copy_region.dstSubresource.baseArrayLayer = 0; + copy_region.dstSubresource.layerCount = 0; + copy_region.dstOffset.x = 0; + copy_region.dstOffset.y = 0; + copy_region.dstOffset.z = 0; + copy_region.extent.width = 64; + copy_region.extent.height = 64; + copy_region.extent.depth = 1; + m_commandBuffer->CopyImage(src_image.image(), VK_IMAGE_LAYOUT_GENERAL, dst_image.image(), VK_IMAGE_LAYOUT_GENERAL, 1, + ©_region); + EndCommandBuffer(); + + m_errorMonitor->VerifyFound(); +} + +TEST_F(VkLayerTest, CopyImageDstSizeExceeded) { + + // Image copy with dest region specified greater than dest image size + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "exceeds extents dstImage was created with"); + + ASSERT_NO_FATAL_FAILURE(InitState()); + + VkImageObj src_image(m_device); + src_image.init(64, 64, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_IMAGE_TILING_LINEAR, 0); + VkImageObj dst_image(m_device); + dst_image.init(32, 32, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_TRANSFER_DST_BIT, VK_IMAGE_TILING_LINEAR, 0); + + BeginCommandBuffer(); + VkImageCopy copy_region; + copy_region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + copy_region.srcSubresource.mipLevel = 0; + copy_region.srcSubresource.baseArrayLayer = 0; + copy_region.srcSubresource.layerCount = 0; + copy_region.srcOffset.x = 0; + copy_region.srcOffset.y = 0; + copy_region.srcOffset.z = 0; + copy_region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + copy_region.dstSubresource.mipLevel = 0; + copy_region.dstSubresource.baseArrayLayer = 0; + copy_region.dstSubresource.layerCount = 0; + copy_region.dstOffset.x = 0; + copy_region.dstOffset.y = 0; + copy_region.dstOffset.z = 0; + copy_region.extent.width = 64; + copy_region.extent.height = 64; + copy_region.extent.depth = 1; + m_commandBuffer->CopyImage(src_image.image(), VK_IMAGE_LAYOUT_GENERAL, dst_image.image(), VK_IMAGE_LAYOUT_GENERAL, 1, + ©_region); + EndCommandBuffer(); + + m_errorMonitor->VerifyFound(); +} + TEST_F(VkLayerTest, CopyImageFormatSizeMismatch) { VkResult err; bool pass; |