diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-07-08 12:33:45 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-07-08 12:33:45 -0600 |
| commit | ef26f2e134f9aa5b557fb802f7da114455a50779 (patch) | |
| tree | 1265173f5970a1345e854cc4133dc354551d2d28 /layers/core_validation.cpp | |
| parent | d787e3a7918795b0e023148fd6ee6c84530e736c (diff) | |
| download | usermoji-ef26f2e134f9aa5b557fb802f7da114455a50779.tar.xz | |
layers: Remove cb_bindings when CB is reset
When a CB is reset (or freed) make sure to remove it from any image/buffer
cb_bindings that it was tied to.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index bcf86eb7..9c1e679c 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -505,6 +505,7 @@ static bool addCommandBufferBindingImage(layer_data *dev_data, GLOBAL_CB_NODE *c // Now update CBInfo's Mem reference list cb_node->memObjs.insert(img_node->mem); } + cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(img_node->image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT}); } // Now update cb binding for image img_node->cb_bindings.insert(cb_node); @@ -522,6 +523,7 @@ static bool addCommandBufferBindingBuffer(layer_data *dev_data, GLOBAL_CB_NODE * pMemInfo->commandBufferBindings.insert(cb_node->commandBuffer); // Now update CBInfo's Mem reference list cb_node->memObjs.insert(buff_node->mem); + cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(buff_node->buffer), VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT}); } // Now update cb binding for buffer buff_node->cb_bindings.insert(cb_node); @@ -3717,6 +3719,25 @@ static bool addCmd(layer_data *my_data, GLOBAL_CB_NODE *pCB, const CMD_TYPE cmd, } return skip_call; } +// For a given object, if cb_node is in that objects cb_bindings, remove cb_node +static void removeCommandBufferBinding(layer_data *dev_data, VK_OBJECT const *object, GLOBAL_CB_NODE *cb_node) { + switch (object->type) { + case VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT: { + auto img_node = getImageNode(dev_data, reinterpret_cast<VkImage>(object->handle)); + if (img_node) + img_node->cb_bindings.erase(cb_node); + break; + } + case VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT: { + auto buf_node = getBufferNode(dev_data, reinterpret_cast<VkBuffer>(object->handle)); + if (buf_node) + buf_node->cb_bindings.erase(cb_node); + break; + } + default: + assert(0); // unhandled object type + } +} // Reset the command buffer state // Maintain the createInfo and set state to CB_NEW, but clear all other state static void resetCB(layer_data *dev_data, const VkCommandBuffer cb) { @@ -3773,6 +3794,10 @@ static void resetCB(layer_data *dev_data, const VkCommandBuffer cb) { pCB->eventUpdates.clear(); pCB->queryUpdates.clear(); + // Remove object bindings + for (auto obj : pCB->object_bindings) { + removeCommandBufferBinding(dev_data, &obj, pCB); + } // Remove this cmdBuffer's reference from each FrameBuffer's CB ref list for (auto framebuffer : pCB->framebuffers) { auto fb_node = getFramebuffer(dev_data, framebuffer); |
