public void ShutDown()
        {
            // Before shutting down set to windowed mode or when you release the swap chain it will throw an exception.
            SwapChain?.SetFullscreenState(false, null);

            // Dispose of all objects.
            AlphaAdditiveBlendState2?.Dispose();
            AlphaAdditiveBlendState2 = null;
            AlphaEnableBlendingState?.Dispose();
            AlphaEnableBlendingState = null;
            AlphaDisableBlendingState?.Dispose();
            AlphaDisableBlendingState = null;
            DepthDisabledStencilState?.Dispose();
            DepthDisabledStencilState = null;
            RasterState?.Dispose();
            RasterState = null;
            RasterStateNoCulling?.Dispose();
            RasterStateNoCulling = null;
            DepthStencilView?.Dispose();
            DepthStencilView = null;
            DepthStencilState?.Dispose();
            DepthStencilState = null;
            DepthStencilBuffer?.Dispose();
            DepthStencilBuffer = null;
            RenderTargetView?.Dispose();
            RenderTargetView = null;
            DeviceContext?.Dispose();
            DeviceContext = null;
            Device?.Dispose();
            Device = null;
            SwapChain?.Dispose();
            SwapChain = null;
        }
示例#2
0
        public void Dispose()
        {
            _swapChain?.SetFullscreenState(false, null);

            AlphaAdditiveBlendState2?.Dispose();
            AlphaAdditiveBlendState2 = null;

            AlphaEnableBlendingState?.Dispose();
            AlphaEnableBlendingState = null;

            AlphaDisableBlendingState?.Dispose();
            AlphaDisableBlendingState = null;

            DepthDisabledStencilState?.Dispose();
            DepthDisabledStencilState = null;

            _rasterState?.Dispose();
            _rasterState = null;

            _depthStencilView?.Dispose();
            _depthStencilView = null;

            DepthStencilState?.Dispose();
            DepthStencilState = null;

            _depthStencilBuffer?.Dispose();
            _depthStencilBuffer = null;

            _renderTargetView?.Dispose();
            _renderTargetView = null;

            DeviceContext?.Dispose();
            DeviceContext = null;

            Device?.Dispose();
            Device = null;

            _swapChain?.Dispose();
            _swapChain = null;
        }