diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp index 77f7706e..7e4069f6 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp @@ -586,6 +586,31 @@ namespace SHADE cmdBuffer->EndLabeledSegment(); } + /*-----------------------------------------------------------------------------------*/ + /* SHBatch - Getter Functions */ + /*-----------------------------------------------------------------------------------*/ + Handle SHBatch::GetTransformBuffer(uint32_t frameIndex) const noexcept + { + if (frameIndex >= transformDataBuffer.size()) + { + SHLOG_WARNING("[SHBatch] Attempted to retrieve a transform buffer of an invalid index."); + return {}; + } + + return transformDataBuffer[frameIndex]; + } + + Handle SHBatch::GetMDIBuffer(uint32_t frameIndex) const noexcept + { + if (frameIndex >= drawDataBuffer.size()) + { + SHLOG_WARNING("[SHBatch] Attempted to retrieve a MDI draw data buffer of an invalid index."); + return {}; + } + + return drawDataBuffer[frameIndex]; + } + /*---------------------------------------------------------------------------------*/ /* SHBatch - Helper Functions */ /*---------------------------------------------------------------------------------*/ diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.h b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.h index dd4d33fd..d4ce068e 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.h @@ -94,6 +94,8 @@ namespace SHADE /*-----------------------------------------------------------------------------*/ Handle GetPipeline() const noexcept { return pipeline; }; bool IsEmpty() const noexcept { return subBatches.empty(); } + Handle GetTransformBuffer(uint32_t frameIndex) const noexcept; + Handle GetMDIBuffer(uint32_t frameIndex) const noexcept; private: /*-----------------------------------------------------------------------------*/ @@ -122,7 +124,7 @@ namespace SHADE std::unique_ptr matPropsData; Byte matPropsDataSize = 0; Byte singleMatPropAlignedSize = 0; - Byte singleMatPropSize = 0; + Byte singleMatPropSize = 0; bool isCPUBuffersDirty = true; // GPU Buffers TripleBuffer drawDataBuffer; diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHSuperBatch.h b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHSuperBatch.h index 9877e04e..75bd1829 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHSuperBatch.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHSuperBatch.h @@ -54,7 +54,7 @@ namespace SHADE /*-----------------------------------------------------------------------------*/ void Add(const SHRenderable* renderable) noexcept; void Remove(const SHRenderable* renderable) noexcept; - void Clear() noexcept; + void Clear() noexcept; void UpdateBuffers(uint32_t frameIndex, Handle descPool); void Build(Handle device, Handle descPool, uint32_t frameIndex) noexcept; void Draw(Handle cmdBuffer, uint32_t frameIndex) noexcept; @@ -63,6 +63,7 @@ namespace SHADE /* Getter Functions */ /*-----------------------------------------------------------------------------*/ Handle GetSubpass() const noexcept { return subpass; }; + const std::vector& GetBatches() const noexcept { return batches; } private: /*-----------------------------------------------------------------------------*/