public void Dispose() { if (backBuffer != null) { backBuffer.Dispose(); backBuffer = null; } if (autoDepthStencil != null) { autoDepthStencil.Dispose(); autoDepthStencil = null; } }
public void OnReset(Context glContext, int width, int height, ref SwapChainDescription implicitSwapChainDescription) { if (backBuffer != null) { backBuffer.Dispose(); backBuffer = null; } if (autoDepthStencil != null) { autoDepthStencil.Dispose(); autoDepthStencil = null; } texture2DDescription.Width = width; texture2DDescription.Height = height; texture2DDescription.Sampling = implicitSwapChainDescription.Sampling; texture2DDescription.FormatID = implicitSwapChainDescription.ColorBufferFormatID; texture2DDescription.BindFlags = BindFlags.RenderTarget; backBuffer = new CBackBuffer(device, ref texture2DDescription); if (implicitSwapChainDescription.EnableAutoDepthStencil) { texture2DDescription.FormatID = implicitSwapChainDescription.DepthStencilFormatID; texture2DDescription.BindFlags = BindFlags.DepthStencil; autoDepthStencil = new CAutoDepthStencil(device, ref texture2DDescription); } }
void CreateBackBufferAndDepthStencil() { implicitBackBuffer = new CBackBuffer(this, primaryWindow.SwapChainWidth, primaryWindow.SwapChainHeight, implicitSwapChainDesc.ColorBufferFormatID, implicitSwapChainDesc.Sampling); implicitBackBuffer.UpdateSurface(d3dDevice.GetBackBuffer(0, 0)); implicitDepthStencilBuffer = new CAutoDepthStencil(this, primaryWindow.SwapChainWidth, primaryWindow.SwapChainHeight, implicitSwapChainDesc.DepthStencilFormatID, implicitSwapChainDesc.Sampling); if (implicitSwapChainDesc.EnableAutoDepthStencil) implicitDepthStencilBuffer.UpdateSurface(d3dDevice.DepthStencilSurface); }