Esempio n. 1
0
 protected void Clean()
 {
     // clean up all resources
     // anything we missed will show up in the debug output
     Vertices.Close();
     Vertexbuffer.Dispose();
     Layout.Dispose();
     InputSignature.Dispose();
     Vertexshader.Dispose();
     Pixelshader.Dispose();
     Rendertarget.Dispose();
     _swapchain.Dispose();
     _device.Dispose();
 }
Esempio n. 2
0
 public void Dispose()
 {
     if (InputSignature != null)
     {
         InputSignature.Dispose();
     }
     if (ConstantBuffers != null)
     {
         ConstantBuffers.ForEach(buf => buf.Dispose());
         ConstantBuffers.Clear();
     }
     if (ShaderPtr != null)
     {
         ShaderPtr.Dispose();
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    if (VertexShader != null)
                    {
                        if (Device.ImmediateContext.VertexShader.Get().NativePointer == VertexShader.NativePointer)
                        {
                            Device.ImmediateContext.VertexShader.Set(null);
                            VertexShader.Dispose();
                            VertexShader = null;
                        }
                    }

                    if (PixelShader != null)
                    {
                        if (Device.ImmediateContext.PixelShader.Get().NativePointer == PixelShader.NativePointer)
                        {
                            Device.ImmediateContext.PixelShader.Set(null);
                            PixelShader.Dispose();
                            PixelShader = null;
                        }
                    }

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

                    if (InputSignature != null)
                    {
                        InputSignature.Dispose();
                        InputSignature = null;
                    }
                }
                disposed = true;
            }
        }
Esempio n. 4
0
 public override void Dispose()
 {
     VertexShader.Dispose();
     InputSignature.Dispose();
     PrintDisposeLog();
 }