aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-05-08 15:35:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-09 17:31:23 +0000
commitc84c030295bac4fcd907cd64456d763f765add80 (patch)
tree55d6880391305c750b5eda030c51a650d361f9f2 /src
parent234fc140eb0ac02011f9c0b467d9657945bedb42 (diff)
Add debug-only helper methods to get #ops & #clips per opList
These are being/will be used to determine the correct amout of memory to preallocate for ops & clips in the opLists. Change-Id: I98ebaec8a6e72a43d97101aca5fbc58264964ebd Reviewed-on: https://skia-review.googlesource.com/15882 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrOpList.h3
-rw-r--r--src/gpu/GrRenderTargetContext.cpp2
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp8
-rw-r--r--src/gpu/GrRenderTargetOpList.h4
-rw-r--r--src/gpu/GrTextureContext.cpp4
-rw-r--r--src/gpu/GrTextureOpList.cpp1
-rw-r--r--src/gpu/GrTextureOpList.h2
7 files changed, 19 insertions, 5 deletions
diff --git a/src/gpu/GrOpList.h b/src/gpu/GrOpList.h
index b354abed76..54a13e1d91 100644
--- a/src/gpu/GrOpList.h
+++ b/src/gpu/GrOpList.h
@@ -82,6 +82,9 @@ public:
SkDEBUGCODE(virtual void validateTargetsSingleRenderTarget() const = 0;)
+ SkDEBUGCODE(virtual int numOps() const = 0;)
+ SkDEBUGCODE(virtual int numClips() const { return 0; })
+
protected:
GrSurfaceProxy* fTarget;
GrAuditTrail* fAuditTrail;
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index f81dc46255..7de1f8dddf 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -127,7 +127,7 @@ GrRenderTargetOpList* GrRenderTargetContext::getOpList() {
return fOpList.get();
}
-// TODO: move this (and GrTextContext::copy) to GrSurfaceContext?
+// MDB TODO: move this (and GrTextContext::copy) to GrSurfaceContext?
bool GrRenderTargetContext::onCopy(GrSurfaceProxy* srcProxy,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 9920cfd8f7..a9f4351a77 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -29,7 +29,9 @@ static const int kMaxOpLookahead = 10;
GrRenderTargetOpList::GrRenderTargetOpList(sk_sp<GrRenderTargetProxy> proxy, GrGpu* gpu,
GrAuditTrail* auditTrail)
: INHERITED(std::move(proxy), auditTrail)
- , fLastClipStackGenID(SK_InvalidUniqueID) {
+ , fLastClipStackGenID(SK_InvalidUniqueID)
+ SkDEBUGCODE(, fNumClips(0))
+{
if (GrCaps::InstancedSupport::kNone != gpu->caps()->instancedSupport()) {
fInstancedRendering.reset(gpu->createInstancedRendering());
}
@@ -246,6 +248,7 @@ void GrRenderTargetOpList::fullClear(GrRenderTargetContext* renderTargetContext,
////////////////////////////////////////////////////////////////////////////////
+// MDB TODO: fuse with GrTextureOpList::copySurface
bool GrRenderTargetOpList::copySurface(GrResourceProvider* resourceProvider,
GrRenderTargetContext* dst,
GrSurfaceProxy* src,
@@ -359,6 +362,7 @@ GrOp* GrRenderTargetOpList::recordOp(std::unique_ptr<GrOp> op,
GR_AUDIT_TRAIL_OP_RESULT_NEW(fAuditTrail, op);
if (clip) {
clip = fClipAllocator.make<GrAppliedClip>(std::move(*clip));
+ SkDEBUGCODE(fNumClips++;)
}
fRecordedOps.emplace_back(std::move(op), renderTarget, clip, dstTexture);
fRecordedOps.back().fOp->wasRecorded(this);
@@ -398,7 +402,7 @@ void GrRenderTargetOpList::forwardCombine(const GrCaps& caps) {
fRecordedOps[j].fOp = std::move(fRecordedOps[i].fOp);
break;
}
- // Stop going traversing if we would cause a painter's order violation.
+ // Stop traversing if we would cause a painter's order violation.
if (!can_reorder(fRecordedOps[j].fOp->bounds(), op->bounds())) {
GrOP_INFO("\t\tForward: Intersects with (%s, opID: %u)\n", candidate.fOp->name(),
candidate.fOp->uniqueID());
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index 342f9278d5..21dd70e01b 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -106,6 +106,9 @@ public:
SkDEBUGCODE(void validateTargetsSingleRenderTarget() const override;)
+ SkDEBUGCODE(int numOps() const override { return fRecordedOps.count(); })
+ SkDEBUGCODE(int numClips() const override { return fNumClips; })
+
private:
friend class GrRenderTargetContextPriv; // for stencil clip state. TODO: this is invasive
@@ -153,6 +156,7 @@ private:
// MDB TODO: 4096 for the first allocation of the clip space will be huge overkill.
// Gather statistics to determine the correct size.
SkArenaAlloc fClipAllocator{4096};
+ SkDEBUGCODE(int fNumClips;)
typedef GrOpList INHERITED;
};
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index 68e94f9be3..fb8e79584e 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -68,14 +68,14 @@ GrTextureOpList* GrTextureContext::getOpList() {
return fOpList.get();
}
-// TODO: move this (and GrRenderTargetContext::copy) to GrSurfaceContext?
+// MDB TODO: move this (and GrRenderTargetContext::copy) to GrSurfaceContext?
bool GrTextureContext::onCopy(GrSurfaceProxy* srcProxy,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
ASSERT_SINGLE_OWNER
RETURN_FALSE_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrTextureContext::copy");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrTextureContext::onCopy");
#ifndef ENABLE_MDB
// We can't yet fully defer copies to textures, so GrTextureContext::copySurface will
diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp
index 689ea44783..97a4bbf05e 100644
--- a/src/gpu/GrTextureOpList.cpp
+++ b/src/gpu/GrTextureOpList.cpp
@@ -81,6 +81,7 @@ void GrTextureOpList::reset() {
////////////////////////////////////////////////////////////////////////////////
+// MDB TODO: fuse with GrRenderTargetOpList::copySurface
bool GrTextureOpList::copySurface(GrResourceProvider* resourceProvider,
GrSurfaceProxy* dst,
GrSurfaceProxy* src,
diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h
index d42818d140..f351ea811b 100644
--- a/src/gpu/GrTextureOpList.h
+++ b/src/gpu/GrTextureOpList.h
@@ -64,6 +64,8 @@ public:
SkDEBUGCODE(virtual void validateTargetsSingleRenderTarget() const override;)
+ SkDEBUGCODE(int numOps() const override { return fRecordedOps.count(); })
+
private:
// MDB TODO: The unique IDs are only needed for the audit trail. There should only be one
// on the opList itself.