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 -5
View File
@@ -5,7 +5,7 @@
#include "copium/buffer/RendererVertexBuffer.h"
#include "copium/core/Vulkan.h"
#include "copium/pipeline/Pipeline.h"
#include "copium/renderer/DrawCall.h"
#include "copium/renderer/Batch.h"
#include "copium/sampler/Texture2D.h"
#include "copium/util/Common.h"
@@ -24,13 +24,12 @@ namespace Copium
IndexBuffer ibo;
Texture2D emptyTexture;
std::unique_ptr<Pipeline> graphicsPipeline;
std::vector<std::unique_ptr<DrawCall>> drawCalls;
std::vector<std::unique_ptr<Batch>> batches;
// Temporary data during a render
CommandBuffer* currentCommandBuffer;
DrawCall* currentDrawCall;
std::vector<const Sampler*> samplers;
int drawCallIndex;
int batchIndex;
int quadCount;
int textureCount;
void* mappedVertexBuffer;
@@ -42,6 +41,9 @@ namespace Copium
void Begin(CommandBuffer& commandBuffer);
void End();
Pipeline& GetGraphicsPipeline();
void SetDescriptorSet(const DescriptorSet& descriptorSet);
private:
void InitializeIndexBuffer();
void InitializeGraphicsPipeline(VkRenderPass renderPass);
@@ -49,7 +51,7 @@ namespace Copium
int AllocateSampler(const Sampler& sampler);
void AllocateQuad();
void Flush();
void NextDrawCall();
void NextBatch();
void AddVertex(const glm::vec2& position, const glm::vec3& color, int texindex, const glm::vec2& texCoord);
};