aboutsummaryrefslogtreecommitdiff
path: root/layers/unique_objects.cpp
diff options
context:
space:
mode:
authorGabríel Arthúr Pétursson <gabriel@system.is>2017-06-03 23:27:59 +0000
committerChris Forbes <chrisf@ijw.co.nz>2017-06-07 14:57:20 -0700
commit900135556fce1ecf6793267d4db4b423d7f009c1 (patch)
tree5e3402d98fc1214ecd9765ccc9c17ba3313dd652 /layers/unique_objects.cpp
parent6be9526304e7b7ea4f9bbbe91c84c03b842b457f (diff)
downloadusermoji-900135556fce1ecf6793267d4db4b423d7f009c1.tar.xz
layers: Free per-device and -instance data on destroy
Instance and device data are allocated by the first call to GetLayerDataPtr in the corresponding vkCreate call. We need to delete them when we're done with them. Introduce a FreeLayerDataPtr helper function that assists with this task. Deletes for dispatch tables were missing in a few places too. Add them.
Diffstat (limited to 'layers/unique_objects.cpp')
-rw-r--r--layers/unique_objects.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/layers/unique_objects.cpp b/layers/unique_objects.cpp
index 9064d1a7..a26085a1 100644
--- a/layers/unique_objects.cpp
+++ b/layers/unique_objects.cpp
@@ -172,7 +172,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati
}
layer_debug_report_destroy_instance(instance_data->report_data);
- layer_data_map.erase(key);
+ FreeLayerDataPtr(key, instance_layer_data_map);
}
VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo,
@@ -216,7 +216,8 @@ VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCall
layer_debug_report_destroy_device(device);
dev_data->dispatch_table.DestroyDevice(device, pAllocator);
- layer_data_map.erase(key);
+
+ FreeLayerDataPtr(key, layer_data_map);
}
static const VkLayerProperties globalLayerProps = {"VK_LAYER_GOOGLE_unique_objects",