aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2016-11-14 08:18:09 -0700
committerMark Lobodzinski <mark@lunarg.com>2016-11-14 08:18:09 -0700
commit4bac7a3e221c5dd943d8bb600fe21356342486c9 (patch)
tree1e1dbc626689ffa6462143306c323117e02c8f50 /layers/core_validation.cpp
parentf64d9c889f7cfd1dd7c4bb034136bbd7020a82f2 (diff)
downloadusermoji-4bac7a3e221c5dd943d8bb600fe21356342486c9.tar.xz
layers: GH321, vkAllocateMemory return code handling
If a custom allocator is used and fails, validation will continue, using a null pointer and leading to invalid/unuseful validation errors. Added a check for a good return code. Change-Id: I2a91f2e9b3b951296b1e452364c863bca6b67b9f
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 32e9f908..6fcfda7a 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -5083,10 +5083,12 @@ VKAPI_ATTR VkResult VKAPI_CALL AllocateMemory(VkDevice device, const VkMemoryAll
const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) {
layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkResult result = my_data->dispatch_table.AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
- // TODO : Track allocations and overall size here
- std::lock_guard<std::mutex> lock(global_lock);
- add_mem_obj_info(my_data, device, *pMemory, pAllocateInfo);
- print_mem_list(my_data);
+ if (result == VK_SUCCESS) {
+ // TODO : Track allocations and overall size here
+ std::lock_guard<std::mutex> lock(global_lock);
+ add_mem_obj_info(my_data, device, *pMemory, pAllocateInfo);
+ print_mem_list(my_data);
+ }
return result;
}