Surface resource cache through cmdline flag

This lets us test out the memory-fallback code in the new
ops task reordering pathway on our bots.

Bug: skia:10877
Change-Id: Ic5662ef68e46b144eb2821687390c858d0056ba1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396157
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
diff --git a/tools/flags/CommonFlagsGpu.cpp b/tools/flags/CommonFlagsGpu.cpp
index 3d05713..092e838 100644
--- a/tools/flags/CommonFlagsGpu.cpp
+++ b/tools/flags/CommonFlagsGpu.cpp
@@ -39,6 +39,10 @@
 static DEFINE_bool(reduceOpsTaskSplitting, false, "Improve opsTask sorting");
 static DEFINE_bool(dontReduceOpsTaskSplitting, false, "Allow more opsTask splitting");
 
+static DEFINE_int(gpuResourceCacheLimit, -1,
+                  "Maximum number of bytes to use for budgeted GPU resources. "
+                  "Default is -1, which means GrResourceCache::kDefaultMaxSize.");
+
 static GpuPathRenderers get_named_pathrenderers_flags(const char* name) {
     if (!strcmp(name, "none")) {
         return GpuPathRenderers::kNone;
@@ -98,6 +102,7 @@
     ctxOptions->fGpuPathRenderers                    = collect_gpu_path_renderers_from_flags();
     ctxOptions->fInternalMultisampleCount            = FLAGS_internalSamples;
     ctxOptions->fDisableDriverCorrectnessWorkarounds = FLAGS_disableDriverCorrectnessWorkarounds;
+    ctxOptions->fResourceCacheLimitOverride          = FLAGS_gpuResourceCacheLimit;
 
     if (FLAGS_reduceOpsTaskSplitting) {
         SkASSERT(!FLAGS_dontReduceOpsTaskSplitting);