diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-06-23 17:03:56 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-06-28 07:40:04 -0600 |
| commit | f9bc98a9e2054b25cf995266580c386cc72206e8 (patch) | |
| tree | 88c08f633c738f4ab77e8d93cf12093ede89a2c3 /layers/core_validation.cpp | |
| parent | d975e91286da24af56770b1b6734edc0bcab6ece (diff) | |
| download | usermoji-f9bc98a9e2054b25cf995266580c386cc72206e8.tar.xz | |
layers: BUFFER_NODE clean-up
Initial work to prepare for larger overhaul of BUFFER_NODE as well
as unifying INVALID_CB treatment.
This adds cb_bindings set to BASE_NODE which will be used to track
command buffers that objects are bound to in order to flag them as
INVALID if objects are deleted while CB are still valid.
Initially making use of this with BUFFER_NODE, but it will move to
all objects that can be bound to command buffers.
Also, use getBufferNode() utility in DestroyBuffer() and add buffer
to BUFFER_NODE so it can be used for erasing node from map.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 0a047c9f..5e3090a4 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5099,14 +5099,14 @@ VKAPI_ATTR void VKAPI_CALL DestroyBuffer(VkDevice device, VkBuffer buffer, lock.lock(); } // Clean up memory binding and range information for buffer - auto buff_it = dev_data->bufferMap.find(buffer); - if (buff_it != dev_data->bufferMap.end()) { - auto mem_info = getMemObjInfo(dev_data, buff_it->second.get()->mem); + auto buff_node = getBufferNode(dev_data, buffer); + if (buff_node) { + auto mem_info = getMemObjInfo(dev_data, buff_node->mem); if (mem_info) { - remove_memory_ranges(reinterpret_cast<uint64_t &>(buffer), buff_it->second.get()->mem, mem_info->bufferRanges); + remove_memory_ranges(reinterpret_cast<uint64_t &>(buffer), buff_node->mem, mem_info->bufferRanges); } clear_object_binding(dev_data, reinterpret_cast<uint64_t &>(buffer), VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT); - dev_data->bufferMap.erase(buff_it); + dev_data->bufferMap.erase(buff_node->buffer); } } @@ -5544,7 +5544,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateBuffer(VkDevice device, const VkBufferCreat if (VK_SUCCESS == result) { std::lock_guard<std::mutex> lock(global_lock); // TODO : This doesn't create deep copy of pQueueFamilyIndices so need to fix that if/when we want that data to be valid - dev_data->bufferMap.insert(std::make_pair(*pBuffer, unique_ptr<BUFFER_NODE>(new BUFFER_NODE(pCreateInfo)))); + dev_data->bufferMap.insert(std::make_pair(*pBuffer, unique_ptr<BUFFER_NODE>(new BUFFER_NODE(*pBuffer, pCreateInfo)))); } return result; } |
