From 383fec4ea5233e282acadcfc9e28246b51f0c17e Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sat, 9 Nov 2024 23:33:34 -0400 Subject: [PATCH] Fix stale buffers being referenced by a SpriteBatch after resizing. Fixes #2117. --- src/modules/graphics/SpriteBatch.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/SpriteBatch.cpp b/src/modules/graphics/SpriteBatch.cpp index 5af6492fa..aaac5e46f 100644 --- a/src/modules/graphics/SpriteBatch.cpp +++ b/src/modules/graphics/SpriteBatch.cpp @@ -256,6 +256,8 @@ void SpriteBatch::setBufferSize(int newsize) size = newsize; next = new_next; + + attributesID.invalidate(); } int SpriteBatch::getBufferSize() const @@ -293,8 +295,7 @@ void SpriteBatch::attachAttribute(const std::string &name, Buffer *buffer, Mesh attached_attributes[name] = newattrib; - // Invalidate attributes ID. - attributesID = VertexAttributesID(); + attributesID.invalidate(); } void SpriteBatch::setDrawRange(int start, int count)