diff options
author | Greg Daniel <egdaniel@google.com> | 2018-01-29 10:34:25 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-29 16:01:21 +0000 |
commit | aa3dfbe51e6f14db5ccc048b4167ad334ce05176 (patch) | |
tree | 29ecae5f1461148747751d7c51e00e3cc470db9b /src/gpu/GrTextureOpList.cpp | |
parent | 03bd9ee472ed1f7b3b2320277fdf32e461abc54d (diff) |
Remove Ops whose lazy proxies fail to instantiate on flush
Bug: skia:
Change-Id: If8b5b9e5d0c306be28ba192b731d34d185427354
Reviewed-on: https://skia-review.googlesource.com/99440
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrTextureOpList.cpp')
-rw-r--r-- | src/gpu/GrTextureOpList.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp index c0de35fa1a..ad00d95a00 100644 --- a/src/gpu/GrTextureOpList.cpp +++ b/src/gpu/GrTextureOpList.cpp @@ -33,14 +33,18 @@ void GrTextureOpList::dump() const { SkDebugf("ops (%d):\n", fRecordedOps.count()); for (int i = 0; i < fRecordedOps.count(); ++i) { - SkDebugf("*******************************\n"); - SkDebugf("%d: %s\n", i, fRecordedOps[i]->name()); - SkString str = fRecordedOps[i]->dumpInfo(); - SkDebugf("%s\n", str.c_str()); - const SkRect& clippedBounds = fRecordedOps[i]->bounds(); - SkDebugf("ClippedBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n", - clippedBounds.fLeft, clippedBounds.fTop, clippedBounds.fRight, - clippedBounds.fBottom); + if (!fRecordedOps[i]) { + SkDebugf("%d: <failed instantiation>\n", i); + } else { + SkDebugf("*******************************\n"); + SkDebugf("%d: %s\n", i, fRecordedOps[i]->name()); + SkString str = fRecordedOps[i]->dumpInfo(); + SkDebugf("%s\n", str.c_str()); + const SkRect& clippedBounds = fRecordedOps[i]->bounds(); + SkDebugf("ClippedBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n", + clippedBounds.fLeft, clippedBounds.fTop, clippedBounds.fRight, + clippedBounds.fBottom); + } } } @@ -123,6 +127,26 @@ bool GrTextureOpList::copySurface(const GrCaps& caps, return true; } +void GrTextureOpList::purgeOpsWithUninstantiatedProxies() { + bool hasUninstantiatedProxy = false; + auto checkInstantiation = [ &hasUninstantiatedProxy ] (GrSurfaceProxy* p) { + if (!p->priv().isInstantiated()) { + hasUninstantiatedProxy = true; + } + }; + for (int i = 0; i < fRecordedOps.count(); ++i) { + const GrOp* op = fRecordedOps[i].get(); // only diff from the GrRenderTargetOpList version + hasUninstantiatedProxy = false; + if (op) { + op->visitProxies(checkInstantiation); + } + if (hasUninstantiatedProxy) { + // When instantiation of the proxy fails we drop the Op + fRecordedOps[i] = nullptr; + } + } +} + void GrTextureOpList::gatherProxyIntervals(GrResourceAllocator* alloc) const { unsigned int cur = alloc->numOps(); |