Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: src/gpu/vk/GrVkGpu.cpp

Issue 1935163002: Make sure that Vulkan debug callback ptr is non-null. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix one more tab Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkGpu.cpp
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 71782777a55838c8cf97ff9a94ffa4f39c4d90e9..a8525223ed15980ef86b740ec3d1c3938402d981 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
}
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698