internal static void DisposeDevice() { ForceWindowed(); OnDeviceEnd(); m_initialized = false; MyHBAO.ReleaseScreenResources(); if (MyGBuffer.Main != null) { MyGBuffer.Main.Release(); MyGBuffer.Main = null; } if (Backbuffer != null) { Backbuffer.Release(); Backbuffer = null; } if (m_swapchain != null) { m_swapchain.Dispose(); m_swapchain = null; } if (RC != null) { RC.Dispose(); RC = null; } if (Device != null) { #if DEBUG if (VRage.MyCompilationSymbols.DX11Debug) { var deviceDebug = new DeviceDebug(Device); deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Detail | ReportingLevel.Summary); deviceDebug.Dispose(); } #endif Device.Dispose(); Device = null; WIC = null; } if (m_factory != null) { m_factory.Dispose(); m_factory = null; } }
/// <summary> /// Helps finding any remaining unreleased references via console output, which can be /// enabled by using Dx Control Panel and adding the app there (DX11) and also enabling /// native debugging output in the properties of the project to debug. Then see Output window. /// </summary> private void OutputRefCountOfLiveObjectsToFindMemoryLeaksInDebugMode() { #if DEBUG var deviceDebug = new DeviceDebug(nativeDevice); // http://sharpdx.org/forum/4-general/1241-reportliveobjects // Contains several Refcount: 0 lines. This cannot be avoided, but is still be useful to // find memory leaks (all objects should have Refcount=0, the device still has RefCount=3) deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Detail); deviceDebug.Dispose(); #endif }
internal static void DisposeDevice() { ForceWindowed(); OnDeviceEnd(); if (MyGBuffer.Main != null) { MyGBuffer.Main.Release(); MyGBuffer.Main = null; } if (Backbuffer != null) { Backbuffer.Release(); Backbuffer = null; } if (m_swapchain != null) { m_swapchain.Dispose(); m_swapchain = null; } if (DeviceContext != null) { DeviceContext.Dispose(); DeviceContext = null; } if (Device != null) { #if DEBUG if (VRage.MyCompilationSymbols.DX11Debug) { var deviceDebug = new DeviceDebug(Device); deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Detail | ReportingLevel.Summary); deviceDebug.Dispose(); } #endif Device.Dispose(); Device = null; } if (m_factory != null) { m_factory.Dispose(); m_factory = null; } }
public void Dispose() { #if DEBUG _debug.ReportLiveDeviceObjects(ReportingLevel.Detail | ReportingLevel.IgnoreInternal); _debug.Dispose(); #endif Device.Dispose(); _swapChain.Dispose(); _backBuffer.Dispose(); _renderTarget.Dispose(); Context.Dispose(); Factory2D.Dispose(); FactoryDWrite.Dispose(); }
internal static void DisposeDevice() { ForceWindowed(); OnDeviceEnd(); if (MyGBuffer.Main != null) { MyGBuffer.Main.Release(); MyGBuffer.Main = null; } if (Backbuffer != null) { Backbuffer.Release(); Backbuffer = null; } if (m_swapchain != null) { m_swapchain.Dispose(); m_swapchain = null; } if (ImmediateContext != null) { ImmediateContext.Dispose(); ImmediateContext = null; } if (Device != null) { #if DEBUG_DEVICE var deviceDebug = new DeviceDebug(Device); deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Detail); deviceDebug.Dispose(); #endif Device.Dispose(); Device = null; } if (m_factory != null) { m_factory.Dispose(); m_factory = null; } }
protected override void PlatformDispose() { _d3d11ResourceFactory.Dispose(); _mainSwapchain?.Dispose(); _immediateContext.Dispose(); DeviceDebug deviceDebug = _device.QueryInterfaceOrNull <DeviceDebug>(); _device.Dispose(); if (deviceDebug != null) { deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Summary); deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Detail); deviceDebug.Dispose(); } }
public async Task Execute(dynamic[] Args) { if (Args.Length == 0 || (Args.Length == 1 && Args[0] == 0)) { Base.Exit(); } else if (Args.Length == 1 && Args[0] == 1) { var debug = new DeviceDebug(Base.DXDevice); debug.ReportLiveDeviceObjects(ReportingLevel.Detail | ReportingLevel.Summary); debug.Dispose(); Base.Exit(); Render.Elements.AllElements.Clear(); Base.WaitForTheBox(); Environment.Exit(0); } }
public void DisposeFrames() { DrawContext.Dispose(); Brush?.Dispose(); DeviceContext.Target = null; DeviceContext3D.OutputMerger.SetRenderTargets((RenderTargetView)null); DeviceContext3D.ClearState(); foreach (var resource in FrameResources) { resource.Bitmap.Dispose(); resource.Surface.Dispose(); resource.WrappedBackBuffer.Dispose(); resource.RenderTarget.Dispose(); } DeviceContext3D.Flush(); #if false DeviceDebug debug = Device3D11.QueryInterface <DeviceDebug>(); debug.ReportLiveDeviceObjects(ReportingLevel.Detail); debug.Dispose(); #endif }