aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-01-22 15:44:40 +1300
committerJon Ashburn <jon@lunarg.com>2016-01-22 16:47:37 -0700
commit514b8cbb051b02cf24ad3893e0c1d0922e184b2e (patch)
treeef47a561bfdbedf00a208a520d4e86ff7a842405
parentfeee791c13ddb435d22e42811dfcdfd2ab82830f (diff)
downloadusermoji-514b8cbb051b02cf24ad3893e0c1d0922e184b2e.tar.xz
layers: Only set up tracking for new descriptors if allocation succeeded.
It's possible for this call to fail -- the pool is exhausted, or the request was simply bogus. In these cases, the returned descriptor set handles are meaningless. Don't shove them in our hashtables. Signed-off-by: Chris Forbes <chrisforbes@google.com>
-rw-r--r--layers/object_tracker.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/layers/object_tracker.h b/layers/object_tracker.h
index 4622c189..0c3d42b5 100644
--- a/layers/object_tracker.h
+++ b/layers/object_tracker.h
@@ -932,11 +932,13 @@ explicit_AllocateDescriptorSets(
VkResult result = get_dispatch_table(object_tracker_device_table_map, device)->AllocateDescriptorSets(
device, pAllocateInfo, pDescriptorSets);
- loader_platform_thread_lock_mutex(&objLock);
- for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; i++) {
- alloc_descriptor_set(device, pAllocateInfo->descriptorPool, pDescriptorSets[i], VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT);
+ if (VK_SUCCESS == result) {
+ loader_platform_thread_lock_mutex(&objLock);
+ for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; i++) {
+ alloc_descriptor_set(device, pAllocateInfo->descriptorPool, pDescriptorSets[i], VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT);
+ }
+ loader_platform_thread_unlock_mutex(&objLock);
}
- loader_platform_thread_unlock_mutex(&objLock);
return result;
}