From 95ebffd8a396f8d4d7f1a631fba902c7a2eadbd9 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Wed, 13 Sep 2017 11:11:14 -0600 Subject: layers:Use existing ds layout to create push desc Just look up descriptor set layout for given set from pipeline layout state when creating a push descriptor. No need to re-create the layout on the fly. --- layers/core_validation.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b211e812..012e0d61 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5639,26 +5639,11 @@ static void PreCallRecordCmdPushDescriptorSetKHR(layer_data *device_data, VkComm cb_state->lastBound[pipelineBindPoint].push_descriptors[set] = nullptr; } } - VkDescriptorSetLayoutCreateInfo layout_create_info{}; - VkDescriptorSetLayoutBinding *bindings = new VkDescriptorSetLayoutBinding[descriptorWriteCount]; - layout_create_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; - layout_create_info.flags = VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR; - layout_create_info.bindingCount = descriptorWriteCount; - layout_create_info.pBindings = bindings; - for (uint32_t i = 0; i < descriptorWriteCount; i++) { - bindings[i].binding = pDescriptorWrites[i].dstBinding; - bindings[i].descriptorCount = pDescriptorWrites[i].descriptorCount; - bindings[i].descriptorType = pDescriptorWrites[i].descriptorType; - bindings[i].stageFlags = 0; - bindings[i].pImmutableSamplers = nullptr; - } - - const VkDescriptorSetLayout desc_set_layout = 0; - auto const shared_ds_layout = std::make_shared(&layout_create_info, desc_set_layout); - std::unique_ptr new_desc{new cvdescriptorset::DescriptorSet(0, 0, shared_ds_layout, device_data)}; + const auto &layout_state = getPipelineLayout(device_data, layout); + std::unique_ptr new_desc{ + new cvdescriptorset::DescriptorSet(0, 0, layout_state->set_layouts[set], device_data)}; cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[set] = new_desc.get(); cb_state->lastBound[pipelineBindPoint].push_descriptors[set] = std::move(new_desc); - delete [] bindings; } VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, -- cgit v1.2.3