diff options
author | Robert Phillips <robertphillips@google.com> | 2017-04-24 16:27:17 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-24 16:27:23 +0000 |
commit | 4a395049a977d7e04515bad490365fe9ec9ffaab (patch) | |
tree | efb32997bbe5376eb40dffa5a59d85a7e2c9b0c2 /src/gpu/GrDrawingManager.cpp | |
parent | 3e38d8205fc743ca956a265a3965ede2897b040a (diff) |
Revert "Split up opLists (take 2)"
This reverts commit df2bf213649e0b2bcb9402548af9976bbdf7a218.
Reason for revert: Maybe AndroidOne timing out
Original change's description:
> Split up opLists (take 2)
>
> Reland of: https://skia-review.googlesource.com/c/11581/ (Split up opLists)
>
> https://skia-review.googlesource.com/c/13860/ (Make InstancedRendering more opList-splitting friendly) has landed so this should be good for another attempt.
>
> Change-Id: Icc9998196587510328e0a9ca1b2ce42013a86c6c
> Reviewed-on: https://skia-review.googlesource.com/13802
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I744f2a3145b294e5911862bb39d57ca33a1b9a5a
Reviewed-on: https://skia-review.googlesource.com/14184
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrDrawingManager.cpp')
-rw-r--r-- | src/gpu/GrDrawingManager.cpp | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index 48d19f296e..282226c748 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -26,10 +26,10 @@ void GrDrawingManager::cleanup() { for (int i = 0; i < fOpLists.count(); ++i) { fOpLists[i]->makeClosed(); // no opList should receive a new command after this + fOpLists[i]->clearTarget(); // We shouldn't need to do this, but it turns out some clients still hold onto opLists - // after a cleanup. - // MDB TODO: is this still true? + // after a cleanup fOpLists[i]->reset(); } @@ -92,7 +92,6 @@ void GrDrawingManager::internalFlush(GrSurfaceProxy*, GrResourceCache::FlushType // but need to be flushed anyway. Closing such GrOpLists here will mean new // GrOpLists will be created to replace them if the SkGpuDevice(s) write to them again. fOpLists[i]->makeClosed(); - SkDEBUGCODE(fOpLists[i]->validateTargetsSingleRenderTarget()); } #ifdef ENABLE_MDB @@ -125,7 +124,6 @@ void GrDrawingManager::internalFlush(GrSurfaceProxy*, GrResourceCache::FlushType if (!opList) { continue; // Odd - but not a big deal } - opList->makeClosed(); SkDEBUGCODE(opList->validateTargetsSingleRenderTarget()); opList->prepareOps(&fFlushState); if (!opList->executeOps(&fFlushState)) { @@ -162,7 +160,17 @@ void GrDrawingManager::internalFlush(GrSurfaceProxy*, GrResourceCache::FlushType fOpLists[i]->reset(); } +#ifndef ENABLE_MDB + // When MDB is disabled we keep reusing the same GrOpList + if (fOpLists.count()) { + SkASSERT(fOpLists.count() == 1); + // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnmarked check + // won't bark + fOpLists[0]->resetFlag(GrOpList::kWasOutput_Flag); + } +#else fOpLists.reset(); +#endif fFlushState.reset(); // We always have to notify the cache when it requested a flush so it can reset its state. @@ -199,12 +207,19 @@ void GrDrawingManager::addPreFlushCallbackObject(sk_sp<GrPreFlushCallbackObject> sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(sk_sp<GrRenderTargetProxy> rtp) { SkASSERT(fContext); - // This is a temporary fix for the partial-MDB world. In that world we're not reordering - // so ops that (in the single opList world) would've just glommed onto the end of the single - // opList but referred to a far earlier RT need to appear in their own opList. - if (!fOpLists.empty()) { - fOpLists.back()->makeClosed(); +#ifndef ENABLE_MDB + // When MDB is disabled we always just return the single GrOpList + if (fOpLists.count()) { + SkASSERT(fOpLists.count() == 1); + // In the non-MDB-world the same GrOpList gets reused for multiple render targets. + // Update this pointer so all the asserts are happy + rtp->setLastOpList(fOpLists[0].get()); + // DrawingManager gets the creation ref - this ref is for the caller + + // TODO: although this is true right now it isn't cool + return sk_ref_sp((GrRenderTargetOpList*) fOpLists[0].get()); } +#endif sk_sp<GrRenderTargetOpList> opList(new GrRenderTargetOpList(rtp, fContext->getGpu(), @@ -221,21 +236,19 @@ sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(sk_sp<GrRenderTargetPr sk_sp<GrTextureOpList> GrDrawingManager::newTextureOpList(sk_sp<GrTextureProxy> textureProxy) { SkASSERT(fContext); - // This is a temporary fix for the partial-MDB world. In that world we're not reordering - // so ops that (in the single opList world) would've just glommed onto the end of the single - // opList but referred to a far earlier RT need to appear in their own opList. - if (!fOpLists.empty()) { - fOpLists.back()->makeClosed(); - } - - sk_sp<GrTextureOpList> opList(new GrTextureOpList(textureProxy, fContext->getGpu(), + sk_sp<GrTextureOpList> opList(new GrTextureOpList(std::move(textureProxy), fContext->getGpu(), fContext->getAuditTrail())); - SkASSERT(textureProxy->getLastOpList() == opList.get()); - - fOpLists.push_back() = opList; +#ifndef ENABLE_MDB + // When MDB is disabled we still create a new GrOpList, but don't store or ref it - we rely + // on the caller to immediately execute and free it. + return opList; +#else + *fOpLists.append() = opList; + // Drawing manager gets the creation ref - this ref is for the caller return opList; +#endif } GrAtlasTextContext* GrDrawingManager::getAtlasTextContext() { |