From a4c93ac535d3b0ed979c7bf666f09aa7dbf1f0eb Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 18 May 2017 11:40:04 -0400 Subject: Add check for incorrect opList splits This CL relies on: https://skia-review.googlesource.com/c/14186/ (Split up opLists (take 3)) We can't/don't want to close the opList in the GrSurfaceContext dtor because we, semi-often, wrap a proxy in a utility SurfaceContext in order to upload data to it (e.g., when creating a proxy w/ data or in the texture strip atlas). In the current set up, the "temporary fixes" in newRTOpList and newTextureOpList should prevent any out of order execution. Change-Id: I8189db6ed59096d7b8c1704028df395f84e4a681 Reviewed-on: https://skia-review.googlesource.com/14187 Reviewed-by: Greg Daniel Commit-Queue: Robert Phillips --- src/gpu/GrDrawingManager.cpp | 17 +++++++++++++++++ src/gpu/GrRenderTargetContext.cpp | 3 --- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index b177a43003..09e43c81d5 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -95,6 +95,23 @@ void GrDrawingManager::internalFlush(GrSurfaceProxy*, GrResourceCache::FlushType fOpLists[i]->makeClosed(*fContext->caps()); } +#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. + if (fOpLists.count()) { + GrRenderTargetOpList* prevOpList = fOpLists[0]->asRenderTargetOpList(); + for (int i = 1; i < fOpLists.count(); ++i) { + GrRenderTargetOpList* curOpList = fOpLists[i]->asRenderTargetOpList(); + + if (prevOpList && curOpList) { + SkASSERT(prevOpList->fTarget.get() != curOpList->fTarget.get()); + } + + prevOpList = curOpList; + } + } +#endif + #ifdef ENABLE_MDB SkDEBUGCODE(bool result =) SkTTopoSort(&fOpLists); diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index e58b4bb06e..ffcd480302 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -105,9 +105,6 @@ void GrRenderTargetContext::validate() const { #endif GrRenderTargetContext::~GrRenderTargetContext() { - if (fOpList) { - fOpList->makeClosed(*this->caps()); - } ASSERT_SINGLE_OWNER } -- cgit v1.2.3