Pass Arenas* to GrOpsTask and GrOps instead of multiple pointers to each pool type
Change-Id: I47ac0b069334cb9702473b1bb923f585712f38ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261087
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index ab22baf..95dfcfb 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -53,8 +53,10 @@
// from GrRecordingContext
GrDrawingManager* drawingManager() { return fContext->drawingManager(); }
+
GrOpMemoryPool* opMemoryPool() { return fContext->arenas().opMemoryPool(); }
SkArenaAlloc* recordTimeAllocator() { return fContext->arenas().recordTimeAllocator(); }
+ GrRecordingContext::Arenas arenas() { return fContext->arenas(); }
GrStrikeCache* getGrStrikeCache() { return fContext->getGrStrikeCache(); }
GrTextBlobCache* getTextBlobCache() { return fContext->getTextBlobCache(); }
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 6239ddc..8eb4f68 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -680,8 +680,7 @@
GrSurfaceProxy* proxy = surfaceView.proxy();
this->closeRenderTasksForNewRenderTask(proxy);
- sk_sp<GrOpsTask> opsTask(new GrOpsTask(fContext->priv().opMemoryPool(),
- fContext->priv().recordTimeAllocator(),
+ sk_sp<GrOpsTask> opsTask(new GrOpsTask(fContext->priv().arenas(),
std::move(surfaceView),
fContext->priv().auditTrail()));
SkASSERT(proxy->getLastRenderTask() == opsTask.get());
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 28dd6cb..12d658f 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -158,8 +158,8 @@
// Concatenates two op chains and attempts to merge ops across the chains. Assumes that we know that
// the two chains are chainable. Returns the new chain.
GrOpsTask::OpChain::List GrOpsTask::OpChain::DoConcat(
- List chainA, List chainB, const GrCaps& caps, GrOpMemoryPool* pool,
- SkArenaAlloc* rtArena, GrAuditTrail* auditTrail) {
+ List chainA, List chainB, const GrCaps& caps, GrRecordingContext::Arenas* arenas,
+ GrAuditTrail* auditTrail) {
// We process ops in chain b from head to tail. We attempt to merge with nodes in a, starting
// at chain a's tail and working toward the head. We produce one of the following outcomes:
// 1) b's head is merged into an op in a.
@@ -184,7 +184,7 @@
bool canForwardMerge =
(a == chainA.tail()) || can_reorder(a->bounds(), forwardMergeBounds);
if (canForwardMerge || canBackwardMerge) {
- auto result = a->combineIfPossible(chainB.head(), rtArena, caps);
+ auto result = a->combineIfPossible(chainB.head(), arenas, caps);
SkASSERT(result != GrOp::CombineResult::kCannotCombine);
merged = (result == GrOp::CombineResult::kMerged);
GrOP_INFO("\t\t: (%s opID: %u) -> Combining with (%s, opID: %u)\n",
@@ -194,7 +194,7 @@
if (merged) {
GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(auditTrail, a, chainB.head());
if (canBackwardMerge) {
- pool->release(chainB.popHead());
+ arenas->opMemoryPool()->release(chainB.popHead());
} else {
// We merged the contents of b's head into a. We will replace b's head with a in
// chain b.
@@ -203,7 +203,7 @@
origATail = a->prevInChain();
}
std::unique_ptr<GrOp> detachedA = chainA.removeOp(a);
- pool->release(chainB.popHead());
+ arenas->opMemoryPool()->release(chainB.popHead());
chainB.pushHead(std::move(detachedA));
if (chainA.empty()) {
// We merged all the nodes in chain a to chain b.
@@ -236,7 +236,7 @@
bool GrOpsTask::OpChain::tryConcat(
List* list, GrProcessorSet::Analysis processorAnalysis, const DstProxyView& dstProxyView,
const GrAppliedClip* appliedClip, const SkRect& bounds, const GrCaps& caps,
- GrOpMemoryPool* pool, SkArenaAlloc* rtArena, GrAuditTrail* auditTrail) {
+ GrRecordingContext::Arenas* arenas, GrAuditTrail* auditTrail) {
SkASSERT(!fList.empty());
SkASSERT(!list->empty());
SkASSERT(fProcessorAnalysis.requiresDstTexture() == SkToBool(fDstProxyView.proxy()));
@@ -259,7 +259,7 @@
SkDEBUGCODE(bool first = true;)
do {
- switch (fList.tail()->combineIfPossible(list->head(), rtArena, caps)) {
+ switch (fList.tail()->combineIfPossible(list->head(), arenas, caps)) {
case GrOp::CombineResult::kCannotCombine:
// If an op supports chaining then it is required that chaining is transitive and
// that if any two ops in two different chains can merge then the two chains
@@ -268,8 +268,8 @@
SkASSERT(first);
return false;
case GrOp::CombineResult::kMayChain:
- fList = DoConcat(std::move(fList), skstd::exchange(*list, List()), caps, pool,
- rtArena, auditTrail);
+ fList = DoConcat(std::move(fList), skstd::exchange(*list, List()), caps, arenas,
+ auditTrail);
// The above exchange cleared out 'list'. The list needs to be empty now for the
// loop to terminate.
SkASSERT(list->empty());
@@ -279,7 +279,7 @@
list->tail()->name(), list->tail()->uniqueID(), list->head()->name(),
list->head()->uniqueID());
GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(auditTrail, fList.tail(), list->head());
- pool->release(list->popHead());
+ arenas->opMemoryPool()->release(list->popHead());
break;
}
}
@@ -291,10 +291,11 @@
return true;
}
-bool GrOpsTask::OpChain::prependChain(OpChain* that, const GrCaps& caps, GrOpMemoryPool* pool,
- SkArenaAlloc* rtArena, GrAuditTrail* auditTrail) {
+bool GrOpsTask::OpChain::prependChain(OpChain* that, const GrCaps& caps,
+ GrRecordingContext::Arenas* arenas,
+ GrAuditTrail* auditTrail) {
if (!that->tryConcat(&fList, fProcessorAnalysis, fDstProxyView, fAppliedClip, fBounds, caps,
- pool, rtArena, auditTrail)) {
+ arenas, auditTrail)) {
this->validate();
// append failed
return false;
@@ -318,7 +319,7 @@
std::unique_ptr<GrOp> GrOpsTask::OpChain::appendOp(
std::unique_ptr<GrOp> op, GrProcessorSet::Analysis processorAnalysis,
const DstProxyView* dstProxyView, const GrAppliedClip* appliedClip, const GrCaps& caps,
- GrOpMemoryPool* pool, SkArenaAlloc* rtArena, GrAuditTrail* auditTrail) {
+ GrRecordingContext::Arenas* arenas, GrAuditTrail* auditTrail) {
const GrXferProcessor::DstProxyView noDstProxyView;
if (!dstProxyView) {
dstProxyView = &noDstProxyView;
@@ -327,8 +328,8 @@
SkRect opBounds = op->bounds();
List chain(std::move(op));
if (!this->tryConcat(
- &chain, processorAnalysis, *dstProxyView, appliedClip, opBounds, caps, pool,
- rtArena, auditTrail)) {
+ &chain, processorAnalysis, *dstProxyView, appliedClip, opBounds, caps,
+ arenas, auditTrail)) {
// append failed, give the op back to the caller.
this->validate();
return chain.popHead();
@@ -352,23 +353,20 @@
////////////////////////////////////////////////////////////////////////////////
-GrOpsTask::GrOpsTask(GrOpMemoryPool* opMemoryPool,
- SkArenaAlloc* rtArena,
+GrOpsTask::GrOpsTask(GrRecordingContext::Arenas arenas,
GrSurfaceProxyView view,
GrAuditTrail* auditTrail)
: GrRenderTask(std::move(view))
- , fOpMemoryPool(opMemoryPool)
- , fRecordTimeAllocator(rtArena)
+ , fArenas(arenas)
, fAuditTrail(auditTrail)
, fLastClipStackGenID(SK_InvalidUniqueID)
SkDEBUGCODE(, fNumClips(0)) {
- SkASSERT(fOpMemoryPool);
fTargetView.proxy()->setLastRenderTask(this);
}
void GrOpsTask::deleteOps() {
for (auto& chain : fOpChains) {
- chain.deleteOps(fOpMemoryPool);
+ chain.deleteOps(fArenas.opMemoryPool());
}
fOpChains.reset();
}
@@ -789,7 +787,7 @@
// A closed GrOpsTask should never receive new/more ops
SkASSERT(!this->isClosed());
if (!op->bounds().isFinite()) {
- fOpMemoryPool->release(std::move(op));
+ fArenas.opMemoryPool()->release(std::move(op));
return;
}
@@ -817,7 +815,7 @@
while (true) {
OpChain& candidate = fOpChains.fromBack(i);
op = candidate.appendOp(std::move(op), processorAnalysis, dstProxyView, clip, caps,
- fOpMemoryPool, fRecordTimeAllocator, fAuditTrail);
+ &fArenas, fAuditTrail);
if (!op) {
return;
}
@@ -852,8 +850,7 @@
int j = i + 1;
while (true) {
OpChain& candidate = fOpChains[j];
- if (candidate.prependChain(&chain, caps, fOpMemoryPool, fRecordTimeAllocator,
- fAuditTrail)) {
+ if (candidate.prependChain(&chain, caps, &fArenas, fAuditTrail)) {
break;
}
// Stop traversing if we would cause a painter's order violation.
diff --git a/src/gpu/GrOpsTask.h b/src/gpu/GrOpsTask.h
index d497f56..a38076e 100644
--- a/src/gpu/GrOpsTask.h
+++ b/src/gpu/GrOpsTask.h
@@ -12,6 +12,7 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkStrokeRec.h"
#include "include/core/SkTypes.h"
+#include "include/private/GrRecordingContext.h"
#include "include/private/SkColorData.h"
#include "include/private/SkTArray.h"
#include "include/private/SkTDArray.h"
@@ -30,18 +31,16 @@
class GrCaps;
class GrClearOp;
class GrGpuBuffer;
-class GrOpMemoryPool;
class GrRenderTargetProxy;
-class SkArenaAlloc;
class GrOpsTask : public GrRenderTask {
private:
using DstProxyView = GrXferProcessor::DstProxyView;
public:
- // The GrOpMemoryPool must outlive the GrOpsTask, either by preserving the context that owns
+ // The Arenas must outlive the GrOpsTask, either by preserving the context that owns
// the pool, or by moving the pool to the DDL that takes over the GrOpsTask.
- GrOpsTask(GrOpMemoryPool*, SkArenaAlloc*, GrSurfaceProxyView, GrAuditTrail*);
+ GrOpsTask(GrRecordingContext::Arenas, GrSurfaceProxyView, GrAuditTrail*);
~GrOpsTask() override;
GrOpsTask* asOpsTask() override { return this; }
@@ -200,14 +199,14 @@
// Attempts to move the ops from the passed chain to this chain at the head. Also attempts
// to merge ops between the chains. Upon success the passed chain is empty.
// Fails when the chains aren't of the same op type, have different clips or dst proxies.
- bool prependChain(OpChain*, const GrCaps&, GrOpMemoryPool*, SkArenaAlloc*, GrAuditTrail*);
+ bool prependChain(OpChain*, const GrCaps&, GrRecordingContext::Arenas*, GrAuditTrail*);
// Attempts to add 'op' to this chain either by merging or adding to the tail. Returns
// 'op' to the caller upon failure, otherwise null. Fails when the op and chain aren't of
// the same op type, have different clips or dst proxies.
std::unique_ptr<GrOp> appendOp(std::unique_ptr<GrOp> op, GrProcessorSet::Analysis,
const DstProxyView*, const GrAppliedClip*, const GrCaps&,
- GrOpMemoryPool*, SkArenaAlloc*, GrAuditTrail*);
+ GrRecordingContext::Arenas*, GrAuditTrail*);
void setSkipExecuteFlag() { fSkipExecute = true; }
bool shouldExecute() const {
@@ -241,10 +240,9 @@
void validate() const;
bool tryConcat(List*, GrProcessorSet::Analysis, const DstProxyView&, const GrAppliedClip*,
- const SkRect& bounds, const GrCaps&, GrOpMemoryPool*, SkArenaAlloc*,
+ const SkRect& bounds, const GrCaps&, GrRecordingContext::Arenas*,
GrAuditTrail*);
- static List DoConcat(List, List, const GrCaps&, GrOpMemoryPool*, SkArenaAlloc*,
- GrAuditTrail*);
+ static List DoConcat(List, List, const GrCaps&, GrRecordingContext::Arenas*, GrAuditTrail*);
List fList;
GrProcessorSet::Analysis fProcessorAnalysis;
@@ -279,12 +277,11 @@
// however, requires that the RTC be able to coordinate with the op list to achieve similar ends
friend class GrRenderTargetContext;
- // This is a backpointer to the GrOpMemoryPool that holds the memory for this GrOpsTask's ops.
- // In the DDL case, the GrOpMemoryPool must have been detached from the original recording
- // context and moved into the owning DDL.
- GrOpMemoryPool* fOpMemoryPool;
- SkArenaAlloc* fRecordTimeAllocator;
- GrAuditTrail* fAuditTrail;
+ // This is a backpointer to the Arenas that holds the memory for this GrOpsTask's ops. In the
+ // DDL case, the Arenas must have been detached from the original recording context and moved
+ // into the owning DDL.
+ GrRecordingContext::Arenas fArenas;
+ GrAuditTrail* fAuditTrail;
GrLoadOp fColorLoadOp = GrLoadOp::kLoad;
SkPMColor4f fLoadClearColor = SK_PMColor4fTRANSPARENT;
diff --git a/src/gpu/GrRecordingContextPriv.h b/src/gpu/GrRecordingContextPriv.h
index a733ec4..6ec2468 100644
--- a/src/gpu/GrRecordingContextPriv.h
+++ b/src/gpu/GrRecordingContextPriv.h
@@ -43,6 +43,7 @@
GrOpMemoryPool* opMemoryPool() { return fContext->arenas().opMemoryPool(); }
SkArenaAlloc* recordTimeAllocator() { return fContext->arenas().recordTimeAllocator(); }
+ GrRecordingContext::Arenas arenas() { return fContext->arenas(); }
GrRecordingContext::OwnedArenas&& detachArenas() { return fContext->detachArenas(); }
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index 6b2e2ce..d1389cf 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -192,7 +192,8 @@
return analysis;
}
-GrOp::CombineResult GrCCDrawPathsOp::onCombineIfPossible(GrOp* op, SkArenaAlloc*, const GrCaps&) {
+GrOp::CombineResult GrCCDrawPathsOp::onCombineIfPossible(GrOp* op, GrRecordingContext::Arenas*,
+ const GrCaps&) {
GrCCDrawPathsOp* that = op->cast<GrCCDrawPathsOp>();
SkASSERT(fOwningPerOpsTaskPaths);
SkASSERT(fNumDraws);
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.h b/src/gpu/ccpr/GrCCDrawPathsOp.h
index 27eae4b..f5e41fd 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.h
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.h
@@ -37,7 +37,7 @@
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*,
bool hasMixedSampledCoverage, GrClampType) override;
- CombineResult onCombineIfPossible(GrOp*, SkArenaAlloc*, const GrCaps&) override;
+ CombineResult onCombineIfPossible(GrOp*, GrRecordingContext::Arenas*, const GrCaps&) override;
void visitProxies(const VisitProxyFunc& fn) const override {
for (const auto& range : fInstanceRanges) {
fn(range.fAtlasProxy, GrMipMapped::kNo);
diff --git a/src/gpu/ccpr/GrCCPerFlushResources.cpp b/src/gpu/ccpr/GrCCPerFlushResources.cpp
index 864b7bb..d4788a6 100644
--- a/src/gpu/ccpr/GrCCPerFlushResources.cpp
+++ b/src/gpu/ccpr/GrCCPerFlushResources.cpp
@@ -39,7 +39,8 @@
bool hasMixedSampledCoverage, GrClampType) override {
return GrProcessorSet::EmptySetAnalysis();
}
- CombineResult onCombineIfPossible(GrOp* other, SkArenaAlloc*, const GrCaps&) override {
+ CombineResult onCombineIfPossible(GrOp* other, GrRecordingContext::Arenas*,
+ const GrCaps&) override {
// We will only make multiple copy ops if they have different source proxies.
// TODO: make use of texture chaining.
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ccpr/GrStencilAtlasOp.h b/src/gpu/ccpr/GrStencilAtlasOp.h
index c54d8ec..ef27932 100644
--- a/src/gpu/ccpr/GrStencilAtlasOp.h
+++ b/src/gpu/ccpr/GrStencilAtlasOp.h
@@ -40,7 +40,8 @@
bool hasMixedSampledCoverage, GrClampType) override {
return GrProcessorSet::EmptySetAnalysis();
}
- CombineResult onCombineIfPossible(GrOp* other, SkArenaAlloc*, const GrCaps&) override {
+ CombineResult onCombineIfPossible(GrOp* other, GrRecordingContext::Arenas*,
+ const GrCaps&) override {
// We will only make multiple copy ops if they have different source proxies.
// TODO: make use of texture chaining.
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 9fde479..54f0ecc 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -829,7 +829,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
AAConvexPathOp* that = t->cast<AAConvexPathOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index ab780c7..ad86615 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -866,7 +866,8 @@
typedef SkTArray<int, true> IntArray;
typedef SkTArray<float, true> FloatArray;
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
AAHairlineOp* that = t->cast<AAHairlineOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index a8dedbb..80596a3 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -312,7 +312,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
AAFlatteningConvexPathOp* that = t->cast<AAFlatteningConvexPathOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index 5ec6335..f6ddab2 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -452,7 +452,8 @@
flushInfo->fGlyphsToFlush = 0;
}
-GrOp::CombineResult GrAtlasTextOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) {
+GrOp::CombineResult GrAtlasTextOp::onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) {
GrAtlasTextOp* that = t->cast<GrAtlasTextOp>();
if (fProcessors != that->fProcessors) {
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index 82dceba..453f309 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -148,7 +148,8 @@
bool usesLocalCoords() const { return fUsesLocalCoords; }
int numGlyphs() const { return fNumGlyphs; }
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override;
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override;
GrGeometryProcessor* setupDfProcessor(SkArenaAlloc* arena,
const GrShaderCaps& caps,
diff --git a/src/gpu/ops/GrClearOp.h b/src/gpu/ops/GrClearOp.h
index c3b8695..5353d47 100644
--- a/src/gpu/ops/GrClearOp.h
+++ b/src/gpu/ops/GrClearOp.h
@@ -65,7 +65,8 @@
this->setBounds(SkRect::Make(rect), HasAABloat::kNo, IsHairline::kNo);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
// This could be much more complicated. Currently we look at cases where the new clear
// contains the old clear, or when the new clear is a subset of the old clear and is the
// same color.
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 522b094..75ba0ce 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -642,7 +642,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
DashOp* that = t->cast<DashOp>();
if (fProcessorSet != that->fProcessorSet) {
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index ddbb809..b7e3c1d 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -450,7 +450,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
DefaultPathOp* that = t->cast<DefaultPathOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp
index 13df23a..a60819f 100644
--- a/src/gpu/ops/GrDrawAtlasOp.cpp
+++ b/src/gpu/ops/GrDrawAtlasOp.cpp
@@ -56,7 +56,7 @@
bool hasColors() const { return fHasColors; }
int quadCount() const { return fQuadCount; }
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps&) override;
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*, const GrCaps&) override;
struct Geometry {
SkPMColor4f fColor;
@@ -221,7 +221,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
-GrOp::CombineResult DrawAtlasOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) {
+GrOp::CombineResult DrawAtlasOp::onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) {
DrawAtlasOp* that = t->cast<DrawAtlasOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 370731a..46dfb54 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -78,7 +78,7 @@
GrPrimitiveType::kPoints == fPrimitiveType;
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps&) override;
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*, const GrCaps&) override;
struct Mesh {
SkPMColor4f fColor; // Used if this->hasPerVertexColors() is false.
@@ -519,7 +519,7 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
-GrOp::CombineResult DrawVerticesOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*,
+GrOp::CombineResult DrawVerticesOp::onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
const GrCaps& caps) {
DrawVerticesOp* that = t->cast<DrawVerticesOp>();
diff --git a/src/gpu/ops/GrDrawableOp.h b/src/gpu/ops/GrDrawableOp.h
index 5194664..063886f 100644
--- a/src/gpu/ops/GrDrawableOp.h
+++ b/src/gpu/ops/GrDrawableOp.h
@@ -37,7 +37,8 @@
GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
- CombineResult onCombineIfPossible(GrOp* that, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* that, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
return CombineResult::kCannotCombine;
}
void onPrepare(GrOpFlushState*) override {}
diff --git a/src/gpu/ops/GrFillRRectOp.cpp b/src/gpu/ops/GrFillRRectOp.cpp
index 443adf6..381c44a 100644
--- a/src/gpu/ops/GrFillRRectOp.cpp
+++ b/src/gpu/ops/GrFillRRectOp.cpp
@@ -157,7 +157,8 @@
return analysis;
}
-GrDrawOp::CombineResult GrFillRRectOp::onCombineIfPossible(GrOp* op, SkArenaAlloc*, const GrCaps&) {
+GrDrawOp::CombineResult GrFillRRectOp::onCombineIfPossible(GrOp* op, GrRecordingContext::Arenas*,
+ const GrCaps&) {
const auto& that = *op->cast<GrFillRRectOp>();
if (fFlags != that.fFlags || fProcessors != that.fProcessors ||
fInstanceData.count() > std::numeric_limits<int>::max() - that.fInstanceData.count()) {
diff --git a/src/gpu/ops/GrFillRRectOp.h b/src/gpu/ops/GrFillRRectOp.h
index 4490059..09bfa16 100644
--- a/src/gpu/ops/GrFillRRectOp.h
+++ b/src/gpu/ops/GrFillRRectOp.h
@@ -29,7 +29,7 @@
}
GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*,
bool hasMixedSampledCoverage, GrClampType) final;
- CombineResult onCombineIfPossible(GrOp*, SkArenaAlloc*, const GrCaps&) final;
+ CombineResult onCombineIfPossible(GrOp*, GrRecordingContext::Arenas*, const GrCaps&) final;
void visitProxies(const VisitProxyFunc& fn) const override {
if (fProgramInfo) {
fProgramInfo->visitProxies(fn);
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/GrFillRectOp.cpp
index 68c932f..4c6bfda 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/GrFillRectOp.cpp
@@ -288,7 +288,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
const auto* that = t->cast<FillRectOp>();
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 24931c0..f207516 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -298,7 +298,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
NonAALatticeOp* that = t->cast<NonAALatticeOp>();
if (fView != that->fView) {
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrOp.cpp b/src/gpu/ops/GrOp.cpp
index 40bc792..98c88a4 100644
--- a/src/gpu/ops/GrOp.cpp
+++ b/src/gpu/ops/GrOp.cpp
@@ -30,12 +30,13 @@
SkDEBUGCODE(fBoundsFlags = kUninitialized_BoundsFlag);
}
-GrOp::CombineResult GrOp::combineIfPossible(GrOp* that, SkArenaAlloc* arena, const GrCaps& caps) {
+GrOp::CombineResult GrOp::combineIfPossible(GrOp* that, GrRecordingContext::Arenas* arenas,
+ const GrCaps& caps) {
SkASSERT(this != that);
if (this->classID() != that->classID()) {
return CombineResult::kCannotCombine;
}
- auto result = this->onCombineIfPossible(that, arena, caps);
+ auto result = this->onCombineIfPossible(that, arenas, caps);
if (result == CombineResult::kMerged) {
this->joinBounds(*that);
}
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index cd61968..6f53215 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -12,6 +12,7 @@
#include "include/core/SkRect.h"
#include "include/core/SkString.h"
#include "include/gpu/GrGpuResource.h"
+#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrNonAtomicRef.h"
#include "src/gpu/GrTracing.h"
#include "src/gpu/GrXferProcessor.h"
@@ -95,8 +96,9 @@
kCannotCombine
};
- // The arena is the same record time allocator available when the op was created.
- CombineResult combineIfPossible(GrOp* that, SkArenaAlloc* arena, const GrCaps& caps);
+ // The arenas are the same as what was available when the op was created.
+ CombineResult combineIfPossible(GrOp* that, GrRecordingContext::Arenas* arena,
+ const GrCaps& caps);
const SkRect& bounds() const {
SkASSERT(kUninitialized_BoundsFlag != fBoundsFlags);
@@ -289,7 +291,7 @@
return fBounds.joinPossiblyEmptyRect(that.fBounds);
}
- virtual CombineResult onCombineIfPossible(GrOp*, SkArenaAlloc*, const GrCaps&) {
+ virtual CombineResult onCombineIfPossible(GrOp*, GrRecordingContext::Arenas*, const GrCaps&) {
return CombineResult::kCannotCombine;
}
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index eea698f..75e8710 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1411,7 +1411,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
CircleOp* that = t->cast<CircleOp>();
// can only represent 65535 unique vertices with 16-bit indices
@@ -1707,7 +1708,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
ButtCapDashedCircleOp* that = t->cast<ButtCapDashedCircleOp>();
// can only represent 65535 unique vertices with 16-bit indices
@@ -1967,7 +1969,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
EllipseOp* that = t->cast<EllipseOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
@@ -2209,7 +2212,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
DIEllipseOp* that = t->cast<DIEllipseOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
return CombineResult::kCannotCombine;
@@ -2644,7 +2648,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
CircularRRectOp* that = t->cast<CircularRRectOp>();
// can only represent 65535 unique vertices with 16-bit indices
@@ -2931,7 +2936,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
EllipticalRRectOp* that = t->cast<EllipticalRRectOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index 8cafcf8..523856d 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -141,7 +141,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
RegionOp* that = t->cast<RegionOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index f67f5b6..1ae8b44 100644
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -610,7 +610,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
ShadowCircularRRectOp* that = t->cast<ShadowCircularRRectOp>();
fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin());
fVertCount += that->fVertCount;
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index 25fde10..b673cb1 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -819,7 +819,8 @@
const SkPMColor4f& color() const { return fShapes[0].fColor; }
bool usesDistanceField() const { return fUsesDistanceField; }
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
SmallPathOp* that = t->cast<SmallPathOp>();
if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
return CombineResult::kCannotCombine;
diff --git a/src/gpu/ops/GrStrokeRectOp.cpp b/src/gpu/ops/GrStrokeRectOp.cpp
index db60858..0cbf9b6 100644
--- a/src/gpu/ops/GrStrokeRectOp.cpp
+++ b/src/gpu/ops/GrStrokeRectOp.cpp
@@ -444,7 +444,7 @@
const SkMatrix& viewMatrix() const { return fViewMatrix; }
bool miterStroke() const { return fMiterStroke; }
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps&) override;
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*, const GrCaps&) override;
void generateAAStrokeRectGeometry(GrVertexWriter& vertices,
const SkPMColor4f& color,
@@ -625,7 +625,7 @@
}
}
-GrOp::CombineResult AAStrokeRectOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*,
+GrOp::CombineResult AAStrokeRectOp::onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
const GrCaps& caps) {
AAStrokeRectOp* that = t->cast<AAStrokeRectOp>();
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 04412f8..61ee5a3 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -942,7 +942,8 @@
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
}
- CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
+ CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
+ const GrCaps& caps) override {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
const auto* that = t->cast<TextureOp>();