Refactor UniformBuffers and DescriptorSets

- Refactor UniformBuffers to keep track of the uniforms it contains
- Refactor DescriptorSets to initialize UniformsBuffers and keep track
  of all its bindings
- DescriptorSets can now be created from the Pipeline
- Add custom DescriptorSets to Renderer
This commit is contained in:
Thraix
2023-03-24 22:27:03 +01:00
parent fbf53234f3
commit 9faec15fd6
22 changed files with 469 additions and 173 deletions
@@ -7,6 +7,7 @@ namespace Copium
PipelineCreator::PipelineCreator(VkRenderPass renderPass, const std::string& vertexShader, const std::string& fragmentShader)
: vertexShader{vertexShader},
fragmentShader{fragmentShader},
shaderReflector{vertexShader, fragmentShader},
renderPass{renderPass}
{
AddShaderDescription();
@@ -39,8 +40,7 @@ namespace Copium
void PipelineCreator::AddShaderDescription()
{
ShaderReflector reflector{vertexShader, fragmentShader};
for (auto& binding : reflector.bindings)
for (auto& binding : shaderReflector.bindings)
{
descriptorSetLayouts[binding.set].emplace_back(DescriptorSetBinding{binding.binding, GetDescriptorType(binding.bindingType), binding.arraySize, GetShaderStageFlags(binding.shaderType)});
}