diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-09-06 20:37:01 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-09-07 09:25:26 -0600 |
| commit | cc9aaf2690a806c4610251840a9358f8cdd5f07e (patch) | |
| tree | 426f02ae34fe7c7e7f6771a6ed075303b0245804 /layers/core_validation.cpp | |
| parent | 82c3db15e7efd28bfa4f4e43933d1fde07101a61 (diff) | |
| download | usermoji-cc9aaf2690a806c4610251840a9358f8cdd5f07e.tar.xz | |
layers: Add cmd buffer binding for fb images
Fixes #915
When binding framebuffer to command buffer, we need to also bind the
underlying images. Then, if images are destroyed, the cmd buffer
will correctly be marked as invalid and an error will be flagged if
an attempt to submit the cmd buffer is made.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 55d5c334..24190dac 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -4924,6 +4924,9 @@ QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, V pCBNode->submitCount++; // increment submit count skip_call |= validatePrimaryCommandBufferState(dev_data, pCBNode); skip_call |= validateQueueFamilyIndices(dev_data, pCBNode, queue); + // Potential early exit here as bad object state may crash in delayed function calls + if (skip_call) + return result; // Call submit-time functions to validate/update state for (auto &function : pCBNode->validate_functions) { skip_call |= function(); @@ -6722,6 +6725,14 @@ BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo } // Connect this framebuffer to this cmdBuffer framebuffer->cb_bindings.insert(pCB); + for (auto attach : framebuffer->attachments) { + auto img_node = getImageNode(dev_data, attach.image); + if (img_node) { + addCommandBufferBinding( + &img_node->cb_bindings, + {reinterpret_cast<uint64_t &>(attach.image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT}, pCB); + } + } } } } @@ -10046,7 +10057,14 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p pCB->framebuffers.insert(pRenderPassBegin->framebuffer); // Connect this framebuffer to this cmdBuffer framebuffer->cb_bindings.insert(pCB); - + for (auto attach : framebuffer->attachments) { + auto img_node = getImageNode(dev_data, attach.image); + if (img_node) { + addCommandBufferBinding(&img_node->cb_bindings, + {reinterpret_cast<uint64_t &>(attach.image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT}, + pCB); + } + } // transition attachments to the correct layouts for the first subpass TransitionSubpassLayouts(dev_data, pCB, &pCB->activeRenderPassBeginInfo, pCB->activeSubpass); } else { |
