From b7b330115819f1ab67c9b03d7bc1f499ef30881a Mon Sep 17 00:00:00 2001 From: Xiao Qi Date: Thu, 24 Nov 2022 02:01:41 +0800 Subject: [PATCH] Added isDirty copy in move ctor for SHBatch --- .../Graphics/MiddleEnd/Batching/SHBatch.cpp | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp index 3bebbfbd..211c50b7 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatch.cpp @@ -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(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) -- 2.40.1