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
@@ -0,0 +1,25 @@
#include "copium/renderer/Batch.h"
#include "copium/renderer/RendererVertex.h"
namespace Copium
{
Batch::Batch(Vulkan& vulkan, Pipeline& pipeline, DescriptorPool& descriptorPool, int vertexCount, const std::vector<const Sampler*> samplers)
: vulkan{vulkan},
pipeline{pipeline},
vertexBuffer{vulkan, RendererVertex::GetDescriptor(), vertexCount},
descriptorSet{pipeline.CreateDescriptorSet(descriptorPool, 0)}
{
descriptorSet->SetSamplers(samplers, 0);
}
RendererVertexBuffer& Batch::GetVertexBuffer()
{
return vertexBuffer;
}
DescriptorSet& Batch::GetDescriptorSet()
{
return *descriptorSet;
}
}