diff --git a/include/vkcv/DescriptorConfig.hpp b/include/vkcv/DescriptorConfig.hpp index ba0ad33c92b91ccffa0f10796cfd96546687a124..71b14ba86d63cf8206afd5a258edb189923ac087 100644 --- a/include/vkcv/DescriptorConfig.hpp +++ b/include/vkcv/DescriptorConfig.hpp @@ -1,5 +1,7 @@ #pragma once +#include <unordered_map> + #include "vkcv/Handles.hpp" #include "vkcv/ShaderStage.hpp" #include "vkcv/Logger.hpp" @@ -68,11 +70,13 @@ namespace vkcv uint32_t descriptorCount; ShaderStages shaderStages; }; + + typedef std::unordered_map<uint32_t, DescriptorBinding> DescriptorBindings; struct DescriptorSetLayout { vk::DescriptorSetLayout vulkanHandle; - std::unordered_map<uint32_t, DescriptorBinding> descriptorBindings; + DescriptorBindings descriptorBindings; }; struct DescriptorSet diff --git a/modules/material/src/vkcv/material/Material.cpp b/modules/material/src/vkcv/material/Material.cpp index a7297af1bd420254b72c96dbdd3f6ecbcc0d390a..43a72e4cb6c936457f3723e32dc2715d9788ce08 100644 --- a/modules/material/src/vkcv/material/Material.cpp +++ b/modules/material/src/vkcv/material/Material.cpp @@ -27,10 +27,10 @@ namespace vkcv::material { return (m_Type == MaterialType::UNKNOWN); } - const std::unordered_map<uint32_t, DescriptorBinding>& Material::getDescriptorBindings(MaterialType type) + const DescriptorBindings& Material::getDescriptorBindings(MaterialType type) { - static std::unordered_map<uint32_t, DescriptorBinding> pbr_bindings = {}; - static std::unordered_map<uint32_t, DescriptorBinding> default_bindings = {}; + static DescriptorBindings pbr_bindings = {}; + static DescriptorBindings default_bindings = {}; switch (type) { case MaterialType::PBR_MATERIAL: diff --git a/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp b/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp index e654694a26f0b9b0df7119620cfedc9961393c8a..e8615342a6ccacbbc021b2293b56b3cd1949fe91 100644 --- a/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp +++ b/modules/upscaling/src/vkcv/upscaling/FSRUpscaling.cpp @@ -65,32 +65,36 @@ namespace vkcv::upscaling { } } - static std::unordered_map<uint32_t, DescriptorBinding> getDescriptorBindings() { - std::unordered_map<uint32_t, DescriptorBinding> descriptorBindings = {}; + static DescriptorBindings getDescriptorBindings() { + DescriptorBindings descriptorBindings = {}; auto binding_0 = DescriptorBinding( 0, DescriptorType::UNIFORM_BUFFER_DYNAMIC, 1, - ShaderStage::COMPUTE); + ShaderStage::COMPUTE + ); auto binding_1 = DescriptorBinding( 1, DescriptorType::IMAGE_SAMPLED, 1, - ShaderStage::COMPUTE); + ShaderStage::COMPUTE + ); auto binding_2 = DescriptorBinding( 2, DescriptorType::IMAGE_STORAGE, 1, - ShaderStage::COMPUTE); + ShaderStage::COMPUTE + ); auto binding_3 = DescriptorBinding( 3, DescriptorType::SAMPLER, 1, - ShaderStage::COMPUTE); + ShaderStage::COMPUTE + ); descriptorBindings.insert(std::make_pair(0, binding_0)); descriptorBindings.insert(std::make_pair(1, binding_1)); diff --git a/src/vkcv/Core.cpp b/src/vkcv/Core.cpp index f726f222386ac6c0fc2b15fc62e8582bf73cc758..ebfd1cc9980fce64a1aca399c88c15971403f105 100644 --- a/src/vkcv/Core.cpp +++ b/src/vkcv/Core.cpp @@ -685,7 +685,7 @@ namespace vkcv return m_ImageManager->getImageFormat(image); } - DescriptorSetLayoutHandle Core::createDescriptorSetLayout(const std::unordered_map<uint32_t, DescriptorBinding> &bindingsMap) + DescriptorSetLayoutHandle Core::createDescriptorSetLayout(const DescriptorBindings &bindingsMap) { return m_DescriptorManager->createDescriptorSetLayout(bindingsMap); } diff --git a/src/vkcv/DescriptorManager.cpp b/src/vkcv/DescriptorManager.cpp index 8599335f3b65e52944a6e034ea386fa876b27bc6..a1c2dd543a51ad72b5632c6b2be68247b4d4f69a 100644 --- a/src/vkcv/DescriptorManager.cpp +++ b/src/vkcv/DescriptorManager.cpp @@ -42,7 +42,7 @@ namespace vkcv } } - DescriptorSetLayoutHandle DescriptorManager::createDescriptorSetLayout(const std::unordered_map<uint32_t, DescriptorBinding> &setBindingsMap) + DescriptorSetLayoutHandle DescriptorManager::createDescriptorSetLayout(const DescriptorBindings &setBindingsMap) { //create the descriptor set's layout by iterating over its bindings std::vector<vk::DescriptorSetLayoutBinding> bindingsVector = {}; diff --git a/src/vkcv/ShaderProgram.cpp b/src/vkcv/ShaderProgram.cpp index 249da9d8de736a8d1254d75033ea53b19de7cdb7..363981f4fdcbcdee98bbf286db0811c7b37fae94 100644 --- a/src/vkcv/ShaderProgram.cpp +++ b/src/vkcv/ShaderProgram.cpp @@ -235,7 +235,7 @@ namespace vkcv { return m_VertexAttachments; } - const std::unordered_map<uint32_t, std::unordered_map<uint32_t, DescriptorBinding>>& ShaderProgram::getReflectedDescriptors() const + const std::unordered_map<uint32_t, DescriptorBindings>& ShaderProgram::getReflectedDescriptors() const { return m_DescriptorSets; }