diff options
Diffstat (limited to 'tools/sk_app/VulkanWindowContext.cpp')
-rw-r--r-- | tools/sk_app/VulkanWindowContext.cpp | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/tools/sk_app/VulkanWindowContext.cpp b/tools/sk_app/VulkanWindowContext.cpp index 8e0749ec1b..411f114e63 100644 --- a/tools/sk_app/VulkanWindowContext.cpp +++ b/tools/sk_app/VulkanWindowContext.cpp @@ -51,8 +51,7 @@ void VulkanWindowContext::initializeContext() { GrVkBackendContext backendContext; if (!sk_gpu_test::CreateVkBackendContext(fGetInstanceProcAddr, fGetDeviceProcAddr, - &backendContext, &fDebugCallback, - &fPresentQueueIndex, fCanPresentFn)) { + &backendContext, &fPresentQueueIndex, fCanPresentFn)) { return; } @@ -410,26 +409,28 @@ VulkanWindowContext::~VulkanWindowContext() { } void VulkanWindowContext::destroyContext() { - if (this->isValid()) { - fQueueWaitIdle(fPresentQueue); - fDeviceWaitIdle(fDevice); + if (!this->isValid()) { + return; + } - this->destroyBuffers(); + fQueueWaitIdle(fPresentQueue); + fDeviceWaitIdle(fDevice); - if (VK_NULL_HANDLE != fCommandPool) { - GR_VK_CALL(fInterface, DestroyCommandPool(fDevice, fCommandPool, nullptr)); - fCommandPool = VK_NULL_HANDLE; - } + this->destroyBuffers(); - if (VK_NULL_HANDLE != fSwapchain) { - fDestroySwapchainKHR(fDevice, fSwapchain, nullptr); - fSwapchain = VK_NULL_HANDLE; - } + if (VK_NULL_HANDLE != fCommandPool) { + GR_VK_CALL(fInterface, DestroyCommandPool(fDevice, fCommandPool, nullptr)); + fCommandPool = VK_NULL_HANDLE; + } - if (VK_NULL_HANDLE != fSurface) { - fDestroySurfaceKHR(fInstance, fSurface, nullptr); - fSurface = VK_NULL_HANDLE; - } + if (VK_NULL_HANDLE != fSwapchain) { + fDestroySwapchainKHR(fDevice, fSwapchain, nullptr); + fSwapchain = VK_NULL_HANDLE; + } + + if (VK_NULL_HANDLE != fSurface) { + fDestroySurfaceKHR(fInstance, fSurface, nullptr); + fSurface = VK_NULL_HANDLE; } fContext.reset(); @@ -439,14 +440,6 @@ void VulkanWindowContext::destroyContext() { fDestroyDevice(fDevice, nullptr); fDevice = VK_NULL_HANDLE; } - -#ifdef SK_ENABLE_VK_LAYERS - if (fDebugCallback != VK_NULL_HANDLE) { - GR_VK_CALL(fInterface, DestroyDebugReportCallbackEXT(fInstance, fDebugCallback, - nullptr)); - } -#endif - fPhysicalDevice = VK_NULL_HANDLE; if (VK_NULL_HANDLE != fInstance) { |