protected override void PlatformDispose() { // Dispose staging buffers foreach (DeviceBuffer buffer in _availableStagingBuffers) { buffer.Dispose(); } _availableStagingBuffers.Clear(); _d3d11ResourceFactory.Dispose(); _mainSwapchain?.Dispose(); _immediateContext.Dispose(); if (IsDebugEnabled) { uint refCount = _device.Release(); if (refCount > 0) { ID3D11Debug deviceDebug = _device.QueryInterfaceOrNull <ID3D11Debug>(); if (deviceDebug != null) { deviceDebug.ReportLiveDeviceObjects(ReportLiveDeviceObjectFlags.Summary | ReportLiveDeviceObjectFlags.Detail | ReportLiveDeviceObjectFlags.IgnoreInternal); deviceDebug.Dispose(); } } _dxgiAdapter.Dispose(); // Report live objects using DXGI if available (DXGIGetDebugInterface1 will fail on pre Windows 8 OS). if (VorticeDXGI.DXGIGetDebugInterface1(out IDXGIDebug1 dxgiDebug).Success) { dxgiDebug.ReportLiveObjects(VorticeDXGI.All, ReportLiveObjectFlags.Summary | ReportLiveObjectFlags.IgnoreInternal); dxgiDebug.Dispose(); } } else { _device.Dispose(); _dxgiAdapter.Dispose(); } }