示例#1
0
 public void Shutdown()
 {
     SwapChain?.SetFullscreenState(false, null);
     m_RSSolid?.Dispose();
     m_RSSolid = null;
     m_RSWireFrame?.Dispose();
     m_RSWireFrame = null;
     m_RSCullSolid?.Dispose();
     m_RSCullSolid = null;
     m_RSCullWireFrame?.Dispose();
     m_RSCullWireFrame = null;
     m_DepthStencilView?.Dispose();
     m_DepthStencilView = null;
     DepthStencilState?.Dispose();
     DepthStencilState = null;
     m_depthStencilBuffer?.Dispose();
     m_depthStencilBuffer = null;
     m_RenderTargetView?.Dispose();
     m_RenderTargetView = null;
     DeviceContext?.Dispose();
     DeviceContext = null;
     Device?.Dispose();
     Device = null;
     SwapChain?.Dispose();
     SwapChain = null;
 }
示例#2
0
 public virtual void Dispose()
 {
     if (mState != null)
     {
         mState.Dispose();
     }
 }
示例#3
0
        public void Dispose()
        {
            if (!disposed)
            {
                disposed = true;
                Background.Dispose();
                CompressToSwap.Dispose();

                SphereRenderer.Dispose();
                CapsuleRenderer.Dispose();

                UILineRenderer.Dispose();
                GlyphRenderer.Dispose();

                depthBuffer.Dispose();
                dsv.Dispose();
                colorBuffer.Dispose();
                rtv.Dispose();
                rasterizerState.Dispose();
                opaqueDepthState.Dispose();
                opaqueBlendState.Dispose();
                uiDepthState.Dispose();
                uiBlendState.Dispose();
            }
        }
示例#4
0
        public void Dispose()
        {
            if (!disposed)
            {
                disposed = true;
                Background.Dispose();
                CompressToSwap.Dispose();

                SphereRenderer.Dispose();
                CapsuleRenderer.Dispose();
                BoxRenderer.Dispose();
                TriangleRenderer.Dispose();
                MeshRenderer.Dispose();

                UILineRenderer.Dispose();
                GlyphRenderer.Dispose();

                dsv.Dispose();
                depthBuffer.Dispose();
                rtv.Dispose();
                colorBuffer.Dispose();
                resolvedSRV.Dispose();
                resolvedRTV.Dispose();
                resolvedColorBuffer.Dispose();

                rasterizerState.Dispose();
                opaqueDepthState.Dispose();
                opaqueBlendState.Dispose();
                a2cBlendState.Dispose();
                uiDepthState.Dispose();
                uiBlendState.Dispose();

                Shapes.Dispose();
            }
        }
示例#5
0
 public void ShutDown()
 {
     SwapChain?.SetFullscreenState(false, null);
     AlphaEnableBlendingState?.Dispose();
     AlphaEnableBlendingState = null;
     AlphaDisableBlendingState?.Dispose();
     AlphaDisableBlendingState = null;
     DepthDisabledStencilState?.Dispose();
     DepthDisabledStencilState = null;
     RasterState?.Dispose();
     RasterState = null;
     RasterStateNoCulling?.Dispose();
     RasterStateNoCulling = null;
     RasterStateWirefram?.Dispose();
     RasterStateWirefram = 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;
 }
        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.
            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;
        }
        private void InitializeDepthStencilState(Device device)
        {
            DepthStencilStateDescription depthStencilDescription;

            depthStencilDescription.IsDepthEnabled  = true;
            depthStencilDescription.DepthWriteMask  = DepthWriteMask.All;
            depthStencilDescription.DepthComparison = Comparison.Less;

            depthStencilDescription.IsStencilEnabled = true;
            depthStencilDescription.StencilReadMask  = 0xFF;
            depthStencilDescription.StencilWriteMask = 0xFF;

            depthStencilDescription.FrontFace.FailOperation      = StencilOperation.Keep;
            depthStencilDescription.FrontFace.DepthFailOperation = StencilOperation.Keep;
            depthStencilDescription.FrontFace.PassOperation      = StencilOperation.Keep;
            depthStencilDescription.FrontFace.Comparison         = Comparison.Always;

            depthStencilDescription.BackFace.FailOperation      = StencilOperation.Keep;
            depthStencilDescription.BackFace.DepthFailOperation = StencilOperation.Decrement;
            depthStencilDescription.BackFace.PassOperation      = StencilOperation.Keep;
            depthStencilDescription.BackFace.Comparison         = Comparison.Always;

            DepthStencilState?.Dispose();
            DepthStencilState = new DepthStencilState(device, depthStencilDescription);
        }
示例#8
0
        public void Dispose()
        {
            _constants.Dispose();

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

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

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

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

            if (Shader != null)
            {
                Shader.Dispose();
                Shader = null;
            }
        }
        public void Dispose()
        {
            _drawIndexedHook?.Deactivate();
            _drawIndexedHook?.Dispose();
            _depthDisabledState?.Dispose();

            // Don't dispose _deviceContext, it will crash the application or game
        }
示例#10
0
 public void Dispose()
 {
     VertexShader?.Dispose();
     PixelShader?.Dispose();
     RasterizerState?.Dispose();
     DepthStencilState?.Dispose();
     BlendState?.Dispose();
 }
 public void Dispose()
 {
     _graphicsDevice?.Dispose();
     _assets?.Dispose();
     _lightBlendState?.Dispose();
     _stencilCullPass1?.Dispose();
     _stencilCullPass2?.Dispose();
 }
示例#12
0
        public void Dispose()
        {
            RasterizerState?.Dispose();
            DepthStencilState?.Dispose();
            BlendState?.Dispose();

            OpenTK.Graphics.OpenGL4.GL.DeleteProgramPipeline(_nativePipeline);
        }
示例#13
0
 ///<summary>Disposes all resources owned by this RenderContext.</summary>
 public void Dispose()
 {
     _defaultDepthStencilState.Dispose();
     _defaultRasterizerState.Dispose();
     _additiveBlend?.Dispose();
     _overrideBlend?.Dispose();
     _alphaBlend?.Dispose();
     PlatformDispose();
 }
示例#14
0
        internal static void Load()
        {
            Standard?.Dispose();
            NoDepth?.Dispose();

            MakeNoDepthDesc();
            MakeDepthEnabledState();
            Standard = new DepthStencilState(Renderer.Device, DepthStencilStateDescription.Default());
        }
示例#15
0
 public void Dispose()
 {
     SwapChain.Dispose();
     RenderTargetView.Dispose();
     DepthStencilState.Dispose();
     DepthStencilView.Dispose();
     DepthStencilTexture.Dispose();
     RasterizerState.Dispose();
 }
示例#16
0
 /// <summary>
 /// Frees all graphics resources used by the renderer.
 /// </summary>
 public void Dispose()
 {
     _vertexBuffer.Dispose();
     _indexBuffer.Dispose();
     _depthDisabledState.Dispose();
     _blendState.Dispose();
     _fontTextureBinding.Dispose();
     _shaderSet.Dispose();
 }
示例#17
0
        public void Shutdown()
        {
            // Before shutting down set to windowed mode or when you release the swap chain it will throw an exception.
            if (SwapChain != null)
            {
                SwapChain.SetFullscreenState(false, null);
            }

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

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

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

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

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

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

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

            if (SwapChain != null)
            {
                SwapChain.Dispose();
                SwapChain = null;
            }
        }
示例#18
0
        private void Dispose(bool disposing)
        {
            if (mState != null)
            {
                mState.Dispose();
                mState = null;
            }

            mContext = null;
        }
示例#19
0
 public void ShutDown()
 {
     depthStencilState.Dispose();
     depthStencil.Dispose();
     depthStencilTexture.Dispose();
     renderTarget.Dispose();
     backBufferTexture.Dispose();
     swapChain.Dispose();
     device.Dispose();
 }
示例#20
0
        public void Dispose()
        {
            // Release all resources

            figures.Dispose();

            if (ctx != null)
            {
                ctx.ClearState();
                ctx.Flush();
                ctx.Dispose();
            }

            if (il != null)
            {
                il.Dispose();
            }
            if (effect != null)
            {
                effect.Dispose();
            }

            if (hmd != null)
            {
                keyboard.Dispose();
                directInput.Dispose();

                mtex.Dispose();
                layers.Dispose();

                eye_texes[0].Dispose();
                eye_texes[1].Dispose();

                default_rasterizer_state.Dispose();
                default_depth_stencil_state.Dispose();
                default_blend_state.Dispose();

                ztex_view.Dispose();
                ztex.Dispose();

                buf0_view.Dispose();
                buf0.Dispose();

                swap_chain.Dispose();
                dxgi_factory.Dispose();

                // Disposing the device, before the hmd, will cause the hmd to fail when disposing.
                // Disposing the device, after the hmd, will cause the dispose of the device to fail.
                // It looks as if the hmd steals ownership of the device and destroys it, when it's shutting down.
                // device.Dispose();

                hmd.Dispose();
            }
            oculus.Dispose();
        }
示例#21
0
 public void Dispose()
 {
     if (!disposed)
     {
         disposed = true;
         constants.Dispose();
         vertexShader.Dispose();
         pixelShader.Dispose();
         depthState.Dispose();
     }
 }
示例#22
0
        public override void GenerateShadowMaps(Device device, DeviceContext deviceContext, CRenderScene renderScene)
        {
            UserDefinedAnnotation annotation = deviceContext.QueryInterface <UserDefinedAnnotation>();

            annotation.BeginEvent("SpotLightShadowMap");

            deviceContext.Rasterizer.SetViewport(0.0f, 0.0f, CStaticRendererCvars.ShadowMapSize, CStaticRendererCvars.ShadowMapSize);

            deviceContext.ClearDepthStencilView(ShadowMapTexture.GetRenderTarget(), DepthStencilClearFlags.Depth, 1.0f, 0);
            deviceContext.OutputMerger.SetRenderTargets(ShadowMapTexture.GetRenderTarget());

            DepthStencilStateDescription depthStateDesc = new DepthStencilStateDescription()
            {
                IsDepthEnabled  = true,
                DepthWriteMask  = DepthWriteMask.All,
                DepthComparison = Comparison.Less,

                IsStencilEnabled = false,
                StencilReadMask  = 0xFF,
                StencilWriteMask = 0xFF,
            };

            DepthStencilState depthState = new DepthStencilState(device, depthStateDesc);

            deviceContext.OutputMerger.SetDepthStencilState(depthState);

            SSceneViewInfo viewInfo = new SSceneViewInfo()
            {
                FitProjectionToScene = false,
                Fov          = MathUtil.Pi / 2.0f,
                ScreenFar    = Range,
                ScreenNear   = 0.1f,
                ScreenHeight = CStaticRendererCvars.ShadowMapSize,
                ScreenWidth  = CStaticRendererCvars.ShadowMapSize,
                ScreenLeft   = 0.0f,
                ScreenTop    = 0.0f,
                ViewLocation = Transform.WorldPosition,
                ViewMatrix   = Matrix.Invert(Transform.WorldMatrix)
            };

            m_projectionMatrix        = Matrix.PerspectiveFovLH(viewInfo.Fov, 1.0f, viewInfo.ScreenNear, viewInfo.ScreenFar);
            viewInfo.ProjectionMatrix = m_projectionMatrix;
            viewInfo.CreateBoundingFrustum();

            depthState.Dispose();
            renderScene.RenderSceneDepth(device, deviceContext, in viewInfo);

            DepthStencilView nullDepthView = null;

            deviceContext.OutputMerger.SetRenderTargets(nullDepthView);

            annotation.EndEvent();
            annotation.Dispose();
        }
        public void Dispose()
        {
            foreach (var cachedSector in SectorCache.Values)
            {
                cachedSector.Dispose();
            }

            SectorCache.Clear();

            PointLightStencil.Dispose();
            ShadowStencil.Dispose();
        }
示例#24
0
        public override void Dispose()
        {
            geometryShader?.Dispose();
            vertexShader?.Dispose();
            pixelShader?.Dispose();
            layout?.Dispose();
            Texture?.Dispose();

            blendStateDepth?.Dispose();

            depthStencilStateNoDepth?.Dispose();
        }
示例#25
0
 public void Shutdown()
 {
     swapChain.SetFullscreenState(false, null);
     rasterizerState.Dispose();
     depthStencilView.Dispose();
     depthStencilState.Dispose();
     depthStencilBuffer.Dispose();
     renderTargetView.Dispose();
     DeviceContext.Dispose();
     Device.Dispose();
     swapChain.Dispose();
 }
示例#26
0
        private void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    // cleanup managed stuff
                }

                // cleanup unmanaged stuff
                if (_device != null)
                {
                    _device.Dispose();
                }
                if (_swapChain != null)
                {
                    _swapChain.Dispose();
                }
                if (_renderTargetView != null)
                {
                    _renderTargetView.Dispose();
                }
                if (_depthStencilBuffer != null)
                {
                    _depthStencilBuffer.Dispose();
                }
                if (_depthStencilView != null)
                {
                    _depthStencilView.Dispose();
                }
                if (_depthStencilState != null)
                {
                    _depthStencilState.Dispose();
                }
                if (_alphaEnableBlendingState != null)
                {
                    _alphaEnableBlendingState.Dispose();
                }
                if (_alphaDisabledBlendingState != null)
                {
                    _alphaDisabledBlendingState.Dispose();
                }

                _device             = null;
                _swapChain          = null;
                _renderTargetView   = null;
                _depthStencilView   = null;
                _depthStencilBuffer = null;

                disposed = true;
            }
        }
示例#27
0
    protected override void FreeResource()
    {
        BlendState.Dispose();
        DepthStencilState.Dispose();
        RasterizerState.Dispose();
        foreach (var samplerBinding in Samplers)
        {
            samplerBinding.Dispose();
        }

        VertexShader.Dispose();
        PixelShader.Dispose();
    }
示例#28
0
        /// <summary>
        /// Dispose element
        /// </summary>
        public void Dispose()
        {
            _rasterState.Dispose();
            _blendState.Dispose();
            _depthState.Dispose();
            _samplerState.Dispose();

            _backbufferView.Dispose();
            _zbufferView.Dispose();
            _swapchain.Dispose();
            _deviceContext.Dispose();
            _device.Dispose();
        }
示例#29
0
        /// <summary>
        /// 内部objectを破棄します。
        /// </summary>
        public void Dispose()
        {
            figures.Dispose();

            if (ctx != null)
            {
                ctx.ClearState();
                ctx.Flush();
                ctx.Dispose();
            }

            default_rasterizer_state.Dispose();
            default_depth_stencil_state.Dispose();
            default_blend_state.Dispose();

            if (ztex_view != null)
            {
                ztex_view.Dispose();
            }
            if (ztex != null)
            {
                ztex.Dispose();
            }

            if (buf0_view != null)
            {
                buf0_view.Dispose();
            }
            if (buf0 != null)
            {
                buf0.Dispose();
            }

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

            if (il != null)
            {
                il.Dispose();
            }
            if (effect != null)
            {
                effect.Dispose();
            }
            if (device != null)
            {
                device.Dispose();
            }
        }
示例#30
0
        public override void Dispose()
        {
            rasterizerStateDefault?.Dispose();
            rasterizerStateDefaultNC?.Dispose();
            rasterizerStateWireframe?.Dispose();

            blendStateDefault?.Dispose();
            blendStateAddColour?.Dispose();
            blendStateDepth?.Dispose();

            depthStencilStateSolid?.Dispose();
            depthStencilStateTranslucent?.Dispose();
            depthStencilStateDepth?.Dispose();
        }