diff options
| author | Chris Forbes <chrisforbes@google.com> | 2017-08-25 11:19:44 -0700 |
|---|---|---|
| committer | Chris Forbes <chrisf@ijw.co.nz> | 2017-08-25 12:15:04 -0700 |
| commit | 9f83d48d98f8fdc8d8dfb6ca3129d8d4c3425dce (patch) | |
| tree | 54c3a7c4c62da5141e95337dbee49511bc96cc90 /layers | |
| parent | 357c9a73fdda5af11ac23413429a31b161bbeb25 (diff) | |
| download | usermoji-9f83d48d98f8fdc8d8dfb6ca3129d8d4c3425dce.tar.xz | |
Revert "Revert "layers: unique_ptr for temp compute pipelines""
This reverts commit 615dc4e3ea0495bc28130377b9e637e9979a560e.
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/core_validation.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index d6749ef4..b3e07acb 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -4421,13 +4421,11 @@ 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); @@ -4477,28 +4475,24 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelin const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { bool skip = false; - // TODO : Improve this data struct w/ unique_ptrs so cleanup below is automatic - vector<PIPELINE_STATE *> pPipeState(count); + vector<std::unique_ptr<PIPELINE_STATE>> pPipeState; + pPipeState.reserve(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[i] = new PIPELINE_STATE; + pPipeState.push_back(unique_ptr<PIPELINE_STATE>(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]); + skip |= validate_compute_pipeline(dev_data, pPipeState[i].get()); } 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; @@ -4509,11 +4503,9 @@ 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) { - delete pPipeState[i]; - } else { + if (pPipelines[i] != VK_NULL_HANDLE) { pPipeState[i]->pipeline = pPipelines[i]; - dev_data->pipelineMap[pPipeState[i]->pipeline] = pPipeState[i]; + dev_data->pipelineMap[pPipeState[i]->pipeline] = pPipeState[i].release(); } } |
