return skip;
}
-static bool ValidatePipelineLocked(layer_data *dev_data, std::vector<PIPELINE_STATE *> const &pPipelines, int pipelineIndex) {
+static bool ValidatePipelineLocked(layer_data *dev_data, std::vector<std::unique_ptr<PIPELINE_STATE>> const &pPipelines, int pipelineIndex) {
bool skip = false;
- PIPELINE_STATE *pPipeline = pPipelines[pipelineIndex];
+ PIPELINE_STATE *pPipeline = pPipelines[pipelineIndex].get();
// If create derivative bit is set, check that we've specified a base
// pipeline correctly, and that the base pipeline was created to allow
"Invalid Pipeline CreateInfo: base pipeline must occur earlier in array than derivative pipeline. %s",
validation_error_map[VALIDATION_ERROR_208005a0]);
} else {
- pBasePipeline = pPipelines[pPipeline->graphicsPipelineCI.basePipelineIndex];
+ pBasePipeline = pPipelines[pPipeline->graphicsPipelineCI.basePipelineIndex].get();
}
} else if (pPipeline->graphicsPipelineCI.basePipelineHandle != VK_NULL_HANDLE) {
pBasePipeline = getPipelineState(dev_data, pPipeline->graphicsPipelineCI.basePipelineHandle);
}
// UNLOCKED pipeline validation. DO NOT lookup objects in the layer_data->* maps in this function.
-static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<PIPELINE_STATE *> const &pPipelines, int pipelineIndex) {
+static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::unique_ptr<PIPELINE_STATE>> const &pPipelines, int pipelineIndex) {
bool skip = false;
- PIPELINE_STATE *pPipeline = pPipelines[pipelineIndex];
+ PIPELINE_STATE *pPipeline = pPipelines[pipelineIndex].get();
// Ensure the subpass index is valid. If not, then validate_and_capture_pipeline_shader_state
// produces nonsense errors that confuse users. Other layers should already
// 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<PIPELINE_STATE *> pipe_state(count);
+ vector<std::unique_ptr<PIPELINE_STATE>> pipe_state;
+ pipe_state.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++) {
- pipe_state[i] = new PIPELINE_STATE;
+ pipe_state.push_back(std::unique_ptr<PIPELINE_STATE>(new PIPELINE_STATE));
pipe_state[i]->initGraphicsPipeline(&pCreateInfos[i]);
pipe_state[i]->render_pass_ci.initialize(GetRenderPassState(dev_data, pCreateInfos[i].renderPass)->createInfo.ptr());
pipe_state[i]->pipeline_layout = *getPipelineLayout(dev_data, pCreateInfos[i].layout);
if (skip) {
for (i = 0; i < count; i++) {
- delete pipe_state[i];
pPipelines[i] = VK_NULL_HANDLE;
}
return VK_ERROR_VALIDATION_FAILED_EXT;
dev_data->dispatch_table.CreateGraphicsPipelines(device, pipelineCache, count, pCreateInfos, pAllocator, pPipelines);
lock.lock();
for (i = 0; i < count; i++) {
- if (pPipelines[i] == VK_NULL_HANDLE) {
- delete pipe_state[i];
- } else {
+ if (pPipelines[i] != VK_NULL_HANDLE) {
pipe_state[i]->pipeline = pPipelines[i];
- dev_data->pipelineMap[pipe_state[i]->pipeline] = pipe_state[i];
+ dev_data->pipelineMap[pipe_state[i]->pipeline] = pipe_state[i].release();
}
}