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>
This commit is contained in:
parent
34280e29cf
commit
28b0c5d4b3
@ -321,7 +321,7 @@ public:
|
||||
DEFINE_OP_CLASS_ID
|
||||
const char* name() const override { return "BezierQuadTestOp"; }
|
||||
|
||||
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
|
||||
static std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
|
||||
GrClipEdgeType et,
|
||||
const SkRect& rect,
|
||||
const SkPMColor4f& color,
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrDrawingManager.h"
|
||||
#include "src/gpu/GrMemoryPool.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/ops/GrAtlasTextOp.h"
|
||||
#include "src/gpu/text/GrTextContext.h"
|
||||
@ -122,12 +123,8 @@ public:
|
||||
private:
|
||||
void deleteOps();
|
||||
|
||||
GrOpMemoryPool* opMemoryPool() {
|
||||
return fContext->internal().grContext()->priv().opMemoryPool();
|
||||
}
|
||||
|
||||
SkArenaAlloc* recordTimeAllocator() {
|
||||
return fContext->internal().grContext()->priv().recordTimeAllocator();
|
||||
GrRecordingContext::Arenas arenas() {
|
||||
return fContext->internal().grContext()->GrRecordingContext::priv().arenas();
|
||||
}
|
||||
|
||||
uint32_t fColor;
|
||||
@ -181,12 +178,11 @@ void SkInternalAtlasTextTarget::addDrawOp(const GrClip& clip, std::unique_ptr<Gr
|
||||
op->finalizeForTextTarget(fColor, caps);
|
||||
int n = SkTMin(kMaxBatchLookBack, fOps.count());
|
||||
|
||||
GrOpMemoryPool* pool = this->opMemoryPool();
|
||||
SkArenaAlloc* arena = this->recordTimeAllocator();
|
||||
GrRecordingContext::Arenas arenas = this->arenas();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
GrAtlasTextOp* other = fOps.fromBack(i).get();
|
||||
if (other->combineIfPossible(op.get(), arena, caps) == GrOp::CombineResult::kMerged) {
|
||||
pool->release(std::move(op));
|
||||
if (other->combineIfPossible(op.get(), &arenas, caps) == GrOp::CombineResult::kMerged) {
|
||||
arenas.opMemoryPool()->release(std::move(op));
|
||||
return;
|
||||
}
|
||||
if (GrRectsOverlap(op->bounds(), other->bounds())) {
|
||||
@ -197,7 +193,7 @@ void SkInternalAtlasTextTarget::addDrawOp(const GrClip& clip, std::unique_ptr<Gr
|
||||
}
|
||||
|
||||
void SkInternalAtlasTextTarget::deleteOps() {
|
||||
GrOpMemoryPool* pool = this->opMemoryPool();
|
||||
GrOpMemoryPool* pool = this->arenas().opMemoryPool();
|
||||
for (int i = 0; i < fOps.count(); ++i) {
|
||||
if (fOps[i]) {
|
||||
pool->release(std::move(fOps[i]));
|
||||
|
@ -53,8 +53,10 @@ public:
|
||||
|
||||
// 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(); }
|
||||
|
@ -680,8 +680,7 @@ sk_sp<GrOpsTask> GrDrawingManager::newOpsTask(GrSurfaceProxyView surfaceView,
|
||||
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());
|
||||
|
@ -158,8 +158,8 @@ void GrOpsTask::OpChain::deleteOps(GrOpMemoryPool* pool) {
|
||||
// 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 @@ GrOpsTask::OpChain::List GrOpsTask::OpChain::DoConcat(
|
||||
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 @@ GrOpsTask::OpChain::List GrOpsTask::OpChain::DoConcat(
|
||||
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 @@ GrOpsTask::OpChain::List GrOpsTask::OpChain::DoConcat(
|
||||
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 @@ GrOpsTask::OpChain::List GrOpsTask::OpChain::DoConcat(
|
||||
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 @@ bool GrOpsTask::OpChain::tryConcat(
|
||||
|
||||
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 @@ bool GrOpsTask::OpChain::tryConcat(
|
||||
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 @@ bool GrOpsTask::OpChain::tryConcat(
|
||||
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 @@ bool GrOpsTask::OpChain::tryConcat(
|
||||
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 @@ bool GrOpsTask::OpChain::prependChain(OpChain* that, const GrCaps& caps, GrOpMem
|
||||
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 @@ std::unique_ptr<GrOp> GrOpsTask::OpChain::appendOp(
|
||||
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 @@ inline void GrOpsTask::OpChain::validate() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 @@ void GrOpsTask::recordOp(
|
||||
// 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 @@ void GrOpsTask::recordOp(
|
||||
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 @@ void GrOpsTask::forwardCombine(const GrCaps& caps) {
|
||||
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.
|
||||
|
@ -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 GrAuditTrail;
|
||||
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 @@ private:
|
||||
// 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 @@ private:
|
||||
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 @@ private:
|
||||
// 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;
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
|
||||
GrOpMemoryPool* opMemoryPool() { return fContext->arenas().opMemoryPool(); }
|
||||
SkArenaAlloc* recordTimeAllocator() { return fContext->arenas().recordTimeAllocator(); }
|
||||
GrRecordingContext::Arenas arenas() { return fContext->arenas(); }
|
||||
|
||||
GrRecordingContext::OwnedArenas&& detachArenas() { return fContext->detachArenas(); }
|
||||
|
||||
|
@ -192,7 +192,8 @@ GrProcessorSet::Analysis GrCCDrawPathsOp::SingleDraw::finalize(
|
||||
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);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
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);
|
||||
|
@ -39,7 +39,8 @@ public:
|
||||
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;
|
||||
|
@ -40,7 +40,8 @@ public:
|
||||
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;
|
||||
|
@ -829,7 +829,8 @@ private:
|
||||
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;
|
||||
|
@ -866,7 +866,8 @@ private:
|
||||
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())) {
|
||||
|
@ -312,7 +312,8 @@ private:
|
||||
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;
|
||||
|
@ -452,7 +452,8 @@ void GrAtlasTextOp::flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) co
|
||||
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;
|
||||
|
@ -148,7 +148,8 @@ private:
|
||||
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,
|
||||
|
@ -65,7 +65,8 @@ private:
|
||||
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.
|
||||
|
@ -642,7 +642,8 @@ private:
|
||||
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;
|
||||
|
@ -450,7 +450,8 @@ private:
|
||||
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;
|
||||
|
@ -56,7 +56,7 @@ private:
|
||||
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 @@ void DrawAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBound
|
||||
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())) {
|
||||
|
@ -78,7 +78,7 @@ private:
|
||||
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 @@ void DrawVerticesOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBo
|
||||
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>();
|
||||
|
||||
|
@ -37,7 +37,8 @@ private:
|
||||
|
||||
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 {}
|
||||
|
@ -157,7 +157,8 @@ GrProcessorSet::Analysis GrFillRRectOp::finalize(
|
||||
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()) {
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
}
|
||||
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);
|
||||
|
@ -288,7 +288,8 @@ private:
|
||||
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>();
|
||||
|
||||
|
@ -298,7 +298,8 @@ private:
|
||||
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;
|
||||
|
@ -30,12 +30,13 @@ GrOp::GrOp(uint32_t classID) : fClassID(classID) {
|
||||
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);
|
||||
}
|
||||
|
@ -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 @@ public:
|
||||
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 @@ private:
|
||||
return fBounds.joinPossiblyEmptyRect(that.fBounds);
|
||||
}
|
||||
|
||||
virtual CombineResult onCombineIfPossible(GrOp*, SkArenaAlloc*, const GrCaps&) {
|
||||
virtual CombineResult onCombineIfPossible(GrOp*, GrRecordingContext::Arenas*, const GrCaps&) {
|
||||
return CombineResult::kCannotCombine;
|
||||
}
|
||||
|
||||
|
@ -1411,7 +1411,8 @@ private:
|
||||
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 @@ private:
|
||||
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 @@ private:
|
||||
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 @@ private:
|
||||
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 @@ private:
|
||||
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 @@ private:
|
||||
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())) {
|
||||
|
@ -141,7 +141,8 @@ private:
|
||||
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;
|
||||
|
@ -610,7 +610,8 @@ private:
|
||||
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;
|
||||
|
@ -819,7 +819,8 @@ private:
|
||||
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;
|
||||
|
@ -444,7 +444,7 @@ private:
|
||||
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 @@ sk_sp<const GrGpuBuffer> AAStrokeRectOp::GetIndexBuffer(GrResourceProvider* reso
|
||||
}
|
||||
}
|
||||
|
||||
GrOp::CombineResult AAStrokeRectOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*,
|
||||
GrOp::CombineResult AAStrokeRectOp::onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
|
||||
const GrCaps& caps) {
|
||||
AAStrokeRectOp* that = t->cast<AAStrokeRectOp>();
|
||||
|
||||
|
@ -942,7 +942,8 @@ private:
|
||||
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>();
|
||||
|
||||
|
@ -130,10 +130,11 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc* arena, const GrCaps&) override {
|
||||
// This op doesn't use the record time allocator, but make sure the GrOpsTask is sending it
|
||||
SkASSERT(arena);
|
||||
(void) arena;
|
||||
CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas* arenas,
|
||||
const GrCaps&) override {
|
||||
// This op doesn't use the arenas, but make sure the GrOpsTask is sending it
|
||||
SkASSERT(arenas);
|
||||
(void) arenas;
|
||||
auto that = t->cast<TestOp>();
|
||||
int v0 = fValueRanges[0].fValue;
|
||||
int v1 = that->fValueRanges[0].fValue;
|
||||
@ -213,8 +214,7 @@ DEF_GPUTEST(OpChainTest, reporter, /*ctxInfo*/) {
|
||||
GrOpFlushState flushState(context->priv().getGpu(),
|
||||
context->priv().resourceProvider(),
|
||||
&tracker);
|
||||
GrOpsTask opsTask(context->priv().opMemoryPool(),
|
||||
context->priv().recordTimeAllocator(),
|
||||
GrOpsTask opsTask(context->priv().arenas(),
|
||||
GrSurfaceProxyView(proxy, kOrigin, outSwizzle),
|
||||
context->priv().auditTrail());
|
||||
// This assumes the particular values of kRanges.
|
||||
|
Loading…
Reference in New Issue
Block a user