aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrIndexBuffer.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-05-13 10:55:33 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-13 10:55:33 -0700
commitc5f1c5414fc8f73cbefadcc1b24ec794056fa203 (patch)
treeac2bdf703cc4cb8f0e2e85991f8c5a666700bf4e /src/gpu/GrIndexBuffer.h
parent1bf714fb45c82628bc91186d14ea2d8ed62371a8 (diff)
Refactor GrBufferAllocPools to use resource cache
Diffstat (limited to 'src/gpu/GrIndexBuffer.h')
-rw-r--r--src/gpu/GrIndexBuffer.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gpu/GrIndexBuffer.h b/src/gpu/GrIndexBuffer.h
index 4dfd1c1b07..bf64ff87d2 100644
--- a/src/gpu/GrIndexBuffer.h
+++ b/src/gpu/GrIndexBuffer.h
@@ -13,8 +13,18 @@
#include "GrGeometryBuffer.h"
+
class GrIndexBuffer : public GrGeometryBuffer {
public:
+ static void ComputeScratchKey(size_t size, bool dynamic, GrScratchKey* key) {
+ static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
+
+ GrScratchKey::Builder builder(key, kType, 2);
+
+ builder[0] = SkToUInt(size);
+ builder[1] = dynamic ? 1 : 0;
+ }
+
/**
* Retrieves the maximum number of quads that could be rendered
* from the index buffer (using kTriangles_GrPrimitiveType).
@@ -25,7 +35,12 @@ public:
}
protected:
GrIndexBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacked)
- : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) {}
+ : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) {
+ GrScratchKey key;
+ ComputeScratchKey(gpuMemorySize, dynamic, &key);
+ this->setScratchKey(key);
+ }
+
private:
typedef GrGeometryBuffer INHERITED;
};