private void UninitializeResources() { if (_renderTarget == null) return; // Unassign back buffer from D3DImage. Lock(); SetBackBuffer(D3DResourceType.IDirect3DSurface9, IntPtr.Zero, true); #else SetBackBuffer(D3DResourceType.IDirect3DSurface9, IntPtr.Zero); Unlock(); // Dispose resources. _query.SafeDispose(); _query = null; _isFrameReady = true; // Set to true while nothing is being rendered. _stagingResource9.SafeDispose(); _stagingResource9 = null; _surface9.SafeDispose(); _surface9 = null; _texture9.SafeDispose(); _texture9 = null; _stagingResource11.SafeDispose(); _stagingResource11 = null; _texture11.SafeDispose(); _texture11 = null; _renderTarget.SafeDispose(); _renderTarget = null; }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting /// unmanaged resources. /// </summary> public void Dispose() { if (!_isDisposed) { _isDisposed = true; _intersectionImage.SafeDispose(); } }
protected override void Dispose(bool disposing) { if (disposing) { // Dispose managed resources. H0Spectrum.SafeDispose(); H0Spectrum = null; DisplacementSpectrum.SafeDispose(); DisplacementSpectrum = null; NormalSpectrum.SafeDispose(); NormalSpectrum = null; } base.Dispose(disposing); }