Fix bug in GrResourceAllocator's intermediate flushing (take 2)
Without the missing increment of fCurOpListIndex in the intermediate flush case, the drawing manager could end up re-executing an entire opList.
TBR=bsalomon@google.com
Bug: 942538
Change-Id: I8298c02071e87a343ec03d809959d06049071d93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203726
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h
index ea1250f..9453d36 100644
--- a/src/gpu/GrResourceAllocator.h
+++ b/src/gpu/GrResourceAllocator.h
@@ -42,8 +42,13 @@
*/
class GrResourceAllocator {
public:
- GrResourceAllocator(GrResourceProvider* resourceProvider, GrDeinstantiateProxyTracker* tracker)
- : fResourceProvider(resourceProvider), fDeinstantiateTracker(tracker) {}
+ GrResourceAllocator(GrResourceProvider* resourceProvider,
+ GrDeinstantiateProxyTracker* tracker
+ SkDEBUGCODE(, int numOpLists))
+ : fResourceProvider(resourceProvider)
+ , fDeinstantiateTracker(tracker)
+ SkDEBUGCODE(, fNumOpLists(numOpLists)) {
+ }
~GrResourceAllocator();
@@ -88,6 +93,9 @@
// Remove dead intervals from the active list
void expire(unsigned int curIndex);
+ bool onOpListBoundary() const;
+ void forceIntermediateFlush(int* stopIndex);
+
// These two methods wrap the interactions with the free pool
void recycleSurface(sk_sp<GrSurface> surface);
sk_sp<GrSurface> findSurfaceFor(const GrSurfaceProxy* proxy, bool needsStencil);
@@ -218,11 +226,11 @@
IntervalList fIntvlList; // All the intervals sorted by increasing start
IntervalList fActiveIntvls; // List of live intervals during assignment
- // (sorted by increasing end)
- unsigned int fNumOps = 1; // op # 0 is reserved for uploads at the start
- // of a flush
+ // (sorted by increasing end)
+ unsigned int fNumOps = 0;
SkTArray<unsigned int> fEndOfOpListOpIndices;
int fCurOpListIndex = 0;
+ SkDEBUGCODE(const int fNumOpLists = -1;)
SkDEBUGCODE(bool fAssigned = false;)