diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index 0797e4feb..bb18efc77 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -1927,7 +1927,7 @@ void Graphics::flushBatchedDraws() { auto &sbstate = batchedDrawState; - if (sbstate.vertexCount == 0 && sbstate.indexCount == 0) + if (sbstate.vertexCount == 0 && sbstate.indexCount == 0 || sbstate.flushing) return; VertexAttributes attributes; @@ -1952,6 +1952,8 @@ void Graphics::flushBatchedDraws() if (attributes.enableBits == 0) return; + sbstate.flushing = true; + Colorf nc = getColor(); if (attributes.isEnabled(ATTRIB_COLOR)) setColor(Colorf(1.0f, 1.0f, 1.0f, 1.0f)); @@ -1996,8 +1998,9 @@ void Graphics::flushBatchedDraws() if (attributes.isEnabled(ATTRIB_COLOR)) setColor(nc); - batchedDrawState.vertexCount = 0; - batchedDrawState.indexCount = 0; + sbstate.vertexCount = 0; + sbstate.indexCount = 0; + sbstate.flushing = false; } void Graphics::flushBatchedDrawsGlobal() diff --git a/src/modules/graphics/Graphics.h b/src/modules/graphics/Graphics.h index 030d9d7f1..4a2c92b9c 100644 --- a/src/modules/graphics/Graphics.h +++ b/src/modules/graphics/Graphics.h @@ -989,6 +989,8 @@ class Graphics : public Module StreamBuffer::MapInfo vbMap[2]; StreamBuffer::MapInfo indexBufferMap = StreamBuffer::MapInfo(); + bool flushing = false; + BatchedDrawState() { vb[0] = vb[1] = nullptr;