From a3f6625666fa2e12bb780c0f2687394c4a2eb846 Mon Sep 17 00:00:00 2001
From: Tobin Ehlis <tobine@google.com>
Date: Tue, 17 Apr 2018 16:15:01 -0600
Subject: [PATCH] tests:Update 2nd CB test to change rect value

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 795300c06..3eac586c5 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -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) {
-- 
GitLab