diff options
Diffstat (limited to 'src/gpu/GrResourceAllocator.cpp')
-rw-r--r-- | src/gpu/GrResourceAllocator.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp index 6ed3d4dc43..f41169c110 100644 --- a/src/gpu/GrResourceAllocator.cpp +++ b/src/gpu/GrResourceAllocator.cpp @@ -36,11 +36,9 @@ void GrResourceAllocator::markEndOfOpList(int opListIndex) { } GrResourceAllocator::~GrResourceAllocator() { -#ifndef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION SkASSERT(fIntvlList.empty()); SkASSERT(fActiveIntvls.empty()); SkASSERT(!fIntvlHash.count()); -#endif } void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy, unsigned int start, unsigned int end @@ -79,12 +77,12 @@ void GrResourceAllocator::addInterval(GrSurfaceProxy* proxy, unsigned int start, fIntvlList.insertByIncreasingStart(newIntvl); fIntvlHash.add(newIntvl); -#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION - // FIXME: remove this once we can do the lazy instantiation from assign instead. - if (GrSurfaceProxy::LazyState::kNot != proxy->lazyInstantiationState()) { - proxy->priv().doLazyInstantiation(fResourceProvider); + if (!fResourceProvider->explicitlyAllocateGPUResources()) { + // FIXME: remove this once we can do the lazy instantiation from assign instead. + if (GrSurfaceProxy::LazyState::kNot != proxy->lazyInstantiationState()) { + proxy->priv().doLazyInstantiation(fResourceProvider); + } } -#endif } GrResourceAllocator::Interval* GrResourceAllocator::IntervalList::popHead() { @@ -131,6 +129,13 @@ void GrResourceAllocator::IntervalList::insertByIncreasingEnd(Interval* intvl) { } } + + GrResourceAllocator::Interval* GrResourceAllocator::IntervalList::detachAll() { + Interval* tmp = fHead; + fHead = nullptr; + return tmp; +} + // 'surface' can be reused. Add it back to the free pool. void GrResourceAllocator::freeUpSurface(sk_sp<GrSurface> surface) { const GrScratchKey &key = surface->resourcePriv().getScratchKey(); @@ -207,6 +212,11 @@ bool GrResourceAllocator::assign(int* startIndex, int* stopIndex, AssignError* o *startIndex = fCurOpListIndex; *stopIndex = fEndOfOpListOpIndices.count(); + if (!fResourceProvider->explicitlyAllocateGPUResources()) { + fIntvlList.detachAll(); // arena allocator will clean these up for us + return true; + } + SkDEBUGCODE(fAssigned = true;) while (Interval* cur = fIntvlList.popHead()) { |