Propagate GrRenderable flag to GrCaps::getBackendFormatFromColorType

This makes calling GrCaps::getBackendFormatFromColorType equivalent to calling GrContext::defaultBackendFormat

Change-Id: Ic402245fa0502920c47c2a29aadc4e559abdc09b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230416
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
index 72e423f..c559de4 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -150,9 +150,8 @@
         SkImageInfo ii = SkImageInfo::Make(fWidth, fHeight, fColorType,
                                            kPremul_SkAlphaType, fColorSpace);
 
-        const GrCaps* caps = context->priv().caps();
-        GrBackendFormat backendFormat =
-                caps->getBackendFormatFromColorType(SkColorTypeToGrColorType(fColorType));
+        GrBackendFormat backendFormat = context->defaultBackendFormat(fColorType,
+                                                                      GrRenderable::kYes);
         if (!backendFormat.isValid()) {
             return SkSurfaceCharacterization();
         }
@@ -764,8 +763,9 @@
         REPORTER_ASSERT(reporter, !recorder.getCanvas());
         REPORTER_ASSERT(reporter, !recorder.detach());
 
-        const GrCaps* caps = context->priv().caps();
-        GrBackendFormat format = caps->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+        GrBackendFormat format = context->defaultBackendFormat(kRGBA_8888_SkColorType,
+                                                               GrRenderable::kNo);
+        SkASSERT(format.isValid());
 
         sk_sp<SkImage> image = recorder.makePromiseTexture(
                 format, 32, 32, GrMipMapped::kNo,
@@ -850,8 +850,9 @@
     {
         SkDeferredDisplayListRecorder recorder(characterization);
 
-        const GrCaps* caps = context->priv().caps();
-        GrBackendFormat format = caps->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+        GrBackendFormat format = context->defaultBackendFormat(kRGBA_8888_SkColorType,
+                                                               GrRenderable::kNo);
+        SkASSERT(format.isValid());
 
         sk_sp<SkImage> promiseImage = recorder.makePromiseTexture(
                 format, 32, 32, GrMipMapped::kNo,
diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp
index b01f1b4..9a732c2 100644
--- a/tests/DetermineDomainModeTest.cpp
+++ b/tests/DetermineDomainModeTest.cpp
@@ -125,6 +125,8 @@
                                           bool isExact,
                                           RectInfo* rect) {
     GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
+    const GrCaps* caps = ctx->priv().caps();
+
     int size = isPowerOfTwo ? 128 : 100;
     SkBackingFit fit = isExact ? SkBackingFit::kExact : SkBackingFit::kApprox;
 
@@ -133,8 +135,8 @@
     desc.fHeight = size;
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-    GrBackendFormat format =
-            ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+    GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                           GrRenderable::kNo);
 
     static const char* name = "proxy";
 
diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp
index 45deed5..c7245ce 100644
--- a/tests/DrawOpAtlasTest.cpp
+++ b/tests/DrawOpAtlasTest.cpp
@@ -134,12 +134,13 @@
     auto proxyProvider = context->priv().proxyProvider();
     auto resourceProvider = context->priv().resourceProvider();
     auto drawingManager = context->priv().drawingManager();
+    const GrCaps* caps = context->priv().caps();
 
     GrOnFlushResourceProvider onFlushResourceProvider(drawingManager);
     TestingUploadTarget uploadTarget;
 
-    GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
+    GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
+                                                           GrRenderable::kNo);
 
     std::unique_ptr<GrDrawOpAtlas> atlas = GrDrawOpAtlas::Make(
                                                 proxyProvider,
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index bbe2962..ef25d7f0 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -149,7 +149,7 @@
                                                 : kBottomLeft_GrSurfaceOrigin;
 
     GrColorType ct = GrColorType::kRGBA_8888;
-    const GrBackendFormat format = caps->getBackendFormatFromColorType(ct);
+    const GrBackendFormat format = caps->getDefaultBackendFormat(ct, GrRenderable::kYes);
 
     int sampleCnt = random->nextBool() ? caps->getRenderTargetSampleCount(2, ct, format) : 1;
     // Above could be 0 if msaa isn't supported.
@@ -272,7 +272,8 @@
         dummyDesc.fHeight = 18;
         dummyDesc.fConfig = kRGBA_8888_GrPixelConfig;
         const GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+            context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                            GrRenderable::kYes);
         proxies[0] = proxyProvider->createProxy(format, dummyDesc, GrRenderable::kYes, 1,
                                                 kBottomLeft_GrSurfaceOrigin, mipMapped,
                                                 SkBackingFit::kExact, SkBudgeted::kNo,
@@ -284,7 +285,8 @@
         dummyDesc.fHeight = 22;
         dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
         const GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_8);
+            context->priv().caps()->getDefaultBackendFormat(GrColorType::kAlpha_8,
+                                                            GrRenderable::kNo);
         proxies[1] = proxyProvider->createProxy(format, dummyDesc, GrRenderable::kNo, 1,
                                                 kTopLeft_GrSurfaceOrigin, mipMapped,
                                                 SkBackingFit::kExact, SkBudgeted::kNo,
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 47e5b13..c3d1685 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -149,7 +149,8 @@
                             "config:%d, tex:%d, isConfigTexturable:%d", config, SkToBool(tex), ict);
 
             GrColorType colorType = GrPixelConfigToColorType(config);
-            const GrBackendFormat format = caps->getBackendFormatFromColorType(colorType);
+            const GrBackendFormat format = caps->getDefaultBackendFormat(colorType,
+                                                                         GrRenderable::kNo);
             if (!format.isValid()) {
                 continue;
             }
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
index f47bb94..cf0ac31 100644
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ b/tests/GrTestingBackendTextureUploadTest.cpp
@@ -29,8 +29,8 @@
 
     GrColorType grCT = SkColorTypeToGrColorType(ct);
 
-    GrBackendFormat backendFormat = caps->getBackendFormatFromColorType(grCT);
-    if (!caps->isFormatTexturable(grCT, backendFormat)) {
+    GrBackendFormat backendFormat = context->defaultBackendFormat(ct, renderable);
+    if (!backendFormat.isValid()) {
         return;
     }
 
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index d051fc5..a94b880 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -82,7 +82,8 @@
            LazyProxyTest* test, bool nullTexture)
                     : GrDrawOp(ClassID()), fTest(test) {
             const GrBackendFormat format =
-                    ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kBGR_565);
+                ctx->priv().caps()->getDefaultBackendFormat(GrColorType::kBGR_565,
+                                                            GrRenderable::kNo);
             fProxy = GrProxyProvider::MakeFullyLazyProxy(
                     [this, nullTexture](
                             GrResourceProvider* rp) -> GrSurfaceProxy::LazyInstantiationResult {
@@ -131,7 +132,8 @@
                 , fTest(test)
                 , fAtlas(atlas) {
             const GrBackendFormat format =
-                ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kAlpha_F16);
+                ctx->priv().caps()->getDefaultBackendFormat(GrColorType::kAlpha_F16,
+                                                            GrRenderable::kYes);
             fLazyProxy = GrProxyProvider::MakeFullyLazyProxy(
                     [this](GrResourceProvider* rp) -> GrSurfaceProxy::LazyInstantiationResult {
                         REPORTER_ASSERT(fTest->fReporter, !fTest->fHasClipTexture);
@@ -225,14 +227,15 @@
     GrMockOptions mockOptions;
     sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions());
     auto proxyProvider = ctx->priv().proxyProvider();
+    const GrCaps* caps = ctx->priv().caps();
 
     GrSurfaceDesc desc;
     desc.fWidth = kSize;
     desc.fHeight = kSize;
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-    GrBackendFormat format =
-            ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+    GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                           GrRenderable::kNo);
 
     using LazyInstantiationType = GrSurfaceProxy::LazyInstantiationType;
     using LazyInstantiationResult = GrSurfaceProxy::LazyInstantiationResult;
@@ -322,7 +325,8 @@
         desc.fHeight = kSize;
         desc.fConfig = kRGBA_8888_GrPixelConfig;
         GrBackendFormat format =
-                ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+            ctx->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                        GrRenderable::kNo);
 
         fLazyProxy = proxyProvider->createLazyProxy(
                 [testExecuteValue, shouldFailInstantiation,
@@ -435,7 +439,8 @@
     GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
 
     GrBackendFormat format =
-                ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+        ctx->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                    GrRenderable::kNo);
 
     using LazyType = GrSurfaceProxy::LazyInstantiationType;
     for (auto lazyType : {LazyType::kSingleUse, LazyType::kMultipleUse, LazyType::kDeinstantiate}) {
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 8502724..d531054 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -301,7 +301,8 @@
             return fAtlasProxy;
         }
 
-        const GrBackendFormat format = caps->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+        const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                                     GrRenderable::kYes);
 
         fAtlasProxy = GrProxyProvider::MakeFullyLazyProxy(
                 [](GrResourceProvider* resourceProvider)
diff --git a/tests/OpChainTest.cpp b/tests/OpChainTest.cpp
index f650149..b078986 100644
--- a/tests/OpChainTest.cpp
+++ b/tests/OpChainTest.cpp
@@ -168,7 +168,8 @@
     desc.fHeight = 1;
 
     const GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+        context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                        GrRenderable::kYes);
 
     auto proxy = context->priv().proxyProvider()->createProxy(
             format, desc, GrRenderable::kYes, 1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 15ae0a5..260aad6 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -169,7 +169,8 @@
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
     const GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+        context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                        GrRenderable::kNo);
 
     for (bool makeClone : {false, true}) {
         for (int parentCnt = 0; parentCnt < 2; parentCnt++) {
diff --git a/tests/PromiseImageTest.cpp b/tests/PromiseImageTest.cpp
index 4ee3db6..12f01a3 100644
--- a/tests/PromiseImageTest.cpp
+++ b/tests/PromiseImageTest.cpp
@@ -242,10 +242,11 @@
 
     GrContext* ctx = ctxInfo.grContext();
     GrGpu* gpu = ctx->priv().getGpu();
-    const GrCaps* caps = ctx->priv().caps();
 
-    GrBackendFormat gray8Format  = caps->getBackendFormatFromColorType(GrColorType::kGray_8);
-    GrBackendFormat alpha8Format = caps->getBackendFormatFromColorType(GrColorType::kAlpha_8);
+    GrBackendFormat gray8Format  = ctx->defaultBackendFormat(kGray_8_SkColorType,
+                                                             GrRenderable::kNo);
+    GrBackendFormat alpha8Format = ctx->defaultBackendFormat(kAlpha_8_SkColorType,
+                                                             GrRenderable::kNo);
     if (gray8Format != alpha8Format) {
         // kGray_8 and kAlpha_8 won't share the same backend texture
         return;
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index 2bbe164..9d1af4f 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -124,16 +124,18 @@
 // Test converting between RenderTargetProxies and TextureProxies for deferred
 // Proxies
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxInfo) {
-    GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
+    GrContext* context = ctxInfo.grContext();
+    GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+    const GrCaps* caps = context->priv().caps();
 
     GrSurfaceDesc desc;
     desc.fWidth = 64;
     desc.fHeight = 64;
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-    const GrBackendFormat format =
-            ctxInfo.grContext()->priv().caps()->getBackendFormatFromColorType(
-                    GrColorType::kRGBA_8888);
+    const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                                 GrRenderable::kYes);
+
     {
         sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
                 format, desc, GrRenderable::kYes, 1, kBottomLeft_GrSurfaceOrigin,
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index 8123864..4dd831d 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -34,19 +34,25 @@
     REPORTER_ASSERT(reporter, actualBackingRefs == expectedBackingRefs);
 }
 
-static sk_sp<GrTextureProxy> make_deferred(GrProxyProvider* proxyProvider, const GrCaps* caps) {
+static sk_sp<GrTextureProxy> make_deferred(GrContext* context) {
+    GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+    const GrCaps* caps = context->priv().caps();
+
     GrSurfaceDesc desc;
     desc.fWidth = kWidthHeight;
     desc.fHeight = kWidthHeight;
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-    const GrBackendFormat format = caps->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+    const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                                 GrRenderable::kYes);
     return proxyProvider->createProxy(format, desc, GrRenderable::kYes, 1,
                                       kBottomLeft_GrSurfaceOrigin, SkBackingFit::kApprox,
                                       SkBudgeted::kYes, GrProtected::kNo);
 }
 
-static sk_sp<GrTextureProxy> make_wrapped(GrProxyProvider* proxyProvider, const GrCaps* caps) {
+static sk_sp<GrTextureProxy> make_wrapped(GrContext* context) {
+    GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+
     GrSurfaceDesc desc;
     desc.fWidth = kWidthHeight;
     desc.fHeight = kWidthHeight;
@@ -58,14 +64,12 @@
 }
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
-    GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
     GrResourceProvider* resourceProvider = ctxInfo.grContext()->priv().resourceProvider();
-    const GrCaps* caps = ctxInfo.grContext()->priv().caps();
 
     for (auto make : { make_deferred, make_wrapped }) {
         // Pending IO ref
         {
-            sk_sp<GrTextureProxy> proxy((*make)(proxyProvider, caps));
+            sk_sp<GrTextureProxy> proxy((*make)(ctxInfo.grContext()));
             if (proxy.get()) {
                 GrProxyPendingIO pendingIO(proxy.get());
 
@@ -82,7 +86,7 @@
 
         // Multiple normal refs
         {
-            sk_sp<GrTextureProxy> proxy((*make)(proxyProvider, caps));
+            sk_sp<GrTextureProxy> proxy((*make)(ctxInfo.grContext()));
             if (proxy.get()) {
                 proxy->ref();
                 proxy->ref();
@@ -103,7 +107,7 @@
 
         // Continue using (reffing) proxy after instantiation
         {
-            sk_sp<GrTextureProxy> proxy((*make)(proxyProvider, caps));
+            sk_sp<GrTextureProxy> proxy((*make)(ctxInfo.grContext()));
             if (proxy.get()) {
                 proxy->ref();
 
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 2cc5e97..de2ed87 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -127,7 +127,7 @@
                             desc.fHeight = widthHeight;
                             desc.fConfig = config;
 
-                            const GrBackendFormat format = caps.getBackendFormatFromColorType(ct);
+                            auto format = caps.getDefaultBackendFormat(ct, GrRenderable::kYes);
                             if (!format.isValid()) {
                                 continue;
                             }
@@ -257,7 +257,7 @@
                 // Test wrapping FBO 0 (with made up properties). This tests sample count and the
                 // special case where FBO 0 doesn't support window rectangles.
                 if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
-                    GrBackendFormat beFormat = caps.getBackendFormatFromColorType(grColorType);
+                    auto beFormat = caps.getDefaultBackendFormat(grColorType, GrRenderable::kYes);
                     GrGLFramebufferInfo fboInfo;
                     fboInfo.fFBOID = 0;
                     SkASSERT(beFormat.getGLFormat());
@@ -366,7 +366,8 @@
 }
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
-    GrProxyProvider* provider = ctxInfo.grContext()->priv().proxyProvider();
+    GrContext* context = ctxInfo.grContext();
+    GrProxyProvider* provider = context->priv().proxyProvider();
 
     for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
         for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {
@@ -382,8 +383,9 @@
                     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
                     const GrBackendFormat format =
-                        ctxInfo.grContext()->priv().caps()->getBackendFormatFromColorType(
-                                GrColorType::kRGBA_8888);
+                            context->priv().caps()->getDefaultBackendFormat(
+                                GrColorType::kRGBA_8888,
+                                renderable);
 
                     sk_sp<GrTextureProxy> proxy = provider->createProxy(
                             format, desc, renderable, 1, kBottomLeft_GrSurfaceOrigin, fit,
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 9ee9212..ce257b5 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -41,7 +41,7 @@
     desc.fHeight = p.fSize;
     desc.fConfig = config;
 
-    const GrBackendFormat format = caps->getBackendFormatFromColorType(p.fColorType);
+    const GrBackendFormat format = caps->getDefaultBackendFormat(p.fColorType, p.fRenderable);
 
     return proxyProvider->createProxy(format, desc, p.fRenderable, p.fSampleCnt, p.fOrigin, p.fFit,
                                       p.fBudgeted, GrProtected::kNo);
@@ -292,7 +292,7 @@
         }
         return GrSurfaceProxy::LazyInstantiationResult(std::move(texture));
     };
-    const GrBackendFormat format = caps->getBackendFormatFromColorType(p.fColorType);
+    const GrBackendFormat format = caps->getDefaultBackendFormat(p.fColorType, p.fRenderable);
     auto lazyType = deinstantiate ? GrSurfaceProxy::LazyInstantiationType ::kDeinstantiate
                                   : GrSurfaceProxy::LazyInstantiationType ::kSingleUse;
     GrInternalSurfaceFlags flags = GrInternalSurfaceFlags::kNone;
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 2cef6e9..561f495 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -124,7 +124,7 @@
     GrResourceProvider* resourceProvider = context->priv().resourceProvider();
 
     GrColorType grColorType = GrColorType::kRGBA_8888;
-    GrBackendFormat format = caps->getBackendFormatFromColorType(grColorType);
+    GrBackendFormat format = caps->getDefaultBackendFormat(grColorType, GrRenderable::kYes);
 
     sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(resourceProvider, 4, 1, SkBudgeted::kYes);
     REPORTER_ASSERT(reporter, smallRT0);
@@ -1623,17 +1623,20 @@
                                    GrResourceProvider::Flags::kNoPendingIO);
 }
 
-static sk_sp<GrTextureProxy> make_mipmap_proxy(GrProxyProvider* proxyProvider,
-                                               const GrCaps* caps,
+static sk_sp<GrTextureProxy> make_mipmap_proxy(GrContext * context,
                                                GrRenderable renderable,
                                                int width, int height,
                                                int sampleCnt) {
+    GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+    const GrCaps* caps = context->priv().caps();
+
     GrSurfaceDesc desc;
     desc.fWidth = width;
     desc.fHeight = height;
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-    const GrBackendFormat format = caps->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+    const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                                 GrRenderable::kNo);
     auto origin = renderable == GrRenderable::kYes ? kBottomLeft_GrSurfaceOrigin
                                                    : kTopLeft_GrSurfaceOrigin;
 
@@ -1645,8 +1648,8 @@
 // Texture-only, both-RT-and-Texture and MIPmapped
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
-    GrProxyProvider* proxyProvider = context->priv().proxyProvider();
     GrResourceProvider* resourceProvider = context->priv().resourceProvider();
+    const GrCaps* caps = context->priv().caps();
 
     static const int kSize = 64;
 
@@ -1658,8 +1661,7 @@
         size_t size = tex->gpuMemorySize();
         REPORTER_ASSERT(reporter, kSize*kSize*4 == size);
 
-        size_t sampleCount = (size_t)context->priv().caps()->getRenderTargetSampleCount(
-                4, kRGBA_8888_GrPixelConfig);
+        size_t sampleCount = (size_t)caps->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig);
         if (sampleCount >= 4) {
             tex = make_normal_texture(resourceProvider, GrRenderable::kYes, kSize, kSize,
                                       sampleCount);
@@ -1675,21 +1677,17 @@
         REPORTER_ASSERT(reporter, kSize*kSize*4 == size);
     }
 
-
     // Mipmapped versions
-    const GrCaps* caps  = context->priv().caps();
     if (caps->mipMapSupport()) {
         sk_sp<GrTextureProxy> proxy;
 
-        proxy = make_mipmap_proxy(proxyProvider, caps, GrRenderable::kYes, kSize, kSize, 1);
+        proxy = make_mipmap_proxy(context, GrRenderable::kYes, 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->priv().caps()->getRenderTargetSampleCount(
-                4, kRGBA_8888_GrPixelConfig);
+        size_t sampleCount = (size_t)caps->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig);
         if (sampleCount >= 4) {
-            proxy = make_mipmap_proxy(proxyProvider, caps, GrRenderable::kYes, kSize, kSize,
-                                      sampleCount);
+            proxy = make_mipmap_proxy(context, GrRenderable::kYes, kSize, kSize, sampleCount);
             size = proxy->gpuMemorySize();
             REPORTER_ASSERT(reporter,
                kSize*kSize*4+(kSize*kSize*4)/3 == size ||                 // msaa4 failed
@@ -1697,7 +1695,7 @@
                kSize*kSize*4*(sampleCount+1)+(kSize*kSize*4)/3 == size);  // explicit resolve buffer
         }
 
-        proxy = make_mipmap_proxy(proxyProvider, caps, GrRenderable::kNo, kSize, kSize, 1);
+        proxy = make_mipmap_proxy(context, GrRenderable::kNo, kSize, kSize, 1);
         size = proxy->gpuMemorySize();
         REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size);
     }
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index e6bc9bb..ae5a4d8 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -38,9 +38,11 @@
 
 static sk_sp<GrTextureProxy> deferred_tex(skiatest::Reporter* reporter, GrContext* ctx,
                                           GrProxyProvider* proxyProvider, SkBackingFit fit) {
+    const GrCaps* caps = ctx->priv().caps();
+
     const GrSurfaceDesc desc = make_desc();
-    GrBackendFormat format =
-            ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+    GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                           GrRenderable::kNo);
 
     sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(format, desc, GrRenderable::kNo, 1,
                                                              kBottomLeft_GrSurfaceOrigin, fit,
@@ -52,9 +54,12 @@
 
 static sk_sp<GrTextureProxy> deferred_texRT(skiatest::Reporter* reporter, GrContext* ctx,
                                             GrProxyProvider* proxyProvider, SkBackingFit fit) {
+    const GrCaps* caps = ctx->priv().caps();
+
     const GrSurfaceDesc desc = make_desc();
-    GrBackendFormat format =
-            ctx->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+
+    GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                           GrRenderable::kYes);
 
     sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(format, desc, GrRenderable::kYes, 1,
                                                              kBottomLeft_GrSurfaceOrigin, fit,
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index 3d0fb2b..d4c4aab 100644
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -102,12 +102,8 @@
 
     auto* caps = context->priv().caps();
 
-    auto backendFormat = caps->getBackendFormatFromColorType(colorType);
-    if (!caps->isFormatTexturable(colorType, backendFormat)) {
-        return;
-    }
-
-    if ((renderable == GrRenderable::kYes && !caps->isFormatRenderable(colorType, backendFormat))) {
+    auto backendFormat = caps->getDefaultBackendFormat(colorType, renderable);
+    if (!backendFormat.isValid()) {
         return;
     }
 
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index c34c6c2..ea0a524 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -506,6 +506,7 @@
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsPendingIO, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
     GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+    const GrCaps* caps = context->priv().caps();
 
     static const int kFullSize = 62;
     static const int kHalfSize = 31;
@@ -527,8 +528,8 @@
         desc.fHeight = 64;
         desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-        const GrBackendFormat format =
-            context->priv().caps()->getBackendFormatFromColorType(GrColorType::kRGBA_8888);
+        const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
+                                                                     GrRenderable::kNo);
 
         sk_sp<GrTextureProxy> temp = proxyProvider->createProxy(
                 format, desc, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, SkBackingFit::kApprox,