layers: Don't make a mess of partial pipeline creation failure
authorChris Forbes <chrisforbes@google.com>
Wed, 30 Nov 2016 01:41:35 +0000 (14:41 +1300)
committerChris Forbes <chrisforbes@google.com>
Thu, 1 Dec 2016 18:48:08 +0000 (07:48 +1300)
Previously we'd end up with a VK_NULL_HANDLE -> junk PIPELINE_STATE
mapping, which confuses other things.

Signed-off-by: Chris Forbes <chrisforbes@google.com>
layers/core_validation.cpp

index 729de86..5e0a7c9 100644 (file)
@@ -6879,8 +6879,13 @@ CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t
     auto result = dev_data->dispatch_table.CreateGraphicsPipelines(device, pipelineCache, count, pCreateInfos, pAllocator, pPipelines);
     lock.lock();
     for (i = 0; i < count; i++) {
-        pipe_state[i]->pipeline = pPipelines[i];
-        dev_data->pipelineMap[pipe_state[i]->pipeline] = pipe_state[i];
+        if (pPipelines[i] == VK_NULL_HANDLE) {
+            delete pipe_state[i];
+        }
+        else {
+            pipe_state[i]->pipeline = pPipelines[i];
+            dev_data->pipelineMap[pipe_state[i]->pipeline] = pipe_state[i];
+        }
     }
 
     return result;