From ddf9835e9cdf512b1d5172d014f00ceb6dacd039 Mon Sep 17 00:00:00 2001 From: jvanverth Date: Mon, 21 Mar 2016 11:46:00 -0700 Subject: [PATCH] Minor fixes to avoid NVPR in Vulkan and provide good GrVkGpu teardown. BUG=skia:5097 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1818093002 Review URL: https://codereview.chromium.org/1818093002 --- src/gpu/GrContextFactory.cpp | 6 +++++- src/gpu/vk/GrVkGpu.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp index bcf0c32..fc1af6c 100755 --- a/src/gpu/GrContextFactory.cpp +++ b/src/gpu/GrContextFactory.cpp @@ -129,7 +129,11 @@ GrContextFactory::ContextInfo GrContextFactory::getContextInfo(GLContextType typ glCtx->makeCurrent(); GrBackendContext p3dctx = reinterpret_cast(glInterface.get()); #ifdef SK_VULKAN - grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions)); + if (kEnableNVPR_GLContextOptions & options) { + return ContextInfo(); + } else { + grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions)); + } #else grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); #endif diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 96c74dd..0666f10 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -356,9 +356,11 @@ GrVkGpu::~GrVkGpu() { fCurrentCmdBuffer->unref(this); // wait for all commands to finish + fResourceProvider.checkCommandBuffers(); VkResult res = VK_CALL(QueueWaitIdle(fQueue)); - SkASSERT(res == VK_SUCCESS); - + // 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(); -- 2.7.4