Rewrite tessellation atlases as normal render tasks
Rewrites tessellation atlases as normal render tasks instead of
"onFlush" tasks. These tasks get inserted into the DAG upfront, lay
out their atlases as dependent tasks get built and reference them, and
finally add their ops to render themselves during onMakeClosed. Doing it
this way allows us to pause the flush and re-render the atlas whenever
it runs out of room.
Bug: b/188794626
Bug: chromium:928984
Change-Id: Id59a5527924c63d5ff7c5bce46a88368e79fc3ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420556
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 2d47502..5f2884c 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -382,7 +382,8 @@
op->visitProxies(addDependency);
- this->recordOp(std::move(op), GrProcessorSet::EmptySetAnalysis(), nullptr, nullptr, caps);
+ this->recordOp(std::move(op), false/*usesMSAA*/, GrProcessorSet::EmptySetAnalysis(), nullptr,
+ nullptr, caps);
}
void GrOpsTask::addDrawOp(GrDrawingManager* drawingMgr, GrOp::Owner op, bool usesMSAA,
@@ -412,16 +413,7 @@
fRenderPassXferBarriers |= GrXferBarrierFlags::kBlend;
}
-#ifdef SK_DEBUG
- // Ensure we can support dynamic msaa if the caller is trying to trigger it.
- GrRenderTargetProxy* rtProxy = this->target(0)->asRenderTargetProxy();
- if (rtProxy->numSamples() == 1 && usesMSAA) {
- SkASSERT(caps.supportsDynamicMSAA(rtProxy));
- }
-#endif
- fUsesMSAASurface |= usesMSAA;
-
- this->recordOp(std::move(op), processorAnalysis, clip.doesClip() ? &clip : nullptr,
+ this->recordOp(std::move(op), usesMSAA, processorAnalysis, clip.doesClip() ? &clip : nullptr,
&dstProxyView, caps);
}
@@ -947,19 +939,27 @@
}
void GrOpsTask::recordOp(
- GrOp::Owner op, GrProcessorSet::Analysis processorAnalysis, GrAppliedClip* clip,
- const GrDstProxyView* dstProxyView, const GrCaps& caps) {
- SkDEBUGCODE(op->validate();)
- SkASSERT(processorAnalysis.requiresDstTexture() == (dstProxyView && dstProxyView->proxy()));
+ GrOp::Owner op, bool usesMSAA, GrProcessorSet::Analysis processorAnalysis,
+ GrAppliedClip* clip, const GrDstProxyView* dstProxyView, const GrCaps& caps) {
GrSurfaceProxy* proxy = this->target(0);
+#ifdef SK_DEBUG
+ op->validate();
+ SkASSERT(processorAnalysis.requiresDstTexture() == (dstProxyView && dstProxyView->proxy()));
SkASSERT(proxy);
-
// A closed GrOpsTask should never receive new/more ops
SkASSERT(!this->isClosed());
+ // Ensure we can support dynamic msaa if the caller is trying to trigger it.
+ if (proxy->asRenderTargetProxy()->numSamples() == 1 && usesMSAA) {
+ SkASSERT(caps.supportsDynamicMSAA(proxy->asRenderTargetProxy()));
+ }
+#endif
+
if (!op->bounds().isFinite()) {
return;
}
+ fUsesMSAASurface |= usesMSAA;
+
// Account for this op's bounds before we attempt to combine.
// NOTE: The caller should have already called "op->setClippedBounds()" by now, if applicable.
fTotalBounds.join(op->bounds());