private void TearDown() { device.WaitIdle(); renderFinishedSemaphore.Dispose(); renderFinishedSemaphore = null; imageAvailableSemaphore.Dispose(); imageAvailableSemaphore = null; vertexBufferMemory.Free(); vertexBufferMemory = null; vertexBuffer.Dispose(); vertexBuffer = null; commandPool.Dispose(); commandPool = null; foreach (var frameBuffer in frameBuffers) { frameBuffer.Dispose(); } frameBuffers = null; fragShader.Dispose(); fragShader = null; vertShader.Dispose(); vertShader = 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; device.Dispose(); device = null; surface.Dispose(); surface = null; instance.Dispose(); instance = null; }