aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawingManager.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-07-16 13:33:53 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-17 11:38:10 +0000
commit94fee93c9b23bd1a32604753da8bef755d6c8a95 (patch)
treeacad655e303bbf931f391ce76d5d034476d7b608 /src/gpu/GrDrawingManager.cpp
parent9c98576bceffc721a71550ea9c0942d9a008da3b (diff)
Reduce arbitrary opList splitting when sorting
Change-Id: I49a47672600f72dc46f27462a2c344e77a06a659 Reviewed-on: https://skia-review.googlesource.com/141243 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrDrawingManager.cpp')
-rw-r--r--src/gpu/GrDrawingManager.cpp57
1 files changed, 38 insertions, 19 deletions
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 0df9b34468..366f285cf3 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -32,11 +32,6 @@
#include "ccpr/GrCoverageCountingPathRenderer.h"
#include "text/GrTextContext.h"
-// Turn on/off the sorting of opLists at flush time
-#ifndef SK_DISABLE_RENDER_TARGET_SORTING
- #define SK_DISABLE_RENDER_TARGET_SORTING
-#endif
-
GrDrawingManager::GrDrawingManager(GrContext* context,
const GrPathRendererChain::Options& optionsForPathRendererChain,
const GrTextContext::Options& optionsForTextContext,
@@ -132,6 +127,11 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
fOpLists[i]->makeClosed(*fContext->contextPriv().caps());
}
+ if (fSortRenderTargets) {
+ SkDEBUGCODE(bool result =) SkTTopoSort<GrOpList, GrOpList::TopoSortTraits>(&fOpLists);
+ SkASSERT(result);
+ }
+
#ifdef SK_DEBUG
// This block checks for any unnecessary splits in the opLists. If two sequential opLists
// share the same backing GrSurfaceProxy it means the opList was artificially split.
@@ -149,11 +149,6 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
}
#endif
- if (fSortRenderTargets) {
- SkDEBUGCODE(bool result =) SkTTopoSort<GrOpList, GrOpList::TopoSortTraits>(&fOpLists);
- SkASSERT(result);
- }
-
GrOpFlushState flushState(gpu, fContext->contextPriv().resourceProvider(),
&fTokenTracker);
@@ -278,7 +273,7 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
SkDebugf("Flushing opLists: %d to %d out of [%d, %d]\n",
startIndex, stopIndex, 0, fOpLists.count());
for (int i = startIndex; i < stopIndex; ++i) {
- fOpLists[i]->dump(false);
+ fOpLists[i]->dump(true);
}
#endif
@@ -431,11 +426,23 @@ sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(GrRenderTargetProxy* r
bool managedOpList) {
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->contextPriv().caps());
+ if (fSortRenderTargets) {
+ // In this case we need to close all the opLists that rely on the current contents of
+ // 'rtp'. That is bc we're going to update the content of the proxy so they need to be
+ // split in case they use both the old and new content. (This is a bit of an overkill:
+ // they really only need to be split if they ever reference proxy's contents again but
+ // that is hard to predict/handle).
+ if (GrOpList* lastOpList = rtp->getLastOpList()) {
+ lastOpList->closeThoseWhoDependOnMe(*fContext->contextPriv().caps());
+ }
+ } else {
+ // 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.
+ fOpLists.back()->makeClosed(*fContext->contextPriv().caps());
+ }
}
auto resourceProvider = fContext->contextPriv().resourceProvider();
@@ -457,11 +464,23 @@ 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->contextPriv().caps());
+ if (fSortRenderTargets) {
+ // In this case we need to close all the opLists that rely on the current contents of
+ // 'rtp'. That is bc we're going to update the content of the proxy so they need to be
+ // split in case they use both the old and new content. (This is a bit of an overkill:
+ // they really only need to be split if they ever reference proxy's contents again but
+ // that is hard to predict/handle).
+ if (GrOpList* lastOpList = textureProxy->getLastOpList()) {
+ lastOpList->closeThoseWhoDependOnMe(*fContext->contextPriv().caps());
+ }
+ } else {
+ // 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.
+ fOpLists.back()->makeClosed(*fContext->contextPriv().caps());
+ }
}
sk_sp<GrTextureOpList> opList(new GrTextureOpList(fContext->contextPriv().resourceProvider(),