Cleanup descriptor layout handling

This commit is contained in:
2023-09-03 17:07:23 +02:00
parent b328db0075
commit 446e11e3b8
7 changed files with 49 additions and 20 deletions

View File

@@ -129,10 +129,14 @@ namespace openVulkanoCpp::Vulkan
void VulkanShader::CreatePipelineLayout()
{
//vk::PushConstantRange camPushConstantDesc = { vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eFragment, 0, 3 * sizeof(Math::Matrix4f) + sizeof(Math::Vector4f) + 8 * sizeof(float) };
//std::array<vk::PushConstantRange, 1> camPushConstantDescs = { camPushConstantDesc };
std::array<vk::DescriptorSetLayoutBinding, 1> layoutBindings1 = { reinterpret_cast<const vk::DescriptorSetLayoutBinding&>(NODE_LAYOUT_BINDING) };
std::array<vk::DescriptorSetLayoutBinding, 1> layoutBindings2 = { reinterpret_cast<const vk::DescriptorSetLayoutBinding&>(CAM_LAYOUT_BINDING) };
if (!descriptorSetLayouts.empty())
{
for(auto& descriptorSetLayout : descriptorSetLayouts)
device.destroyDescriptorSetLayout(descriptorSetLayout);
descriptorSetLayouts.clear();
}
std::array<vk::DescriptorSetLayoutBinding, 1> layoutBindings1 = { reinterpret_cast<const vk::DescriptorSetLayoutBinding&>(Scene::Camera::DESCRIPTOR_SET_LAYOUT_BINDING) };
std::array<vk::DescriptorSetLayoutBinding, 1> layoutBindings2 = { reinterpret_cast<const vk::DescriptorSetLayoutBinding&>(Scene::Node::DESCRIPTOR_SET_LAYOUT_BINDING) };
descriptorSetLayouts.push_back(device.createDescriptorSetLayout({ {}, layoutBindings1.size(), layoutBindings1.data() }));
descriptorSetLayouts.push_back(device.createDescriptorSetLayout({ {}, layoutBindings2.size(), layoutBindings2.data() }));