forked from MoonsideGames/MoonWorks
Actually dispose graphics resources
parent
cb25e6feff
commit
5679dba978
|
@ -134,9 +134,12 @@ namespace MoonWorks
|
|||
|
||||
Draw(timestep, alpha);
|
||||
|
||||
GraphicsDevice.SubmitDestroyCommandBuffer();
|
||||
}
|
||||
|
||||
GraphicsDevice.SubmitDestroyCommandBuffer();
|
||||
}
|
||||
|
||||
GraphicsDevice.Dispose();
|
||||
}
|
||||
|
||||
private void HandleSDLEvents()
|
||||
|
|
|
@ -101,16 +101,18 @@ namespace MoonWorks.Graphics
|
|||
{
|
||||
lock (resources)
|
||||
{
|
||||
foreach (var resource in resources)
|
||||
{
|
||||
if (resource.TryGetTarget(out var target))
|
||||
for (var i = resources.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var resource = resources[i];
|
||||
if (resource.TryGetTarget(out var target))
|
||||
{
|
||||
target.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
resources.Clear();
|
||||
}
|
||||
|
||||
SubmitDestroyCommandBuffer();
|
||||
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()
|
||||
{
|
||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||
|
|
Loading…
Reference in New Issue