Exposed transform and MDI buffers in SHBatch and exposed Batches in SHSuperBatch

This commit is contained in:
Kah Wei 2022-12-30 15:29:17 +08:00
parent 8e2c32d110
commit ce16ca6f8d
3 changed files with 30 additions and 2 deletions

View File

@ -586,6 +586,31 @@ namespace SHADE
cmdBuffer->EndLabeledSegment(); cmdBuffer->EndLabeledSegment();
} }
/*-----------------------------------------------------------------------------------*/
/* SHBatch - Getter Functions */
/*-----------------------------------------------------------------------------------*/
Handle<SHVkBuffer> 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<SHVkBuffer> 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 */ /* SHBatch - Helper Functions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/

View File

@ -94,6 +94,8 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
Handle<SHVkPipeline> GetPipeline() const noexcept { return pipeline; }; Handle<SHVkPipeline> GetPipeline() const noexcept { return pipeline; };
bool IsEmpty() const noexcept { return subBatches.empty(); } bool IsEmpty() const noexcept { return subBatches.empty(); }
Handle<SHVkBuffer> GetTransformBuffer(uint32_t frameIndex) const noexcept;
Handle<SHVkBuffer> GetMDIBuffer(uint32_t frameIndex) const noexcept;
private: private:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
@ -122,7 +124,7 @@ namespace SHADE
std::unique_ptr<char> matPropsData; std::unique_ptr<char> matPropsData;
Byte matPropsDataSize = 0; Byte matPropsDataSize = 0;
Byte singleMatPropAlignedSize = 0; Byte singleMatPropAlignedSize = 0;
Byte singleMatPropSize = 0; Byte singleMatPropSize = 0;
bool isCPUBuffersDirty = true; bool isCPUBuffersDirty = true;
// GPU Buffers // GPU Buffers
TripleBuffer drawDataBuffer; TripleBuffer drawDataBuffer;

View File

@ -54,7 +54,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
void Add(const SHRenderable* renderable) noexcept; void Add(const SHRenderable* renderable) noexcept;
void Remove(const SHRenderable* renderable) noexcept; void Remove(const SHRenderable* renderable) noexcept;
void Clear() noexcept; void Clear() noexcept;
void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool); void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
void Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept; void Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
void Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) noexcept; void Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) noexcept;
@ -63,6 +63,7 @@ namespace SHADE
/* Getter Functions */ /* Getter Functions */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
Handle<SHSubpass> GetSubpass() const noexcept { return subpass; }; Handle<SHSubpass> GetSubpass() const noexcept { return subpass; };
const std::vector<SHBatch>& GetBatches() const noexcept { return batches; }
private: private:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/