forked from MoonsideGames/MoonWorks
Actually dispose graphics resources
parent
cb25e6feff
commit
5679dba978
|
@ -134,9 +134,12 @@ namespace MoonWorks
|
||||||
|
|
||||||
Draw(timestep, alpha);
|
Draw(timestep, alpha);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
GraphicsDevice.SubmitDestroyCommandBuffer();
|
GraphicsDevice.SubmitDestroyCommandBuffer();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
GraphicsDevice.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleSDLEvents()
|
private void HandleSDLEvents()
|
||||||
|
|
|
@ -101,8 +101,9 @@ namespace MoonWorks.Graphics
|
||||||
{
|
{
|
||||||
lock (resources)
|
lock (resources)
|
||||||
{
|
{
|
||||||
foreach (var resource in resources)
|
for (var i = resources.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
var resource = resources[i];
|
||||||
if (resource.TryGetTarget(out var target))
|
if (resource.TryGetTarget(out var target))
|
||||||
{
|
{
|
||||||
target.Dispose();
|
target.Dispose();
|
||||||
|
@ -111,6 +112,7 @@ namespace MoonWorks.Graphics
|
||||||
resources.Clear();
|
resources.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SubmitDestroyCommandBuffer();
|
||||||
Refresh.Refresh_DestroyDevice(Handle);
|
Refresh.Refresh_DestroyDevice(Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +120,6 @@ namespace MoonWorks.Graphics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources
|
|
||||||
~GraphicsDevice()
|
~GraphicsDevice()
|
||||||
{
|
{
|
||||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||||
|
|
Loading…
Reference in New Issue