diff options
| author | Chris Forbes <chrisforbes@google.com> | 2017-08-25 09:37:28 -0700 |
|---|---|---|
| committer | Chris Forbes <chrisforbes@google.com> | 2017-08-25 09:37:28 -0700 |
| commit | 13c884b55f05d4b756612a8d830b6adbb3f2af4e (patch) | |
| tree | c61891bf3195014c95c7124f820c91c6ad9117ac /layers/core_validation.cpp | |
| parent | cf25fd0bcc902474f719058b2b97c7e674e571d7 (diff) | |
| download | usermoji-13c884b55f05d4b756612a8d830b6adbb3f2af4e.tar.xz | |
Revert "layers: unique_ptr for temp compute pipelines"
This reverts commit cfc1ed15584a12ef62e113c8daf673c6a68ce29c.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b3e07acb..d6749ef4 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -4421,11 +4421,13 @@ bool validate_dual_src_blend_feature(layer_data *device_data, PIPELINE_STATE *pi VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t count, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { + // TODO What to do with pipelineCache? // The order of operations here is a little convoluted but gets the job done // 1. Pipeline create state is first shadowed into PIPELINE_STATE struct // 2. Create state is then validated (which uses flags setup during shadowing) // 3. If everything looks good, we'll then create the pipeline and add NODE to pipelineMap bool skip = false; + // TODO : Improve this data struct w/ unique_ptrs so cleanup below is automatic vector<std::unique_ptr<PIPELINE_STATE>> pipe_state; pipe_state.reserve(count); layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); @@ -4475,24 +4477,28 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelin const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { bool skip = false; - vector<std::unique_ptr<PIPELINE_STATE>> pPipeState; - pPipeState.reserve(count); + // TODO : Improve this data struct w/ unique_ptrs so cleanup below is automatic + vector<PIPELINE_STATE *> pPipeState(count); layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); uint32_t i = 0; unique_lock_t lock(global_lock); for (i = 0; i < count; i++) { + // TODO: Verify compute stage bits + // Create and initialize internal tracking data structure - pPipeState.push_back(unique_ptr<PIPELINE_STATE>(new PIPELINE_STATE)); + pPipeState[i] = new PIPELINE_STATE; pPipeState[i]->initComputePipeline(&pCreateInfos[i]); pPipeState[i]->pipeline_layout = *getPipelineLayout(dev_data, pCreateInfos[i].layout); // TODO: Add Compute Pipeline Verification - skip |= validate_compute_pipeline(dev_data, pPipeState[i].get()); + skip |= validate_compute_pipeline(dev_data, pPipeState[i]); } if (skip) { for (i = 0; i < count; i++) { + // Clean up any locally allocated data structures + delete pPipeState[i]; pPipelines[i] = VK_NULL_HANDLE; } return VK_ERROR_VALIDATION_FAILED_EXT; @@ -4503,9 +4509,11 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelin dev_data->dispatch_table.CreateComputePipelines(device, pipelineCache, count, pCreateInfos, pAllocator, pPipelines); lock.lock(); for (i = 0; i < count; i++) { - if (pPipelines[i] != VK_NULL_HANDLE) { + if (pPipelines[i] == VK_NULL_HANDLE) { + delete pPipeState[i]; + } else { pPipeState[i]->pipeline = pPipelines[i]; - dev_data->pipelineMap[pPipeState[i]->pipeline] = pPipeState[i].release(); + dev_data->pipelineMap[pPipeState[i]->pipeline] = pPipeState[i]; } } |
