Bump default GrResourceCache size to 256MB

Consider rendering an SkPicture to a 1080p, 4x msaa render target:

  1920 * 1080 * (4 color bytes + 1 stencil byte) * 4 samples = 40Mb!

But SkCanvas::drawPicture calls saveLayer, which allocates a duplicate
render target:

  40Mb * 2 = 80Mb!!

So with the original 96MB, a quite conservative msaa render target
almost blows out the entire resource cache just on the backing. This
CL bumps up the default cache size to 256MB.

Change-Id: I756c62f4ee6b9c62b1a3e535f31e15a1ecc3d63f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292265
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2020-05-27 14:04:15 -06:00 committed by Skia Commit-Bot
parent f8cb055f92
commit 062d2d9a5d
2 changed files with 1 additions and 7 deletions

View File

@ -69,12 +69,6 @@
var grcontext = this.MakeGrContext(ctx);
if (grcontext) {
// Bump the default resource cache limit.
var RESOURCE_CACHE_BYTES = 256 * 1024 * 1024;
grcontext.setResourceCacheLimitBytes(RESOURCE_CACHE_BYTES);
}
// Note that canvas.width/height here is used because it gives the size of the buffer we're
// rendering into. This may not be the same size the element is displayed on the page, which
// constrolled by css, and available in canvas.clientWidth/height.

View File

@ -61,7 +61,7 @@ public:
~GrResourceCache();
// Default maximum number of bytes of gpu memory of budgeted resources in the cache.
static const size_t kDefaultMaxSize = 96 * (1 << 20);
static const size_t kDefaultMaxSize = 256 * (1 << 20);
/** Used to access functionality needed by GrGpuResource for lifetime management. */
class ResourceAccess;