tests:Modify DestroyPipelineRenderPass
authorTobin Ehlis <tobine@google.com>
Thu, 28 Sep 2017 18:51:11 +0000 (12:51 -0600)
committerTobin Ehlis <tobine@google.com>
Thu, 28 Sep 2017 20:26:43 +0000 (13:26 -0700)
We previously had a validation bug where an invalid binding was created
between the cmd buffer and the renderPass used in pipeline creation.
This change still destroys the renerPass before draw-time validation,
but delays the destroy until after the pipeline is bound to make sure
that the invalid binding is not created.

tests/layer_validation_tests.cpp

index f8110f7..54676eb 100644 (file)
@@ -6433,12 +6433,14 @@ TEST_F(VkPositiveLayerTest, DestroyPipelineRenderPass) {
     err = vkCreatePipelineLayout(m_device->device(), &plci, nullptr, &pl);
     ASSERT_VK_SUCCESS(err);
     pipe.CreateVKPipeline(pl, rp);
-    // Destroy renderPass before pipeline is used
-    vkDestroyRenderPass(m_device->device(), rp, nullptr);
 
     m_commandBuffer->begin();
     m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo);
     vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
+    // Destroy renderPass before pipeline is used in Draw
+    //  We delay until after CmdBindPipeline to verify that invalid binding isn't
+    //  created between CB & renderPass, which we used to do.
+    vkDestroyRenderPass(m_device->device(), rp, nullptr);
     vkCmdDraw(m_commandBuffer->handle(), 3, 1, 0, 0);
     vkCmdEndRenderPass(m_commandBuffer->handle());
     m_commandBuffer->end();