Fixed main menu rendering after scene change #270

Merged
XiaoQiDigipen merged 1 commits from UI-Bug-Fix into main 2022-11-24 02:02:24 +08:00
1 changed files with 13 additions and 8 deletions

View File

@ -51,6 +51,7 @@ namespace SHADE
, referencedMatInstances { std::move(rhs.referencedMatInstances) }
, matBufferDirty { std::move(rhs.matBufferDirty) }
, subBatches { std::move(rhs.subBatches) }
, isDirty { std::move(rhs.isDirty) }
, drawData { std::move(rhs.drawData) }
, transformData { std::move(rhs.transformData) }
, instancedIntegerData { std::move(rhs.instancedIntegerData) }
@ -82,6 +83,7 @@ namespace SHADE
referencedMatInstances = std::move(rhs.referencedMatInstances);
matBufferDirty = std::move(rhs.matBufferDirty) ;
subBatches = std::move(rhs.subBatches) ;
isDirty = std::move(rhs.isDirty) ;
drawData = std::move(rhs.drawData) ;
transformData = std::move(rhs.transformData) ;
instancedIntegerData = std::move(rhs.instancedIntegerData) ;
@ -438,14 +440,17 @@ namespace SHADE
{
// Create command
const uint32_t CURR_INSTANCES = static_cast<uint32_t>(subBatch.Renderables.size());
drawData.emplace_back(vk::DrawIndexedIndirectCommand
{
.indexCount = subBatch.Mesh->IndexCount,
.instanceCount = CURR_INSTANCES,
.firstIndex = subBatch.Mesh->FirstIndex,
.vertexOffset = subBatch.Mesh->FirstVertex,
.firstInstance = nextInstanceIndex
});
if (CURR_INSTANCES > 0)
{
drawData.emplace_back(vk::DrawIndexedIndirectCommand
{
.indexCount = subBatch.Mesh->IndexCount,
.instanceCount = CURR_INSTANCES,
.firstIndex = subBatch.Mesh->FirstIndex,
.vertexOffset = subBatch.Mesh->FirstVertex,
.firstInstance = nextInstanceIndex
});
}
nextInstanceIndex += CURR_INSTANCES;
// Fill in buffers (CPU)