aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextureOpList.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-11-08 13:34:43 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-08 19:06:17 +0000
commitf290376736b42a19b87da78c6ba2558313896860 (patch)
tree664ff0fb2802069f4373238a6127b287cc3db8a6 /src/gpu/GrTextureOpList.cpp
parent47ba5cd0974273192c83cc27addb9ae1880c1d6d (diff)
Prepare to enable explicit gpu resource allocation
Change-Id: I407e45711c61831febbac3d3d3a88e3fdde92c5f Reviewed-on: https://skia-review.googlesource.com/68212 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrTextureOpList.cpp')
-rw-r--r--src/gpu/GrTextureOpList.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp
index 9a3d15be97..5c4fe3cc06 100644
--- a/src/gpu/GrTextureOpList.cpp
+++ b/src/gpu/GrTextureOpList.cpp
@@ -124,14 +124,18 @@ bool GrTextureOpList::copySurface(const GrCaps& caps,
}
void GrTextureOpList::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);
@@ -140,9 +144,11 @@ void GrTextureOpList::gatherProxyIntervals(GrResourceAllocator* alloc) const {
const GrOp* op = fRecordedOps[i].get(); // only diff from the GrRenderTargetOpList 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();
}
}