aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrResourceAllocator.h
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-07-21 11:38:13 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-21 16:18:53 +0000
commit57aa367aa3c5911cd4a21230799b147e44190282 (patch)
tree63b03042079833f226a26f734cc0229010f1429a /src/gpu/GrResourceAllocator.h
parent8825a09fc88f46dcec1d547dfbe7457ea224790b (diff)
Add initial version of GrResourceAllocator's free pool (take 2)
TBR=bsalomon@google.com Change-Id: I252d0d75f9ad3911abf97495f67d5178e924dd78 Reviewed-on: https://skia-review.googlesource.com/25560 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrResourceAllocator.h')
-rw-r--r--src/gpu/GrResourceAllocator.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h
index 300aa25b3b..fcaa3d5c9a 100644
--- a/src/gpu/GrResourceAllocator.h
+++ b/src/gpu/GrResourceAllocator.h
@@ -8,8 +8,11 @@
#ifndef GrResourceAllocator_DEFINED
#define GrResourceAllocator_DEFINED
+#include "GrGpuResourcePriv.h"
+#include "GrSurface.h"
#include "GrSurfaceProxy.h"
#include "SkTDynamicHash.h"
+#include "SkTMultiMap.h"
class GrResourceProvider;
@@ -60,12 +63,15 @@ private:
void freeUpSurface(GrSurface* surface);
sk_sp<GrSurface> findSurfaceFor(GrSurfaceProxy* proxy);
- struct UniqueHashTraits {
- static const GrUniqueKey& GetKey(const GrSurface& s) { return s.getUniqueKey(); }
+ struct FreePoolTraits {
+ static const GrScratchKey& GetKey(const GrSurface& s) {
+ return s.resourcePriv().getScratchKey();
+ }
- static uint32_t Hash(const GrUniqueKey& key) { return key.hash(); }
+ static uint32_t Hash(const GrScratchKey& key) { return key.hash(); }
};
- typedef SkTDynamicHash<GrSurface, GrUniqueKey, UniqueHashTraits> UniqueHash;
+ typedef SkTMultiMap<GrSurface, GrScratchKey, FreePoolTraits> FreePoolMultiMap;
+
typedef SkTDynamicHash<Interval, unsigned int> IntvlHash;
class Interval {
@@ -114,7 +120,7 @@ private:
};
GrResourceProvider* fResourceProvider;
- UniqueHash fFreePool; // Recently created/used GrSurfaces
+ FreePoolMultiMap fFreePool; // Recently created/used GrSurfaces
IntvlHash fIntvlHash; // All the intervals, hashed by proxyID
IntervalList fIntvlList; // All the intervals sorted by increasing start