public void Dispose() { try { m_swapchain?.Dispose(); } catch { } finally { m_swapchain = null; } }
/// <summary> /// This call configure the graphic library for the new device instance. /// </summary> public override void InvalidateDevice() { base.InvalidateDevice(); // - Wait the GPU (we must operate only when GPU is idle) GraphicDevice.Handle.WaitIdle(); // - Dispose render pass DefaultRenderPass.Dispose(); // - Dispose the pipeline Pipeline.Dispose(); // - Dipose current swapchain Swapchain.Dispose(); // - Dispose current VK surface DrawingSurface.Dispose(); // - Dispose vertex and index managers VertexManager.Dispose(); IndexManager.Dispose(); // - Release all VK shaders ShaderManager.Dispose(); for (int i = 0; i < MaxFrameInFlight; ++i) { if (CommandBuffers[i] != null) { foreach (var buffer in CommandBuffers[i]) { buffer.Reset(); } Commands[i].FreeCommandBuffers(CommandBuffers[i]); } } foreach (Fence fence in InFlightFences) { fence.Destroy(); } foreach (Semaphore sem in ImageAvailableSemaphores) { sem.Destroy(); } foreach (Semaphore sem in RenderFinishedSemaphores) { sem.Destroy(); } // - Dispose device GraphicDevice.Dispose(); // - Initialize device Initialize(); // - Reconfigure the renderer ConfigureRendering(); }
public void Dispose() { _gd.WaitForIdle(); // TODO: Shouldn't be necessary, but Vulkan backend trips a validation error (swapchain in use when disposed). _sc.Dispose(); _window.Close(); _gcHandle.Free(); }
/// <summary> /// Implement IDisposable. /// </summary> protected override void Dispose(bool disposing) { base.Dispose(disposing); GraphicDevice.Handle.WaitForFences(InFlightFences.ToArray(), true, UInt64.MaxValue); // - Wait the GPU (we must operate only when GPU is idle) GraphicDevice.Handle.WaitIdle(); // - Dispose render pass DefaultRenderPass.Dispose(); // - Dispose the pipeline Pipeline.Dispose(); // - Dipose current swapchain Swapchain.Dispose(); // - Dispose vertex and index managers VertexManager.Dispose(); IndexManager.Dispose(); // - Release all VK shaders ShaderManager.Dispose(); for (int i = 0; i < MaxFrameInFlight; ++i) { if (CommandBuffers[i] != null) { foreach (var buffer in CommandBuffers[i]) { buffer.Reset(); } } } foreach (CommandPool pool in Commands) { pool?.Destroy(); } foreach (Fence fence in InFlightFences) { fence?.Destroy(); } foreach (Semaphore sem in ImageAvailableSemaphores) { sem?.Destroy(); } foreach (Semaphore sem in RenderFinishedSemaphores) { sem?.Destroy(); } // - Dispose device GraphicDevice.Dispose(); // - Dispose vulkan Library.Dispose(); }
protected override void Dispose(bool disposing) { if (disposing) { Swapchain.Dispose(); } base.Dispose(disposing); }
private void RecreateSwapChain() { device.WaitIdle(); commandPool.FreeCommandBuffers(commandBuffers); foreach (var frameBuffer in frameBuffers) { frameBuffer.Dispose(); } frameBuffers = null; pipeline.Dispose(); pipeline = null; pipelineLayout.Dispose(); pipelineLayout = null; foreach (var imageView in swapChainImageViews) { imageView.Dispose(); } swapChainImageViews = null; renderPass.Dispose(); renderPass = null; swapChain.Dispose(); swapChain = null; CreateSwapChain(); CreateImageViews(); CreateRenderPass(); CreateGraphicsPipeline(); CreateFrameBuffers(); CreateCommandBuffers(); }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { window.Close(); EventCallback = null; swapchain.Framebuffer.Dispose(); swapchain.Dispose(); GcHandle.Free(); } disposed = true; } }
/// <summary> /// Configure the graphic library to work with a new surface size. /// </summary> /// <param name="videoSurface">Target surface.</param> public override void InvalidateGraphics() { base.InvalidateGraphics(); // - Wait the GPU (we must operate only when GPU is idle) GraphicDevice.Handle.WaitIdle(); // - Dispose render pass DefaultRenderPass.Dispose(); // - Dispose the pipeline Pipeline.Dispose(); // - Dipose current swapchain Swapchain.Dispose(); // - Reconfigure the renderer ConfigureRendering(); }
protected virtual void DestroySwapchain() { _sc.Dispose(); }
void reset_swapchain() { _swapChain?.Dispose(); _swapChain = null; }
public void Dispose() { _sc.Dispose(); _window.Close(); _gcHandle.Free(); }