Index: src/gpu/GrVertexBuffer.h |
diff --git a/src/gpu/GrVertexBuffer.h b/src/gpu/GrVertexBuffer.h |
index 3f2ada2a2c50eb15f3a372b147e2df162c95caa9..3c12cd76d2a6b496ec9e40410ded571534571207 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; |
}; |