From bc8ee52d4649afdc972599e5ef2a2a543867985d Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Tue, 18 Apr 2017 11:21:38 -0400 Subject: Split up opLists Split into: https://skia-review.googlesource.com/c/11793/ (Remove lastProxy capability from GrSurface) Change-Id: I903ba30e17de4aab8cb0d2cc3281ae5c262142f9 Reviewed-on: https://skia-review.googlesource.com/11581 Commit-Queue: Robert Phillips Reviewed-by: Brian Osman --- src/gpu/GrDrawingManager.cpp | 53 +++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) (limited to 'src/gpu/GrDrawingManager.cpp') diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index 6b2c5a20b4..9c5be8e6ca 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 + // after a cleanup. + // MDB TODO: is this still true? fOpLists[i]->reset(); } @@ -83,6 +83,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(); + SkDEBUGCODE(fOpLists[i]->validateTargetsSingleRenderTarget()); } #ifdef ENABLE_MDB @@ -115,6 +116,7 @@ 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)) { @@ -151,17 +153,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. @@ -198,19 +190,12 @@ void GrDrawingManager::addPreFlushCallbackObject(sk_sp sk_sp GrDrawingManager::newRTOpList(sk_sp 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(); } -#endif sk_sp opList(new GrRenderTargetOpList(rtp, fContext->getGpu(), @@ -227,19 +212,21 @@ sk_sp GrDrawingManager::newRTOpList(sk_sp GrDrawingManager::newTextureOpList(sk_sp textureProxy) { SkASSERT(fContext); - sk_sp opList(new GrTextureOpList(std::move(textureProxy), fContext->getGpu(), + // 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 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() { -- cgit v1.2.3