Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: src/gpu/GrVertexBuffer.h

Issue 1139753002: Refactor GrBufferAllocPools to use resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix merge issue Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrResourceProvider.cpp ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « src/gpu/GrResourceProvider.cpp ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698