diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrRenderTargetOpList.cpp | 11 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetOpList.h | 13 | ||||
-rw-r--r-- | src/gpu/GrResourceAllocator.cpp | 13 | ||||
-rw-r--r-- | src/gpu/GrResourceAllocator.h | 13 | ||||
-rw-r--r-- | src/gpu/GrTextureOpList.cpp | 4 |
5 files changed, 37 insertions, 17 deletions
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index 4bdfe589bb..885723c0d6 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -271,14 +271,11 @@ void GrRenderTargetOpList::gatherProxyIntervals(GrResourceAllocator* alloc) cons alloc->incOps(); } - auto gather = [ alloc ] (GrSurfaceProxy* p) { - alloc->addInterval(p); + auto gather = [ alloc SkDEBUGCODE(, this) ] (GrSurfaceProxy* p) { + alloc->addInterval(p SkDEBUGCODE(, fTarget.get() == p)); }; - for (int i = 0; i < fRecordedOps.count(); ++i) { - const GrOp* op = fRecordedOps[i].fOp.get(); // only diff from the GrTextureOpList version - if (op) { - op->visitProxies(gather); - } + for (const RecordedOp& recordedOp : fRecordedOps) { + recordedOp.visitProxies(gather); // only diff from the GrTextureOpList version // Even though the op may have been moved we still need to increment the op count to // keep all the math consistent. diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h index e9797db8f5..7e600d41d1 100644 --- a/src/gpu/GrRenderTargetOpList.h +++ b/src/gpu/GrRenderTargetOpList.h @@ -136,6 +136,19 @@ private: fDstProxy = *dstProxy; } } + + void visitProxies(const GrOp::VisitProxyFunc& func) const { + if (fOp) { + fOp->visitProxies(func); + } + if (fDstProxy.proxy()) { + func(fDstProxy.proxy()); + } + if (fAppliedClip) { + fAppliedClip->visitProxies(func); + } + } + std::unique_ptr<GrOp> fOp; DstProxy fDstProxy; GrAppliedClip* fAppliedClip; diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp index 5cb882f61c..0afc0ed8c9 100644 --- a/src/gpu/GrResourceAllocator.cpp +++ b/src/gpu/GrResourceAllocator.cpp @@ -43,14 +43,21 @@ GrResourceAllocator::~GrResourceAllocator() { #endif } -void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy, - unsigned int start, unsigned int end) { +void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy, unsigned int start, unsigned int end + SkDEBUGCODE(, bool isDirectDstRead)) { SkASSERT(start <= end); SkASSERT(!fAssigned); // We shouldn't be adding any intervals after (or during) assignment if (Interval* intvl = fIntvlHash.find(proxy->uniqueID().asUInt())) { // Revise the interval for an existing use - SkASSERT(intvl->end() <= start && intvl->end() <= end); +#ifdef SK_DEBUG + if (isDirectDstRead) { + // Direct reads from the render target itself should occur w/in the existing interval + SkASSERT(intvl->start() <= start && intvl->end() >= end); + } else { + SkASSERT(intvl->end() <= start && intvl->end() <= end); + } +#endif intvl->extendEnd(end); return; } diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h index f576649030..0030ed2231 100644 --- a/src/gpu/GrResourceAllocator.h +++ b/src/gpu/GrResourceAllocator.h @@ -47,12 +47,14 @@ public: // Add a usage interval from 'start' to 'end' inclusive. This is usually used for renderTargets. // If an existing interval already exists it will be expanded to include the new range. - void addInterval(GrSurfaceProxy*, unsigned int start, unsigned int end); + void addInterval(GrSurfaceProxy*, unsigned int start, unsigned int end + SkDEBUGCODE(, bool isDirectDstRead = false)); // Add an interval that spans just the current op. Usually this is for texture uses. // If an existing interval already exists it will be expanded to include the new operation. - void addInterval(GrSurfaceProxy* proxy) { - this->addInterval(proxy, fNumOps, fNumOps); + void addInterval(GrSurfaceProxy* proxy + SkDEBUGCODE(, bool isDirectDstRead = false)) { + this->addInterval(proxy, fNumOps, fNumOps SkDEBUGCODE(, isDirectDstRead)); } // Returns true when the opLists from 'startIndex' to 'stopIndex' should be executed; @@ -120,8 +122,9 @@ private: void setNext(Interval* next) { fNext = next; } void extendEnd(unsigned int newEnd) { - SkASSERT(newEnd >= fEnd); - fEnd = newEnd; + if (newEnd > fEnd) { + fEnd = newEnd; + } } void assign(sk_sp<GrSurface>); diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp index 5c4fe3cc06..c0de35fa1a 100644 --- a/src/gpu/GrTextureOpList.cpp +++ b/src/gpu/GrTextureOpList.cpp @@ -137,8 +137,8 @@ void GrTextureOpList::gatherProxyIntervals(GrResourceAllocator* alloc) const { alloc->incOps(); } - auto gather = [ alloc ] (GrSurfaceProxy* p) { - alloc->addInterval(p); + auto gather = [ alloc SkDEBUGCODE(, this) ] (GrSurfaceProxy* p) { + alloc->addInterval(p SkDEBUGCODE(, p == fTarget.get())); }; for (int i = 0; i < fRecordedOps.count(); ++i) { const GrOp* op = fRecordedOps[i].get(); // only diff from the GrRenderTargetOpList version |