aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/sk_app
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-06-25 17:16:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-26 13:16:32 +0000
commitd4b2adeaa929edd1664754ac6621ec524992ef03 (patch)
treebaa4c600030ccb5f390984026a9cf8e071c67065 /tools/sk_app
parentf46710802ad50d33fdb9c9a090e7ee83b0f0ef5b (diff)
Move Vulkan DebugCallback code into tools.
Bug: skia: Change-Id: Ib356200e86e54f9ff0ba16396874e6fd10cf0465 Reviewed-on: https://skia-review.googlesource.com/137424 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tools/sk_app')
-rw-r--r--tools/sk_app/VulkanWindowContext.cpp45
-rw-r--r--tools/sk_app/VulkanWindowContext.h1
2 files changed, 27 insertions, 19 deletions
diff --git a/tools/sk_app/VulkanWindowContext.cpp b/tools/sk_app/VulkanWindowContext.cpp
index 411f114e63..8e0749ec1b 100644
--- a/tools/sk_app/VulkanWindowContext.cpp
+++ b/tools/sk_app/VulkanWindowContext.cpp
@@ -51,7 +51,8 @@ void VulkanWindowContext::initializeContext() {
GrVkBackendContext backendContext;
if (!sk_gpu_test::CreateVkBackendContext(fGetInstanceProcAddr, fGetDeviceProcAddr,
- &backendContext, &fPresentQueueIndex, fCanPresentFn)) {
+ &backendContext, &fDebugCallback,
+ &fPresentQueueIndex, fCanPresentFn)) {
return;
}
@@ -409,28 +410,26 @@ VulkanWindowContext::~VulkanWindowContext() {
}
void VulkanWindowContext::destroyContext() {
- if (!this->isValid()) {
- return;
- }
-
- fQueueWaitIdle(fPresentQueue);
- fDeviceWaitIdle(fDevice);
+ if (this->isValid()) {
+ fQueueWaitIdle(fPresentQueue);
+ fDeviceWaitIdle(fDevice);
- this->destroyBuffers();
+ this->destroyBuffers();
- if (VK_NULL_HANDLE != fCommandPool) {
- GR_VK_CALL(fInterface, DestroyCommandPool(fDevice, fCommandPool, nullptr));
- fCommandPool = VK_NULL_HANDLE;
- }
+ if (VK_NULL_HANDLE != fCommandPool) {
+ GR_VK_CALL(fInterface, DestroyCommandPool(fDevice, fCommandPool, nullptr));
+ fCommandPool = VK_NULL_HANDLE;
+ }
- if (VK_NULL_HANDLE != fSwapchain) {
- fDestroySwapchainKHR(fDevice, fSwapchain, nullptr);
- fSwapchain = 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;
+ if (VK_NULL_HANDLE != fSurface) {
+ fDestroySurfaceKHR(fInstance, fSurface, nullptr);
+ fSurface = VK_NULL_HANDLE;
+ }
}
fContext.reset();
@@ -440,6 +439,14 @@ 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) {
diff --git a/tools/sk_app/VulkanWindowContext.h b/tools/sk_app/VulkanWindowContext.h
index 79298f6b38..3d9687b674 100644
--- a/tools/sk_app/VulkanWindowContext.h
+++ b/tools/sk_app/VulkanWindowContext.h
@@ -68,6 +68,7 @@ private:
VkInstance fInstance = VK_NULL_HANDLE;
VkPhysicalDevice fPhysicalDevice = VK_NULL_HANDLE;
VkDevice fDevice = VK_NULL_HANDLE;
+ VkDebugReportCallbackEXT fDebugCallback = VK_NULL_HANDLE;
// simple wrapper class that exists only to initialize a pointer to NULL
template <typename FNPTR_TYPE> class VkPtr {