Skip to content

Commit

Permalink
fix: let go of texture stream after creating texture data
Browse files Browse the repository at this point in the history
  • Loading branch information
ashifolfi committed Apr 1, 2024
1 parent 28be603 commit 4cb66f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/MaterialSystem/MaterialResource.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using WinterEngine.Resource;
using Veldrid;
using WinterEngine.RenderSystem;
using Vortice.Direct3D11;
using System.Reflection;
using Veldrid.ImageSharp;

Expand Down Expand Up @@ -53,7 +51,8 @@ public void LoadData(Stream stream)
string texPath = matData.Root.Get<string>(attr.PropName);

// load texture from resources
ImageSharpTexture texture = new ImageSharpTexture(ResourceManager.GetData($"materials/{texPath}"));
Stream data = ResourceManager.GetData($"materials/{texPath}");
ImageSharpTexture texture = new ImageSharpTexture(data);
prop.SetValue(this,
new TextureHandle(
texture.CreateDeviceTexture(
Expand All @@ -62,6 +61,7 @@ public void LoadData(Stream stream)
)
)
);
data.Close();

break;
default:
Expand Down

0 comments on commit 4cb66f6

Please sign in to comment.