layers:Fix renderPass<->cmdBuffer binding
authorTobin Ehlis <tobine@google.com>
Thu, 28 Sep 2017 19:20:53 +0000 (13:20 -0600)
committerTobin Ehlis <tobine@google.com>
Thu, 28 Sep 2017 20:26:43 +0000 (13:26 -0700)
At BeginRenderPass() time bind the active renderPass to the cmdBuffer.
Don't bind the renderPass used to create the framebuffer. The
renderPass lifetime rules allow the renderPass used in FB creation to
be destroyed after FB creation.

layers/core_validation.cpp

index 9671e5f..5d1e7f5 100644 (file)
@@ -4996,11 +4996,6 @@ static void AddFramebufferBinding(layer_data *dev_data, GLOBAL_CB_NODE *cb_state
         if (view_state) {
             AddCommandBufferBindingImageView(dev_data, cb_state, view_state);
         }
-        auto rp_state = GetRenderPassState(dev_data, fb_state->createInfo.renderPass);
-        if (rp_state) {
-            addCommandBufferBinding(&rp_state->cb_bindings, {HandleToUint64(rp_state->renderPass), kVulkanObjectTypeRenderPass},
-                                    cb_state);
-        }
     }
 }
 
@@ -8114,6 +8109,9 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, con
             cb_node->framebuffers.insert(pRenderPassBegin->framebuffer);
             // Connect this framebuffer and its children to this cmdBuffer
             AddFramebufferBinding(dev_data, cb_node, framebuffer);
+            // Connect this RP to cmdBuffer
+            addCommandBufferBinding(&render_pass_state->cb_bindings,
+                                    {HandleToUint64(render_pass_state->renderPass), kVulkanObjectTypeRenderPass}, cb_node);
             // transition attachments to the correct layouts for beginning of renderPass and first subpass
             TransitionBeginRenderPassLayouts(dev_data, cb_node, render_pass_state, framebuffer);
         }