public void Dispose() { if (!disposed) { //Wait for all rendering to stop before we start disposing of resources logicalDevice.WaitIdle(); //Dispose of the synchronization objects imageAvailableSemaphore.Dispose(); renderFinishedSemaphore.Dispose(); waitFences.DisposeAll(); //Dispose of the scene resources scene?.Dispose(); //Dispose of the swapchain swapchainTextures.DisposeAll(); swapchain.Dispose(); //Dispose of command-pool (will automatically also dispose of the commandbuffers that //where recreated from it) commandPool.Dispose(); //Dispose the Vulkan device and dispose of the os window logicalDevice.Dispose(); nativeWindow.Dispose(); disposed = true; } }
internal void Build() { GraphicsCommandPool?.Reset(); ComputeCommandPool?.Reset(); ImageAvailableSemaphore?.Dispose(); RenderingFinishedSemaphore?.Dispose(); Swapchain?.Dispose(); ImageAvailableSemaphore = ToDispose(Device.CreateSemaphore()); RenderingFinishedSemaphore = ToDispose(Device.CreateSemaphore()); Swapchain = ToDispose(VKHelper.CreateSwapchain(this)); CacheSwapchainImages(); }
public void DestroySwapChainStuff() { foreach (ImageView iv in mChainImageViews) { iv.Dispose(); } mChainImageViews = null; mDPool.Dispose(); mSwapChain.Dispose(); }