Index: src/gpu/GrIndexBuffer.h |
diff --git a/src/gpu/GrIndexBuffer.h b/src/gpu/GrIndexBuffer.h |
index 4dfd1c1b07713ff170fb9d18f708129d71a75c38..bf64ff87d28143d18cf31810d81144ce842065fc 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; |
}; |