Browse Source

Fix stale buffers being referenced by a SpriteBatch after resizing.

Fixes #2117.
Sasha Szpakowski 9 months ago
parent
commit
383fec4ea5
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/modules/graphics/SpriteBatch.cpp

+ 3 - 2
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)