Elevate the target list of Ganesh tasks to base class
A follow up CL will use the availability of this information - the full
list of targets of a GrRenderTask – to enable faster storage of the
lastRenderTask association for a given surface proxy in a given drawing
manager.
Bug: skia:10320
Change-Id: I3eb3276b483a7f09481774896a024172b73a4c84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296729
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index ec2c6c9..1f0a55f 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -360,11 +360,11 @@
GrOpsTask::GrOpsTask(GrDrawingManager* drawingMgr, GrRecordingContext::Arenas arenas,
GrSurfaceProxyView view,
GrAuditTrail* auditTrail)
- : GrRenderTask(std::move(view))
+ : GrRenderTask()
, fArenas(arenas)
, fAuditTrail(auditTrail)
SkDEBUGCODE(, fNumClips(0)) {
- drawingMgr->setLastRenderTask(fTargetView.proxy(), this);
+ this->addTarget(drawingMgr, std::move(view));
}
void GrOpsTask::deleteOps() {
@@ -393,12 +393,6 @@
this->deleteOps();
fClipAllocator.reset();
- GrSurfaceProxy* proxy = fTargetView.proxy();
- if (proxy && this == drawingMgr->getLastRenderTask(proxy)) {
- drawingMgr->setLastRenderTask(proxy, nullptr);
- }
-
- fTargetView.reset();
fDeferredProxies.reset();
fSampledProxies.reset();
fAuditTrail = nullptr;
@@ -422,7 +416,7 @@
for (const auto& chain : fOpChains) {
if (chain.shouldExecute()) {
chain.head()->prePrepare(context,
- &fTargetView,
+ &fTargets[0],
chain.appliedClip(),
chain.dstProxyView());
}
@@ -430,7 +424,7 @@
}
void GrOpsTask::onPrepare(GrOpFlushState* flushState) {
- SkASSERT(fTargetView.proxy()->peekRenderTarget());
+ SkASSERT(this->target(0).proxy()->peekRenderTarget());
SkASSERT(this->isClosed());
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
@@ -451,7 +445,7 @@
TRACE_EVENT0("skia.gpu", chain.head()->name());
#endif
GrOpFlushState::OpArgs opArgs(chain.head(),
- &fTargetView,
+ &fTargets[0],
chain.appliedClip(),
chain.dstProxyView());
@@ -459,7 +453,7 @@
// Temporary debugging helper: for debugging prePrepare w/o going through DDLs
// Delete once most of the GrOps have an onPrePrepare.
- // chain.head()->prePrepare(flushState->gpu()->getContext(), &fTargetView,
+ // chain.head()->prePrepare(flushState->gpu()->getContext(), &this->target(0),
// chain.appliedClip());
// GrOp::prePrepare may or may not have been called at this point
@@ -507,8 +501,8 @@
return false;
}
- SkASSERT(fTargetView.proxy());
- GrRenderTargetProxy* proxy = fTargetView.proxy()->asRenderTargetProxy();
+ SkASSERT(this->numTargets() == 1);
+ GrRenderTargetProxy* proxy = this->target(0).proxy()->asRenderTargetProxy();
SkASSERT(proxy);
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
@@ -575,7 +569,7 @@
: GrStoreOp::kStore;
GrOpsRenderPass* renderPass = create_render_pass(
- flushState->gpu(), proxy->peekRenderTarget(), stencil, fTargetView.origin(),
+ flushState->gpu(), proxy->peekRenderTarget(), stencil, this->target(0).origin(),
fClippedContentBounds, fColorLoadOp, fLoadClearColor, stencilLoadOp, stencilStoreOp,
fSampledProxies);
if (!renderPass) {
@@ -594,7 +588,7 @@
#endif
GrOpFlushState::OpArgs opArgs(chain.head(),
- &fTargetView,
+ &fTargets[0],
chain.appliedClip(),
chain.dstProxyView());
@@ -614,7 +608,7 @@
fColorLoadOp = op;
fLoadClearColor = color;
if (GrLoadOp::kClear == fColorLoadOp) {
- GrSurfaceProxy* proxy = fTargetView.proxy();
+ GrSurfaceProxy* proxy = this->target(0).proxy();
SkASSERT(proxy);
fTotalBounds = proxy->backingStoreBoundsRect();
}
@@ -635,7 +629,7 @@
// If the opsTask is using a render target which wraps a vulkan command buffer, we can't do
// a clear load since we cannot change the render pass that we are using. Thus we fall back
// to making a clear op in this case.
- return !fTargetView.asRenderTargetProxy()->wrapsVkSecondaryCB();
+ return !this->target(0).asRenderTargetProxy()->wrapsVkSecondaryCB();
}
// Could not empty the task, so an op must be added to handle the clear
@@ -761,7 +755,7 @@
alloc->addInterval(fDeferredProxies[i], 0, 0, GrResourceAllocator::ActualUse::kNo);
}
- GrSurfaceProxy* targetProxy = fTargetView.proxy();
+ GrSurfaceProxy* targetProxy = this->target(0).proxy();
// Add the interval for all the writes to this GrOpsTasks's target
if (fOpChains.count()) {
@@ -780,7 +774,7 @@
auto gather = [ alloc SkDEBUGCODE(, this) ] (GrSurfaceProxy* p, GrMipMapped) {
alloc->addInterval(p, alloc->curOp(), alloc->curOp(), GrResourceAllocator::ActualUse::kYes
- SkDEBUGCODE(, fTargetView.proxy() == p));
+ SkDEBUGCODE(, this->target(0).proxy() == p));
};
for (const OpChain& recordedOp : fOpChains) {
recordedOp.visitProxies(gather);
@@ -796,7 +790,7 @@
const DstProxyView* dstProxyView, const GrCaps& caps) {
SkDEBUGCODE(op->validate();)
SkASSERT(processorAnalysis.requiresDstTexture() == (dstProxyView && dstProxyView->proxy()));
- GrSurfaceProxy* proxy = fTargetView.proxy();
+ GrSurfaceProxy* proxy = this->target(0).proxy();
SkASSERT(proxy);
// A closed GrOpsTask should never receive new/more ops
@@ -896,11 +890,11 @@
fClosedObservers.reset();
});
if (!this->isNoOp()) {
- GrSurfaceProxy* proxy = fTargetView.proxy();
+ GrSurfaceProxy* proxy = this->target(0).proxy();
// Use the entire backing store bounds since the GPU doesn't clip automatically to the
// logical dimensions.
SkRect clippedContentBounds = proxy->backingStoreBoundsRect();
- // TODO: If we can fix up GLPrograms test to always intersect the fTargetView proxy bounds
+ // TODO: If we can fix up GLPrograms test to always intersect the target proxy bounds
// then we can simply assert here that the bounds intersect.
if (clippedContentBounds.intersect(fTotalBounds)) {
clippedContentBounds.roundOut(&fClippedContentBounds);