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

Unified Diff: src/gpu/GrResourceProvider.cpp

Issue 1204773003: Revert of Refactor GrBufferAllocPools to use resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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.h ('k') | src/gpu/GrVertexBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceProvider.cpp
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 3c447bded6d3d173610352e66e2638db455c7a66..4b9d265129849698f92a161abf9f237cc2b7173e 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -28,7 +28,7 @@
const GrUniqueKey& key) {
size_t bufferSize = patternSize * reps * sizeof(uint16_t);
- GrIndexBuffer* buffer = this->getIndexBuffer(bufferSize, /* dynamic = */ false, true);
+ GrIndexBuffer* buffer = this->gpu()->createIndexBuffer(bufferSize, /* dynamic = */ false);
if (!buffer) {
return NULL;
}
@@ -83,58 +83,3 @@
return this->gpu()->pathRendering()->createGlyphs(tf, desc, stroke);
}
-GrIndexBuffer* GrResourceProvider::getIndexBuffer(size_t size, bool dynamic,
- bool calledDuringFlush) {
- if (this->isAbandoned()) {
- return NULL;
- }
-
- if (dynamic) {
- // bin by pow2 with a reasonable min
- static const uint32_t MIN_SIZE = 1 << 12;
- size = SkTMax(MIN_SIZE, GrNextPow2(SkToUInt(size)));
-
- GrScratchKey key;
- GrIndexBuffer::ComputeScratchKey(size, dynamic, &key);
- uint32_t scratchFlags = 0;
- if (calledDuringFlush) {
- scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag;
- } else {
- scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag;
- }
- GrGpuResource* resource = this->cache()->findAndRefScratchResource(key, scratchFlags);
- if (resource) {
- return static_cast<GrIndexBuffer*>(resource);
- }
- }
-
- return this->gpu()->createIndexBuffer(size, dynamic);
-}
-
-GrVertexBuffer* GrResourceProvider::getVertexBuffer(size_t size, bool dynamic,
- bool calledDuringFlush) {
- if (this->isAbandoned()) {
- return NULL;
- }
-
- if (dynamic) {
- // bin by pow2 with a reasonable min
- static const uint32_t MIN_SIZE = 1 << 15;
- size = SkTMax(MIN_SIZE, GrNextPow2(SkToUInt(size)));
-
- GrScratchKey key;
- GrVertexBuffer::ComputeScratchKey(size, dynamic, &key);
- uint32_t scratchFlags = 0;
- if (calledDuringFlush) {
- scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag;
- } else {
- scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag;
- }
- GrGpuResource* resource = this->cache()->findAndRefScratchResource(key, scratchFlags);
- if (resource) {
- return static_cast<GrVertexBuffer*>(resource);
- }
- }
-
- return this->gpu()->createVertexBuffer(size, dynamic);
-}
« no previous file with comments | « src/gpu/GrResourceProvider.h ('k') | src/gpu/GrVertexBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698