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);
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;
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];
}
}