forked from MoonsideGames/MoonWorks
Actually dispose graphics resources
parent
cb25e6feff
commit
5679dba978
|
@ -134,9 +134,12 @@ namespace MoonWorks
|
|||
|
||||
Draw(timestep, alpha);
|
||||
|
||||
}
|
||||
|
||||
GraphicsDevice.SubmitDestroyCommandBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
GraphicsDevice.Dispose();
|
||||
}
|
||||
|
||||
private void HandleSDLEvents()
|
||||
|
|
|
@ -101,8 +101,9 @@ namespace MoonWorks.Graphics
|
|||
{
|
||||
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))
|
||||
{
|
||||
target.Dispose();
|
||||
|
@ -111,6 +112,7 @@ namespace MoonWorks.Graphics
|
|||
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