mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
dispose static sprite batch buffers properly
This commit is contained in:
parent
0809cd0218
commit
1c48a69371
1 changed files with 4 additions and 0 deletions
|
@ -103,6 +103,7 @@ namespace MLEM.Misc {
|
||||||
newIndices[index++] = (short) (item * 4 + 3);
|
newIndices[index++] = (short) (item * 4 + 3);
|
||||||
newIndices[index++] = (short) (item * 4 + 2);
|
newIndices[index++] = (short) (item * 4 + 2);
|
||||||
}
|
}
|
||||||
|
this.indices?.Dispose();
|
||||||
this.indices = new IndexBuffer(this.graphicsDevice, IndexElementSize.SixteenBits, newIndices.Length, BufferUsage.WriteOnly);
|
this.indices = new IndexBuffer(this.graphicsDevice, IndexElementSize.SixteenBits, newIndices.Length, BufferUsage.WriteOnly);
|
||||||
this.indices.SetData(newIndices);
|
this.indices.SetData(newIndices);
|
||||||
}
|
}
|
||||||
|
@ -316,6 +317,9 @@ namespace MLEM.Misc {
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
this.spriteEffect.Dispose();
|
this.spriteEffect.Dispose();
|
||||||
|
this.indices?.Dispose();
|
||||||
|
foreach (var buffer in this.vertexBuffers)
|
||||||
|
buffer.Dispose();
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue