public void Dispose() { Utilities.Dispose(ref CameraShader); Utilities.Dispose(ref CameraDepth); Utilities.Dispose(ref ShadowShader); Utilities.Dispose(ref ShadowDepth); Depth.DisposeStates(); if (Device?.ImmediateContext != null) { Device.ImmediateContext.ClearState(); Device.ImmediateContext.Flush(); Device.ImmediateContext.Dispose(); } Utilities.Dispose(ref Device); Utilities.Dispose(ref SwapChain); Debug?.ReportLiveDeviceObjects(ReportingLevel.Detail | ReportingLevel.IgnoreInternal); Utilities.Dispose(ref Debug); }