From 28bc02258769ec3ae94ffed401ce507255ab0060 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Thu, 16 Oct 2025 08:43:40 +0300 Subject: [PATCH] perf: forgotten memory allocation on triangle batch --- Engine.Integration/Engine.Integration.MonoGame/TriangleBatch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine.Integration/Engine.Integration.MonoGame/TriangleBatch.cs b/Engine.Integration/Engine.Integration.MonoGame/TriangleBatch.cs index e4201f2..fd98064 100644 --- a/Engine.Integration/Engine.Integration.MonoGame/TriangleBatch.cs +++ b/Engine.Integration/Engine.Integration.MonoGame/TriangleBatch.cs @@ -21,6 +21,7 @@ public class TriangleBatch : ITriangleBatch this.graphicsDevice = graphicsDevice; basicEffect = new(graphicsDevice); basicEffect.VertexColorEnabled = true; + vertexBuffer = new VertexBuffer(graphicsDevice, typeof(VertexPositionColor), 1024, BufferUsage.WriteOnly); } public void Draw(Triangle triangle, ColorRGBA colorRGBA) @@ -64,7 +65,6 @@ public class TriangleBatch : ITriangleBatch graphicsDevice.RasterizerState = rasterizerState; basicEffect.Projection = _projection; basicEffect.View = _view; - vertexBuffer = new VertexBuffer(graphicsDevice, typeof(VertexPositionColor), 1024, BufferUsage.WriteOnly); vertexBuffer.SetData(vertices); graphicsDevice.SetVertexBuffer(vertexBuffer);