diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrOpList.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetOpList.cpp | 10 | ||||
-rw-r--r-- | src/gpu/GrResourceAllocator.cpp | 7 | ||||
-rw-r--r-- | src/gpu/GrResourceAllocator.h | 3 |
4 files changed, 22 insertions, 2 deletions
diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp index 8fe053172e..b63e96ca26 100644 --- a/src/gpu/GrOpList.cpp +++ b/src/gpu/GrOpList.cpp @@ -67,7 +67,11 @@ void GrOpList::endFlush() { void GrOpList::instantiateDeferredProxies(GrResourceProvider* resourceProvider) { for (int i = 0; i < fDeferredProxies.count(); ++i) { +#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION fDeferredProxies[i]->instantiate(resourceProvider); +#else + SkASSERT(fDeferredProxies[i]->priv().isInstantiated()); +#endif } } diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index ff85a41afe..add5eb42d5 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -266,6 +266,16 @@ bool GrRenderTargetOpList::copySurface(const GrCaps& caps, void GrRenderTargetOpList::gatherProxyIntervals(GrResourceAllocator* alloc) const { unsigned int cur = alloc->numOps(); + for (int i = 0; i < fDeferredProxies.count(); ++i) { + SkASSERT(!fDeferredProxies[i]->priv().isInstantiated()); + // We give all the deferred proxies a write usage at the very start of flushing. This + // locks them out of being reused for the entire flush until they are read - and then + // they can be recycled. This is a bit unfortunate because a flush can proceed in waves + // with sub-flushes. The deferred proxies only need to be pinned from the start of + // the sub-flush in which they appear. + alloc->addInterval(fDeferredProxies[i], 0, 0); + } + // Add the interval for all the writes to this opList's target if (fRecordedOps.count()) { alloc->addInterval(fTarget.get(), cur, cur+fRecordedOps.count()-1); diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp index bf46c61e8e..5f40a92a41 100644 --- a/src/gpu/GrResourceAllocator.cpp +++ b/src/gpu/GrResourceAllocator.cpp @@ -51,7 +51,12 @@ void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy, unsigned int start, if (Interval* intvl = fIntvlHash.find(proxy->uniqueID().asUInt())) { // Revise the interval for an existing use #ifdef SK_DEBUG - if (isDirectDstRead) { + if (0 == start && 0 == end) { + // This interval is for the initial upload to a deferred proxy. Due to the vagaries + // of how deferred proxies are collected they can appear as uploads multiple times in a + // single opLists' list and as uploads in several opLists. + SkASSERT(0 == intvl->start()); + } else if (isDirectDstRead) { // Direct reads from the render target itself should occur w/in the existing interval SkASSERT(intvl->start() <= start && intvl->end() >= end); } else { diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h index 0030ed2231..6f0f09cb40 100644 --- a/src/gpu/GrResourceAllocator.h +++ b/src/gpu/GrResourceAllocator.h @@ -174,7 +174,8 @@ private: IntervalList fIntvlList; // All the intervals sorted by increasing start IntervalList fActiveIntvls; // List of live intervals during assignment // (sorted by increasing end) - unsigned int fNumOps = 0; + unsigned int fNumOps = 1; // op # 0 is reserved for uploads at the start + // of a flush SkTArray<unsigned int> fEndOfOpListOpIndices; int fCurOpListIndex = 0; |