aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-02-23 09:44:02 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-23 15:30:36 +0000
commit69d4992e69d7b142450d0ccb587b7b26be7cf1ea (patch)
tree941968e6888cdcf3562709b1a4f3a42d23407040 /src
parent30f9bc69cfc506075e1fce8e7934f941c0203023 (diff)
In Vulkan make sure resolve is sent to GPU when preparing msaa RenderTarget for external IO
In GrDrawingManager, when preparing for I/O we first flush the GPU then call resolve. However, in Vulkan the resolve lives in a command buffer that needs to be flushed to the GPU as well. This is most likely the cause we were seeing in Viewer app where first frame was always black since the actually resolve command buffer was not flushed to the gpu before presenting. All future frames would then typically show one frame behind. BUG=skia: Change-Id: Iaf492f88680b998be0087637279cc78d5a38ec50 Reviewed-on: https://skia-review.googlesource.com/8903 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/vk/GrVkGpu.cpp12
-rw-r--r--src/gpu/vk/GrVkGpu.h6
2 files changed, 13 insertions, 5 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 0f2f9946b2..915ac9747e 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -405,17 +405,21 @@ void GrVkGpu::resolveImage(GrVkRenderTarget* dst, GrVkRenderTarget* src, const S
fCurrentCmdBuffer->resolveImage(this, *src->msaaImage(), *dst, 1, &resolveInfo);
}
-void GrVkGpu::onResolveRenderTarget(GrRenderTarget* target) {
+void GrVkGpu::internalResolveRenderTarget(GrRenderTarget* target, bool requiresSubmit) {
if (target->needsResolve()) {
SkASSERT(target->numColorSamples() > 1);
GrVkRenderTarget* rt = static_cast<GrVkRenderTarget*>(target);
SkASSERT(rt->msaaImage());
-
+
const SkIRect& srcRect = rt->getResolveRect();
this->resolveImage(rt, rt, srcRect, SkIPoint::Make(srcRect.fLeft, srcRect.fTop));
rt->flagAsResolved();
+
+ if (requiresSubmit) {
+ this->submitCommandBuffer(kSkip_SyncQueue);
+ }
}
}
@@ -823,7 +827,7 @@ void GrVkGpu::generateMipmap(GrVkTexture* tex) {
// We may need to resolve the texture first if it is also a render target
GrVkRenderTarget* texRT = static_cast<GrVkRenderTarget*>(tex->asRenderTarget());
if (texRT) {
- this->onResolveRenderTarget(texRT);
+ this->internalResolveRenderTarget(texRT, false);
}
int width = tex->width();
@@ -1652,7 +1656,7 @@ bool GrVkGpu::onReadPixels(GrSurface* surface,
case GrVkRenderTarget::kAutoResolves_ResolveType:
break;
case GrVkRenderTarget::kCanResolve_ResolveType:
- this->onResolveRenderTarget(rt);
+ this->internalResolveRenderTarget(rt, false);
break;
default:
SkFAIL("Unknown resolve type");
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 5dddb93cf0..18059b9682 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -117,7 +117,9 @@ public:
return fCompiler;
}
- void onResolveRenderTarget(GrRenderTarget* target) override;
+ void onResolveRenderTarget(GrRenderTarget* target) override {
+ this->internalResolveRenderTarget(target, true);
+ }
void submitSecondaryCommandBuffer(GrVkSecondaryCommandBuffer*,
const GrVkRenderPass*,
@@ -201,6 +203,8 @@ private:
// work in the queue to finish before returning.
void submitCommandBuffer(SyncQueue sync);
+ void internalResolveRenderTarget(GrRenderTarget* target, bool requiresSubmit);
+
void copySurfaceAsCopyImage(GrSurface* dst,
GrSurface* src,
GrVkImage* dstImage,