From 94c9d45a4304ce8915e037092cb7cd498a992248 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 11 Feb 2021 01:36:22 +0100 Subject: [PATCH] don't auto-dispose the texture --- MLEM.Data/RuntimeTexturePacker.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MLEM.Data/RuntimeTexturePacker.cs b/MLEM.Data/RuntimeTexturePacker.cs index 0824a3a..1936e93 100644 --- a/MLEM.Data/RuntimeTexturePacker.cs +++ b/MLEM.Data/RuntimeTexturePacker.cs @@ -103,7 +103,7 @@ namespace MLEM.Data { stopwatch.Stop(); this.LastCalculationTime = stopwatch.Elapsed; - // figure out texture size + // figure out texture size and generate texture var width = this.textures.Max(t => t.PackedArea.Right); var height = this.textures.Max(t => t.PackedArea.Bottom); if (this.forcePowerOfTwo) { @@ -112,11 +112,8 @@ namespace MLEM.Data { } if (this.forceSquare) width = height = Math.Max(width, height); - - // generate texture this.PackedTexture = new Texture2D(device, width, height); - device.Disposing += (o, a) => this.PackedTexture.Dispose(); - + // copy texture data onto the packed texture stopwatch.Restart(); using (var data = this.PackedTexture.GetTextureData()) {