aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRenderTargetOpList.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-11-08 15:24:31 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-08 21:00:37 +0000
commitf8e2502819499894dff40c4f2f46e46edda15507 (patch)
tree7fe8c9c6e191f9d393abc8d29ffa1d4146db302d /src/gpu/GrRenderTargetOpList.cpp
parent065b41dd90782e22b5708c8b43696db641d54f46 (diff)
Prepare to enable explicit gpu resource allocation (take 2)
Change-Id: I3fd78d53e8bea84c0217b9fe6e180eaa9e4ac753 Reviewed-on: https://skia-review.googlesource.com/68920 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetOpList.cpp')
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 09486c7c99..e6b91ff9c6 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -257,14 +257,18 @@ bool GrRenderTargetOpList::copySurface(const GrCaps& caps,
}
void GrRenderTargetOpList::gatherProxyIntervals(GrResourceAllocator* alloc) const {
- if (!fRecordedOps.count()) {
- return;
- }
-
unsigned int cur = alloc->numOps();
// Add the interval for all the writes to this opList's target
- alloc->addInterval(fTarget.get(), cur, cur+fRecordedOps.count()-1);
+ if (fRecordedOps.count()) {
+ alloc->addInterval(fTarget.get(), cur, cur+fRecordedOps.count()-1);
+ } else {
+ // This can happen if there is a loadOp (e.g., a clear) but no other draws. In this case we
+ // still need to add an interval for the destination so we create a fake op# for
+ // the missing clear op.
+ alloc->addInterval(fTarget.get());
+ alloc->incOps();
+ }
auto gather = [ alloc ] (GrSurfaceProxy* p) {
alloc->addInterval(p);
@@ -273,9 +277,11 @@ void GrRenderTargetOpList::gatherProxyIntervals(GrResourceAllocator* alloc) cons
const GrOp* op = fRecordedOps[i].fOp.get(); // only diff from the GrTextureOpList version
if (op) {
op->visitProxies(gather);
-
- alloc->incOps();
}
+
+ // Even though the op may have been moved we still need to increment the op count to
+ // keep all the math consistent.
+ alloc->incOps();
}
}