aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawingManager.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-04-18 11:21:38 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-18 15:59:45 +0000
commitbc8ee52d4649afdc972599e5ef2a2a543867985d (patch)
treefa21947e32de29e4c582d777e25a7b181d01efd6 /src/gpu/GrDrawingManager.cpp
parent6e834799946537370e6f3c10aa2745ed969b2a27 (diff)
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 <robertphillips@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrDrawingManager.cpp')
-rw-r--r--src/gpu/GrDrawingManager.cpp53
1 files changed, 20 insertions, 33 deletions
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<GrPreFlushCallbackObject>
sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(sk_sp<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();
}
-#endif
sk_sp<GrRenderTargetOpList> opList(new GrRenderTargetOpList(rtp,
fContext->getGpu(),
@@ -227,19 +212,21 @@ sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(sk_sp<GrRenderTargetPr
sk_sp<GrTextureOpList> GrDrawingManager::newTextureOpList(sk_sp<GrTextureProxy> textureProxy) {
SkASSERT(fContext);
- sk_sp<GrTextureOpList> 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<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() {