Make GrCaps and GrShaderCaps private.

Moves getCaps() from GrContext to GrContextPriv and removes unused refCaps().

Change-Id: Ic6a8951b656c0d1b2773eae73bff8e88af819866
Reviewed-on: https://skia-review.googlesource.com/127389
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 99bea4f..a156ad6 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -439,10 +439,10 @@
 
         GrContextFactory factory(grContextOpts);
         if (const GrContext* ctx = factory.get(ctxType, ctxOverrides)) {
-            GrPixelConfig grPixConfig = SkImageInfo2GrPixelConfig(colorType, colorSpace,
-                                                                  *ctx->caps());
+            GrPixelConfig grPixConfig =
+                    SkImageInfo2GrPixelConfig(colorType, colorSpace, *ctx->contextPriv().caps());
             int supportedSampleCount =
-                    ctx->caps()->getRenderTargetSampleCount(sampleCount, grPixConfig);
+                    ctx->contextPriv().caps()->getRenderTargetSampleCount(sampleCount, grPixConfig);
             if (sampleCount != supportedSampleCount) {
                 SkDebugf("Configuration '%s' sample count %d is not a supported sample count.\n",
                          config->getTag().c_str(), sampleCount);
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 5c8ab96..2936493 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1497,7 +1497,7 @@
     sk_sp<SkSurface> surface;
 #if SK_SUPPORT_GPU
     GrContext* context = factory.getContextInfo(fContextType, fContextOverrides).grContext();
-    const int maxDimension = context->caps()->maxTextureSize();
+    const int maxDimension = context->contextPriv().caps()->maxTextureSize();
     if (maxDimension < SkTMax(size.width(), size.height())) {
         return Error::Nonfatal("Src too large to create a texture.\n");
     }
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 57caa46..226ce31 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -136,7 +136,7 @@
             return;
         }
 
-        if (!context->caps()->shaderCaps()->floatIs32Bits()) {
+        if (!context->contextPriv().caps()->shaderCaps()->floatIs32Bits()) {
             SkPaint paint;
             sk_tool_utils::set_portable_typeface(&paint);
             paint.setAntiAlias(true);
@@ -224,9 +224,9 @@
 
 
                     bool flipKL = (c == loopIndex && cnt != 3);
-                    sk_sp<GrGeometryProcessor> gp = GrCubicEffect::Make(color, SkMatrix::I(), klm,
-                                                                        flipKL, edgeType,
-                                                                        *context->caps());
+                    sk_sp<GrGeometryProcessor> gp =
+                            GrCubicEffect::Make(color, SkMatrix::I(), klm, flipKL, edgeType,
+                                                *context->contextPriv().caps());
                     if (!gp) {
                         break;
                     }
@@ -358,8 +358,8 @@
             for(int edgeType = 0; edgeType < kGrClipEdgeTypeCnt; ++edgeType) {
                 sk_sp<GrGeometryProcessor> gp;
                 GrClipEdgeType et = (GrClipEdgeType)edgeType;
-                gp = GrConicEffect::Make(color, SkMatrix::I(), et,
-                                         *context->caps(), SkMatrix::I(), false);
+                gp = GrConicEffect::Make(color, SkMatrix::I(), et, *context->contextPriv().caps(),
+                                         SkMatrix::I(), false);
                 if (!gp) {
                     continue;
                 }
@@ -566,8 +566,8 @@
             for(int edgeType = 0; edgeType < kGrClipEdgeTypeCnt; ++edgeType) {
                 sk_sp<GrGeometryProcessor> gp;
                 GrClipEdgeType et = (GrClipEdgeType)edgeType;
-                gp = GrQuadEffect::Make(color, SkMatrix::I(), et,
-                                        *context->caps(), SkMatrix::I(), false);
+                gp = GrQuadEffect::Make(color, SkMatrix::I(), et, *context->contextPriv().caps(),
+                                        SkMatrix::I(), false);
                 if (!gp) {
                     continue;
                 }
diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp
index a5d77fc..6f75344 100644
--- a/gm/bigrrectaaeffect.cpp
+++ b/gm/bigrrectaaeffect.cpp
@@ -8,6 +8,7 @@
 #include "gm.h"
 #include "sk_tool_utils.h"
 #if SK_SUPPORT_GPU
+#include "GrCaps.h"
 #include "GrContext.h"
 #include "GrRenderTargetContextPriv.h"
 #include "SkRRect.h"
diff --git a/gm/bitmapshader.cpp b/gm/bitmapshader.cpp
index 98205d2..3f3c51e 100644
--- a/gm/bitmapshader.cpp
+++ b/gm/bitmapshader.cpp
@@ -5,12 +5,17 @@
  * found in the LICENSE file.
  */
 #include "gm.h"
-#include "sk_tool_utils.h"
 
 #include "SkBitmap.h"
 #include "SkPaint.h"
 #include "SkShader.h"
+#include "sk_tool_utils.h"
+
+#if SK_SUPPORT_GPU
+#include "GrCaps.h"
 #include "GrContext.h"
+#include "GrContextPriv.h"
+#endif
 
 namespace skiagm {
 
@@ -116,9 +121,11 @@
     // (See https://skia-review.googlesource.com/c/skia/+/73200)
     int bitmapW = 1;
     int bitmapH = 60000;
+#if SK_SUPPORT_GPU
     if (auto* ctx = canvas->getGrContext()) {
-        bitmapH = ctx->caps()->maxTextureSize() + 1;
+        bitmapH = ctx->contextPriv().caps()->maxTextureSize() + 1;
     }
+#endif
     bitmap.setInfo(SkImageInfo::MakeA8(bitmapW, bitmapH), bitmapW);
     uint8_t* pixels = new uint8_t[bitmapH];
     for(int i = 0; i < bitmapH; ++i) {
diff --git a/gm/rrects.cpp b/gm/rrects.cpp
index dfeebf3..d6b5291 100644
--- a/gm/rrects.cpp
+++ b/gm/rrects.cpp
@@ -8,6 +8,7 @@
 #include "gm.h"
 #include "sk_tool_utils.h"
 #if SK_SUPPORT_GPU
+#include "GrCaps.h"
 #include "GrContext.h"
 #include "GrRenderTargetContextPriv.h"
 #include "effects/GrRRectEffect.h"
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index b6d7cba..e5e2627 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -91,7 +91,7 @@
         GrSurfaceDesc desc;
         desc.fWidth = fBmp.width();
         desc.fHeight = fBmp.height();
-        desc.fConfig = SkImageInfo2GrPixelConfig(fBmp.info(), *context->caps());
+        desc.fConfig = SkImageInfo2GrPixelConfig(fBmp.info(), *context->contextPriv().caps());
         SkASSERT(kUnknown_GrPixelConfig != desc.fConfig);
 
         sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp
index c427b1a..d03cf6d 100644
--- a/gm/windowrectangles.cpp
+++ b/gm/windowrectangles.cpp
@@ -11,13 +11,15 @@
 #include "SkRRect.h"
 
 #if SK_SUPPORT_GPU
-#  include "GrAppliedClip.h"
-#  include "GrStencilClip.h"
-#  include "GrReducedClip.h"
-#  include "GrRenderTargetContext.h"
-#  include "GrRenderTargetContextPriv.h"
-#  include "GrResourceProvider.h"
-#  include "effects/GrTextureDomain.h"
+#include "GrAppliedClip.h"
+#include "GrCaps.h"
+#include "GrContextPriv.h"
+#include "GrReducedClip.h"
+#include "GrRenderTargetContext.h"
+#include "GrRenderTargetContextPriv.h"
+#include "GrResourceProvider.h"
+#include "GrStencilClip.h"
+#include "effects/GrTextureDomain.h"
 #endif
 
 constexpr static SkIRect kDeviceRect = {0, 0, 600, 600};
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index 74c11a9..0c69ec0 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -90,7 +90,8 @@
             GrSurfaceDesc desc;
             desc.fWidth = fBmp[i].width();
             desc.fHeight = fBmp[i].height();
-            desc.fConfig = SkImageInfo2GrPixelConfig(fBmp[i].info(), *context->caps());
+            desc.fConfig =
+                    SkImageInfo2GrPixelConfig(fBmp[i].info(), *context->contextPriv().caps());
             SkASSERT(kUnknown_GrPixelConfig != desc.fConfig);
 
             proxy[i] = proxyProvider->createTextureProxy(desc, SkBudgeted::kYes,
@@ -216,7 +217,8 @@
             GrSurfaceDesc desc;
             desc.fWidth = fBmp[index].width();
             desc.fHeight = fBmp[index].height();
-            desc.fConfig = SkImageInfo2GrPixelConfig(fBmp[index].info(), *context->caps());
+            desc.fConfig =
+                    SkImageInfo2GrPixelConfig(fBmp[index].info(), *context->contextPriv().caps());
             SkASSERT(kUnknown_GrPixelConfig != desc.fConfig);
 
             proxy[i] = proxyProvider->createTextureProxy(
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 8f0d04b..136bade 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -11,14 +11,12 @@
   "$_include/gpu/GrBackendSemaphore.h",
   "$_include/gpu/GrBackendSurface.h",
   "$_include/gpu/GrBlend.h",
-  "$_include/gpu/GrCaps.h",
   "$_include/gpu/GrConfig.h",
   "$_include/gpu/GrContextOptions.h",
   "$_include/gpu/GrContext.h",
   "$_include/gpu/GrGpuResource.h",
   "$_include/gpu/GrRenderTarget.h",
   "$_include/gpu/GrResourceKey.h",
-  "$_include/gpu/GrShaderCaps.h",
   "$_include/gpu/GrSurface.h",
   "$_include/gpu/GrTexture.h",
   "$_include/gpu/GrSamplerState.h",
@@ -62,6 +60,7 @@
   "$_src/gpu/GrBuffer.h",
   "$_src/gpu/GrBufferAllocPool.cpp",
   "$_src/gpu/GrBufferAllocPool.h",
+  "$_src/gpu/GrCaps.h",
   "$_src/gpu/GrCaps.cpp",
   "$_src/gpu/GrClip.h",
   "$_src/gpu/GrClipStackClip.h",
@@ -175,6 +174,7 @@
   "$_src/gpu/GrResourceProviderPriv.h",
   "$_src/gpu/GrScissorState.h",
   "$_src/gpu/GrSemaphore.h",
+  "$_src/gpu/GrShaderCaps.h",
   "$_src/gpu/GrShaderCaps.cpp",
   "$_src/gpu/GrShape.cpp",
   "$_src/gpu/GrShape.h",
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 89e8052..b8c0634 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -8,7 +8,6 @@
 #ifndef GrContext_DEFINED
 #define GrContext_DEFINED
 
-#include "GrCaps.h"
 #include "SkMatrix.h"
 #include "SkPathEffect.h"
 #include "SkTypes.h"
@@ -19,6 +18,7 @@
 class GrAtlasManager;
 class GrBackendFormat;
 class GrBackendSemaphore;
+class GrCaps;
 class GrContextPriv;
 class GrContextThreadSafeProxy;
 class GrContextThreadSafeProxyPriv;
@@ -204,9 +204,6 @@
      */
     void purgeUnlockedResources(bool scratchResourcesOnly);
 
-    /** Access the context capabilities */
-    const GrCaps* caps() const { return fCaps.get(); }
-
     /**
      * Gets the maximum supported texture size.
      */
@@ -416,12 +413,7 @@
     GrContextThreadSafeProxy(sk_sp<const GrCaps> caps,
                              uint32_t uniqueID,
                              GrBackend backend,
-                             const GrContextOptions& options)
-        : fCaps(std::move(caps))
-        , fContextUniqueID(uniqueID)
-        , fBackend(backend)
-        , fOptions(options) {
-    }
+                             const GrContextOptions& options);
 
     sk_sp<const GrCaps>    fCaps;
     const uint32_t         fContextUniqueID;
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp
index c1a21b0..39f0c1b 100644
--- a/src/atlastext/SkAtlasTextTarget.cpp
+++ b/src/atlastext/SkAtlasTextTarget.cpp
@@ -148,7 +148,7 @@
     if (op->maskType() != GrAtlasTextOp::kGrayscaleDistanceField_MaskType) {
         return;
     }
-    const GrCaps& caps = *this->context()->internal().grContext()->caps();
+    const GrCaps& caps = *this->context()->internal().grContext()->contextPriv().caps();
     op->finalizeForTextTarget(fColor, caps);
     int n = SkTMin(kMaxBatchLookBack, fOps.count());
     for (int i = 0; i < n; ++i) {
diff --git a/src/core/SkBlurMF.cpp b/src/core/SkBlurMF.cpp
index b75fd16..d716c33 100644
--- a/src/core/SkBlurMF.cpp
+++ b/src/core/SkBlurMF.cpp
@@ -21,6 +21,7 @@
 #if SK_SUPPORT_GPU
 #include "GrClip.h"
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "GrFragmentProcessor.h"
 #include "GrRenderTargetContext.h"
 #include "GrResourceProvider.h"
@@ -758,8 +759,8 @@
         SkScalar pad = 3.0f * xformedSigma;
         rect.outset(pad, pad);
 
-        fp = GrRectBlurEffect::Make(proxyProvider, *context->caps()->shaderCaps(), rect,
-                                    xformedSigma);
+        fp = GrRectBlurEffect::Make(proxyProvider, *context->contextPriv().caps()->shaderCaps(),
+                                    rect, xformedSigma);
     } else if (path.isOval(&rect) && SkScalarNearlyEqual(rect.width(), rect.height())) {
         fp = GrCircleBlurFragmentProcessor::Make(proxyProvider, rect, xformedSigma);
 
@@ -812,7 +813,7 @@
             SkScalar pad = 3.0f * xformedSigma;
             const SkRect dstCoverageRect = devRRect.rect().makeOutset(pad, pad);
 
-            fp = GrRectBlurEffect::Make(proxyProvider, *context->caps()->shaderCaps(),
+            fp = GrRectBlurEffect::Make(proxyProvider, *context->contextPriv().caps()->shaderCaps(),
                                         dstCoverageRect, xformedSigma);
         } else {
             fp = GrCircleBlurFragmentProcessor::Make(proxyProvider,
diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp
index d390228..d13fd39 100644
--- a/src/core/SkDeferredDisplayListRecorder.cpp
+++ b/src/core/SkDeferredDisplayListRecorder.cpp
@@ -102,11 +102,11 @@
     // DDL is being replayed into.
 
     GrInternalSurfaceFlags surfaceFlags = GrInternalSurfaceFlags::kNone;
-    if (fContext->caps()->usesMixedSamples() && desc.fSampleCnt > 1 && !usesGLFBO0) {
+    if (fContext->contextPriv().caps()->usesMixedSamples() && desc.fSampleCnt > 1 && !usesGLFBO0) {
         // In GL, FBO 0 never supports mixed samples
         surfaceFlags |= GrInternalSurfaceFlags::kMixedSampled;
     }
-    if (fContext->caps()->maxWindowRectangles() > 0 && !usesGLFBO0) {
+    if (fContext->contextPriv().caps()->maxWindowRectangles() > 0 && !usesGLFBO0) {
         // In GL, FBO 0 never supports window rectangles
         surfaceFlags |= GrInternalSurfaceFlags::kWindowRectsSupport;
     }
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index c75ff3e..a2f95ad 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -455,7 +455,7 @@
 
     int scaleFactorX, radiusX;
     int scaleFactorY, radiusY;
-    int maxTextureSize = context->caps()->maxTextureSize();
+    int maxTextureSize = context->contextPriv().caps()->maxTextureSize();
     sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX);
     sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY);
     SkASSERT(sigmaX || sigmaY);
diff --git a/src/core/SkSurfaceCharacterization.cpp b/src/core/SkSurfaceCharacterization.cpp
index 74160d2..d71559f 100644
--- a/src/core/SkSurfaceCharacterization.cpp
+++ b/src/core/SkSurfaceCharacterization.cpp
@@ -8,6 +8,7 @@
 #include "SkSurfaceCharacterization.h"
 
 #if SK_SUPPORT_GPU
+#include "GrCaps.h"
 #include "GrContextThreadSafeProxyPriv.h"
 
 bool SkSurfaceCharacterization::operator==(const SkSurfaceCharacterization& other) const {
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 8cf3728..47d6ae2 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -443,7 +443,7 @@
     desc.fWidth  = bitmap.width();
     desc.fHeight = 128;
     desc.fRowHeight = bitmap.height();
-    desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *context->caps());
+    desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *context->contextPriv().caps());
 
     if (kUnknown_GrPixelConfig == desc.fConfig) {
         return nullptr;
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 3835bfa..3ec773d 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -44,8 +44,8 @@
     context->contextPriv().getResourceCache()->insertCrossContextGpuResource(texture.get());
 
     GrBackendTexture backendTexture = texture->getBackendTexture();
-    if (!context->caps()->validateBackendTexture(backendTexture, colorType,
-                                                 &backendTexture.fConfig)) {
+    if (!context->contextPriv().caps()->validateBackendTexture(backendTexture, colorType,
+                                                               &backendTexture.fConfig)) {
         return nullptr;
     }
 
diff --git a/include/gpu/GrCaps.h b/src/gpu/GrCaps.h
similarity index 98%
rename from include/gpu/GrCaps.h
rename to src/gpu/GrCaps.h
index 0e81e23..5858afa 100644
--- a/include/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -139,7 +139,10 @@
 
     /** This is the maximum tile size to use by GPU devices for rendering sw-backed images/bitmaps.
         It is usually the max texture size, unless we're overriding it for testing. */
-    int maxTileSize() const { SkASSERT(fMaxTileSize <= fMaxTextureSize); return fMaxTileSize; }
+    int maxTileSize() const {
+        SkASSERT(fMaxTileSize <= fMaxTextureSize);
+        return fMaxTileSize;
+    }
 
     int maxRasterSamples() const { return fMaxRasterSamples; }
 
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index f5c08f0..92a6d04 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -117,14 +117,14 @@
 
         GrShape shape(path, GrStyle::SimpleFill());
         GrPathRenderer::CanDrawPathArgs canDrawArgs;
-        canDrawArgs.fCaps = context->caps();
+        canDrawArgs.fCaps = context->contextPriv().caps();
         canDrawArgs.fClipConservativeBounds = &scissorRect;
         canDrawArgs.fViewMatrix = &viewMatrix;
         canDrawArgs.fShape = &shape;
         canDrawArgs.fAAType = GrChooseAAType(GrAA(element->isAA()),
                                              renderTargetContext->fsaaType(),
                                              GrAllowMixedSamples::kYes,
-                                             *context->caps());
+                                             *context->contextPriv().caps());
         canDrawArgs.fHasUserStencilSettings = hasUserStencilSettings;
 
         // the 'false' parameter disallows use of the SW path renderer
@@ -151,8 +151,9 @@
     // of whether it would invoke the GrSoftwarePathRenderer.
 
     // If we're avoiding stencils, always use SW:
-    if (context->caps()->avoidStencilBuffers())
+    if (context->contextPriv().caps()->avoidStencilBuffers()) {
         return true;
+    }
 
     // Set the matrix so that rendered clip elements are transformed to mask space from clip
     // space.
@@ -191,9 +192,9 @@
     }
 
     GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
-    const auto* caps = context->caps()->shaderCaps();
+    const auto* caps = context->contextPriv().caps()->shaderCaps();
     int maxWindowRectangles = renderTargetContext->priv().maxWindowRectangles();
-    int maxAnalyticFPs = context->caps()->maxClipAnalyticFPs();
+    int maxAnalyticFPs = context->contextPriv().caps()->maxClipAnalyticFPs();
     if (GrFSAAType::kNone != renderTargetContext->fsaaType()) {
         // With mixed samples (non-msaa color buffer), any coverage info is lost from color once it
         // hits the color buffer anyway, so we may as well use coverage AA if nothing else in the
@@ -201,7 +202,8 @@
         if (renderTargetContext->numColorSamples() > 1 || useHWAA || hasUserStencilSettings) {
             maxAnalyticFPs = 0;
         }
-        SkASSERT(!context->caps()->avoidStencilBuffers()); // We disable MSAA when avoiding stencil.
+        // We disable MSAA when avoiding stencil.
+        SkASSERT(!context->contextPriv().caps()->avoidStencilBuffers());
     }
     auto* ccpr = context->contextPriv().drawingManager()->getCoverageCountingPathRenderer();
 
@@ -253,7 +255,7 @@
 
     // If the stencil buffer is multisampled we can use it to do everything.
     if ((GrFSAAType::kNone == renderTargetContext->fsaaType() && reducedClip.maskRequiresAA()) ||
-        context->caps()->avoidStencilBuffers()) {
+        context->contextPriv().caps()->avoidStencilBuffers()) {
         sk_sp<GrTextureProxy> result;
         if (UseSWOnlyPath(context, hasUserStencilSettings, renderTargetContext, reducedClip)) {
             // The clip geometry is complex enough that it will be more efficient to create it
@@ -272,7 +274,7 @@
 
         // If alpha or software clip mask creation fails, fall through to the stencil code paths,
         // unless stencils are disallowed.
-        if (context->caps()->avoidStencilBuffers()) {
+        if (context->contextPriv().caps()->avoidStencilBuffers()) {
             SkDebugf("WARNING: Clip mask requires stencil, but stencil unavailable. "
                      "Clip will be ignored.\n");
             return false;
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 499c711..3bb5b3a 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -163,6 +163,16 @@
     delete fGlyphCache;
 }
 
+//////////////////////////////////////////////////////////////////////////////
+
+GrContextThreadSafeProxy::GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t uniqueID,
+                                                   GrBackend backend,
+                                                   const GrContextOptions& options)
+        : fCaps(std::move(caps))
+        , fContextUniqueID(uniqueID)
+        , fBackend(backend)
+        , fOptions(options) {}
+
 sk_sp<GrContextThreadSafeProxy> GrContext::threadSafeProxy() {
     return fThreadSafeProxy;
 }
@@ -314,18 +324,18 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-int GrContext::maxTextureSize() const { return this->caps()->maxTextureSize(); }
+int GrContext::maxTextureSize() const { return fCaps->maxTextureSize(); }
 
-int GrContext::maxRenderTargetSize() const { return this->caps()->maxRenderTargetSize(); }
+int GrContext::maxRenderTargetSize() const { return fCaps->maxRenderTargetSize(); }
 
 bool GrContext::colorTypeSupportedAsImage(SkColorType colorType) const {
-    GrPixelConfig config = SkImageInfo2GrPixelConfig(colorType, nullptr, *this->caps());
-    return this->caps()->isConfigTexturable(config);
+    GrPixelConfig config = SkImageInfo2GrPixelConfig(colorType, nullptr, *fCaps);
+    return fCaps->isConfigTexturable(config);
 }
 
 int GrContext::maxSurfaceSampleCountForColorType(SkColorType colorType) const {
-    GrPixelConfig config = SkImageInfo2GrPixelConfig(colorType, nullptr, *this->caps());
-    return this->caps()->maxRenderTargetSampleCount(config);
+    GrPixelConfig config = SkImageInfo2GrPixelConfig(colorType, nullptr, *fCaps);
+    return fCaps->maxRenderTargetSampleCount(config);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -574,7 +584,7 @@
     GrGpu::WritePixelTempDrawInfo tempDrawInfo;
     GrSRGBConversion srgbConversion = determine_write_pixels_srgb_conversion(
             srcColorType, srcColorSpace, GrPixelConfigIsSRGBEncoded(dstProxy->config()),
-            dst->colorSpaceInfo().colorSpace(), *fContext->caps());
+            dst->colorSpaceInfo().colorSpace(), *fContext->contextPriv().caps());
     if (!fContext->fGpu->getWritePixelsInfo(dstSurface, dstProxy->origin(), width, height,
                                             srcColorType, srgbConversion, &drawPreference,
                                             &tempDrawInfo)) {
@@ -743,7 +753,7 @@
     GrGpu::ReadPixelTempDrawInfo tempDrawInfo;
     GrSRGBConversion srgbConversion = determine_read_pixels_srgb_conversion(
             GrPixelConfigIsSRGBEncoded(srcProxy->config()), src->colorSpaceInfo().colorSpace(),
-            dstColorType, dstColorSpace, *fContext->caps());
+            dstColorType, dstColorSpace, *fContext->contextPriv().caps());
 
     if (!fContext->fGpu->getReadPixelsInfo(srcSurface, srcProxy->origin(), width, height, rowBytes,
                                            dstColorType, srgbConversion, &drawPreference,
@@ -895,10 +905,11 @@
             (dstProxy->config() == kRGBA_8888_GrPixelConfig ||
              dstProxy->config() == kBGRA_8888_GrPixelConfig) &&
             !(pixelOpsFlags & kDontFlush_PixelOpsFlag) &&
-            fContext->caps()->isConfigTexturable(kRGBA_8888_GrPixelConfig) &&
+            fContext->contextPriv().caps()->isConfigTexturable(kRGBA_8888_GrPixelConfig) &&
             fContext->validPMUPMConversionExists();
 
-    if (!fContext->caps()->surfaceSupportsWritePixels(dstSurface) || canvas2DFastPath) {
+    if (!fContext->contextPriv().caps()->surfaceSupportsWritePixels(dstSurface) ||
+        canvas2DFastPath) {
         // We don't expect callers that are skipping flushes to require an intermediate draw.
         SkASSERT(!(pixelOpsFlags & kDontFlush_PixelOpsFlag));
         if (pixelOpsFlags & kDontFlush_PixelOpsFlag) {
@@ -957,8 +968,8 @@
         return false;
     }
 
-    GrColorType allowedColorType =
-            fContext->caps()->supportedWritePixelsColorType(dstProxy->config(), srcColorType);
+    GrColorType allowedColorType = fContext->contextPriv().caps()->supportedWritePixelsColorType(
+            dstProxy->config(), srcColorType);
     convert = convert || (srcColorType != allowedColorType);
 
     if (!dst->colorSpaceInfo().colorSpace()) {
@@ -1071,10 +1082,11 @@
             SkToBool(srcProxy->asTextureProxy()) &&
             (srcProxy->config() == kRGBA_8888_GrPixelConfig ||
              srcProxy->config() == kBGRA_8888_GrPixelConfig) &&
-            fContext->caps()->isConfigRenderable(kRGBA_8888_GrPixelConfig) &&
+            fContext->contextPriv().caps()->isConfigRenderable(kRGBA_8888_GrPixelConfig) &&
             fContext->validPMUPMConversionExists();
 
-    if (!fContext->caps()->surfaceSupportsReadPixels(srcSurface) || canvas2DFastPath) {
+    if (!fContext->contextPriv().caps()->surfaceSupportsReadPixels(srcSurface) ||
+        canvas2DFastPath) {
         GrSurfaceDesc desc;
         desc.fFlags = canvas2DFastPath ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
         desc.fConfig = canvas2DFastPath ? kRGBA_8888_GrPixelConfig : srcProxy->config();
@@ -1132,8 +1144,8 @@
         top = srcSurface->height() - top - height;
     }
 
-    GrColorType allowedColorType =
-            fContext->caps()->supportedReadPixelsColorType(srcProxy->config(), dstColorType);
+    GrColorType allowedColorType = fContext->contextPriv().caps()->supportedReadPixelsColorType(
+            srcProxy->config(), dstColorType);
     convert = convert || (dstColorType != allowedColorType);
 
     if (!src->colorSpaceInfo().colorSpace()) {
@@ -1392,7 +1404,7 @@
                                                                  const SkSurfaceProps* surfaceProps,
                                                                  SkBudgeted budgeted) {
     SkASSERT(sampleCnt > 0);
-    if (0 == fContext->caps()->getRenderTargetSampleCount(sampleCnt, config)) {
+    if (0 == fContext->contextPriv().caps()->getRenderTargetSampleCount(sampleCnt, config)) {
         config = GrPixelConfigFallback(config);
     }
 
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 61ff3c1..7e6ecb8 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -30,6 +30,8 @@
      */
     static sk_sp<GrContext> MakeDDL(const sk_sp<GrContextThreadSafeProxy>&);
 
+    const GrCaps* caps() const { return fContext->fCaps.get(); }
+
     GrDrawingManager* drawingManager() { return fContext->fDrawingManager.get(); }
 
     sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>,
diff --git a/src/gpu/GrDDLContext.cpp b/src/gpu/GrDDLContext.cpp
index 5ed65ea..1ae640c 100644
--- a/src/gpu/GrDDLContext.cpp
+++ b/src/gpu/GrDDLContext.cpp
@@ -6,6 +6,7 @@
  */
 
 #include "GrContext.h"
+#include "GrCaps.h"
 #include "GrContextPriv.h"
 #include "GrContextThreadSafeProxyPriv.h"
 
diff --git a/src/gpu/GrDrawOpTest.cpp b/src/gpu/GrDrawOpTest.cpp
index 7aba424..d14e5b5 100644
--- a/src/gpu/GrDrawOpTest.cpp
+++ b/src/gpu/GrDrawOpTest.cpp
@@ -8,6 +8,7 @@
 #include "GrDrawOpTest.h"
 #include "GrCaps.h"
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "GrUserStencilSettings.h"
 #include "SkRandom.h"
 #include "SkTypes.h"
@@ -15,7 +16,7 @@
 #if GR_TEST_UTILS
 
 const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext* context) {
-    if (context->caps()->avoidStencilBuffers()) {
+    if (context->contextPriv().caps()->avoidStencilBuffers()) {
         return &GrUserStencilSettings::kUnused;
     }
     static constexpr GrUserStencilSettings kReads(
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index ffacf55..de414ae 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -6,7 +6,6 @@
  */
 
 #include "GrDrawingManager.h"
-
 #include "GrBackendSemaphore.h"
 #include "GrContext.h"
 #include "GrContextPriv.h"
@@ -23,11 +22,9 @@
 #include "GrTextureOpList.h"
 #include "GrTextureProxy.h"
 #include "GrTextureProxyPriv.h"
-
 #include "SkDeferredDisplayList.h"
 #include "SkSurface_Gpu.h"
 #include "SkTTopoSort.h"
-
 #include "GrTracing.h"
 #include "text/GrAtlasTextContext.h"
 
@@ -65,7 +62,7 @@
 void GrDrawingManager::cleanup() {
     for (int i = 0; i < fOpLists.count(); ++i) {
         // no opList should receive a new command after this
-        fOpLists[i]->makeClosed(*fContext->caps());
+        fOpLists[i]->makeClosed(*fContext->contextPriv().caps());
 
         // We shouldn't need to do this, but it turns out some clients still hold onto opLists
         // after a cleanup.
@@ -130,7 +127,7 @@
         // needs to flush mid-draw. In that case, the SkGpuDevice's GrOpLists won't be closed
         // but need to be flushed anyway. Closing such GrOpLists here will mean new
         // GrOpLists will be created to replace them if the SkGpuDevice(s) write to them again.
-        fOpLists[i]->makeClosed(*fContext->caps());
+        fOpLists[i]->makeClosed(*fContext->contextPriv().caps());
     }
 
 #ifdef SK_DEBUG
@@ -186,7 +183,7 @@
                     SkASSERT(GrSurfaceProxy::LazyState::kNot == p->lazyInstantiationState());
                 });
 #endif
-                onFlushOpList->makeClosed(*fContext->caps());
+                onFlushOpList->makeClosed(*fContext->contextPriv().caps());
                 onFlushOpList->prepare(&flushState);
                 fOnFlushCBOpLists.push_back(std::move(onFlushOpList));
             }
@@ -380,7 +377,7 @@
 void GrDrawingManager::moveOpListsToDDL(SkDeferredDisplayList* ddl) {
     for (int i = 0; i < fOpLists.count(); ++i) {
         // no opList should receive a new command after this
-        fOpLists[i]->makeClosed(*fContext->caps());
+        fOpLists[i]->makeClosed(*fContext->contextPriv().caps());
     }
 
     ddl->fOpLists = std::move(fOpLists);
@@ -402,7 +399,7 @@
     // so ops that (in the single opList world) would've just glommed onto the end of the single
     // opList but referred to a far earlier RT need to appear in their own opList.
     if (!fOpLists.empty()) {
-        fOpLists.back()->makeClosed(*fContext->caps());
+        fOpLists.back()->makeClosed(*fContext->contextPriv().caps());
     }
 
     auto resourceProvider = fContext->contextPriv().resourceProvider();
@@ -427,7 +424,7 @@
     // so ops that (in the single opList world) would've just glommed onto the end of the single
     // opList but referred to a far earlier RT need to appear in their own opList.
     if (!fOpLists.empty()) {
-        fOpLists.back()->makeClosed(*fContext->caps());
+        fOpLists.back()->makeClosed(*fContext->contextPriv().caps());
     }
 
     sk_sp<GrTextureOpList> opList(new GrTextureOpList(fContext->contextPriv().resourceProvider(),
@@ -502,7 +499,7 @@
 
     // SkSurface catches bad color space usage at creation. This check handles anything that slips
     // by, including internal usage.
-    if (!SkSurface_Gpu::Valid(fContext->caps(), sProxy->config(), colorSpace.get())) {
+    if (!SkSurface_Gpu::Valid(fContext->contextPriv().caps(), sProxy->config(), colorSpace.get())) {
         SkDEBUGFAIL("Invalid config and colorspace combination");
         return nullptr;
     }
@@ -525,7 +522,7 @@
 
     // SkSurface catches bad color space usage at creation. This check handles anything that slips
     // by, including internal usage.
-    if (!SkSurface_Gpu::Valid(fContext->caps(), sProxy->config(), colorSpace.get())) {
+    if (!SkSurface_Gpu::Valid(fContext->contextPriv().caps(), sProxy->config(), colorSpace.get())) {
         SkDEBUGFAIL("Invalid config and colorspace combination");
         return nullptr;
     }
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp
index 5bf81d2..920415f 100644
--- a/src/gpu/GrImageTextureMaker.cpp
+++ b/src/gpu/GrImageTextureMaker.cpp
@@ -6,12 +6,12 @@
  */
 
 #include "GrImageTextureMaker.h"
-
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "GrGpuResourcePriv.h"
 #include "SkGr.h"
-#include "SkImage_Base.h"
 #include "SkImageCacherator.h"
+#include "SkImage_Base.h"
 #include "SkPixelRef.h"
 
 GrImageTextureMaker::GrImageTextureMaker(GrContext* context, const SkImage* client,
@@ -36,7 +36,7 @@
                                       SkColorSpace* dstColorSpace) {
     if (fOriginalKey.isValid() && SkImage::kAllow_CachingHint == fCachingHint) {
         SkImageCacherator::CachedFormat cacheFormat =
-            fCacher->chooseCacheFormat(dstColorSpace, this->context()->caps());
+                fCacher->chooseCacheFormat(dstColorSpace, this->context()->contextPriv().caps());
         GrUniqueKey cacheKey;
         fCacher->makeCacheKeyFromOrigKey(fOriginalKey, cacheFormat, &cacheKey);
         MakeCopyKeyFromOrigKey(cacheKey, stretch, paramsCopyKey);
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index d892dee..9e2e1fe 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -115,5 +115,5 @@
 }
 
 const GrCaps* GrOnFlushResourceProvider::caps() const {
-    return fDrawingMgr->getContext()->caps();
+    return fDrawingMgr->getContext()->contextPriv().caps();
 }
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index c5a1f63..39208bc 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -9,18 +9,17 @@
 #define GrPathRenderer_DEFINED
 
 #include "GrCaps.h"
-#include "GrRenderTargetContext.h"
+#include "GrContextPriv.h"
 #include "GrPaint.h"
+#include "GrRenderTargetContext.h"
 #include "GrShape.h"
 #include "GrUserStencilSettings.h"
-
 #include "SkDrawProcs.h"
 #include "SkTArray.h"
 
 class SkPath;
 class GrFixedClip;
 class GrHardClip;
-struct GrPoint;
 
 /**
  *  Base class for drawing paths into a GrOpList.
@@ -138,7 +137,7 @@
         SkDEBUGCODE(args.validate();)
 #ifdef SK_DEBUG
         CanDrawPathArgs canArgs;
-        canArgs.fCaps = args.fContext->caps();
+        canArgs.fCaps = args.fContext->contextPriv().caps();
         canArgs.fClipConservativeBounds = args.fClipConservativeBounds;
         canArgs.fViewMatrix = args.fViewMatrix;
         canArgs.fShape = args.fShape;
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index bc77634..4dc814e 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -7,15 +7,12 @@
 
 
 #include "GrPathRendererChain.h"
-
 #include "GrCaps.h"
 #include "GrShaderCaps.h"
 #include "GrContext.h"
 #include "GrContextPriv.h"
 #include "GrGpu.h"
-
 #include "ccpr/GrCoverageCountingPathRenderer.h"
-
 #include "ops/GrAAConvexPathRenderer.h"
 #include "ops/GrAAHairLinePathRenderer.h"
 #include "ops/GrAALinearizingConvexPathRenderer.h"
@@ -26,7 +23,7 @@
 #include "ops/GrTessellatingPathRenderer.h"
 
 GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& options) {
-    const GrCaps& caps = *context->caps();
+    const GrCaps& caps = *context->contextPriv().caps();
     if (options.fGpuPathRenderers & GpuPathRenderers::kDashLine) {
         fChain.push_back(sk_make_sp<GrDashLinePathRenderer>());
     }
@@ -43,8 +40,8 @@
 
     if (options.fGpuPathRenderers & GpuPathRenderers::kCoverageCounting) {
         bool drawCachablePaths = !options.fAllowPathMaskCaching;
-        if (auto ccpr = GrCoverageCountingPathRenderer::CreateIfSupported(*context->caps(),
-                                                                          drawCachablePaths)) {
+        if (auto ccpr =
+                    GrCoverageCountingPathRenderer::CreateIfSupported(caps, drawCachablePaths)) {
             fCoverageCountingPathRenderer = ccpr.get();
             context->contextPriv().addOnFlushCallbackObject(fCoverageCountingPathRenderer);
             fChain.push_back(std::move(ccpr));
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 2b02b8d..561fd4f 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -25,9 +25,7 @@
     return fContext->contextPriv().proxyProvider();
 }
 
-const GrCaps* GrProcessorTestData::caps() {
-    return fContext->caps();
-}
+const GrCaps* GrProcessorTestData::caps() { return fContext->contextPriv().caps(); }
 
 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
 class GrFragmentProcessor;
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 1c5150c..e6cd6b3 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -847,7 +847,7 @@
 
             GrShape shape(clipPath, GrStyle::SimpleFill());
             GrPathRenderer::CanDrawPathArgs canDrawArgs;
-            canDrawArgs.fCaps = context->caps();
+            canDrawArgs.fCaps = context->contextPriv().caps();
             canDrawArgs.fClipConservativeBounds = &stencilClip.fixedClip().scissorRect();
             canDrawArgs.fViewMatrix = &SkMatrix::I();
             canDrawArgs.fShape = &shape;
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 6d8f6cd..c447a5c 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -340,7 +340,7 @@
     if (!clip.hasWindowRectangles()) {
         isFull = !clip.scissorEnabled() ||
                  (CanClearFullscreen::kYes == canClearFullscreen &&
-                  fContext->caps()->preferFullscreenClears()) ||
+                  this->caps()->preferFullscreenClears()) ||
                  clip.scissorRect().contains(SkIRect::MakeWH(this->width(), this->height()));
     }
 
@@ -589,7 +589,7 @@
 
 int GrRenderTargetContextPriv::maxWindowRectangles() const {
     return fRenderTargetContext->fRenderTargetProxy->maxWindowRectangles(
-                                                    *fRenderTargetContext->fContext->caps());
+            *fRenderTargetContext->caps());
 }
 
 void GrRenderTargetContextPriv::clearStencilClip(const GrFixedClip& clip, bool insideStencilMask) {
@@ -917,7 +917,7 @@
 
     GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
     if (GrAAType::kCoverage == aaType) {
-        const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
+        const GrShaderCaps* shaderCaps = this->caps()->shaderCaps();
         std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeRRectOp(std::move(paint),
                                                                     viewMatrix,
                                                                     rrect,
@@ -1306,7 +1306,7 @@
 
     GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
     if (GrAAType::kCoverage == aaType) {
-        const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
+        const GrShaderCaps* shaderCaps = this->caps()->shaderCaps();
         if (auto op = GrOvalOpFactory::MakeOvalOp(std::move(paint), viewMatrix, oval, style,
                                                   shaderCaps)) {
             this->addDrawOp(clip, std::move(op));
@@ -1337,7 +1337,7 @@
 
     GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
     if (GrAAType::kCoverage == aaType) {
-        const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
+        const GrShaderCaps* shaderCaps = this->caps()->shaderCaps();
         std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeArcOp(std::move(paint),
                                                                   viewMatrix,
                                                                   oval,
@@ -1563,7 +1563,7 @@
 
     GrShape shape(path, GrStyle::SimpleFill());
     GrPathRenderer::CanDrawPathArgs canDrawArgs;
-    canDrawArgs.fCaps = fRenderTargetContext->drawingManager()->getContext()->caps();
+    canDrawArgs.fCaps = fRenderTargetContext->caps();
     canDrawArgs.fViewMatrix = &viewMatrix;
     canDrawArgs.fShape = &shape;
     canDrawArgs.fClipConservativeBounds = &clipConservativeBounds;
@@ -1627,7 +1627,7 @@
                                                     : GrAllowMixedSamples::kYes;
     GrAAType aaType = this->chooseAAType(aa, allowMixedSamples);
     GrPathRenderer::CanDrawPathArgs canDrawArgs;
-    canDrawArgs.fCaps = this->drawingManager()->getContext()->caps();
+    canDrawArgs.fCaps = this->caps();
     canDrawArgs.fViewMatrix = &viewMatrix;
     canDrawArgs.fShape = &originalShape;
     canDrawArgs.fClipConservativeBounds = &clipConservativeBounds;
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 5865da9..8d677ae 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -333,7 +333,7 @@
     void insertEventMarker(const SkString&);
 
     GrFSAAType fsaaType() const { return fRenderTargetProxy->fsaaType(); }
-    const GrCaps* caps() const { return fContext->caps(); }
+    const GrCaps* caps() const { return fContext->contextPriv().caps(); }
     int width() const { return fRenderTargetProxy->width(); }
     int height() const { return fRenderTargetProxy->height(); }
     int numColorSamples() const { return fRenderTargetProxy->numColorSamples(); }
diff --git a/include/gpu/GrShaderCaps.h b/src/gpu/GrShaderCaps.h
similarity index 84%
rename from include/gpu/GrShaderCaps.h
rename to src/gpu/GrShaderCaps.h
index d8f4d95..2f2d277 100644
--- a/include/gpu/GrShaderCaps.h
+++ b/src/gpu/GrShaderCaps.h
@@ -5,25 +5,25 @@
  * found in the LICENSE file.
  */
 
-
 #ifndef GrShaderCaps_DEFINED
 #define GrShaderCaps_DEFINED
 
-#include "../private/GrSwizzle.h"
 #include "../private/GrGLSL.h"
+#include "../private/GrSwizzle.h"
 
 namespace SkSL {
-    class ShaderCapsFactory;
+class ShaderCapsFactory;
 }
+
 struct GrContextOptions;
 class SkJSONWriter;
 
 class GrShaderCaps : public SkRefCnt {
 public:
     /**
-    * Indicates how GLSL must interact with advanced blend equations. The KHR extension requires
-    * special layout qualifiers in the fragment shader.
-    */
+     * Indicates how GLSL must interact with advanced blend equations. The KHR extension requires
+     * special layout qualifiers in the fragment shader.
+     */
     enum AdvBlendEqInteraction {
         kNotSupported_AdvBlendEqInteraction,     //<! No _blend_equation_advanced extension
         kAutomatic_AdvBlendEqInteraction,        //<! No interaction required
@@ -93,9 +93,7 @@
         return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction;
     }
 
-    bool mustDeclareFragmentShaderOutput() const {
-        return fGLSLGeneration > k110_GrGLSLGeneration;
-    }
+    bool mustDeclareFragmentShaderOutput() const { return fGLSLGeneration > k110_GrGLSLGeneration; }
 
     bool usesPrecisionModifiers() const { return fUsesPrecisionModifiers; }
 
@@ -172,9 +170,7 @@
     // required in order to use a secondary output in the shader. This returns a nullptr if no such
     // extension is required. However, the return value of this function does not say whether dual
     // source blending is supported.
-    const char* secondaryOutputExtensionString() const {
-        return fSecondaryOutputExtensionString;
-    }
+    const char* secondaryOutputExtensionString() const { return fSecondaryOutputExtensionString; }
 
     // This returns the name of an extension that must be enabled in the shader to support external
     // textures. In some cases, two extensions must be enabled - the second extension is returned
@@ -243,42 +239,42 @@
 
     GrGLSLGeneration fGLSLGeneration;
 
-    bool fShaderDerivativeSupport   : 1;
-    bool fGeometryShaderSupport     : 1;
-    bool fGSInvocationsSupport      : 1;
-    bool fPathRenderingSupport      : 1;
-    bool fDstReadInShaderSupport    : 1;
-    bool fDualSourceBlendingSupport : 1;
-    bool fIntegerSupport            : 1;
-    bool fTexelBufferSupport        : 1;
-    bool fImageLoadStoreSupport     : 1;
-    bool fDropsTileOnZeroDivide : 1;
-    bool fFBFetchSupport : 1;
-    bool fFBFetchNeedsCustomOutput : 1;
-    bool fUsesPrecisionModifiers : 1;
-    bool fFlatInterpolationSupport : 1;
-    bool fPreferFlatInterpolation : 1;
+    bool fShaderDerivativeSupport           : 1;
+    bool fGeometryShaderSupport             : 1;
+    bool fGSInvocationsSupport              : 1;
+    bool fPathRenderingSupport              : 1;
+    bool fDstReadInShaderSupport            : 1;
+    bool fDualSourceBlendingSupport         : 1;
+    bool fIntegerSupport                    : 1;
+    bool fTexelBufferSupport                : 1;
+    bool fImageLoadStoreSupport             : 1;
+    bool fDropsTileOnZeroDivide             : 1;
+    bool fFBFetchSupport                    : 1;
+    bool fFBFetchNeedsCustomOutput          : 1;
+    bool fUsesPrecisionModifiers            : 1;
+    bool fFlatInterpolationSupport          : 1;
+    bool fPreferFlatInterpolation           : 1;
     bool fNoPerspectiveInterpolationSupport : 1;
-    bool fExternalTextureSupport : 1;
-    bool fTexelFetchSupport : 1;
-    bool fVertexIDSupport : 1;
-    bool fFPManipulationSupport : 1;
-    bool fFloatIs32Bits : 1;
-    bool fHalfIs32Bits : 1;
+    bool fExternalTextureSupport            : 1;
+    bool fTexelFetchSupport                 : 1;
+    bool fVertexIDSupport                   : 1;
+    bool fFPManipulationSupport             : 1;
+    bool fFloatIs32Bits                     : 1;
+    bool fHalfIs32Bits                      : 1;
 
     // Used for specific driver bug work arounds
-    bool fCanUseAnyFunctionInShader : 1;
-    bool fCanUseMinAndAbsTogether : 1;
-    bool fCanUseFractForNegativeValues : 1;
-    bool fMustForceNegatedAtanParamToFloat : 1;
-    bool fAtan2ImplementedAsAtanYOverX : 1;
-    bool fMustDoOpBetweenFloorAndAbs : 1;
-    bool fRequiresLocalOutputColorForFBFetch : 1;
-    bool fMustObfuscateUniformColor : 1;
+    bool fCanUseAnyFunctionInShader                   : 1;
+    bool fCanUseMinAndAbsTogether                     : 1;
+    bool fCanUseFractForNegativeValues                : 1;
+    bool fMustForceNegatedAtanParamToFloat            : 1;
+    bool fAtan2ImplementedAsAtanYOverX                : 1;
+    bool fMustDoOpBetweenFloorAndAbs                  : 1;
+    bool fRequiresLocalOutputColorForFBFetch          : 1;
+    bool fMustObfuscateUniformColor                   : 1;
     bool fMustGuardDivisionEvenAfterExplicitZeroCheck : 1;
-    bool fCanUseFragCoord : 1;
-    bool fInterpolantsAreInaccurate : 1;
-    bool fIncompleteShortIntPrecision : 1;
+    bool fCanUseFragCoord                             : 1;
+    bool fInterpolantsAreInaccurate                   : 1;
+    bool fIncompleteShortIntPrecision                 : 1;
 
     const char* fVersionDeclString;
 
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 56d6d7d..25093cb 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -6,12 +6,10 @@
  */
 
 #include "GrSurfaceContext.h"
-
 #include "GrContextPriv.h"
 #include "GrDrawingManager.h"
 #include "GrOpList.h"
 #include "SkGr.h"
-
 #include "../private/GrAuditTrail.h"
 
 #define ASSERT_SINGLE_OWNER \
@@ -87,10 +85,11 @@
     SkDEBUGCODE(this->validate();)
     GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrSurfaceContext::copy");
 
-    if (!fContext->caps()->canCopySurface(this->asSurfaceProxy(), src, srcRect, dstPoint)) {
+    if (!fContext->contextPriv().caps()->canCopySurface(this->asSurfaceProxy(), src, srcRect,
+                                                        dstPoint)) {
         return false;
     }
 
-    return this->getOpList()->copySurface(*fContext->caps(),
-                                          this->asSurfaceProxy(), src, srcRect, dstPoint);
+    return this->getOpList()->copySurface(*fContext->contextPriv().caps(), this->asSurfaceProxy(),
+                                          src, srcRect, dstPoint);
 }
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index e39937d..cc61533 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -6,7 +6,6 @@
  */
 
 #include "GrTextureAdjuster.h"
-
 #include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "GrContextPriv.h"
@@ -81,12 +80,12 @@
     if (texColorSpace) {
         *texColorSpace = sk_ref_sp(fColorSpace);
     }
-    SkASSERT(this->width() <= fContext->caps()->maxTextureSize() &&
-             this->height() <= fContext->caps()->maxTextureSize());
+    SkASSERT(this->width() <= fContext->contextPriv().caps()->maxTextureSize() &&
+             this->height() <= fContext->contextPriv().caps()->maxTextureSize());
 
-    if (!GrGpu::IsACopyNeededForTextureParams(fContext->caps(),
-                                              proxy.get(), proxy->width(), proxy->height(),
-                                              params, &copyParams, scaleAdjust)) {
+    if (!GrGpu::IsACopyNeededForTextureParams(fContext->contextPriv().caps(), proxy.get(),
+                                              proxy->width(), proxy->height(), params, &copyParams,
+                                              scaleAdjust)) {
         return proxy;
     }
 
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index b464998..58ab38d 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -17,15 +17,15 @@
                                                                  SkColorSpace* dstColorSpace,
                                                                  sk_sp<SkColorSpace>* texColorSpace,
                                                                  SkScalar scaleAdjust[2]) {
-    if (this->width() > fContext->caps()->maxTextureSize() ||
-        this->height() > fContext->caps()->maxTextureSize()) {
+    if (this->width() > fContext->contextPriv().caps()->maxTextureSize() ||
+        this->height() > fContext->contextPriv().caps()->maxTextureSize()) {
         return nullptr;
     }
 
     CopyParams copyParams;
     bool willBeMipped = params.filter() == GrSamplerState::Filter::kMipMap;
 
-    if (!fContext->caps()->mipMapSupport()) {
+    if (!fContext->contextPriv().caps()->mipMapSupport()) {
         willBeMipped = false;
     }
 
@@ -36,15 +36,15 @@
     sk_sp<GrTextureProxy> original(this->refOriginalTextureProxy(willBeMipped, dstColorSpace,
                                                                  AllowedTexGenType::kCheap));
     if (original) {
-        if (!GrGpu::IsACopyNeededForTextureParams(fContext->caps(), original.get(),
-                                                  original->width(), original->height(),
-                                                  params, &copyParams, scaleAdjust)) {
+        if (!GrGpu::IsACopyNeededForTextureParams(fContext->contextPriv().caps(), original.get(),
+                                                  original->width(), original->height(), params,
+                                                  &copyParams, scaleAdjust)) {
             return original;
         }
     } else {
-        if (!GrGpu::IsACopyNeededForTextureParams(fContext->caps(), nullptr,
-                                                  this->width(), this->height(),
-                                                  params, &copyParams, scaleAdjust)) {
+        if (!GrGpu::IsACopyNeededForTextureParams(fContext->contextPriv().caps(), nullptr,
+                                                  this->width(), this->height(), params,
+                                                  &copyParams, scaleAdjust)) {
             return this->refOriginalTextureProxy(willBeMipped, dstColorSpace,
                                                  AllowedTexGenType::kAny);
         }
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index b79d4a7..bb85aab 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -138,7 +138,7 @@
     // Otherwise, we do our shader math to go from YUV -> sRGB, manually convert sRGB -> Linear,
     // then let the HW convert Linear -> sRGB.
     if (GrPixelConfigIsSRGB(desc.fConfig)) {
-        if (ctx->caps()->srgbWriteControl()) {
+        if (ctx->contextPriv().caps()->srgbWriteControl()) {
             paint.setDisableOutputConversionToSRGB(true);
         } else {
             paint.addColorFragmentProcessor(GrSRGBEffect::Make(GrSRGBEffect::Mode::kSRGBToLinear,
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index f22fbcf..a08c0e5 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -157,7 +157,7 @@
         return nullptr;
     }
 
-    GrPixelConfig config = SkImageInfo2GrPixelConfig(origInfo, *context->caps());
+    GrPixelConfig config = SkImageInfo2GrPixelConfig(origInfo, *context->contextPriv().caps());
     if (kUnknown_GrPixelConfig == config) {
         return nullptr;
     }
@@ -769,7 +769,7 @@
     }
     samplerState.setFilterMode(textureFilterMode);
 
-    int maxTileSize = fContext->caps()->maxTileSize() - 2 * tileFilterPad;
+    int maxTileSize = this->caps()->maxTileSize() - 2 * tileFilterPad;
 
     // these are output, which we safely ignore, as we just want to know the predicate
     int outTileSize;
@@ -789,7 +789,7 @@
     SkMatrix viewMatrix;
     viewMatrix.setConcat(this->ctm(), m);
 
-    int maxTileSize = fContext->caps()->maxTileSize();
+    int maxTileSize = this->caps()->maxTileSize();
 
     // The tile code path doesn't currently support AA, so if the paint asked for aa and we could
     // draw untiled, then we bypass checking for tiling purely for optimization reasons.
@@ -821,7 +821,7 @@
         }
         samplerState.setFilterMode(textureFilterMode);
 
-        int maxTileSizeForFilter = fContext->caps()->maxTileSize() - 2 * tileFilterPad;
+        int maxTileSizeForFilter = this->caps()->maxTileSize() - 2 * tileFilterPad;
         if (this->shouldTileImageID(bitmap.getGenerationID(), bitmap.getSubset(), viewMatrix,
                                     SkMatrix::I(), samplerState, &srcRect, maxTileSizeForFilter,
                                     &tileSize, &clippedSrcRect)) {
@@ -968,11 +968,11 @@
                                  bool bicubic,
                                  bool needsTextureDomain) {
     // We should have already handled bitmaps larger than the max texture size.
-    SkASSERT(bitmap.width() <= fContext->caps()->maxTextureSize() &&
-             bitmap.height() <= fContext->caps()->maxTextureSize());
+    SkASSERT(bitmap.width() <= this->caps()->maxTextureSize() &&
+             bitmap.height() <= this->caps()->maxTextureSize());
     // We should be respecting the max tile size by the time we get here.
-    SkASSERT(bitmap.width() <= fContext->caps()->maxTileSize() &&
-             bitmap.height() <= fContext->caps()->maxTileSize());
+    SkASSERT(bitmap.width() <= this->caps()->maxTileSize() &&
+             bitmap.height() <= this->caps()->maxTileSize());
     SkASSERT(!samplerState.isRepeated());
 
     SkScalar scales[2] = {1.f, 1.f};
@@ -1148,7 +1148,7 @@
         }
     }
 
-    int maxTileSize = fContext->caps()->maxTileSize();
+    int maxTileSize = this->caps()->maxTileSize();
 
     // The tile code path doesn't currently support AA, so if the paint asked for aa and we could
     // draw untiled, then we bypass checking for tiling purely for optimization reasons.
@@ -1179,7 +1179,7 @@
         }
         sampleState.setFilterMode(textureFilterMode);
 
-        int maxTileSizeForFilter = fContext->caps()->maxTileSize() - 2 * tileFilterPad;
+        int maxTileSizeForFilter = this->caps()->maxTileSize() - 2 * tileFilterPad;
         if (this->shouldTileImageID(bitmap.getGenerationID(), bitmap.getSubset(), this->ctm(),
                                     srcToDstMatrix, sampleState, src, maxTileSizeForFilter,
                                     &tileSize, &clippedSrcRect)) {
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index f415f3d..d98dbff 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -8,16 +8,17 @@
 #ifndef SkGpuDevice_DEFINED
 #define SkGpuDevice_DEFINED
 
-#include "SkGr.h"
+#include "GrClipStackClip.h"
+#include "GrContext.h"
+#include "GrContextPriv.h"
+#include "GrRenderTargetContext.h"
+#include "GrTypes.h"
 #include "SkBitmap.h"
 #include "SkClipStackDevice.h"
+#include "SkGr.h"
 #include "SkPicture.h"
 #include "SkRegion.h"
 #include "SkSurface.h"
-#include "GrClipStackClip.h"
-#include "GrRenderTargetContext.h"
-#include "GrContext.h"
-#include "GrTypes.h"
 
 class GrAccelData;
 class GrTextureMaker;
@@ -157,6 +158,8 @@
 
     GrClipStackClip clip() const { return GrClipStackClip(&this->cs()); }
 
+    const GrCaps* caps() const { return fContext->contextPriv().caps(); }
+
     /**
      * Helper functions called by drawBitmapCommon. By the time these are called the SkDraw's
      * matrix, clip, and the device's render target has already been set on GrContext.
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 60586ea..a37523f 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -110,7 +110,7 @@
 sk_sp<GrTextureProxy> GrCopyBaseMipMapToTextureProxy(GrContext* ctx, GrTextureProxy* baseProxy) {
     SkASSERT(baseProxy);
 
-    if (!ctx->caps()->isConfigCopyable(baseProxy->config())) {
+    if (!ctx->contextPriv().caps()->isConfigCopyable(baseProxy->config())) {
         return nullptr;
     }
 
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index 382457d..e996588 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -6,8 +6,8 @@
  */
 
 #include "GrGLRenderTarget.h"
-
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "GrGLGpu.h"
 #include "GrGLUtil.h"
 #include "GrGpuResourcePriv.h"
@@ -187,7 +187,7 @@
 }
 
 bool GrGLRenderTarget::canAttemptStencilAttachment() const {
-    if (this->getGpu()->getContext()->caps()->avoidStencilBuffers()) {
+    if (this->getGpu()->getContext()->contextPriv().caps()->avoidStencilBuffers()) {
         return false;
     }
 
diff --git a/src/gpu/gl/GrGLTextureRenderTarget.cpp b/src/gpu/gl/GrGLTextureRenderTarget.cpp
index 049cb31..a9d7f14 100644
--- a/src/gpu/gl/GrGLTextureRenderTarget.cpp
+++ b/src/gpu/gl/GrGLTextureRenderTarget.cpp
@@ -6,8 +6,8 @@
  */
 
 #include "GrGLTextureRenderTarget.h"
-
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "GrGLGpu.h"
 #include "GrTexturePriv.h"
 #include "SkTraceMemoryDump.h"
@@ -52,7 +52,7 @@
 bool GrGLTextureRenderTarget::canAttemptStencilAttachment() const {
     // The RT FBO of GrGLTextureRenderTarget is never created from a
     // wrapped FBO, so we only care about the flag.
-    return !this->getGpu()->getContext()->caps()->avoidStencilBuffers();
+    return !this->getGpu()->getContext()->contextPriv().caps()->avoidStencilBuffers();
 }
 
 sk_sp<GrGLTextureRenderTarget> GrGLTextureRenderTarget::MakeWrapped(
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 329fa81..dded70a 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -6,6 +6,7 @@
  */
 
 #include "GrDrawVerticesOp.h"
+#include "GrCaps.h"
 #include "GrDefaultGeoProcFactory.h"
 #include "GrOpFlushState.h"
 #include "SkGr.h"
@@ -374,7 +375,7 @@
     do {
        type = GrPrimitiveType(random->nextULessThan(kNumGrPrimitiveTypes));
     } while (GrPrimTypeRequiresGeometryShaderSupport(type) &&
-             !context->caps()->shaderCaps()->geometryShaderSupport());
+             !context->contextPriv().caps()->shaderCaps()->geometryShaderSupport());
 
     uint32_t primitiveCount = random->nextRangeU(1, 100);
 
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index a2e6243..a7700cb 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -5,6 +5,7 @@
  * found in the LICENSE file.
  */
 #include "GrAtlasTextContext.h"
+#include "GrCaps.h"
 #include "GrContext.h"
 #include "GrContextPriv.h"
 #include "GrSDFMaskFilter.h"
@@ -154,8 +155,8 @@
             textBlobCache->remove(cacheBlob.get());
             cacheBlob = textBlobCache->makeCachedBlob(blob, key, blurRec, skPaint);
             this->regenerateTextBlob(cacheBlob.get(), glyphCache,
-                                     *context->caps()->shaderCaps(), paint, scalerContextFlags,
-                                     viewMatrix, props, blob, x, y, drawFilter);
+                                     *context->contextPriv().caps()->shaderCaps(), paint,
+                                     scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
         } else {
             textBlobCache->makeMRU(cacheBlob.get());
 
@@ -165,9 +166,9 @@
                 GrTextBlobCache::BlobGlyphCount(&glyphCount, &runCount, blob);
                 sk_sp<GrAtlasTextBlob> sanityBlob(textBlobCache->makeBlob(glyphCount, runCount));
                 sanityBlob->setupKey(key, blurRec, skPaint);
-                this->regenerateTextBlob(sanityBlob.get(), glyphCache,
-                                         *context->caps()->shaderCaps(), paint, scalerContextFlags,
-                                         viewMatrix, props, blob, x, y, drawFilter);
+                this->regenerateTextBlob(
+                        sanityBlob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(),
+                        paint, scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
                 GrAtlasTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
             }
         }
@@ -178,8 +179,8 @@
             cacheBlob = textBlobCache->makeBlob(blob);
         }
         this->regenerateTextBlob(cacheBlob.get(), glyphCache,
-                                 *context->caps()->shaderCaps(), paint, scalerContextFlags,
-                                 viewMatrix, props, blob, x, y, drawFilter);
+                                 *context->contextPriv().caps()->shaderCaps(), paint,
+                                 scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
     }
 
     cacheBlob->flush(target, props, fDistanceAdjustTable.get(), paint,
@@ -326,11 +327,10 @@
     auto textBlobCache = context->contextPriv().getTextBlobCache();
 
     GrTextUtils::Paint paint(&skPaint, &target->colorSpaceInfo());
-    sk_sp<GrAtlasTextBlob> blob(
-            this->makeDrawTextBlob(textBlobCache, glyphCache,
-                                    *context->caps()->shaderCaps(), paint,
-                                    ComputeScalerContextFlags(target->colorSpaceInfo()),
-                                    viewMatrix, props, text, byteLength, x, y));
+    sk_sp<GrAtlasTextBlob> blob(this->makeDrawTextBlob(
+            textBlobCache, glyphCache, *context->contextPriv().caps()->shaderCaps(), paint,
+            ComputeScalerContextFlags(target->colorSpaceInfo()), viewMatrix, props, text,
+            byteLength, x, y));
     if (blob) {
         blob->flush(target, props, fDistanceAdjustTable.get(), paint,
                     clip, viewMatrix, regionClipBounds, x, y);
@@ -352,8 +352,7 @@
     auto textBlobCache = context->contextPriv().getTextBlobCache();
 
     sk_sp<GrAtlasTextBlob> blob(this->makeDrawPosTextBlob(
-            textBlobCache, glyphCache,
-            *context->caps()->shaderCaps(), paint,
+            textBlobCache, glyphCache, *context->contextPriv().caps()->shaderCaps(), paint,
             ComputeScalerContextFlags(target->colorSpaceInfo()), viewMatrix, props, text,
             byteLength, pos, scalarsPerPosition, offset));
     if (blob) {
@@ -951,12 +950,10 @@
     // right now we don't handle textblobs, nor do we handle drawPosText. Since we only intend to
     // test the text op with this unit test, that is okay.
     sk_sp<GrAtlasTextBlob> blob(textContext->makeDrawTextBlob(
-                                            context->contextPriv().getTextBlobCache(), glyphCache,
-                                            *context->caps()->shaderCaps(), utilsPaint,
-                                            GrAtlasTextContext::kTextBlobOpScalerContextFlags,
-                                            viewMatrix, surfaceProps, text,
-                                            static_cast<size_t>(textLen),
-                                            SkIntToScalar(x), SkIntToScalar(y)));
+            context->contextPriv().getTextBlobCache(), glyphCache,
+            *context->contextPriv().caps()->shaderCaps(), utilsPaint,
+            GrAtlasTextContext::kTextBlobOpScalerContextFlags, viewMatrix, surfaceProps, text,
+            static_cast<size_t>(textLen), SkIntToScalar(x), SkIntToScalar(y)));
 
     return blob->test_makeOp(textLen, 0, 0, viewMatrix, x, y, utilsPaint, surfaceProps,
                              textContext->dfAdjustTable(), rtc->textTarget());
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 17a0a25..62b97ae 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -374,7 +374,7 @@
         return false;
     }
 
-    return ctx->caps()->validateBackendTexture(tex, ct, config);
+    return ctx->contextPriv().caps()->validateBackendTexture(tex, ct, config);
 }
 
 sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx,
@@ -694,7 +694,8 @@
         return nullptr;
     }
     GrPixelConfig config = kUnknown_GrPixelConfig;
-    if (!context->caps()->getConfigFromBackendFormat(backendFormat, colorType, &config)) {
+    if (!context->contextPriv().caps()->getConfigFromBackendFormat(backendFormat, colorType,
+                                                                   &config)) {
         return nullptr;
     }
 
@@ -748,12 +749,13 @@
     }
 
     // Some backends or drivers don't support (safely) moving resources between contexts
-    if (!context || !context->caps()->crossContextTextureSupport()) {
+    if (!context || !context->contextPriv().caps()->crossContextTextureSupport()) {
         return codecImage;
     }
 
-    if (limitToMaxTextureSize && (codecImage->width() > context->caps()->maxTextureSize() ||
-                                  codecImage->height() > context->caps()->maxTextureSize())) {
+    auto maxTextureSize = context->contextPriv().caps()->maxTextureSize();
+    if (limitToMaxTextureSize &&
+        (codecImage->width() > maxTextureSize || codecImage->height() > maxTextureSize)) {
         SkAutoPixmapStorage pmap;
         SkImageInfo info = as_IB(codecImage)->onImageInfo();
         if (!dstColorSpace) {
@@ -801,7 +803,7 @@
                                                    SkColorSpace* dstColorSpace,
                                                    bool limitToMaxTextureSize) {
     // Some backends or drivers don't support (safely) moving resources between contexts
-    if (!context || !context->caps()->crossContextTextureSupport()) {
+    if (!context || !context->contextPriv().caps()->crossContextTextureSupport()) {
         return SkImage::MakeRasterCopy(originalPixmap);
     }
 
@@ -814,7 +816,7 @@
 
     const SkPixmap* pixmap = &originalPixmap;
     SkAutoPixmapStorage resized;
-    int maxTextureSize = context->caps()->maxTextureSize();
+    int maxTextureSize = context->contextPriv().caps()->maxTextureSize();
     int maxDim = SkTMax(originalPixmap.width(), originalPixmap.height());
     if (limitToMaxTextureSize && maxDim > maxTextureSize) {
         float scale = static_cast<float>(maxTextureSize) / maxDim;
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp
index 035ddcc..9ca9d0d 100644
--- a/src/image/SkImage_Lazy.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -724,7 +724,7 @@
         // may want to know what space the image data is in, so return it.
         return fInfo.refColorSpace();
     } else {
-        CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->caps());
+        CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->contextPriv().caps());
         SkImageInfo cacheInfo = this->buildCacheInfo(format);
         return cacheInfo.refColorSpace();
     }
@@ -759,7 +759,7 @@
 
     // Determine which cached format we're going to use (which may involve decoding to a different
     // info than the generator provides).
-    CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->caps());
+    CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->contextPriv().caps());
 
     // Fold the cache format into our texture key
     GrUniqueKey key;
@@ -808,7 +808,7 @@
     // 3. Ask the generator to return YUV planes, which the GPU can convert. If we will be mipping
     //    the texture we fall through here and have the CPU generate the mip maps for us.
     if (!proxy && !willBeMipped && !ctx->contextPriv().disableGpuYUVConversion()) {
-        const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(cacheInfo, *ctx->caps());
+        const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(cacheInfo, *ctx->contextPriv().caps());
         ScopedGenerator generator(fSharedGenerator);
         Generator_GrYUVProvider provider(generator);
 
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index c81fc28..b4e6acf 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -6,22 +6,21 @@
  */
 
 #include "SkSurface_Gpu.h"
-
 #include "GrBackendSurface.h"
+#include "GrCaps.h"
 #include "GrContextPriv.h"
 #include "GrRenderTarget.h"
 #include "GrRenderTargetContextPriv.h"
 #include "GrRenderTargetProxyPriv.h"
 #include "GrTexture.h"
-
 #include "SkCanvas.h"
 #include "SkDeferredDisplayList.h"
 #include "SkGpuDevice.h"
+#include "SkImagePriv.h"
 #include "SkImage_Base.h"
 #include "SkImage_Gpu.h"
-#include "SkImagePriv.h"
-#include "SkSurface_Base.h"
 #include "SkSurfaceCharacterization.h"
+#include "SkSurface_Base.h"
 
 #if SK_SUPPORT_GPU
 
@@ -334,7 +333,7 @@
         return nullptr;
     }
 
-    if (!SkSurface_Gpu::Valid(context->caps(), c.config(), c.colorSpace())) {
+    if (!SkSurface_Gpu::Valid(context->contextPriv().caps(), c.config(), c.colorSpace())) {
         return nullptr;
     }
 
@@ -389,7 +388,7 @@
     sampleCount = SkTMax(1, sampleCount);
     GrMipMapped mipMapped = shouldCreateWithMips ? GrMipMapped::kYes : GrMipMapped::kNo;
 
-    if (!ctx->caps()->mipMapSupport()) {
+    if (!ctx->contextPriv().caps()->mipMapSupport()) {
         mipMapped = GrMipMapped::kNo;
     }
 
@@ -433,17 +432,17 @@
         return false;
     }
 
-    if (!ctx->caps()->validateBackendTexture(tex, ct, config)) {
+    if (!ctx->contextPriv().caps()->validateBackendTexture(tex, ct, config)) {
         return false;
     }
 
     // We don't require that the client gave us an exact valid sample cnt. However, it must be
     // less than the max supported sample count and 1 if MSAA is unsupported for the color type.
-    if (!ctx->caps()->getRenderTargetSampleCount(sampleCnt, *config)) {
+    if (!ctx->contextPriv().caps()->getRenderTargetSampleCount(sampleCnt, *config)) {
         return false;
     }
 
-    if (texturable && !ctx->caps()->isConfigTexturable(*config)) {
+    if (texturable && !ctx->contextPriv().caps()->isConfigTexturable(*config)) {
         return false;
     }
     return true;
@@ -467,7 +466,7 @@
     if (!context) {
         return nullptr;
     }
-    if (!SkSurface_Gpu::Valid(context->caps(), texCopy.config(), colorSpace.get())) {
+    if (!SkSurface_Gpu::Valid(context->contextPriv().caps(), texCopy.config(), colorSpace.get())) {
         return nullptr;
     }
     sampleCnt = SkTMax(1, sampleCnt);
@@ -501,15 +500,15 @@
         return false;
     }
 
-    if (!ctx->caps()->validateBackendRenderTarget(rt, ct, config)) {
+    if (!ctx->contextPriv().caps()->validateBackendRenderTarget(rt, ct, config)) {
         return false;
     }
 
     if (rt.sampleCnt() > 1) {
-        if (ctx->caps()->maxRenderTargetSampleCount(*config) <= 1) {
+        if (ctx->contextPriv().caps()->maxRenderTargetSampleCount(*config) <= 1) {
             return false;
         }
-    } else if (!ctx->caps()->isConfigRenderable(*config)) {
+    } else if (!ctx->contextPriv().caps()->isConfigRenderable(*config)) {
         return false;
     }
 
@@ -530,7 +529,7 @@
     if (!validate_backend_render_target(context, rtCopy, &rtCopy.fConfig, colorType, colorSpace)) {
         return nullptr;
     }
-    if (!SkSurface_Gpu::Valid(context->caps(), rtCopy.config(), colorSpace.get())) {
+    if (!SkSurface_Gpu::Valid(context->contextPriv().caps(), rtCopy.config(), colorSpace.get())) {
         return nullptr;
     }
 
@@ -565,7 +564,8 @@
     if (!context) {
         return nullptr;
     }
-    if (!tex.isValid() || !SkSurface_Gpu::Valid(context->caps(), tex.config(), colorSpace.get())) {
+    if (!tex.isValid() ||
+        !SkSurface_Gpu::Valid(context->contextPriv().caps(), tex.config(), colorSpace.get())) {
         return nullptr;
     }
     sampleCnt = SkTMax(1, sampleCnt);
diff --git a/src/shaders/SkPictureShader.cpp b/src/shaders/SkPictureShader.cpp
index 42f5c3e..f958814 100644
--- a/src/shaders/SkPictureShader.cpp
+++ b/src/shaders/SkPictureShader.cpp
@@ -24,6 +24,7 @@
 #include "GrCaps.h"
 #include "GrColorSpaceInfo.h"
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "GrFragmentProcessor.h"
 #endif
 
@@ -358,7 +359,7 @@
         const GrFPArgs& args) const {
     int maxTextureSize = 0;
     if (args.fContext) {
-        maxTextureSize = args.fContext->caps()->maxTextureSize();
+        maxTextureSize = args.fContext->contextPriv().caps()->maxTextureSize();
     }
 
     auto lm = this->totalLocalMatrix(args.fPreLocalMatrix, args.fPostLocalMatrix);
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index 7f597cb..60e9f2a 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -1268,11 +1268,12 @@
     } else {
         SkGradientShaderBase::GradientBitmapType bitmapType =
             SkGradientShaderBase::GradientBitmapType::kLegacy;
+        auto caps = args.fContext->contextPriv().caps();
         if (args.fDstColorSpace) {
             // Try to use F16 if we can
-            if (args.fContext->caps()->isConfigTexturable(kRGBA_half_GrPixelConfig)) {
+            if (caps->isConfigTexturable(kRGBA_half_GrPixelConfig)) {
                 bitmapType = SkGradientShaderBase::GradientBitmapType::kHalfFloat;
-            } else if (args.fContext->caps()->isConfigTexturable(kSRGBA_8888_GrPixelConfig)) {
+            } else if (caps->isConfigTexturable(kSRGBA_8888_GrPixelConfig)) {
                 bitmapType = SkGradientShaderBase::GradientBitmapType::kSRGB;
             } else {
                 // This can happen, but only if someone explicitly creates an unsupported
@@ -1290,7 +1291,7 @@
         desc.fWidth  = bitmap.width();
         desc.fHeight = 32;
         desc.fRowHeight = bitmap.height(); // always 1 here
-        desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *args.fContext->caps());
+        desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *caps);
         fAtlas = atlasManager->refAtlas(desc);
         SkASSERT(fAtlas);
 
diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h
index 40a5a47..eb4fa51 100644
--- a/src/sksl/SkSLUtil.h
+++ b/src/sksl/SkSLUtil.h
@@ -16,7 +16,7 @@
 #include "SkSLString.h"
 #include "SkSLStringStream.h"
 
-#ifndef SKSL_STANDALONE
+#if !defined(SKSL_STANDALONE) && SK_SUPPORT_GPU
 #include "GrContextOptions.h"
 #include "GrShaderCaps.h"
 #endif
@@ -31,9 +31,11 @@
 #endif // SK_BUILD_FOR_WIN
 #endif // SKSL_STANDALONE
 
+class GrShaderCaps;
+
 namespace SkSL {
 
-#ifdef SKSL_STANDALONE
+#if defined(SKSL_STANDALONE) || !SK_SUPPORT_GPU
 
 // we're being compiled standalone, so we don't have access to caps...
 enum GrGLSLGeneration {
diff --git a/tests/ApplyGammaTest.cpp b/tests/ApplyGammaTest.cpp
index 8eb35e1..d210e9e 100644
--- a/tests/ApplyGammaTest.cpp
+++ b/tests/ApplyGammaTest.cpp
@@ -12,6 +12,7 @@
 #include "GrCaps.h"
 #include "GrContext.h"
 #include "GrContextFactory.h"
+#include "GrContextPriv.h"
 #include "GrShaderCaps.h"
 #include "GrTypes.h"
 #include "SkBitmap.h"
@@ -120,7 +121,7 @@
     SkAutoTMalloc<uint32_t> read(kW * kH);
 
     // We allow more error on GPUs with lower precision shader variables.
-    float error = context->caps()->shaderCaps()->halfIs32Bits() ? 0.5f : 1.2f;
+    float error = context->contextPriv().caps()->shaderCaps()->halfIs32Bits() ? 0.5f : 1.2f;
 
     for (auto toSRGB : { false, true }) {
         sk_sp<SkSurface> dst(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii));
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index eeef831..a716c04 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -1045,7 +1045,7 @@
         }
 
         auto context = GrContext::MakeMock(nullptr);
-        const auto* caps = context->caps()->shaderCaps();
+        const auto* caps = context->contextPriv().caps()->shaderCaps();
 
         // Zero the memory we will new the GrReducedClip into. This ensures the elements gen ID
         // will be kInvalidGenID if left uninitialized.
@@ -1116,7 +1116,7 @@
         SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100);
 
         auto context = GrContext::MakeMock(nullptr);
-        const auto* caps = context->caps()->shaderCaps();
+        const auto* caps = context->contextPriv().caps()->shaderCaps();
 
         SkAlignedSTStorage<1, GrReducedClip> storage;
         memset(storage.get(), 0, sizeof(GrReducedClip));
@@ -1205,7 +1205,7 @@
 #undef XYWH
 #undef IXYWH
         auto context = GrContext::MakeMock(nullptr);
-        const auto* caps = context->caps()->shaderCaps();
+        const auto* caps = context->contextPriv().caps()->shaderCaps();
 
         for (size_t i = 0; i < SK_ARRAY_COUNT(testCases); ++i) {
             const GrReducedClip reduced(stack, testCases[i].testBounds, caps);
@@ -1233,7 +1233,7 @@
     SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100);
 
     auto context = GrContext::MakeMock(nullptr);
-    const auto* caps = context->caps()->shaderCaps();
+    const auto* caps = context->contextPriv().caps()->shaderCaps();
 
     // At the time, this would crash.
     const GrReducedClip reduced(stack, bounds, caps);
@@ -1252,7 +1252,7 @@
                           const SkRect& preXformQuery, ClipMethod expectedMethod,
                           int numExpectedElems = 0) {
     auto context = GrContext::MakeMock(nullptr);
-    const auto* caps = context->caps()->shaderCaps();
+    const auto* caps = context->contextPriv().caps()->shaderCaps();
 
     SkRect queryBounds;
     queryXform.mapRect(&queryBounds, preXformQuery);
@@ -1414,7 +1414,7 @@
     pathStack.clipPath(clipPath, SkMatrix::I(), kIntersect_SkClipOp, true);
 
     auto context = GrContext::MakeMock(nullptr);
-    const auto* caps = context->caps()->shaderCaps();
+    const auto* caps = context->contextPriv().caps()->shaderCaps();
 
     for (const SkClipStack& stack : {rectStack, pathStack}) {
         for (SkRect queryBounds : {SkRect::MakeXYWH(53, 60, GrClip::kBoundsTolerance, 1000),
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
index 9716477..d033f89 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -10,22 +10,21 @@
 #if SK_SUPPORT_GPU
 
 #include "GrBackendSurface.h"
+#include "GrContextPriv.h"
 #include "GrGpu.h"
 #include "GrTextureProxyPriv.h"
-
 #include "SkCanvas.h"
 #include "SkColorSpacePriv.h"
 #include "SkDeferredDisplayListRecorder.h"
 #include "SkGpuDevice.h"
 #include "SkImage_Gpu.h"
 #include "SkSurface.h"
-#include "SkSurface_Gpu.h"
 #include "SkSurfaceCharacterization.h"
 #include "SkSurfaceProps.h"
+#include "SkSurface_Gpu.h"
 #include "Test.h"
-
-#include "gl/GrGLDefines.h"
 #include "gl/GrGLCaps.h"
+#include "gl/GrGLDefines.h"
 #ifdef SK_VULKAN
 #include "vk/GrVkDefines.h"
 #endif
@@ -35,13 +34,13 @@
 static GrBackendFormat create_backend_format(GrContext* context,
                                              SkColorType ct, SkColorSpace* cs,
                                              GrPixelConfig config) {
-    const GrCaps* caps = context->caps();
+    const GrCaps* caps = context->contextPriv().caps();
 
     // TODO: what should be done if we have a colorspace that doesn't have a gammaCloseToSRGB?
 
     switch (context->contextPriv().getBackend()) {
     case kOpenGL_GrBackend: {
-        const GrGLCaps* glCaps = static_cast<const GrGLCaps*>(context->caps());
+        const GrGLCaps* glCaps = static_cast<const GrGLCaps*>(caps);
         GrGLStandard standard = glCaps->standard();
 
         switch (ct) {
@@ -418,7 +417,7 @@
     GrContext* context = ctxInfo.grContext();
 
     for (int i = 0; i < SurfaceParameters::kNumParams; ++i) {
-        SurfaceParameters params1(context->caps());
+        SurfaceParameters params1(context->contextPriv().caps());
         params1.modify(i);
 
         SkSurfaceCharacterization char1 = params1.createCharacterization(context);
@@ -427,7 +426,7 @@
         }
 
         for (int j = 0; j < SurfaceParameters::kNumParams; ++j) {
-            SurfaceParameters params2(context->caps());
+            SurfaceParameters params2(context->contextPriv().caps());
             params2.modify(j);
 
             SkSurfaceCharacterization char2 = params2.createCharacterization(context);
@@ -445,7 +444,7 @@
     }
 
     {
-        SurfaceParameters params(context->caps());
+        SurfaceParameters params(context->contextPriv().caps());
 
         SkSurfaceCharacterization valid = params.createCharacterization(context);
         SkASSERT(valid.isValid());
@@ -475,7 +474,7 @@
 
     // First, create a DDL using the stock SkSurface parameters
     {
-        SurfaceParameters params(context->caps());
+        SurfaceParameters params(context->contextPriv().caps());
 
         ddl = params.createDDL(context);
         SkAssertResult(ddl);
@@ -497,7 +496,7 @@
 
     // Then, alter each parameter in turn and check that the DDL & surface are incompatible
     for (int i = 0; i < SurfaceParameters::kNumParams; ++i) {
-        SurfaceParameters params(context->caps());
+        SurfaceParameters params(context->contextPriv().caps());
         params.modify(i);
 
         GrBackendTexture backend;
@@ -509,9 +508,12 @@
         if (SurfaceParameters::kSampleCount == i) {
             SkSurface_Gpu* gpuSurf = static_cast<SkSurface_Gpu*>(s.get());
 
-            int supportedSampleCount = context->caps()->getRenderTargetSampleCount(
-                params.sampleCount(),
-                gpuSurf->getDevice()->accessRenderTargetContext()->asRenderTargetProxy()->config());
+            int supportedSampleCount = context->contextPriv().caps()->getRenderTargetSampleCount(
+                    params.sampleCount(),
+                    gpuSurf->getDevice()
+                            ->accessRenderTargetContext()
+                            ->asRenderTargetProxy()
+                            ->config());
             if (1 == supportedSampleCount) {
                 // If changing the sample count won't result in a different
                 // surface characterization, skip this step
@@ -521,7 +523,8 @@
             }
         }
 
-        if (SurfaceParameters::kMipMipCount == i && !context->caps()->mipMapSupport()) {
+        if (SurfaceParameters::kMipMipCount == i &&
+            !context->contextPriv().caps()->mipMapSupport()) {
             // If changing the mipmap setting won't result in a different surface characterization,
             // skip this step
             s = nullptr;
@@ -540,7 +543,7 @@
 
     // Next test the compatibility of resource cache parameters
     {
-        const SurfaceParameters params(context->caps());
+        const SurfaceParameters params(context->contextPriv().caps());
         GrBackendTexture backend;
 
         sk_sp<SkSurface> s = params.make(context, &backend, false);
@@ -578,7 +581,7 @@
     // Test that the textureability of the DDL characterization can block a DDL draw
     {
         GrBackendTexture backend;
-        const SurfaceParameters params(context->caps());
+        const SurfaceParameters params(context->contextPriv().caps());
         sk_sp<SkSurface> s = params.make(context, &backend, true);
         if (s) {
             REPORTER_ASSERT(reporter, !s->draw(ddl.get()));
@@ -601,7 +604,7 @@
 
     // Exercise the createResized method
     {
-        SurfaceParameters params(context->caps());
+        SurfaceParameters params(context->contextPriv().caps());
         GrBackendTexture backend;
 
         sk_sp<SkSurface> s = params.make(context, &backend, false);
@@ -638,7 +641,7 @@
     GrContext* context = ctxInfo.grContext();
 
     for (int i = 0; i < SurfaceParameters::kNumParams; ++i) {
-        SurfaceParameters params(context->caps());
+        SurfaceParameters params(context->contextPriv().caps());
         params.modify(i);
 
         SkSurfaceCharacterization c = params.createCharacterization(context);
@@ -698,7 +701,7 @@
         return;
     }
 
-    SurfaceParameters params(context->caps());
+    SurfaceParameters params(context->contextPriv().caps());
     GrBackendTexture backend;
 
     sk_sp<SkSurface> s = params.make(context, &backend, false);
@@ -860,7 +863,7 @@
         for (int config = 0; config < kGrPixelConfigCnt; ++config) {
             GrPixelConfig pixelConfig = static_cast<GrPixelConfig>(config);
 
-            SurfaceParameters params(context->caps());
+            SurfaceParameters params(context->contextPriv().caps());
             params.setColorType(colorType);
             params.setConfig(pixelConfig);
 
diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp
index ef219d9..584ae64 100644
--- a/tests/DrawOpAtlasTest.cpp
+++ b/tests/DrawOpAtlasTest.cpp
@@ -184,7 +184,7 @@
                                                                      rtc.get(), paint,
                                                                      SkMatrix::I(), text,
                                                                      16, 16);
-    op->finalize(*context->caps(), nullptr, GrPixelConfigIsClamped::kNo);
+    op->finalize(*context->contextPriv().caps(), nullptr, GrPixelConfigIsClamped::kNo);
 
     TestingUploadTarget uploadTarget;
 
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index e3639fb..3e4ed5f 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -300,8 +300,8 @@
     static const int NUM_TESTS = 1024;
     for (int t = 0; t < NUM_TESTS; t++) {
         // setup random render target(can fail)
-        sk_sp<GrRenderTargetContext> renderTargetContext(random_render_target_context(
-            context, &random, context->caps()));
+        sk_sp<GrRenderTargetContext> renderTargetContext(
+                random_render_target_context(context, &random, context->contextPriv().caps()));
         if (!renderTargetContext) {
             SkDebugf("Could not allocate renderTargetContext");
             return false;
diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp
index bebfd4d..d98fe09 100644
--- a/tests/GrContextFactoryTest.cpp
+++ b/tests/GrContextFactoryTest.cpp
@@ -29,9 +29,8 @@
         if (!context) {
             continue;
         }
-        REPORTER_ASSERT(
-            reporter,
-            context->caps()->shaderCaps()->pathRenderingSupport());
+        REPORTER_ASSERT(reporter,
+                        context->contextPriv().caps()->shaderCaps()->pathRenderingSupport());
     }
 }
 
@@ -44,9 +43,8 @@
         GrContext* context =
             testFactory.get(ctxType, GrContextFactory::ContextOverrides::kDisableNVPR);
         if (context) {
-            REPORTER_ASSERT(
-                reporter,
-                !context->caps()->shaderCaps()->pathRenderingSupport());
+            REPORTER_ASSERT(reporter,
+                            !context->contextPriv().caps()->shaderCaps()->pathRenderingSupport());
         }
     }
 }
@@ -63,11 +61,11 @@
             testFactory.get(ctxType, GrContextFactory::ContextOverrides::kRequireSRGBSupport);
 
         if (context) {
-            REPORTER_ASSERT(reporter, context->caps()->srgbSupport());
+            REPORTER_ASSERT(reporter, context->contextPriv().caps()->srgbSupport());
         } else {
             context = testFactory.get(ctxType);
             if (context) {
-                REPORTER_ASSERT(reporter, !context->caps()->srgbSupport());
+                REPORTER_ASSERT(reporter, !context->contextPriv().caps()->srgbSupport());
             }
         }
     }
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 80788dd..5afe562 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -10,23 +10,24 @@
 
 #if SK_SUPPORT_GPU
 
+#include <array>
+#include <vector>
+#include "GrCaps.h"
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "GrGeometryProcessor.h"
 #include "GrGpuCommandBuffer.h"
 #include "GrOpFlushState.h"
 #include "GrRenderTargetContext.h"
 #include "GrRenderTargetContextPriv.h"
-#include "GrResourceProvider.h"
 #include "GrResourceKey.h"
+#include "GrResourceProvider.h"
 #include "SkBitmap.h"
 #include "SkMakeUnique.h"
-#include "glsl/GrGLSLVertexGeoBuilder.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLGeometryProcessor.h"
 #include "glsl/GrGLSLVarying.h"
-#include <array>
-#include <vector>
-
+#include "glsl/GrGLSLVertexGeoBuilder.h"
 
 GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey);
 
@@ -197,7 +198,7 @@
     });
 
     for (bool indexed : {false, true}) {
-        if (!context->caps()->instanceAttribSupport()) {
+        if (!context->contextPriv().caps()->instanceAttribSupport()) {
             break;
         }
 
@@ -226,7 +227,7 @@
                 }
                 switch (y % 3) {
                     case 0:
-                        if (context->caps()->shaderCaps()->vertexIDSupport()) {
+                        if (context->contextPriv().caps()->shaderCaps()->vertexIDSupport()) {
                             if (y % 2) {
                                 // We don't need this call because it's the initial state of GrMesh.
                                 mesh.setVertexData(nullptr);
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 95604fa..e356779 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -34,7 +34,7 @@
 // SkImages and SkSurfaces
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    if (!context->caps()->mipMapSupport()) {
+    if (!context->contextPriv().caps()->mipMapSupport()) {
         return;
     }
     GrGpu* gpu = context->contextPriv().getGpu();
@@ -103,7 +103,7 @@
 // based on if we will use mips in the draw and the mip status of the GrBackendTexture.
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    if (!context->caps()->mipMapSupport()) {
+    if (!context->contextPriv().caps()->mipMapSupport()) {
         return;
     }
     GrGpu* gpu = context->contextPriv().getGpu();
@@ -229,7 +229,7 @@
 // resource we took the snapshot of.
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    if (!context->caps()->mipMapSupport()) {
+    if (!context->contextPriv().caps()->mipMapSupport()) {
         return;
     }
 
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 8a94084..cceebbb 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1063,7 +1063,7 @@
 
     GrGpu* gpu = ctx->contextPriv().getGpu();
     GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider();
-    const GrCaps& caps = *ctx->caps();
+    const GrCaps& caps = *ctx->contextPriv().caps();
     if (caps.shaderCaps()->dualSourceBlendingSupport()) {
         SK_ABORT("Null context failed to honor request for no ARB_blend_func_extended.");
         return;
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index c56b1ea..4323ed6 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -74,7 +74,7 @@
     GrContext* context = ctxInfo.grContext();
     GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
     GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider();
-    const GrCaps* caps = context->caps();
+    const GrCaps* caps = context->contextPriv().caps();
 
     GrPixelConfig configs[] = {
         kUnknown_GrPixelConfig,
@@ -157,12 +157,12 @@
         if (GrPixelConfigIsSRGB(desc.fConfig)) {
             colorSpace = SkColorSpace::MakeSRGB();
         }
-        if (!context_info.grContext()->caps()->isConfigTexturable(desc.fConfig)) {
+        if (!context->contextPriv().caps()->isConfigTexturable(desc.fConfig)) {
             continue;
         }
         desc.fFlags = kPerformInitialClear_GrSurfaceFlag;
         for (bool rt : {false, true}) {
-            if (rt && !context->caps()->isConfigRenderable(desc.fConfig)) {
+            if (rt && !context->contextPriv().caps()->isConfigRenderable(desc.fConfig)) {
                 continue;
             }
             desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 0aad960..e3c7e35 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -43,7 +43,9 @@
 #include "sk_tool_utils.h"
 
 #if SK_SUPPORT_GPU
+#include "GrCaps.h"
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #endif
 
 static const int kBitmapSize = 4;
@@ -1671,7 +1673,7 @@
 #if SK_SUPPORT_GPU
     // If we're GPU-backed make the bitmap too large to be converted into a texture.
     if (GrContext* ctx = canvas->getGrContext()) {
-        largeW = ctx->caps()->maxTextureSize() + 1;
+        largeW = ctx->contextPriv().caps()->maxTextureSize() + 1;
     }
 #endif
 
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 679dc8a..b69dd2e1 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -850,7 +850,7 @@
         // If we don't have proper support for this feature, the factory will fallback to returning
         // codec-backed images. Those will "work", but some of our checks will fail because we
         // expect the cross-context images not to work on multiple contexts at once.
-        if (!ctx->caps()->crossContextTextureSupport()) {
+        if (!ctx->contextPriv().caps()->crossContextTextureSupport()) {
             continue;
         }
 
@@ -1026,7 +1026,7 @@
             GrContextFactory::ContextType ctxType = static_cast<GrContextFactory::ContextType>(i);
             ContextInfo ctxInfo = testFactory.getContextInfo(ctxType);
             GrContext* ctx = ctxInfo.grContext();
-            if (!ctx || !ctx->caps()->crossContextTextureSupport()) {
+            if (!ctx || !ctx->contextPriv().caps()->crossContextTextureSupport()) {
                 continue;
             }
 
@@ -1055,7 +1055,7 @@
     testContext->makeCurrent();
     REPORTER_ASSERT(reporter, proxy);
     auto createLarge = [context] {
-        return create_image_large(context->caps()->maxTextureSize());
+        return create_image_large(context->contextPriv().caps()->maxTextureSize());
     };
     struct {
         std::function<sk_sp<SkImage> ()>                      fImageFactory;
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index b5f508b..3a9ab8d 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -12,6 +12,7 @@
 
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "GrGeometryProcessor.h"
 #include "GrGpu.h"
 #include "GrOpFlushState.h"
@@ -123,7 +124,7 @@
         ERRORF(reporter, "Could not create render target context.");
         return;
     }
-    int attribCnt = context->caps()->maxVertexAttributes();
+    int attribCnt = context->contextPriv().caps()->maxVertexAttributes();
     if (!attribCnt) {
         ERRORF(reporter, "No attributes allowed?!");
         return;
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index d435059..9cb23ac 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -172,7 +172,8 @@
                                                              SkBackingFit::kApprox, 1, 1,
                                                              kRGBA_8888_GrPixelConfig, nullptr));
             {
-                bool texelBufferSupport = context->caps()->shaderCaps()->texelBufferSupport();
+                bool texelBufferSupport =
+                        context->contextPriv().caps()->shaderCaps()->texelBufferSupport();
                 sk_sp<GrTextureProxy> proxy1 = proxyProvider->createProxy(
                         desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes);
                 sk_sp<GrTextureProxy> proxy2 = proxyProvider->createProxy(
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 5721a41..369cd1c 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -108,7 +108,7 @@
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
     GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
     GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
-    const GrCaps& caps = *ctxInfo.grContext()->caps();
+    const GrCaps& caps = *ctxInfo.grContext()->contextPriv().caps();
 
     int attempt = 0; // useful for debugging
 
@@ -198,7 +198,7 @@
     GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
     GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
     GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu();
-    const GrCaps& caps = *ctxInfo.grContext()->caps();
+    const GrCaps& caps = *ctxInfo.grContext()->contextPriv().caps();
 
     static const int kWidthHeight = 100;
 
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index a0d67bb..e4df621 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -157,8 +157,8 @@
                      std::move(p1), std::move(p2), test.fExpectation);
     }
 
-    int k2 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(2, kRGBA);
-    int k4 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(4, kRGBA);
+    int k2 = ctxInfo.grContext()->contextPriv().caps()->getRenderTargetSampleCount(2, kRGBA);
+    int k4 = ctxInfo.grContext()->contextPriv().caps()->getRenderTargetSampleCount(4, kRGBA);
 
     //--------------------------------------------------------------------------------------------
     TestCase gNonOverlappingTests[] = {
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 11dcdd4..857286a 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -122,7 +122,7 @@
 DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angle_es3, reporter,
                          ctxInfo, nullptr) {
     GrContext* context = ctxInfo.grContext();
-    if (context->caps()->avoidStencilBuffers()) {
+    if (context->contextPriv().caps()->avoidStencilBuffers()) {
         return;
     }
 
@@ -155,7 +155,8 @@
         REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) != get_SB(bigRT.get()));
     }
 
-    int smallSampleCount = context->caps()->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig);
+    int smallSampleCount =
+            context->contextPriv().caps()->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig);
     if (smallSampleCount > 1) {
         // An RT with a different sample count should not share.
         sk_sp<GrRenderTarget> smallMSAART0 = create_RT_with_SB(resourceProvider, 4,
@@ -183,8 +184,8 @@
 
         // But one with a larger sample count should not. (Also check that the two requests didn't
         // rounded up to the same actual sample count or else they could share.).
-        int bigSampleCount =
-                context->caps()->getRenderTargetSampleCount(5, kRGBA_8888_GrPixelConfig);
+        int bigSampleCount = context->contextPriv().caps()->getRenderTargetSampleCount(
+                5, kRGBA_8888_GrPixelConfig);
         if (bigSampleCount > 0 && bigSampleCount != smallSampleCount) {
             sk_sp<GrRenderTarget> smallMSAART2 = create_RT_with_SB(resourceProvider, 4,
                                                                    bigSampleCount,
@@ -1766,8 +1767,8 @@
         size_t size = tex->gpuMemorySize();
         REPORTER_ASSERT(reporter, kSize*kSize*4 == size);
 
-        size_t sampleCount =
-                (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig);
+        size_t sampleCount = (size_t)context->contextPriv().caps()->getRenderTargetSampleCount(
+                4, kRGBA_8888_GrPixelConfig);
         if (sampleCount >= 4) {
             tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize,
                                       sampleCount);
@@ -1785,15 +1786,15 @@
 
 
     // Mipmapped versions
-    if (context->caps()->mipMapSupport()) {
+    if (context->contextPriv().caps()->mipMapSupport()) {
         sk_sp<GrTextureProxy> proxy;
 
         proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 1);
         size_t size = proxy->gpuMemorySize();
         REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size);
 
-        size_t sampleCount =
-                (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig);
+        size_t sampleCount = (size_t)context->contextPriv().caps()->getRenderTargetSampleCount(
+                4, kRGBA_8888_GrPixelConfig);
         if (sampleCount >= 4) {
             proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize,
                                       sampleCount);
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index 7be4db6..2da7102 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -80,7 +80,7 @@
 
 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    if (!context->caps()->srgbSupport()) {
+    if (!context->contextPriv().caps()->srgbSupport()) {
         return;
     }
 
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index 569490c..d090237 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -258,16 +258,16 @@
 // are sRGB, linear, or untagged RGBA_8888.
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    if (!context->caps()->isConfigRenderable(kSRGBA_8888_GrPixelConfig) &&
-        !context->caps()->isConfigTexturable(kSRGBA_8888_GrPixelConfig)) {
+    if (!context->contextPriv().caps()->isConfigRenderable(kSRGBA_8888_GrPixelConfig) &&
+        !context->contextPriv().caps()->isConfigTexturable(kSRGBA_8888_GrPixelConfig)) {
         return;
     }
     // We allow more error on GPUs with lower precision shader variables.
-    float error = context->caps()->shaderCaps()->halfIs32Bits() ? 0.5f : 1.2f;
+    float error = context->contextPriv().caps()->shaderCaps()->halfIs32Bits() ? 0.5f : 1.2f;
     // For the all-sRGB case, we allow a small error only for devices that have
     // precision variation because the sRGB data gets converted to linear and back in
     // the shader.
-    float smallError = context->caps()->shaderCaps()->halfIs32Bits() ? 0.0f : 1.f;
+    float smallError = context->contextPriv().caps()->shaderCaps()->halfIs32Bits() ? 0.0f : 1.f;
 
     ///////////////////////////////////////////////////////////////////////////////////////////////
     // Write sRGB data to a sRGB context - no conversion on the write.
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index a9cd1c7..719a3af 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -239,7 +239,8 @@
 
     {
         // gpu
-        const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps());
+        const GrSurfaceDesc desc =
+                GrImageInfoToSurfaceDesc(bm.info(), *context->contextPriv().caps());
 
         sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
                 desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
@@ -272,7 +273,7 @@
     GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
     SkBitmap bm = create_bm();
 
-    const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps());
+    const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->contextPriv().caps());
 
     sk_sp<GrTextureProxy> proxy =
             proxyProvider->createTextureProxy(desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp
index 40de08d..3c6de0a 100644
--- a/tests/SpecialSurfaceTest.cpp
+++ b/tests/SpecialSurfaceTest.cpp
@@ -12,7 +12,9 @@
 #include "Test.h"
 
 #if SK_SUPPORT_GPU
+#include "GrCaps.h"
 #include "GrContext.h"
+#include "GrContextPriv.h"
 #include "SkGr.h"
 #endif
 
@@ -81,7 +83,7 @@
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) {
     for (auto config : { kRGBA_8888_GrPixelConfig, kRGBA_1010102_GrPixelConfig }) {
-        if (!ctxInfo.grContext()->caps()->isConfigRenderable(config)) {
+        if (!ctxInfo.grContext()->contextPriv().caps()->isConfigRenderable(config)) {
             continue;
         }
         sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.grContext(),
diff --git a/tests/SurfaceSemaphoreTest.cpp b/tests/SurfaceSemaphoreTest.cpp
index 980478b..b3a030e 100644
--- a/tests/SurfaceSemaphoreTest.cpp
+++ b/tests/SurfaceSemaphoreTest.cpp
@@ -111,7 +111,7 @@
                             const sk_gpu_test::ContextInfo& childInfo2,
                             bool flushContext) {
     GrContext* mainCtx = mainInfo.grContext();
-    if (!mainCtx->caps()->fenceSyncSupport()) {
+    if (!mainCtx->contextPriv().caps()->fenceSyncSupport()) {
         return;
     }
 
@@ -213,7 +213,7 @@
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo) {
     GrContext* ctx = ctxInfo.grContext();
-    if (!ctx->caps()->fenceSyncSupport()) {
+    if (!ctx->contextPriv().caps()->fenceSyncSupport()) {
         return;
     }
 
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index e757230..965298a 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -148,7 +148,7 @@
         if (surf) {
             auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext();
             int storedCnt = rtc->numStencilSamples();
-            int allowedCnt = ctxInfo.grContext()->caps()->getSampleCount(
+            int allowedCnt = ctxInfo.grContext()->contextPriv().caps()->getSampleCount(
                     storedCnt, rtc->asSurfaceProxy()->config());
             REPORTER_ASSERT(reporter, storedCnt == allowedCnt,
                             "Should store an allowed sample count (%d vs %d)", allowedCnt,
@@ -164,7 +164,7 @@
         if (surf) {
             auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext();
             int storedCnt = rtc->numStencilSamples();
-            int allowedCnt = ctxInfo.grContext()->caps()->getSampleCount(
+            int allowedCnt = ctxInfo.grContext()->contextPriv().caps()->getSampleCount(
                     storedCnt, rtc->asSurfaceProxy()->config());
             REPORTER_ASSERT(reporter, storedCnt == allowedCnt,
                             "Should store an allowed sample count (%d vs %d)", allowedCnt,
@@ -993,10 +993,11 @@
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, ctxInfo) {
-    GrContext* context = ctxInfo.grContext();
+    auto context = ctxInfo.grContext();
 
-    bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig);
-    bool supports1010102 = context->caps()->isConfigRenderable(kRGBA_1010102_GrPixelConfig);
+    bool f16Support = context->contextPriv().caps()->isConfigRenderable(kRGBA_half_GrPixelConfig);
+    bool supports1010102 =
+            context->contextPriv().caps()->isConfigRenderable(kRGBA_1010102_GrPixelConfig);
     auto surfaceMaker = [context](const SkImageInfo& info) {
         return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
     };
@@ -1009,7 +1010,7 @@
         GrGpu* gpu = context->contextPriv().getGpu();
 
         static const int kSize = 10;
-        GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *context->caps());
+        GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *context->contextPriv().caps());
         SkASSERT(kUnknown_GrPixelConfig != config);
 
         GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index e17dfac..5ff2386 100755
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -64,7 +64,7 @@
 
 void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrColorType colorType,
                          GrSurfaceOrigin origin, bool renderTarget) {
-    if (GrCaps::kNone_MapFlags == context->caps()->mapBufferFlags()) {
+    if (GrCaps::kNone_MapFlags == context->contextPriv().caps()->mapBufferFlags()) {
         return;
     }
 
@@ -111,8 +111,8 @@
             continue;
         }
 
-        if (!context->caps()->isConfigTexturable(desc.fConfig) ||
-            (renderTarget && !context->caps()->isConfigRenderable(desc.fConfig))) {
+        if (!context->contextPriv().caps()->isConfigTexturable(desc.fConfig) ||
+            (renderTarget && !context->contextPriv().caps()->isConfigRenderable(desc.fConfig))) {
             continue;
         }
 
diff --git a/tests/WindowRectanglesTest.cpp b/tests/WindowRectanglesTest.cpp
index d6c4756..ed4e403 100644
--- a/tests/WindowRectanglesTest.cpp
+++ b/tests/WindowRectanglesTest.cpp
@@ -11,6 +11,7 @@
 #if SK_SUPPORT_GPU
 
 #include "GrWindowRectangles.h"
+#include "SkRandom.h"
 #include "SkRectPriv.h"
 
 static SkIRect next_irect(SkRandom& r) {
diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp
index 3692606..2bfccd9 100644
--- a/tools/gpu/GrContextFactory.cpp
+++ b/tools/gpu/GrContextFactory.cpp
@@ -7,6 +7,7 @@
  */
 
 #include "GrContextFactory.h"
+#include "GrContextPriv.h"
 #include "gl/GLTestContext.h"
 
 #if SK_ANGLE
@@ -275,12 +276,12 @@
         return ContextInfo();
     }
     if (ContextOverrides::kRequireNVPRSupport & overrides) {
-        if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) {
+        if (!grCtx->contextPriv().caps()->shaderCaps()->pathRenderingSupport()) {
             return ContextInfo();
         }
     }
     if (ContextOverrides::kRequireSRGBSupport & overrides) {
-        if (!grCtx->caps()->srgbSupport()) {
+        if (!grCtx->contextPriv().caps()->srgbSupport()) {
             return ContextInfo();
         }
     }
diff --git a/tools/sk_app/GLWindowContext.cpp b/tools/sk_app/GLWindowContext.cpp
index 7dddede..b6a8df9 100644
--- a/tools/sk_app/GLWindowContext.cpp
+++ b/tools/sk_app/GLWindowContext.cpp
@@ -6,17 +6,17 @@
  * found in the LICENSE file.
  */
 
-#include "GrBackendSurface.h"
-#include "GrContext.h"
 #include "GLWindowContext.h"
-
-#include "gl/GrGLDefines.h"
-#include "gl/GrGLUtil.h"
-
+#include "GrBackendSurface.h"
+#include "GrCaps.h"
+#include "GrContext.h"
+#include "GrContextPriv.h"
 #include "SkCanvas.h"
 #include "SkImage_Base.h"
 #include "SkMathPriv.h"
 #include "SkSurface.h"
+#include "gl/GrGLDefines.h"
+#include "gl/GrGLUtil.h"
 
 namespace sk_app {
 
@@ -61,8 +61,10 @@
             GR_GL_CALL(fBackendContext.get(), GetIntegerv(GR_GL_FRAMEBUFFER_BINDING,
                                                           &buffer));
             fbInfo.fFBOID = buffer;
-            fbInfo.fFormat = fContext->caps()->srgbSupport() && fDisplayParams.fColorSpace
-                             ? GR_GL_SRGB8_ALPHA8 : GR_GL_RGBA8;
+            fbInfo.fFormat =
+                    fContext->contextPriv().caps()->srgbSupport() && fDisplayParams.fColorSpace
+                            ? GR_GL_SRGB8_ALPHA8
+                            : GR_GL_RGBA8;
 
             GrBackendRenderTarget backendRT(fWidth,
                                             fHeight,
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 6081c05..7808638 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -136,7 +136,7 @@
         bounds = fPicture->cullRect().roundOut();
         if (fGPUEnabled) {
 #if SK_SUPPORT_GPU
-            int maxRTSize = this->getContext()->caps()->maxRenderTargetSize();
+            int maxRTSize = this->getContext()->maxRenderTargetSize();
             bounds = SkIRect::MakeWH(SkTMin(bounds.width(), maxRTSize),
                                      SkTMin(bounds.height(), maxRTSize));
 #endif
diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp
index 92a642a..452095f 100644
--- a/tools/skpbench/skpbench.cpp
+++ b/tools/skpbench/skpbench.cpp
@@ -5,13 +5,20 @@
  * found in the LICENSE file.
  */
 
+#include <stdlib.h>
+#include <algorithm>
+#include <array>
+#include <chrono>
+#include <cmath>
+#include <vector>
 #include "GpuTimer.h"
+#include "GrCaps.h"
 #include "GrContextFactory.h"
-#include "SkGr.h"
-
+#include "GrContextPriv.h"
 #include "SkCanvas.h"
 #include "SkCommonFlags.h"
 #include "SkCommonFlagsGpu.h"
+#include "SkGr.h"
 #include "SkOSFile.h"
 #include "SkOSPath.h"
 #include "SkPerlinNoiseShader.h"
@@ -20,16 +27,10 @@
 #include "SkStream.h"
 #include "SkSurface.h"
 #include "SkSurfaceProps.h"
-#include "picture_utils.h"
-#include "sk_tool_utils.h"
 #include "flags/SkCommandLineFlags.h"
 #include "flags/SkCommonFlagsConfig.h"
-#include <stdlib.h>
-#include <algorithm>
-#include <array>
-#include <chrono>
-#include <cmath>
-#include <vector>
+#include "picture_utils.h"
+#include "sk_tool_utils.h"
 
 /**
  * This is a minimalist program whose sole purpose is to open an skp file, benchmark it on a single
@@ -290,19 +291,18 @@
         exitf(ExitErr::kUnavailable, "failed to create context for config %s",
                                      config->getTag().c_str());
     }
-    if (ctx->caps()->maxRenderTargetSize() < SkTMax(width, height)) {
+    if (ctx->maxRenderTargetSize() < SkTMax(width, height)) {
         exitf(ExitErr::kUnavailable, "render target size %ix%i not supported by platform (max: %i)",
-                                     width, height, ctx->caps()->maxRenderTargetSize());
+              width, height, ctx->maxRenderTargetSize());
     }
-    GrPixelConfig grPixConfig = SkImageInfo2GrPixelConfig(config->getColorType(),
-                                                          config->getColorSpace(),
-                                                          *ctx->caps());
+    GrPixelConfig grPixConfig = SkImageInfo2GrPixelConfig(
+            config->getColorType(), config->getColorSpace(), *ctx->contextPriv().caps());
     if (kUnknown_GrPixelConfig == grPixConfig) {
         exitf(ExitErr::kUnavailable, "failed to get GrPixelConfig from SkColorType: %d",
                                      config->getColorType());
     }
-    int supportedSampleCount =
-            ctx->caps()->getRenderTargetSampleCount(config->getSamples(), grPixConfig);
+    int supportedSampleCount = ctx->contextPriv().caps()->getRenderTargetSampleCount(
+            config->getSamples(), grPixConfig);
     if (supportedSampleCount != config->getSamples()) {
         exitf(ExitErr::kUnavailable, "sample count %i not supported by platform",
                                      config->getSamples());
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 1858682..cfb8c61 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -6,22 +6,21 @@
 */
 
 #include "Viewer.h"
-
+#include <stdlib.h>
+#include <map>
 #include "BisectSlide.h"
 #include "GMSlide.h"
+#include "GrContext.h"
+#include "GrContextPriv.h"
 #include "ImageSlide.h"
 #include "Resources.h"
-#include "SampleSlide.h"
 #include "SKPSlide.h"
-#include "SlideDir.h"
-#include "SvgSlide.h"
-
-#include "GrContext.h"
+#include "SampleSlide.h"
 #include "SkCanvas.h"
 #include "SkColorSpacePriv.h"
 #include "SkColorSpaceXformCanvas.h"
-#include "SkCommonFlags.h"
 #include "SkCommandLineFlags.h"
+#include "SkCommonFlags.h"
 #include "SkCommonFlagsGpu.h"
 #include "SkEventTracingPriv.h"
 #include "SkFontMgrPriv.h"
@@ -38,13 +37,10 @@
 #include "SkTaskGroup.h"
 #include "SkTestFontMgr.h"
 #include "SkThreadedBMPDevice.h"
-
-#include "imgui.h"
-
+#include "SlideDir.h"
+#include "SvgSlide.h"
 #include "ccpr/GrCoverageCountingPathRenderer.h"
-
-#include <stdlib.h>
-#include <map>
+#include "imgui.h"
 
 #if defined(SK_ENABLE_SKOTTIE)
     #include "SkottieSlide.h"
@@ -1479,7 +1475,7 @@
                     } else if (fWindow->sampleCount() > 1) {
                         prButton(GpuPathRenderers::kDefault);
                         prButton(GpuPathRenderers::kAll);
-                        if (ctx->caps()->shaderCaps()->pathRenderingSupport()) {
+                        if (ctx->contextPriv().caps()->shaderCaps()->pathRenderingSupport()) {
                             prButton(GpuPathRenderers::kStencilAndCover);
                         }
                         prButton(GpuPathRenderers::kTessellating);
@@ -1487,7 +1483,8 @@
                     } else {
                         prButton(GpuPathRenderers::kDefault);
                         prButton(GpuPathRenderers::kAll);
-                        if (GrCoverageCountingPathRenderer::IsSupported(*ctx->caps())) {
+                        if (GrCoverageCountingPathRenderer::IsSupported(
+                                    *ctx->contextPriv().caps())) {
                             prButton(GpuPathRenderers::kCoverageCounting);
                         }
                         prButton(GpuPathRenderers::kSmall);
@@ -1852,7 +1849,7 @@
     } else if (fWindow->sampleCount() > 1) {
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kDefault]);
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kAll]);
-        if (ctx->caps()->shaderCaps()->pathRenderingSupport()) {
+        if (ctx->contextPriv().caps()->shaderCaps()->pathRenderingSupport()) {
             prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kStencilAndCover]);
         }
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kTessellating]);
@@ -1860,7 +1857,7 @@
     } else {
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kDefault]);
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kAll]);
-        if (GrCoverageCountingPathRenderer::IsSupported(*ctx->caps())) {
+        if (GrCoverageCountingPathRenderer::IsSupported(*ctx->contextPriv().caps())) {
             prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kCoverageCounting]);
         }
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kSmall]);