Upgrade GrRenderTask::makeClosed to take a GrRecordingContext
The tessellation atlas task will need a recording context in order to
record its ops during onMakeClosed.
Bug: b/188794626
Bug: chromium:928984
Change-Id: Ie8719a514899a5748c52ae78a6ecd997b1439ab7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420879
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrCopyRenderTask.cpp b/src/gpu/GrCopyRenderTask.cpp
index eb65dd5..d91f7f7 100644
--- a/src/gpu/GrCopyRenderTask.cpp
+++ b/src/gpu/GrCopyRenderTask.cpp
@@ -62,7 +62,7 @@
alloc->incOps();
}
-GrRenderTask::ExpectedOutcome GrCopyRenderTask::onMakeClosed(const GrCaps&,
+GrRenderTask::ExpectedOutcome GrCopyRenderTask::onMakeClosed(GrRecordingContext*,
SkIRect* targetUpdateBounds) {
// We don't expect to be marked skippable before being closed.
SkASSERT(fSrc);
diff --git a/src/gpu/GrCopyRenderTask.h b/src/gpu/GrCopyRenderTask.h
index 5df803d..6bfb4db 100644
--- a/src/gpu/GrCopyRenderTask.h
+++ b/src/gpu/GrCopyRenderTask.h
@@ -34,7 +34,7 @@
void onMakeSkippable() override { fSrc.reset(); }
bool onIsUsed(GrSurfaceProxy* proxy) const override { return proxy == fSrc.get(); }
void gatherProxyIntervals(GrResourceAllocator*) const override;
- ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect* targetUpdateBounds) override;
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override;
bool onExecute(GrOpFlushState*) override;
#if GR_TEST_UTILS
diff --git a/src/gpu/GrDDLTask.cpp b/src/gpu/GrDDLTask.cpp
index 42f62e9..aeefd5a 100644
--- a/src/gpu/GrDDLTask.cpp
+++ b/src/gpu/GrDDLTask.cpp
@@ -74,7 +74,7 @@
}
}
-GrRenderTask::ExpectedOutcome GrDDLTask::onMakeClosed(const GrCaps& caps,
+GrRenderTask::ExpectedOutcome GrDDLTask::onMakeClosed(GrRecordingContext*,
SkIRect* targetUpdateBounds) {
SkASSERT(0);
return ExpectedOutcome::kTargetUnchanged;
diff --git a/src/gpu/GrDDLTask.h b/src/gpu/GrDDLTask.h
index 5aceb5e..ba121e4 100644
--- a/src/gpu/GrDDLTask.h
+++ b/src/gpu/GrDDLTask.h
@@ -41,7 +41,7 @@
void gatherProxyIntervals(GrResourceAllocator*) const override;
- ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect* targetUpdateBounds) override;
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override;
void gatherIDs(SkSTArray<8, uint32_t, true>* idArray) const override;
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 3c9b49f..85cea19 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -178,7 +178,7 @@
onFlushCBObject->preFlush(&onFlushProvider, SkMakeSpan(fFlushingRenderTaskIDs));
}
for (const auto& onFlushRenderTask : fOnFlushRenderTasks) {
- onFlushRenderTask->makeClosed(*fContext->priv().caps());
+ onFlushRenderTask->makeClosed(fContext);
#ifdef SK_DEBUG
// OnFlush callbacks are invoked during flush, and are therefore expected to handle
// resource allocation & usage on their own. (No deferred or lazy proxies!)
@@ -444,10 +444,9 @@
}
void GrDrawingManager::closeAllTasks() {
- const GrCaps& caps = *fContext->priv().caps();
for (auto& task : fDAG) {
if (task) {
- task->makeClosed(caps);
+ task->makeClosed(fContext);
}
}
}
@@ -613,7 +612,7 @@
// reordering so ops that (in the single opsTask world) would've just glommed onto the
// end of the single opsTask but referred to a far earlier RT need to appear in their
// own opsTask.
- fActiveOpsTask->makeClosed(*fContext->priv().caps());
+ fActiveOpsTask->makeClosed(fContext);
fActiveOpsTask = nullptr;
}
@@ -674,7 +673,7 @@
// reordering so ops that (in the single opsTask world) would've just glommed onto the
// end of the single opsTask but referred to a far earlier RT need to appear in their
// own opsTask.
- fActiveOpsTask->makeClosed(*fContext->priv().caps());
+ fActiveOpsTask->makeClosed(fContext);
fActiveOpsTask = nullptr;
}
}
@@ -725,8 +724,6 @@
SkDEBUGCODE(this->validate());
SkASSERT(fContext);
- const GrCaps& caps = *fContext->priv().caps();
-
sk_sp<GrWaitRenderTask> waitTask = sk_make_sp<GrWaitRenderTask>(GrSurfaceProxyView(proxy),
std::move(semaphores),
numSemaphores);
@@ -761,7 +758,7 @@
this->closeActiveOpsTask();
this->appendTask(waitTask);
}
- waitTask->makeClosed(caps);
+ waitTask->makeClosed(fContext);
SkDEBUGCODE(this->validate());
}
@@ -786,7 +783,7 @@
// don't need to make sure the whole mip map chain is valid.
task->addDependency(this, srcProxy.get(), GrMipmapped::kNo,
GrTextureResolveManager(this), caps);
- task->makeClosed(caps);
+ task->makeClosed(fContext);
// We have closed the previous active oplist but since a new oplist isn't being added there
// shouldn't be an active one.
@@ -830,7 +827,7 @@
// We always say GrMipmapped::kNo here since we are always just copying from the base layer to
// another base layer. We don't need to make sure the whole mip map chain is valid.
task->addDependency(this, src.get(), GrMipmapped::kNo, GrTextureResolveManager(this), caps);
- task->makeClosed(caps);
+ task->makeClosed(fContext);
// We have closed the previous active oplist but since a new oplist isn't being added there
// shouldn't be an active one.
@@ -871,7 +868,7 @@
return false;
}
- task->makeClosed(caps);
+ task->makeClosed(fContext);
// We have closed the previous active oplist but since a new oplist isn't being added there
// shouldn't be an active one.
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index 0b6fa69..4bf29ac2 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -50,12 +50,12 @@
// task gets closed before making a texture resolve task. makeClosed is what will mark msaa and
// mipmaps dirty.
if (GrRenderTask* renderTask = fDrawingMgr->getLastRenderTask(textureProxy.get())) {
- renderTask->makeClosed(*this->caps());
+ renderTask->makeClosed(fDrawingMgr->getContext());
}
auto task = static_cast<GrTextureResolveRenderTask*>(fDrawingMgr->fOnFlushRenderTasks.push_back(
sk_make_sp<GrTextureResolveRenderTask>()).get());
task->addProxy(fDrawingMgr, std::move(textureProxy), resolveFlags, *this->caps());
- task->makeClosed(*this->caps());
+ task->makeClosed(fDrawingMgr->getContext());
}
bool GrOnFlushResourceProvider::assignUniqueKeyToProxy(const GrUniqueKey& key,
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 9e00676..2d47502 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -1040,9 +1040,9 @@
}
}
-GrRenderTask::ExpectedOutcome GrOpsTask::onMakeClosed(const GrCaps& caps,
+GrRenderTask::ExpectedOutcome GrOpsTask::onMakeClosed(GrRecordingContext* rContext,
SkIRect* targetUpdateBounds) {
- this->forwardCombine(caps);
+ this->forwardCombine(*rContext->priv().caps());
if (!this->isNoOp()) {
GrSurfaceProxy* proxy = this->target(0);
// Use the entire backing store bounds since the GPU doesn't clip automatically to the
diff --git a/src/gpu/GrOpsTask.h b/src/gpu/GrOpsTask.h
index 6c93c0c..39a58a6 100644
--- a/src/gpu/GrOpsTask.h
+++ b/src/gpu/GrOpsTask.h
@@ -231,7 +231,7 @@
void forwardCombine(const GrCaps&);
- ExpectedOutcome onMakeClosed(const GrCaps& caps, SkIRect* targetUpdateBounds) override;
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override;
// Remove all ops, proxies, etc. Used in the merging algorithm when tasks can be skipped.
void reset();
diff --git a/src/gpu/GrRenderTask.cpp b/src/gpu/GrRenderTask.cpp
index eedb84e..1c15d66 100644
--- a/src/gpu/GrRenderTask.cpp
+++ b/src/gpu/GrRenderTask.cpp
@@ -66,13 +66,13 @@
}
#endif
-void GrRenderTask::makeClosed(const GrCaps& caps) {
+void GrRenderTask::makeClosed(GrRecordingContext* rContext) {
if (this->isClosed()) {
return;
}
SkIRect targetUpdateBounds;
- if (ExpectedOutcome::kTargetDirty == this->onMakeClosed(caps, &targetUpdateBounds)) {
+ if (ExpectedOutcome::kTargetDirty == this->onMakeClosed(rContext, &targetUpdateBounds)) {
GrSurfaceProxy* proxy = this->target(0);
if (proxy->requiresManualMSAAResolve()) {
SkASSERT(this->target(0)->asRenderTargetProxy());
@@ -86,7 +86,7 @@
if (fTextureResolveTask) {
this->addDependency(fTextureResolveTask);
- fTextureResolveTask->makeClosed(caps);
+ fTextureResolveTask->makeClosed(rContext);
fTextureResolveTask = nullptr;
}
@@ -152,7 +152,7 @@
// We are closing 'dependedOnTask' here bc the current contents of it are what 'this'
// renderTask depends on. We need a break in 'dependedOnTask' so that the usage of
// that state has a chance to execute.
- dependedOnTask->makeClosed(caps);
+ dependedOnTask->makeClosed(drawingMgr->getContext());
}
auto resolveFlags = GrSurfaceProxy::ResolveFlags::kNone;
@@ -275,14 +275,6 @@
}
#endif
-void GrRenderTask::closeThoseWhoDependOnMe(const GrCaps& caps) {
- for (int i = 0; i < fDependents.count(); ++i) {
- if (!fDependents[i]->isClosed()) {
- fDependents[i]->makeClosed(caps);
- }
- }
-}
-
bool GrRenderTask::isInstantiated() const {
for (const sk_sp<GrSurfaceProxy>& target : fTargets) {
GrSurfaceProxy* proxy = target.get();
diff --git a/src/gpu/GrRenderTask.h b/src/gpu/GrRenderTask.h
index e5855c0..972c63a 100644
--- a/src/gpu/GrRenderTask.h
+++ b/src/gpu/GrRenderTask.h
@@ -29,7 +29,7 @@
GrRenderTask();
SkDEBUGCODE(~GrRenderTask() override);
- void makeClosed(const GrCaps&);
+ void makeClosed(GrRecordingContext*);
void prePrepare(GrRecordingContext* context) { this->onPrePrepare(context); }
@@ -167,7 +167,7 @@
// modify in targetUpdateBounds.
//
// targetUpdateBounds must not extend beyond the proxy bounds.
- virtual ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect* targetUpdateBounds) = 0;
+ virtual ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) = 0;
SkSTArray<1, sk_sp<GrSurfaceProxy>> fTargets;
@@ -209,7 +209,7 @@
}
private:
- // for TopoSortTraits, fTextureResolveTask, closeThoseWhoDependOnMe, addDependency
+ // for TopoSortTraits, fTextureResolveTask, addDependency
friend class GrDrawingManager;
friend class GrMockRenderTask;
@@ -221,7 +221,6 @@
void addDependent(GrRenderTask* dependent);
SkDEBUGCODE(bool isDependent(const GrRenderTask* dependent) const;)
SkDEBUGCODE(void validate() const;)
- void closeThoseWhoDependOnMe(const GrCaps&);
static uint32_t CreateUniqueID();
diff --git a/src/gpu/GrTextureResolveRenderTask.h b/src/gpu/GrTextureResolveRenderTask.h
index dd5f5d3..df2de81 100644
--- a/src/gpu/GrTextureResolveRenderTask.h
+++ b/src/gpu/GrTextureResolveRenderTask.h
@@ -23,7 +23,7 @@
}
void gatherProxyIntervals(GrResourceAllocator*) const override;
- ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override {
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect*) override {
return ExpectedOutcome::kTargetUnchanged;
}
diff --git a/src/gpu/GrTransferFromRenderTask.h b/src/gpu/GrTransferFromRenderTask.h
index 52af6a5..cdcdb29 100644
--- a/src/gpu/GrTransferFromRenderTask.h
+++ b/src/gpu/GrTransferFromRenderTask.h
@@ -33,7 +33,7 @@
}
void gatherProxyIntervals(GrResourceAllocator*) const override;
- ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override {
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect*) override {
return ExpectedOutcome::kTargetUnchanged;
}
diff --git a/src/gpu/GrWaitRenderTask.h b/src/gpu/GrWaitRenderTask.h
index 84eddea..ca89b7f 100644
--- a/src/gpu/GrWaitRenderTask.h
+++ b/src/gpu/GrWaitRenderTask.h
@@ -27,7 +27,7 @@
}
void gatherProxyIntervals(GrResourceAllocator*) const override;
- ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override {
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect*) override {
return ExpectedOutcome::kTargetUnchanged;
}
diff --git a/src/gpu/GrWritePixelsRenderTask.cpp b/src/gpu/GrWritePixelsRenderTask.cpp
index 1b2c37e..46e3d13 100644
--- a/src/gpu/GrWritePixelsRenderTask.cpp
+++ b/src/gpu/GrWritePixelsRenderTask.cpp
@@ -48,7 +48,7 @@
alloc->incOps();
}
-GrRenderTask::ExpectedOutcome GrWritePixelsTask::onMakeClosed(const GrCaps&,
+GrRenderTask::ExpectedOutcome GrWritePixelsTask::onMakeClosed(GrRecordingContext*,
SkIRect* targetUpdateBounds) {
*targetUpdateBounds = fRect;
return ExpectedOutcome::kTargetDirty;
diff --git a/src/gpu/GrWritePixelsRenderTask.h b/src/gpu/GrWritePixelsRenderTask.h
index 7076941..64a3954 100644
--- a/src/gpu/GrWritePixelsRenderTask.h
+++ b/src/gpu/GrWritePixelsRenderTask.h
@@ -31,7 +31,7 @@
bool onIsUsed(GrSurfaceProxy* proxy) const override { return false; }
void gatherProxyIntervals(GrResourceAllocator*) const override;
- ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect* targetUpdateBounds) override;
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override;
bool onExecute(GrOpFlushState*) override;
#if GR_TEST_UTILS
diff --git a/src/gpu/mock/GrMockRenderTask.h b/src/gpu/mock/GrMockRenderTask.h
index 378dbcd..2eb7a25 100644
--- a/src/gpu/mock/GrMockRenderTask.h
+++ b/src/gpu/mock/GrMockRenderTask.h
@@ -26,7 +26,7 @@
void visitProxies_debugOnly(const GrVisitProxyFunc&) const override { return; }
#endif
void gatherProxyIntervals(GrResourceAllocator*) const override {}
- ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override { SkUNREACHABLE; }
+ ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect*) override { SkUNREACHABLE; }
bool onIsUsed(GrSurfaceProxy* proxy) const override {
for (const auto& entry : fUsed) {
if (entry.get() == proxy) {