Index: src/gpu/vk/GrVkGpu.cpp |
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp |
index 33b53b1bcd76b257ffa28f6e5cfa6ec5fb216560..f66b1575a3f20b3d3d346cb820fcb07f8ba93a10 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 |
@@ -136,24 +134,27 @@ GrVkGpu::GrVkGpu(GrContext* context, const GrContextOptions& options, |
} |
GrVkGpu::~GrVkGpu() { |
- fCurrentCmdBuffer->end(this); |
- fCurrentCmdBuffer->unref(this); |
+ fCurrentCmdBuffer->end(this); |
djsollen
2016/05/02 19:17:44
spaces not tabs.
jvanverth1
2016/05/02 19:56:33
Done.
|
+ fCurrentCmdBuffer->unref(this); |
- // wait for all commands to finish |
- fResourceProvider.checkCommandBuffers(); |
- 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); |
+ // wait for all commands to finish |
+ fResourceProvider.checkCommandBuffers(); |
+ 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); |
- // must call this just before we destroy the VkDevice |
- fResourceProvider.destroyResources(); |
+ // must call this just before we destroy the VkDevice |
+ fResourceProvider.destroyResources(); |
- VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr)); |
+ VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr)); |
- shaderc_compiler_release(fCompiler); |
+ 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 |
} |