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>
SkDEBUGCODE(virtual void validateTargetsSingleRenderTarget() const = 0;)
+ SkDEBUGCODE(virtual int numOps() const = 0;)
+ SkDEBUGCODE(virtual int numClips() const { return 0; })
+
protected:
GrSurfaceProxy* fTarget;
GrAuditTrail* fAuditTrail;
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) {
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());
}
////////////////////////////////////////////////////////////////////////////////
+// MDB TODO: fuse with GrTextureOpList::copySurface
bool GrRenderTargetOpList::copySurface(GrResourceProvider* resourceProvider,
GrRenderTargetContext* dst,
GrSurfaceProxy* src,
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);
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());
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
// 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;
};
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
////////////////////////////////////////////////////////////////////////////////
+// MDB TODO: fuse with GrRenderTargetOpList::copySurface
bool GrTextureOpList::copySurface(GrResourceProvider* resourceProvider,
GrSurfaceProxy* dst,
GrSurfaceProxy* src,
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.