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