private unsafe void DestroySwapchain()
        {
            if (swapChain == Swapchain.Null)
            {
                return;
            }

            // stop our presenter thread
            if (presenterThread != null)
            {
                runPresenter = false;
                presentWaiter.Set();
                presenterThread.Join();
            }

            GraphicsDevice.NativeDevice.WaitIdle();
            CommandList.ResetAllPools();

            backbuffer.OnDestroyed();

            foreach (var swapchainImage in swapchainImages)
            {
                GraphicsDevice.NativeDevice.DestroyImageView(swapchainImage.NativeColorAttachmentView);
            }
            swapchainImages = null;

            GraphicsDevice.NativeDevice.DestroySwapchain(swapChain);
            swapChain = Swapchain.Null;
        }
        private unsafe void DestroySwapchain()
        {
            if (swapChain == VkSwapchainKHR.Null)
            {
                return;
            }

            // stop our presenter thread
            if (presenterThread != null)
            {
                runPresenter = false;
                presentWaiter.Set();
                presenterThread.Join();
            }

            vkQueueWaitIdle(GraphicsDevice.NativeCommandQueue);
            CommandList.ResetAllPools();

            backbuffer.OnDestroyed();

            foreach (var swapchainImage in swapchainImages)
            {
                vkDestroyImageView(GraphicsDevice.NativeDevice, swapchainImage.NativeColorAttachmentView, null);
            }
            swapchainImages = null;

            vkDestroySwapchainKHR(GraphicsDevice.NativeDevice, swapChain, null);
            swapChain = VkSwapchainKHR.Null;
        }