diff options
author | Robert Phillips <robertphillips@google.com> | 2018-02-07 17:08:21 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-08 12:36:29 +0000 |
commit | 4150eea6c49ecec882a8d3e1c61d6a25fcd1e905 (patch) | |
tree | 21b7089d6745f769be88f8f3d9a127d521ff48be /src/gpu/GrDrawingManager.cpp | |
parent | 1f1bb9c0b8d5f50ac74716e6961a6c92f1d373d8 (diff) |
Move control of explicit GPU resource allocation to GrContextOptions
Change-Id: Ic284acc79bab5936f0007d5ae5fb1e7a9929e2af
Reviewed-on: https://skia-review.googlesource.com/104880
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrDrawingManager.cpp')
-rw-r--r-- | src/gpu/GrDrawingManager.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index ef4177f0f1..703bc0a92d 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -115,11 +115,10 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*, } #endif -#ifndef SK_DISABLE_RENDER_TARGET_SORTING - SkDEBUGCODE(bool result =) - SkTTopoSort<GrOpList, GrOpList::TopoSortTraits>(&fOpLists); - SkASSERT(result); -#endif + if (fSortRenderTargets) { + SkDEBUGCODE(bool result =) SkTTopoSort<GrOpList, GrOpList::TopoSortTraits>(&fOpLists); + SkASSERT(result); + } GrGpu* gpu = fContext->contextPriv().getGpu(); @@ -179,21 +178,14 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*, alloc.markEndOfOpList(i); } -#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION - startIndex = 0; - stopIndex = fOpLists.count(); -#else GrResourceAllocator::AssignError error = GrResourceAllocator::AssignError::kNoError; - while (alloc.assign(&startIndex, &stopIndex, &error)) -#endif - { -#ifndef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION + while (alloc.assign(&startIndex, &stopIndex, &error)) { if (GrResourceAllocator::AssignError::kFailedProxyInstantiation == error) { for (int i = startIndex; i < stopIndex; ++i) { fOpLists[i]->purgeOpsWithUninstantiatedProxies(); } } -#endif + if (this->executeOpLists(startIndex, stopIndex, &flushState)) { flushed = true; } @@ -221,6 +213,7 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*, bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushState* flushState) { SkASSERT(startIndex <= stopIndex && stopIndex <= fOpLists.count()); + GrResourceProvider* resourceProvider = fContext->contextPriv().resourceProvider(); bool anyOpListsExecuted = false; for (int i = startIndex; i < stopIndex; ++i) { @@ -228,15 +221,19 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt continue; } -#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION - if (!fOpLists[i]->instantiate(fContext->contextPriv().resourceProvider())) { - SkDebugf("OpList failed to instantiate.\n"); - fOpLists[i] = nullptr; - continue; + if (resourceProvider->explicitlyAllocateGPUResources()) { + if (!fOpLists[i]->isInstantiated()) { + // If the backing surface wasn't allocated drop the draw of the entire opList. + fOpLists[i] = nullptr; + continue; + } + } else { + if (!fOpLists[i]->instantiate(resourceProvider)) { + SkDebugf("OpList failed to instantiate.\n"); + fOpLists[i] = nullptr; + continue; + } } -#else - SkASSERT(fOpLists[i]->isInstantiated()); -#endif // TODO: handle this instantiation via lazy surface proxies? // Instantiate all deferred proxies (being built on worker threads) so we can upload them |