Exemple #1
0
        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;
            }
        }
        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;
            }
        }
        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;
            }
        }