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>
diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h
index 3be4836..d7aed05 100644
--- a/src/gpu/GrResourceAllocator.h
+++ b/src/gpu/GrResourceAllocator.h
@@ -54,7 +54,6 @@
}
void assign();
- SkDEBUGCODE(void dump();)
private:
class Interval;
@@ -72,6 +71,7 @@
}
static uint32_t Hash(const GrScratchKey& key) { return key.hash(); }
+ static void OnFree(GrSurface* s) { s->unref(); }
};
typedef SkTMultiMap<GrSurface, GrScratchKey, FreePoolTraits> FreePoolMultiMap;
@@ -98,12 +98,27 @@
fNext = nullptr;
}
+ const GrSurfaceProxy* proxy() const { return fProxy; }
+ GrSurfaceProxy* proxy() { return fProxy; }
+ unsigned int start() const { return fStart; }
+ unsigned int end() const { return fEnd; }
+ const Interval* next() const { return fNext; }
+ Interval* next() { return fNext; }
+
+ void setNext(Interval* next) { fNext = next; }
+
+ void extendEnd(unsigned int newEnd) {
+ SkASSERT(newEnd >= fEnd);
+ fEnd = newEnd;
+ }
+
// for SkTDynamicHash
static const uint32_t& GetKey(const Interval& intvl) {
return intvl.fProxyID;
}
static uint32_t Hash(const uint32_t& key) { return key; }
+ private:
GrSurfaceProxy* fProxy;
uint32_t fProxyID; // This is here b.c. DynamicHash requires a ref to the key
unsigned int fStart;