aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-11-29 11:32:18 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-29 19:02:45 +0000
commitc666502bc6975a73ef352d673b151017a21e8562 (patch)
treefd2b693b80a8fedaff81bac3cd4e1f048abc0519 /src/gpu
parent0425febe6132a0e2824efbbd323efb2a71504776 (diff)
Make sure to visit clips and dst proxies during gather
Bug: skia:7190 Change-Id: I6ba5bad6e155e9092dff9c2ad3241f603c333b4d Reviewed-on: https://skia-review.googlesource.com/76460 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp2
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp7
-rw-r--r--src/gpu/GrRenderTargetOpList.h13
-rw-r--r--src/gpu/GrResourceAllocator.cpp9
-rw-r--r--src/gpu/GrResourceAllocator.h5
-rw-r--r--src/gpu/GrSurfaceProxyPriv.h5
6 files changed, 33 insertions, 8 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 2310ebda94..dc37c27c48 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1833,6 +1833,8 @@ bool GrRenderTargetContext::setupDstProxy(GrRenderTargetProxy* rtProxy, const Gr
// will be responsible to detect this situation and request a texture barrier.
dstProxy->setProxy(sk_ref_sp(texProxy));
dstProxy->setOffset(0, 0);
+ // Notify the resource allocator that this will be a direct read from the render target.
+ SkDEBUGCODE(dstProxy->proxy()->priv().markAsDirectDstRead_debugOnly();)
return true;
}
}
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 4bdfe589bb..6ec8496536 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -274,11 +274,8 @@ void GrRenderTargetOpList::gatherProxyIntervals(GrResourceAllocator* alloc) cons
auto gather = [ alloc ] (GrSurfaceProxy* p) {
alloc->addInterval(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..11fa7ea7ea 100644
--- a/src/gpu/GrResourceAllocator.cpp
+++ b/src/gpu/GrResourceAllocator.cpp
@@ -50,7 +50,14 @@ void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy,
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 (proxy->priv().isDirectDstRead_debugOnly()) {
+ // 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..dde7519392 100644
--- a/src/gpu/GrResourceAllocator.h
+++ b/src/gpu/GrResourceAllocator.h
@@ -120,8 +120,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/GrSurfaceProxyPriv.h b/src/gpu/GrSurfaceProxyPriv.h
index a93a20c051..0e059722ec 100644
--- a/src/gpu/GrSurfaceProxyPriv.h
+++ b/src/gpu/GrSurfaceProxyPriv.h
@@ -70,6 +70,11 @@ public:
static bool AttachStencilIfNeeded(GrResourceProvider*, GrSurface*, bool needsStencil);
+ // These are used to notify the resource allocator when a proxy is a direct read from the render
+ // target itself (via texture barrier). This information is necessary for certain assertions.
+ SkDEBUGCODE(void markAsDirectDstRead_debugOnly() { fProxy->fIsDirectDstRead = true; })
+ SkDEBUGCODE(bool isDirectDstRead_debugOnly() const { return fProxy->fIsDirectDstRead; })
+
private:
explicit GrSurfaceProxyPriv(GrSurfaceProxy* proxy) : fProxy(proxy) {}
GrSurfaceProxyPriv(const GrSurfaceProxyPriv&) {} // unimpl