aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrVertexBuffer.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-06-23 08:23:08 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-23 08:23:08 -0700
commite935f1a0e2351373c33600b8388492ce1218014a (patch)
tree9182150ea7c4cedda75dc2b9d2f6027937c7aed8 /src/gpu/GrVertexBuffer.h
parent591a2ca842cb34919695a32757d700dee8b7822c (diff)
Refactor GrBufferAllocPools to use resource cache
Diffstat (limited to 'src/gpu/GrVertexBuffer.h')
-rw-r--r--src/gpu/GrVertexBuffer.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gpu/GrVertexBuffer.h b/src/gpu/GrVertexBuffer.h
index 3f2ada2a2c..3c12cd76d2 100644
--- a/src/gpu/GrVertexBuffer.h
+++ b/src/gpu/GrVertexBuffer.h
@@ -14,9 +14,24 @@
#include "GrGeometryBuffer.h"
class GrVertexBuffer : 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;
+ }
+
protected:
GrVertexBuffer(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;
};