aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-06-28 16:24:17 -0600
committerTobin Ehlis <tobine@google.com>2016-07-06 19:45:31 -0600
commit4d9f49299fed117e19fc0666c139420684ad9466 (patch)
tree431495e7de0bd18896e4e0162918556917e3a639 /layers/core_validation.cpp
parent8fde7c728bd6651798dcc1823557c766ddfe3065 (diff)
downloadusermoji-4d9f49299fed117e19fc0666c139420684ad9466.tar.xz
layers: Invalidate Cmd Buffers on DestroyImage
When image is destroyed, any command buffers that it's bound to must be invalidated. Also clean-up DestroyImage() a bit.
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index b3d86988..a32c0f49 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -5209,23 +5209,24 @@ DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCa
VKAPI_ATTR void VKAPI_CALL DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) {
layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
- bool skip_call = false;
- if (!skip_call) {
- dev_data->device_dispatch_table->DestroyImage(device, image, pAllocator);
- }
+ // TODO : Flag error if image is use by in-flight command buffer
+ dev_data->device_dispatch_table->DestroyImage(device, image, pAllocator);
std::lock_guard<std::mutex> lock(global_lock);
- const auto &imageEntry = dev_data->imageMap.find(image);
- if (imageEntry != dev_data->imageMap.end()) {
+ auto img_node = getImageNode(dev_data, image);
+ if (img_node) {
+ // Any bound cmd buffers are now invalid
+ invalidateCommandBuffers(img_node->cb_bindings,
+ {reinterpret_cast<uint64_t &>(img_node->image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT});
// Clean up memory mapping, bindings and range references for image
- auto mem_info = getMemObjInfo(dev_data, imageEntry->second.get()->mem);
+ auto mem_info = getMemObjInfo(dev_data, img_node->mem);
if (mem_info) {
- remove_memory_ranges(reinterpret_cast<uint64_t &>(image), imageEntry->second.get()->mem, mem_info->imageRanges);
+ remove_memory_ranges(reinterpret_cast<uint64_t &>(image), img_node->mem, mem_info->imageRanges);
clear_object_binding(dev_data, reinterpret_cast<uint64_t &>(image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT);
mem_info->image = VK_NULL_HANDLE;
}
// Remove image from imageMap
- dev_data->imageMap.erase(imageEntry);
+ dev_data->imageMap.erase(img_node->image);
}
const auto& subEntry = dev_data->imageSubresourceMap.find(image);
if (subEntry != dev_data->imageSubresourceMap.end()) {