tests:Update 2nd CB test to change rect value
authorTobin Ehlis <tobine@google.com>
Tue, 17 Apr 2018 22:15:01 +0000 (16:15 -0600)
committerTobin Ehlis <tobine@google.com>
Wed, 18 Apr 2018 12:25:15 +0000 (06:25 -0600)
Modify ConfirmNoVLErrorWhenVkCmdClearAttachmentsCalledInSecondaryCB
positive test to change the rect value after the call to
vkCmdClearAttachments() in the secondary command buffer but before the
secondary CB is executed in vkCmdExecuteCommands().
This exposes a previous bug in validation layers where the pointer to
the VkClearRect was copied, but not the underlying rect itself.

tests/layer_validation_tests.cpp

index 795300c..3eac586 100644 (file)
@@ -13584,14 +13584,16 @@ TEST_F(VkPositiveLayerTest, ConfirmNoVLErrorWhenVkCmdClearAttachmentsCalledInSec
     color_attachment.colorAttachment = 0;
     VkClearRect clear_rect = {{{0, 0}, {(uint32_t)m_width, (uint32_t)m_height}}, 0, 1};
     vkCmdClearAttachments(secondary.handle(), 1, &color_attachment, 1, &clear_rect);
-    m_errorMonitor->VerifyNotFound();
     secondary.end();
+    // Modify clear rect here to verify that it doesn't cause validation error
+    clear_rect = {{{0, 0}, {99999999, 99999999}}, 0, 0};
 
     m_commandBuffer->begin();
     vkCmdBeginRenderPass(m_commandBuffer->handle(), &m_renderPassBeginInfo, VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS);
     vkCmdExecuteCommands(m_commandBuffer->handle(), 1, &secondary.handle());
     vkCmdEndRenderPass(m_commandBuffer->handle());
     m_commandBuffer->end();
+    m_errorMonitor->VerifyNotFound();
 }
 
 TEST_F(VkLayerTest, CmdClearAttachmentTests) {