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

Unified Diff: src/gpu/GrResourceProvider.cpp

Issue 1129863008: Revert of Refactor GrBufferAllocPools to use resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 5e9177da115f5cf55997e5ecdc7d87ccc0ba8925..8fc3272ae2204715650cd45e664b5d56a1ff1399 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -26,7 +26,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;
}
@@ -63,58 +63,3 @@
return this->createInstancedIndexBuffer(kPattern, 6, kMaxQuads, 4, fQuadIndexBufferKey);
}
-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