From 04f06a47177dcd29a146ff8f0c8f0a8f91cd0e5d Mon Sep 17 00:00:00 2001 From: MihailRis Date: Thu, 14 Dec 2023 18:52:49 +0300 Subject: [PATCH] Removed batch2d empty draw calls --- src/graphics/Batch2D.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/graphics/Batch2D.cpp b/src/graphics/Batch2D.cpp index bd2e3b05..f0c6b5b3 100644 --- a/src/graphics/Batch2D.cpp +++ b/src/graphics/Batch2D.cpp @@ -304,9 +304,11 @@ void Batch2D::sprite(float x, float y, float w, float h, int atlasRes, int index } void Batch2D::render(unsigned int gl_primitive) { - mesh->reload(buffer, index / B2D_VERTEX_SIZE); - mesh->draw(gl_primitive); - index = 0; + if (index == 0) + return; + mesh->reload(buffer, index / B2D_VERTEX_SIZE); + mesh->draw(gl_primitive); + index = 0; } void Batch2D::render() {