Refactor GrBufferAllocPools to use resource cache
Committed: https://skia.googlesource.com/skia/+/e935f1a0e2351373c33600b8388492ce1218014a
Review URL: https://codereview.chromium.org/1139753002
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index d46d09d..728fb88 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -199,12 +199,20 @@
GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) {
this->handleDirtyContext();
- return this->onCreateVertexBuffer(size, dynamic);
+ GrVertexBuffer* vb = this->onCreateVertexBuffer(size, dynamic);
+ if (!this->caps()->reuseScratchBuffers()) {
+ vb->resourcePriv().removeScratchKey();
+ }
+ return vb;
}
GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) {
this->handleDirtyContext();
- return this->onCreateIndexBuffer(size, dynamic);
+ GrIndexBuffer* ib = this->onCreateIndexBuffer(size, dynamic);
+ if (!this->caps()->reuseScratchBuffers()) {
+ ib->resourcePriv().removeScratchKey();
+ }
+ return ib;
}
void GrGpu::clear(const SkIRect* rect,