aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-06-24 14:41:20 -0600
committerTobin Ehlis <tobine@google.com>2016-06-28 07:40:04 -0600
commit72a4047d2dbbcfef42251914e1b534d306365ebd (patch)
tree9d69d0bf39ef8c31aaf35f95db782a6c2f2a6ca9
parent07c81dc68a0ae134cf24a0b5365b318d13699359 (diff)
downloadusermoji-72a4047d2dbbcfef42251914e1b534d306365ebd.tar.xz
layers: Update cb_bindings to hold CB_NODE ptr
Store GLOBAL_CB_NODE ptr in cb_bindings to avoid additional look-ups.
-rw-r--r--layers/core_validation.cpp17
-rw-r--r--layers/core_validation_types.h4
2 files changed, 10 insertions, 11 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 7e14c95b..6100e005 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -3777,7 +3777,7 @@ static void resetCB(layer_data *dev_data, const VkCommandBuffer cb) {
for (auto framebuffer : pCB->framebuffers) {
auto fb_node = getFramebuffer(dev_data, framebuffer);
if (fb_node)
- fb_node->cb_bindings.erase(pCB->commandBuffer);
+ fb_node->cb_bindings.erase(pCB);
}
pCB->framebuffers.clear();
pCB->activeFramebuffer = VK_NULL_HANDLE;
@@ -5529,13 +5529,10 @@ DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocatio
std::unique_lock<std::mutex> lock(global_lock);
auto fb_node = getFramebuffer(dev_data, framebuffer);
if (fb_node) {
- for (auto cb : fb_node->cb_bindings) {
- auto cb_node = getCBNode(dev_data, cb);
- if (cb_node) {
- // Set CB as invalid and record destroyed framebuffer
- cb_node->state = CB_INVALID;
- cb_node->destroyedFramebuffers.insert(framebuffer);
- }
+ for (auto cb_node : fb_node->cb_bindings) {
+ // Set CB as invalid and record destroyed framebuffer
+ cb_node->state = CB_INVALID;
+ cb_node->destroyedFramebuffers.insert(framebuffer);
}
dev_data->frameBufferMap.erase(fb_node->framebuffer);
}
@@ -6232,7 +6229,7 @@ BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo
(uint64_t)(pInfo->framebuffer), (uint64_t)(fbRP), errorString.c_str());
}
// Connect this framebuffer to this cmdBuffer
- framebuffer->cb_bindings.insert(pCB->commandBuffer);
+ framebuffer->cb_bindings.insert(pCB);
}
}
}
@@ -9211,7 +9208,7 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p
pCB->activeSubpassContents = contents;
pCB->framebuffers.insert(pRenderPassBegin->framebuffer);
// Connect this framebuffer to this cmdBuffer
- framebuffer->cb_bindings.insert(pCB->commandBuffer);
+ framebuffer->cb_bindings.insert(pCB);
} else {
skipCall |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h
index 8111cc74..18c86757 100644
--- a/layers/core_validation_types.h
+++ b/layers/core_validation_types.h
@@ -58,6 +58,8 @@ class DescriptorSetLayout;
class DescriptorSet;
};
+struct GLOBAL_CB_NODE;
+
class BASE_NODE {
public:
// Track when object is being used by an in-flight command buffer
@@ -66,7 +68,7 @@ class BASE_NODE {
// binding initialized when cmd referencing object is bound to command buffer
// binding removed when command buffer is reset or destroyed
// When an object is destroyed, any bound cbs are set to INVALID
- std::unordered_set<VkCommandBuffer> cb_bindings;
+ std::unordered_set<GLOBAL_CB_NODE *> cb_bindings;
};
struct DESCRIPTOR_POOL_NODE {