diff options
author | jvanverth <jvanverth@google.com> | 2016-05-02 13:24:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-02 13:24:48 -0700 |
commit | a00980e58037fa36d066be80d7fcc0f73b2dfd40 (patch) | |
tree | 6da8cfc971f07e763c018a117d1e2da1d2fc813b /src/gpu | |
parent | 40ef48580b8bd47355ccf05e43d8032c10a77bbe (diff) |
Make sure that Vulkan debug callback ptr is non-null.
BUG=skia:5244
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1935163002
Review-Url: https://codereview.chromium.org/1935163002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 15 | ||||
-rw-r--r-- | src/gpu/vk/GrVkGpu.h | 3 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 71782777a5..a8525223ed 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -83,15 +83,13 @@ GrGpu* GrVkGpu::Create(GrBackendContext backendContext, const GrContextOptions& GrVkGpu::GrVkGpu(GrContext* context, const GrContextOptions& options, const GrVkBackendContext* backendCtx) : INHERITED(context) -#ifdef ENABLE_VK_LAYERS - , fVkInstance(backendCtx->fInstance) -#endif , fDevice(backendCtx->fDevice) , fQueue(backendCtx->fQueue) , fResourceProvider(this) { fBackendContext.reset(backendCtx); #ifdef ENABLE_VK_LAYERS + fCallback = nullptr; if (backendCtx->fExtensions & kEXT_debug_report_GrVkExtensionFlag) { // Setup callback creation information VkDebugReportCallbackCreateInfoEXT callbackCreateInfo; @@ -106,8 +104,8 @@ GrVkGpu::GrVkGpu(GrContext* context, const GrContextOptions& options, callbackCreateInfo.pUserData = nullptr; // Register the callback - GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateDebugReportCallbackEXT(fVkInstance, - &callbackCreateInfo, nullptr, &fCallback)); + GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateDebugReportCallbackEXT( + backendCtx->fInstance, &callbackCreateInfo, nullptr, &fCallback)); } #endif @@ -141,7 +139,7 @@ GrVkGpu::~GrVkGpu() { // wait for all commands to finish fResourceProvider.checkCommandBuffers(); - SkDEBUGCODE(VkResult res =) VK_CALL(QueueWaitIdle(fQueue)); + SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue)); // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec) SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res); @@ -153,7 +151,10 @@ GrVkGpu::~GrVkGpu() { shaderc_compiler_release(fCompiler); #ifdef ENABLE_VK_LAYERS - VK_CALL(DestroyDebugReportCallbackEXT(fVkInstance, fCallback, nullptr)); + if (fCallback) { + VK_CALL(DestroyDebugReportCallbackEXT(fBackendContext->fInstance, fCallback, nullptr)); + fCallback = nullptr; + } #endif } diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h index 8b8883bd04..506b2379f6 100644 --- a/src/gpu/vk/GrVkGpu.h +++ b/src/gpu/vk/GrVkGpu.h @@ -208,9 +208,6 @@ private: // These Vulkan objects are provided by the client, and also stored in fBackendContext. // They're copied here for convenient access. -#ifdef ENABLE_VK_LAYERS - VkInstance fVkInstance; -#endif VkDevice fDevice; VkQueue fQueue; // Must be Graphics queue |