예제 #1
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            VertexFillBrush.Dispose();
            VertexDrawBrush.Dispose();
            EdgeDrawBrush.Dispose();
            RasterDrawBrush.Dispose();

            d2dSurface.Dispose();
            d2dDeviceContext.Dispose();
            d2dDevice.Dispose();
            d2dFactory.Dispose();
            swapChain.Dispose();
            dxgiDevice.Dispose();
            d3dDevice.Dispose();
        }
예제 #2
0
        /// <summary>
        /// Destroys the SwapChain and all related instances.
        /// </summary>
        void DestroySwapChain()
        {
            _swapChain2?.Dispose();
            _swapChain2 = null;

            _device3?.Dispose();
            _device3 = null;

            _swapChain?.Dispose();
            _swapChain = null;

            _device?.Dispose();
            _device = null;

            _d3D11Device?.Dispose();
            _d3D11Device = null;
        }
예제 #3
0
        public void CloseD3D11()
        {
            CloseSharedResource();

            if (_mainRenderTargerView != null)
            {
                _mainRenderTargerView.Dispose();
                _mainRenderTargerView = null;
            }

            if (_vertexShaderConstansData != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(_vertexShaderConstansData);
                _vertexShaderConstansData = IntPtr.Zero;
            }


            if (_swapChain != null)
            {
                _swapChain.Dispose();
                _swapChain = null;
            }

            if (_dxgiFactory != null)
            {
                _dxgiFactory.Dispose();
                _dxgiFactory = null;
            }

            if (_dxiAdapter != null)
            {
                _dxiAdapter.Dispose();
                _dxiAdapter = null;
            }

            if (_d3d11Device != null)
            {
                _d3d11Device.Dispose();
                _d3d11Device = null;
            }

            if (_dxgiDevice != null)
            {
                _dxgiDevice.Dispose();
                _dxgiDevice = null;
            }

            if (_vertexShader != null)
            {
                _vertexShader.Dispose();
                _vertexShader = null;
            }

            if (_pixelShader != null)
            {
                _pixelShader.Dispose();
                _pixelShader = null;
            }

            if (_vertexShaderConstans != null)
            {
                _vertexShaderConstans.Dispose();
                _vertexShaderConstans = null;
            }

            if (_samplerState != null)
            {
                _samplerState.Dispose();
                _samplerState = null;
            }

            if (_rasterizerState != null)
            {
                _rasterizerState.Dispose();
                _rasterizerState = null;
            }

            if (_inputLayout != null)
            {
                _inputLayout.Dispose();
                _inputLayout = null;
            }
        }