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

Unified Diff: src/gpu/GrResourceCache.cpp

Issue 1287193008: Add ANGLE workaround to prefer flushes over VRAM usage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update comment Created 5 years, 4 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
Index: src/gpu/GrResourceCache.cpp
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 7efe62365bf432f112e12e5a01d9b97fa4f7ec98..c32f77862d36c2d3d4f0f32459293a1338b3f7f7 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -58,7 +58,7 @@ private:
//////////////////////////////////////////////////////////////////////////////
-GrResourceCache::GrResourceCache()
+GrResourceCache::GrResourceCache(const GrCaps* caps)
: fTimestamp(0)
, fMaxCount(kDefaultMaxCount)
, fMaxBytes(kDefaultMaxSize)
@@ -75,7 +75,8 @@ GrResourceCache::GrResourceCache()
, fOverBudgetCB(NULL)
, fOverBudgetData(NULL)
, fFlushTimestamps(NULL)
- , fLastFlushTimestampIndex(0){
+ , fLastFlushTimestampIndex(0)
+ , fPreferVRAMUseOverFlushes(caps->preferVRAMUseOverFlushes()) {
SkDEBUGCODE(fCount = 0;)
SkDEBUGCODE(fNewlyPurgeableResourceForValidation = NULL;)
this->resetFlushTimestamps();
@@ -260,9 +261,12 @@ GrGpuResource* GrResourceCache::findAndRefScratchResource(const GrScratchKey& sc
} else if (flags & kRequireNoPendingIO_ScratchFlag) {
return NULL;
}
- if (this->wouldFit(resourceSize)) {
+ // We would prefer to consume more available VRAM rather than flushing
+ // immediately, but on ANGLE this can lead to starving of the GPU.
+ if (fPreferVRAMUseOverFlushes && this->wouldFit(resourceSize)) {
// kPrefer is specified, we didn't find a resource without pending io,
- // but there is still space in our budget for the resource.
+ // but there is still space in our budget for the resource so force
+ // the caller to allocate a new resource.
return NULL;
}
}
« src/gpu/GrCaps.cpp ('K') | « src/gpu/GrResourceCache.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698