private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { // Now begin running the application idle loop. GorgonApplication.Run(Initialize(), Idle); } catch (Exception ex) { GorgonExample.HandleException(ex); } finally { // Always clean up when you're done. // Since Gorgon uses Direct 3D 11.x, which allocate objects that use native memory and COM objects, we must be careful to dispose of any objects that implement // IDisposable. Failure to do so can lead to warnings from the Direct 3D runtime when running in DEBUG mode. GorgonExample.UnloadResources(); _constantBuffer?.Dispose(); _vertexBuffer.VertexBuffer?.Dispose(); _inputLayout?.Dispose(); _vertexShader?.Dispose(); _pixelShader?.Dispose(); _swap?.Dispose(); _graphics?.Dispose(); } }
/// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary> public void Dispose() { for (int i = 0; i < _volumeRtSections.Length; ++i) { _volumeSections[i]?.Dispose(); _volumeRtSections[i]?.Dispose(); } _textureView = null; _cube?.Dispose(); _volumeScaleFactor?.Dispose(); _volumeRayParams?.Dispose(); _cubeTransform?.Dispose(); _cubePosShader?.Dispose(); _cubeDirShader?.Dispose(); _cubeVs?.Dispose(); _inputLayout?.Dispose(); _cubeTransform = null; _inputLayout = null; _cube = null; _volumeScaleFactor = null; _volumeRayParams = null; _cubePosShader = null; _cubeDirShader = null; _cubeVs = null; }
private static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Initialize(); GorgonApplication.Run(_mainForm, Idle); } catch (Exception ex) { GorgonExample.HandleException(ex); } finally { GorgonExample.UnloadResources(); // Always clean up when you're done. // Since Gorgon uses Direct 3D 11.4, we must be careful to dispose of any objects that implement IDisposable. // Failure to do so can lead to warnings from the Direct 3D runtime when running in DEBUG mode. _depthStencil?.Dispose(); _texture?.Dispose(); _geometryShader?.Dispose(); _pixelShader?.Dispose(); _vertexShader?.Dispose(); _bufferless?.Dispose(); _swap?.Dispose(); _graphics?.Dispose(); } }
/// <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 override void Dispose(bool disposing) { if (!_disposed) { if (disposing) { if (_embossShader != null) { _embossShader.Dispose(); } if (_sharpenShader != null) { _sharpenShader.Dispose(); } if (_sharpenEmbossBuffer != null) { _sharpenEmbossBuffer.Dispose(); } } _embossShader = null; _sharpenShader = null; _disposed = true; } base.Dispose(disposing); }
/// <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 override void Dispose(bool disposing) { if (!disposing) { return; } GorgonVertexShader vertexShader = Interlocked.Exchange(ref _vertexDeferShader, null); GorgonPixelShader deferredShader = Interlocked.Exchange(ref _pixelDeferShader, null); GorgonPixelShader lightShader = Interlocked.Exchange(ref _pixelLitShader, null); GorgonConstantBufferView lightData = Interlocked.Exchange(ref _lightData, null); GorgonConstantBufferView globalData = Interlocked.Exchange(ref _globalData, null); GorgonRenderTargetView[] targets = Interlocked.Exchange(ref _gbufferTargets, null); GorgonTexture2DView textureView = Interlocked.Exchange(ref _gbufferTexture, null); textureView?.Dispose(); for (int i = 0; i < targets.Length; ++i) { targets[i]?.Dispose(); } globalData?.Dispose(); lightData?.Dispose(); lightShader?.Dispose(); deferredShader?.Dispose(); vertexShader?.Dispose(); }
/// <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 override void Dispose(bool disposing) { if (!_disposed) { if (disposing) { if (_linearDodgeBurn != null) { _linearDodgeBurn.Dispose(); } if (_dodgeBurn != null) { _dodgeBurn.Dispose(); } if (_burnDodgeBuffer != null) { _burnDodgeBuffer.Dispose(); } } _burnDodgeBuffer = null; _linearDodgeBurn = null; _dodgeBurn = null; _disposed = true; } base.Dispose(disposing); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { _defaultTexture?.Texture?.Dispose(); _wvpBuffer?.Dispose(); _vertexBufferBindings?[0].VertexBuffer?.Dispose(); _inputLayout?.Dispose(); _vertexShader?.Dispose(); _pixelShader?.Dispose(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><b>true</b> to release both managed and unmanaged resources; <b>false</b> to release only unmanaged resources.</param> protected override void Dispose(bool disposing) { if (!disposing) { return; } GorgonPixelShader shader = Interlocked.Exchange(ref _grayScaleShader, null); shader?.Dispose(); }
/// <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 override void Dispose(bool disposing) { GorgonTexture1DView texture = Interlocked.Exchange(ref _defaultLut, null); GorgonPixelShader shader1 = Interlocked.Exchange(ref _chromeAbShader, null); GorgonPixelShader shader2 = Interlocked.Exchange(ref _simpleChromeAbShader, null); GorgonConstantBufferView cbv = Interlocked.Exchange(ref _settings, null); shader1?.Dispose(); shader2?.Dispose(); texture?.Dispose(); cbv?.Dispose(); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Initialize(); GorgonApplication.Run(_mainForm, Idle); } catch (Exception ex) { GorgonExample.HandleException(ex); } finally { GorgonExample.UnloadResources(); _2D.Dispose(); // Always call dispose so we can free the native memory allocated for the backing graphics API. _sphere?.Dispose(); if (_planes != null) { foreach (Plane plane in _planes) { plane?.Dispose(); } } _texture?.Dispose(); _wvpBuffer?.Dispose(); _materialBuffer?.Dispose(); _vertexShader?.Dispose(); _pixelShader?.Dispose(); _inputLayout?.Dispose(); _swap?.Dispose(); _graphics?.Dispose(); } }