From 0a77f4352c5650cd08112a3e5229e88d34e33336 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Thu, 6 Dec 2018 11:23:32 -0500 Subject: [PATCH] In Vulkan don't submit CB after resolve call unless we are preparing image for I/O Bug: skia: Change-Id: I99c1d2ee1300f1f1757f7c44b3a839aba3091fee Reviewed-on: https://skia-review.googlesource.com/c/175259 Reviewed-by: Ethan Nicholas Commit-Queue: Greg Daniel --- src/gpu/vk/GrVkCopyManager.cpp | 2 +- src/gpu/vk/GrVkGpu.cpp | 2 +- src/gpu/vk/GrVkGpu.h | 7 +++++++ src/gpu/vk/GrVkGpuCommandBuffer.cpp | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gpu/vk/GrVkCopyManager.cpp b/src/gpu/vk/GrVkCopyManager.cpp index f91b04ebf8..efe86b3386 100644 --- a/src/gpu/vk/GrVkCopyManager.cpp +++ b/src/gpu/vk/GrVkCopyManager.cpp @@ -287,7 +287,7 @@ bool GrVkCopyManager::copySurfaceAsDraw(GrVkGpu* gpu, GrVkRenderTarget* texRT = static_cast(srcTex->asRenderTarget()); if (texRT) { - gpu->onResolveRenderTarget(texRT); + gpu->resolveRenderTargetNoFlush(texRT); } // TODO: Make tighter bounds and then adjust bounds for origin and granularity if we see diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index ded00fbcca..184aac44d5 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -1826,7 +1826,7 @@ bool GrVkGpu::onReadPixels(GrSurface* surface, int left, int top, int width, int case GrVkRenderTarget::kAutoResolves_ResolveType: break; case GrVkRenderTarget::kCanResolve_ResolveType: - this->internalResolveRenderTarget(rt, false); + this->resolveRenderTargetNoFlush(rt); break; default: SK_ABORT("Unknown resolve type"); diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h index 32a7c89280..26e53e9993 100644 --- a/src/gpu/vk/GrVkGpu.h +++ b/src/gpu/vk/GrVkGpu.h @@ -119,7 +119,14 @@ public: bool onRegenerateMipMapLevels(GrTexture* tex) override; + void resolveRenderTargetNoFlush(GrRenderTarget* target) { + this->internalResolveRenderTarget(target, false); + } + void onResolveRenderTarget(GrRenderTarget* target) override { + // This resolve is called when we are preparing an msaa surface for external I/O. It is + // called after flushing, so we need to make sure we submit the command buffer after doing + // the resolve so that the resolve actually happens. this->internalResolveRenderTarget(target, true); } diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp index b44dbc1c78..922e410b0f 100644 --- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp +++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp @@ -676,7 +676,7 @@ void GrVkGpuRTCommandBuffer::onDraw(const GrPrimitiveProcessor& primProc, // We may need to resolve the texture first if it is also a render target GrVkRenderTarget* texRT = static_cast(vkTexture->asRenderTarget()); if (texRT) { - fGpu->onResolveRenderTarget(texRT); + fGpu->resolveRenderTargetNoFlush(texRT); } // Check if we need to regenerate any mip maps