Make reducedShaderMode a shader cap

Allows GrProcessors to change behavior based on cap.

Bug: skia:11844
Change-Id: I4378c47c50a9bf33fa7461c6b9c522413e932bcd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395717
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 02a1220..a450c7a 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -56,11 +56,6 @@
     fReadPixelsRowBytesSupport = false;
     fShouldCollapseSrcOverToSrcWhenAble = false;
     fMustSyncGpuDuringAbandon = true;
-#if GR_TEST_UTILS
-    fReducedShaderMode = options.fReducedShaderVariations;
-#else
-    fReducedShaderMode = false;
-#endif
     fDriverDisableMSAAClipAtlas = false;
     fDisableTessellationPathRenderer = false;
 
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 4b09edb..a12dc99 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -160,9 +160,8 @@
         return fMustSyncGpuDuringAbandon;
     }
 
-    // Use a reduced set of rendering algorithms or less optimal effects in order to
-    // reduce the number of unique shaders generated.
-    bool reducedShaderMode() const { return fReducedShaderMode; }
+    // Shortcut for shaderCaps()->reducedShaderMode().
+    bool reducedShaderMode() const { return this->shaderCaps()->reducedShaderMode(); }
 
     /**
      * Indicates whether GPU->CPU memory mapping for GPU resources such as vertex buffers and
@@ -527,7 +526,6 @@
     bool fReadPixelsRowBytesSupport                  : 1;
     bool fShouldCollapseSrcOverToSrcWhenAble         : 1;
     bool fMustSyncGpuDuringAbandon                   : 1;
-    bool fReducedShaderMode : 1;
 
     // Driver workaround
     bool fDriverDisableMSAAClipAtlas                 : 1;
diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp
index d3bc02c..33d6e14 100644
--- a/src/gpu/GrShaderCaps.cpp
+++ b/src/gpu/GrShaderCaps.cpp
@@ -54,6 +54,7 @@
     fFloatIs32Bits = true;
     fHalfIs32Bits = false;
     fHasLowFragmentPrecision = false;
+    fReducedShaderMode = false;
     fColorSpaceMathNeedsFloat = false;
     fBuiltinFMASupport = false;
     fBuiltinDeterminantSupport = false;
@@ -189,5 +190,8 @@
         fMaxTessellationSegments = std::min(options.fMaxTessellationSegmentsOverride,
                                             fMaxTessellationSegments);
     }
+    if (options.fReducedShaderVariations) {
+        fReducedShaderMode = true;
+    }
 #endif
 }
diff --git a/src/gpu/GrShaderCaps.h b/src/gpu/GrShaderCaps.h
index 485522c..2ca11c8 100644
--- a/src/gpu/GrShaderCaps.h
+++ b/src/gpu/GrShaderCaps.h
@@ -84,6 +84,10 @@
 
     bool hasLowFragmentPrecision() const { return fHasLowFragmentPrecision; }
 
+    // Use a reduced set of rendering algorithms or less optimal effects in order to
+    // reduce the number of unique shaders generated.
+    bool reducedShaderMode() const { return fReducedShaderMode; }
+
     // SkSL only.
     bool builtinFMASupport() const { return fBuiltinFMASupport; }
 
@@ -282,6 +286,7 @@
     bool fFloatIs32Bits                     : 1;
     bool fHalfIs32Bits                      : 1;
     bool fHasLowFragmentPrecision           : 1;
+    bool fReducedShaderMode                 : 1;
 
     // Used by SkSL to know when to generate polyfills.
     bool fBuiltinFMASupport : 1;