diff options
author | Robert Phillips <robertphillips@google.com> | 2017-05-11 16:29:14 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-12 12:10:31 +0000 |
commit | 6cdc22cde8e6297d34fdaaa3ed5e69ae86c30a77 (patch) | |
tree | a2462bae16096f92b528d059ff1fb95881ed8d0d /src/gpu/GrDrawingManager.cpp | |
parent | 5c7960be57010bf61db3d4ce879a3194687b5af9 (diff) |
Split up opLists (take 3)
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.
TBR=egdaniel@google.com
Change-Id: I2a09729342bb035af3a16807c1895adbae432ade
Reviewed-on: https://skia-review.googlesource.com/14186
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 | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index b6ca9661a6..38cfb8c71a 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -27,10 +27,10 @@ void GrDrawingManager::cleanup() { for (int i = 0; i < fOpLists.count(); ++i) { // no opList should receive a new command after this fOpLists[i]->makeClosed(*fContext->caps()); - fOpLists[i]->clearTarget(); // We shouldn't need to do this, but it turns out some clients still hold onto opLists - // after a cleanup + // after a cleanup. + // MDB TODO: is this still true? fOpLists[i]->reset(); } @@ -93,6 +93,7 @@ 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(*fContext->caps()); + SkDEBUGCODE(fOpLists[i]->validateTargetsSingleRenderTarget()); } #ifdef ENABLE_MDB @@ -162,17 +163,7 @@ 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. @@ -212,19 +203,12 @@ void GrDrawingManager::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlush sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(GrRenderTargetProxy* rtp) { SkASSERT(fContext); -#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()); + // 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(*fContext->caps()); } -#endif sk_sp<GrRenderTargetOpList> opList(new GrRenderTargetOpList(rtp, fContext->getGpu(), @@ -239,19 +223,21 @@ sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(GrRenderTargetProxy* r sk_sp<GrTextureOpList> GrDrawingManager::newTextureOpList(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(*fContext->caps()); + } + sk_sp<GrTextureOpList> opList(new GrTextureOpList(textureProxy, fContext->getGpu(), fContext->getAuditTrail())); -#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; + SkASSERT(textureProxy->getLastOpList() == opList.get()); + + fOpLists.push_back() = opList; - // Drawing manager gets the creation ref - this ref is for the caller return opList; -#endif } GrAtlasTextContext* GrDrawingManager::getAtlasTextContext() { |