private unsafe void ReleaseDevice() { EmptyTexelBuffer.Dispose(); EmptyTexelBuffer = null; // Wait for all queues to be idle nativeDevice.WaitIdle(); // Destroy all remaining fences GetCompletedValue(); // Mark upload buffer for destruction if (nativeUploadBuffer != SharpVulkan.Buffer.Null) { NativeDevice.UnmapMemory(nativeUploadBufferMemory); nativeResourceCollector.Add(lastCompletedFence, nativeUploadBuffer); nativeResourceCollector.Add(lastCompletedFence, nativeUploadBufferMemory); nativeUploadBuffer = SharpVulkan.Buffer.Null; nativeUploadBufferMemory = DeviceMemory.Null; } // Release fenced resources nativeResourceCollector.Dispose(); DescriptorPools.Dispose(); nativeDevice.DestroyCommandPool(NativeCopyCommandPool); nativeDevice.Destroy(); }
protected override void Destroy() { for (int i = 0; i < VertexBufferCount; i++) { vertexBuffers[i].Dispose(); } activeVertexBufferIndex = -1; mappedVertexBufferPointer = IntPtr.Zero; if (indexBuffer != null) { indexBuffer.Dispose(); indexBuffer = null; } indexBufferBinding = null; pipelineState = null; if (simpleEffect != null) { simpleEffect.Dispose(); simpleEffect = null; } for (int i = 0; i < VertexBufferCount; i++) { inputElementDescriptions[i] = null; } charsToRenderCount = -1; base.Destroy(); }
public void Dispose() { if (GeneratedIndicesAEN != null) { GeneratedIndicesAEN.Dispose(); GeneratedIndicesAEN = null; } }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public override void Dispose() { if (VertexBuffer != null && !VertexBuffer.IsDisposed) { VertexBuffer.Dispose(); } if (effect != null && !effect.IsDisposed) { effect.Dispose(); } }
protected override void Destroy() { foreach (var renderFeature in RenderFeatures) { renderFeature.Dispose(); } RenderFeatures.CollectionChanged -= RenderFeatures_CollectionChanged; descriptorSets.Dispose(); emptyBuffer?.Dispose(); emptyBuffer = null; base.Destroy(); }