layers: Add error for CmdEndRenderPass before reaching final subpass
authorChris Forbes <chrisforbes@google.com>
Wed, 7 Sep 2016 02:08:31 +0000 (14:08 +1200)
committerChris Forbes <chrisforbes@google.com>
Wed, 7 Sep 2016 04:58:25 +0000 (16:58 +1200)
Signed-off-by: Chris Forbes <chrisforbes@google.com>
layers/core_validation.cpp

index 5d3e160..55d5c33 100644 (file)
@@ -10103,6 +10103,13 @@ VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) {
         RENDER_PASS_NODE* pRPNode = pCB->activeRenderPass;
         auto framebuffer = getFramebuffer(dev_data, pCB->activeFramebuffer);
         if (pRPNode) {
+            if (pCB->activeSubpass != pRPNode->pCreateInfo->subpassCount - 1) {
+                skip_call |=
+                    log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+                            reinterpret_cast<uint64_t>(commandBuffer), __LINE__, DRAWSTATE_INVALID_SUBPASS_INDEX, "DS",
+                            "vkCmdEndRenderPass(): Called before reaching final subpass");
+            }
+
             for (size_t i = 0; i < pRPNode->attachments.size(); ++i) {
                 MT_FB_ATTACHMENT_INFO &fb_info = framebuffer->attachments[i];
                 VkFormat format = pRPNode->pCreateInfo->pAttachments[pRPNode->attachments[i].attachment].format;