Pass readSwizzle into more proxy creation to not use config.

This is similar to the earlier change to createProxy but needs to be done
for all the lazy ones as well.

Bug: skia:6718
Change-Id: I3f5721541929e2e3fbfa746b5a2c4221b1af5b49
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265960
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp
index 04bbfd5..1546ece 100644
--- a/src/core/SkDeferredDisplayListRecorder.cpp
+++ b/src/core/SkDeferredDisplayListRecorder.cpp
@@ -160,6 +160,8 @@
         optionalTextureInfo = &kTextureInfo;
     }
 
+    GrSwizzle readSwizzle = caps->getReadSwizzle(fCharacterization.backendFormat(), grColorType);
+
     sk_sp<GrRenderTargetProxy> proxy = proxyProvider->createLazyRenderTargetProxy(
             [lazyProxyData](GrResourceProvider* resourceProvider) {
                 // The proxy backing the destination surface had better have been instantiated
@@ -170,6 +172,7 @@
             },
             fCharacterization.backendFormat(),
             desc,
+            readSwizzle,
             fCharacterization.sampleCount(),
             fCharacterization.origin(),
             surfaceFlags,
@@ -185,10 +188,8 @@
         return false;
     }
 
-    const GrSwizzle& readSwizzle = caps->getReadSwizzle(fCharacterization.backendFormat(),
-                                                        grColorType);
-    const GrSwizzle& outputSwizzle = caps->getOutputSwizzle(fCharacterization.backendFormat(),
-                                                            grColorType);
+    GrSwizzle outputSwizzle = caps->getOutputSwizzle(fCharacterization.backendFormat(),
+                                                     grColorType);
     SkASSERT(readSwizzle == proxy->textureSwizzle());
 
     GrSurfaceProxyView readView(proxy, fCharacterization.origin(), readSwizzle);
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 34b9c07..bd35628 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -149,6 +149,8 @@
         AHardwareBuffer* fAhb;
     };
 
+    GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, grColorType);
+
     sk_sp<GrTextureProxy> texProxy = proxyProvider->createLazyProxy(
             [direct, buffer = AutoAHBRelease(hardwareBuffer), width, height, isProtectedContent,
              backendFormat, grColorType](
@@ -188,9 +190,10 @@
 
                 return tex;
             },
-            backendFormat, desc, GrRenderable::kNo, 1, fSurfaceOrigin, GrMipMapped::kNo,
-            GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
-            SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
+            backendFormat, desc, readSwizzle, GrRenderable::kNo, 1, fSurfaceOrigin,
+            GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly,
+            SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
+            GrSurfaceProxy::UseAllocator::kYes);
 
     return texProxy;
 }
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 33b26e4..b5b9a3b 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -160,6 +160,8 @@
     GrMipMapsStatus mipMapsStatus = fBackendTexture.hasMipMaps()
             ? GrMipMapsStatus::kValid : GrMipMapsStatus::kNotAllocated;
 
+    GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, grColorType);
+
     // Must make copies of member variables to capture in the lambda since this image generator may
     // be deleted before we actually execute the lambda.
     sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
@@ -202,8 +204,8 @@
                 // unrelated to the whatever SkImage key may be assigned to the proxy.
                 return {std::move(tex), true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
             },
-            backendFormat, desc, GrRenderable::kNo, 1, fSurfaceOrigin, mipMapped, mipMapsStatus,
-            GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
+            backendFormat, desc, readSwizzle, GrRenderable::kNo, 1, fSurfaceOrigin, mipMapped,
+            mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
             GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
     if (!proxy) {
         return nullptr;
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index aab6b1f..edc7955 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -295,6 +295,8 @@
     desc.fHeight = srcImage->height();
     desc.fConfig = config;
 
+    GrSwizzle swizzle = this->caps()->getReadSwizzle(format, ct);
+
     sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
             [desc, format, sampleCnt, budgeted, srcImage, fit,
              ct](GrResourceProvider* resourceProvider) {
@@ -306,9 +308,9 @@
                         desc, format, ct, GrRenderable::kNo, sampleCnt, budgeted, fit,
                         GrProtected::kNo, mipLevel));
             },
-            format, desc, GrRenderable::kNo, sampleCnt, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
-            GrMipMapsStatus::kNotAllocated, surfaceFlags, fit, budgeted, GrProtected::kNo,
-            UseAllocator::kYes);
+            format, desc, swizzle, GrRenderable::kNo, sampleCnt, kTopLeft_GrSurfaceOrigin,
+            GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, surfaceFlags, fit, budgeted,
+            GrProtected::kNo, UseAllocator::kYes);
 
     if (!proxy) {
         return nullptr;
@@ -366,8 +368,8 @@
 
     GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info());
 
-    GrBackendFormat format = this->caps()->getDefaultBackendFormat(
-            SkColorTypeToGrColorType(bitmap.info().colorType()), GrRenderable::kNo);
+    GrColorType grCT = SkColorTypeToGrColorType(bitmap.info().colorType());
+    GrBackendFormat format = this->caps()->getDefaultBackendFormat(grCT, GrRenderable::kNo);
     if (!format.isValid()) {
         return nullptr;
     }
@@ -379,6 +381,8 @@
         return nullptr;
     }
 
+    GrSwizzle readSwizzle = this->caps()->getReadSwizzle(format, grCT);
+
     sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
             [desc, format, baseLevel, mipmaps](GrResourceProvider* resourceProvider) {
                 const int mipLevelCount = mipmaps->countLevels() + 1;
@@ -403,9 +407,9 @@
                         desc, format, colorType, GrRenderable::kNo, 1, SkBudgeted::kYes,
                         GrProtected::kNo, texels.get(), mipLevelCount));
             },
-            format, desc, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kYes,
-            GrMipMapsStatus::kValid, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact,
-            SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
+            format, desc, readSwizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
+            GrMipMapped::kYes, GrMipMapsStatus::kValid, GrInternalSurfaceFlags::kNone,
+            SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
 
     if (!proxy) {
         return nullptr;
@@ -508,7 +512,7 @@
                 return LazyCallbackResult(resourceProvider->createCompressedTexture(
                     dimensions, format, budgeted, mipMapped, isProtected, data.get()));
             },
-            format, desc, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, mipMapped,
+            format, desc, GrSwizzle(), GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, mipMapped,
             mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
             SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
 
@@ -774,6 +778,7 @@
 sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
                                                        const GrBackendFormat& format,
                                                        const GrSurfaceDesc& desc,
+                                                       GrSwizzle readSwizzle,
                                                        GrRenderable renderable,
                                                        int renderTargetSampleCnt,
                                                        GrSurfaceOrigin origin,
@@ -800,9 +805,6 @@
         return nullptr;
     }
 
-    GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
-    GrSwizzle readSwizzle = this->caps()->getReadSwizzle(format, colorType);
-
     if (renderable == GrRenderable::kYes) {
         return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*this->caps(),
                                                                     std::move(callback),
@@ -838,6 +840,7 @@
         LazyInstantiateCallback&& callback,
         const GrBackendFormat& format,
         const GrSurfaceDesc& desc,
+        GrSwizzle readSwizzle,
         int sampleCnt,
         GrSurfaceOrigin origin,
         GrInternalSurfaceFlags surfaceFlags,
@@ -860,9 +863,6 @@
         return nullptr;
     }
 
-    GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
-    GrSwizzle readSwizzle = this->caps()->getReadSwizzle(format, colorType);
-
     if (textureInfo) {
         // Wrapped vulkan secondary command buffers don't support texturing since we won't have an
         // actual VkImage to texture from.
@@ -884,6 +884,7 @@
 
 sk_sp<GrTextureProxy> GrProxyProvider::MakeFullyLazyProxy(LazyInstantiateCallback&& callback,
                                                           const GrBackendFormat& format,
+                                                          GrSwizzle readSwizzle,
                                                           GrRenderable renderable,
                                                           int renderTargetSampleCnt,
                                                           GrProtected isProtected,
@@ -902,9 +903,6 @@
     desc.fHeight = -1;
     desc.fConfig = config;
 
-    GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
-    GrSwizzle readSwizzle = caps.getReadSwizzle(format, colorType);
-
     if (GrRenderable::kYes == renderable) {
         return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(
                 caps, std::move(callback), format, desc, renderTargetSampleCnt, origin,
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index 474a40d..cd9f0ea 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -169,6 +169,7 @@
     sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&,
                                           const GrBackendFormat&,
                                           const GrSurfaceDesc&,
+                                          GrSwizzle readSwizzle,
                                           GrRenderable,
                                           int renderTargetSampleCnt,
                                           GrSurfaceOrigin,
@@ -184,6 +185,7 @@
     sk_sp<GrRenderTargetProxy> createLazyRenderTargetProxy(LazyInstantiateCallback&&,
                                                            const GrBackendFormat&,
                                                            const GrSurfaceDesc&,
+                                                           GrSwizzle readSwizzle,
                                                            int renderTargetSampleCnt,
                                                            GrSurfaceOrigin origin,
                                                            GrInternalSurfaceFlags,
@@ -201,6 +203,7 @@
      */
     static sk_sp<GrTextureProxy> MakeFullyLazyProxy(LazyInstantiateCallback&&,
                                                     const GrBackendFormat&,
+                                                    GrSwizzle readSwizzle,
                                                     GrRenderable,
                                                     int renderTargetSampleCnt,
                                                     GrProtected,
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index 0c1e41a..329a78c 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -78,9 +78,12 @@
                         sampleCount](GrResourceProvider* rp) {
         return cb(rp, pixelConfig, format, sampleCount);
     };
+
+    GrSwizzle readSwizzle = caps.getReadSwizzle(format, colorType);
+
     sk_sp<GrTextureProxy> proxy = GrProxyProvider::MakeFullyLazyProxy(
-            std::move(instantiate), format, GrRenderable::kYes, sampleCount, GrProtected::kNo,
-            kTextureOrigin, pixelConfig, caps, useAllocator);
+            std::move(instantiate), format, readSwizzle, GrRenderable::kYes, sampleCount,
+            GrProtected::kNo, kTextureOrigin, pixelConfig, caps, useAllocator);
 
     return proxy;
 }
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 347903b..fe47d42 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -541,10 +541,12 @@
     GrMipMapsStatus mipMapsStatus = (GrMipMapped::kYes == mipMapped)
             ? GrMipMapsStatus::kValid : GrMipMapsStatus::kNotAllocated;
 
+    GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, colorType);
+
     // We pass kReadOnly here since we should treat content of the client's texture as immutable.
     // The promise API provides no way for the client to indicated that the texture is protected.
     return proxyProvider->createLazyProxy(
-            std::move(callback), backendFormat, desc, GrRenderable::kNo, 1, origin, mipMapped,
-            mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
-            GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
+            std::move(callback), backendFormat, desc, readSwizzle, GrRenderable::kNo, 1, origin,
+            mipMapped, mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
+            SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
 }
diff --git a/src/image/SkSurface_GpuMtl.mm b/src/image/SkSurface_GpuMtl.mm
index 9737a04..70e088e 100644
--- a/src/image/SkSurface_GpuMtl.mm
+++ b/src/image/SkSurface_GpuMtl.mm
@@ -57,6 +57,8 @@
     texInfo.fMipMapped = GrMipMapped::kNo;
     texInfo.fTextureType = GrTextureType::k2D;
 
+    GrSwizzle readSwizzle = caps->getReadSwizzle(backendFormat, grColorType);
+
     sk_sp<GrRenderTargetProxy> proxy = proxyProvider->createLazyRenderTargetProxy(
             [layer, drawable, sampleCnt, config](GrResourceProvider* resourceProvider) {
                 CAMetalLayer* metalLayer = (__bridge CAMetalLayer*)layer;
@@ -86,6 +88,7 @@
             },
             backendFormat,
             desc,
+            readSwizzle,
             sampleCnt,
             origin,
             sampleCnt > 1 ? GrInternalSurfaceFlags::kRequiresManualMSAAResolve
@@ -98,7 +101,6 @@
             false,
             GrSurfaceProxy::UseAllocator::kYes);
 
-    GrSwizzle readSwizzle = caps->getReadSwizzle(backendFormat, grColorType);
     GrSwizzle outputSwizzle = caps->getOutputSwizzle(backendFormat, grColorType);
 
     SkASSERT(readSwizzle == proxy->textureSwizzle());
@@ -143,6 +145,8 @@
     texInfo.fMipMapped = GrMipMapped::kNo;
     texInfo.fTextureType = GrTextureType::k2D;
 
+    GrSwizzle readSwizzle = caps->getReadSwizzle(backendFormat, grColorType);
+
     sk_sp<GrRenderTargetProxy> proxy = proxyProvider->createLazyRenderTargetProxy(
             [view, sampleCnt, config](GrResourceProvider* resourceProvider) {
                 MTKView* mtkView = (__bridge MTKView*)view;
@@ -171,6 +175,7 @@
             },
             backendFormat,
             desc,
+            readSwizzle,
             sampleCnt,
             origin,
             sampleCnt > 1 ? GrInternalSurfaceFlags::kRequiresManualMSAAResolve
@@ -183,8 +188,7 @@
             false,
             GrSurfaceProxy::UseAllocator::kYes);
 
-    const GrSwizzle& readSwizzle = caps->getReadSwizzle(backendFormat, grColorType);
-    const GrSwizzle& outputSwizzle = caps->getOutputSwizzle(backendFormat, grColorType);
+    GrSwizzle outputSwizzle = caps->getOutputSwizzle(backendFormat, grColorType);
 
     SkASSERT(readSwizzle == proxy->textureSwizzle());
 
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index f7f9f54..63893fa 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -607,8 +607,10 @@
                 } else {
                     budgeted = SkBudgeted::kNo;
                 }
+                GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(
+                        backendFormat, GrColorType::kRGBA_8888);
                 auto proxy = context->priv().proxyProvider()->createLazyProxy(
-                        singleUseLazyCB, backendFormat, desc, renderable, 1,
+                        singleUseLazyCB, backendFormat, desc, readSwizzle, renderable, 1,
                         GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
                         GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags ::kNone,
                         SkBackingFit::kExact, budgeted, GrProtected::kNo,
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 654bdf3..18902ec 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -82,6 +82,8 @@
             const GrBackendFormat format =
                 ctx->priv().caps()->getDefaultBackendFormat(GrColorType::kBGR_565,
                                                             GrRenderable::kNo);
+            GrSwizzle readSwizzle = ctx->priv().caps()->getReadSwizzle(
+                    format, GrColorType::kBGR_565);
             fProxy = GrProxyProvider::MakeFullyLazyProxy(
                     [this, format,
                      nullTexture](GrResourceProvider* rp) -> GrSurfaceProxy::LazyCallbackResult {
@@ -101,8 +103,8 @@
                             return texture;
                         }
                     },
-                    format, GrRenderable::kNo, 1, GrProtected::kNo, kTopLeft_GrSurfaceOrigin,
-                    kRGB_565_GrPixelConfig, *proxyProvider->caps(),
+                    format, readSwizzle, GrRenderable::kNo, 1, GrProtected::kNo,
+                    kTopLeft_GrSurfaceOrigin, kRGB_565_GrPixelConfig, *proxyProvider->caps(),
                     GrSurfaceProxy::UseAllocator::kYes);
 
             this->setBounds(SkRectPriv::MakeLargest(), GrOp::HasAABloat::kNo,
@@ -134,6 +136,7 @@
             static const GrSurfaceOrigin kOrigin = kBottomLeft_GrSurfaceOrigin;
             const GrBackendFormat format =
                 ctx->priv().caps()->getDefaultBackendFormat(kColorType, GrRenderable::kYes);
+            GrSwizzle readSwizzle = ctx->priv().caps()->getReadSwizzle(format, kColorType);
             fLazyProxy = GrProxyProvider::MakeFullyLazyProxy(
                     [this](GrResourceProvider* rp) -> GrSurfaceProxy::LazyCallbackResult {
                         REPORTER_ASSERT(fTest->fReporter, !fTest->fHasClipTexture);
@@ -141,11 +144,10 @@
                         fAtlas->instantiate(rp);
                         return sk_ref_sp(fAtlas->peekTexture());
                     },
-                    format, GrRenderable::kYes, 1, GrProtected::kNo, kOrigin,
+                    format, readSwizzle, GrRenderable::kYes, 1, GrProtected::kNo, kOrigin,
                     kAlpha_half_GrPixelConfig, *proxyProvider->caps(),
                     GrSurfaceProxy::UseAllocator::kYes);
-            GrSwizzle swizzle = ctx->priv().caps()->getReadSwizzle(format, kColorType);
-            fAccess.set(GrSurfaceProxyView(fLazyProxy, kOrigin, swizzle),
+            fAccess.set(GrSurfaceProxyView(fLazyProxy, kOrigin, readSwizzle),
                         GrSamplerState::Filter::kNearest);
             this->setTextureSamplerCnt(1);
         }
@@ -279,11 +281,13 @@
                 bool fReleaseCallback;
                 sk_sp<GrTexture> fTexture;
             };
+            GrSwizzle readSwizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
             sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
-                    TestCallback(&testCount, releaseCallback, tex), format, desc, GrRenderable::kNo,
-                    1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated,
-                    GrInternalSurfaceFlags::kNone, SkBackingFit::kExact, SkBudgeted::kNo,
-                    GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
+                    TestCallback(&testCount, releaseCallback, tex), format, desc, readSwizzle,
+                    GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
+                    GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone,
+                    SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
+                    GrSurfaceProxy::UseAllocator::kYes);
 
             REPORTER_ASSERT(reporter, proxy.get());
             REPORTER_ASSERT(reporter, 0 == testCount);
@@ -341,6 +345,8 @@
             ctx->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
                                                         GrRenderable::kNo);
 
+        GrSwizzle readSwizzle = ctx->priv().caps()->getReadSwizzle(
+                format, GrColorType::kRGBA_8888);
         fLazyProxy = proxyProvider->createLazyProxy(
                 [testExecuteValue, shouldFailInstantiation, desc,
                  format](GrResourceProvider* rp) -> GrSurfaceProxy::LazyCallbackResult {
@@ -352,9 +358,10 @@
                                               SkBudgeted::kNo, GrProtected::kNo),
                             true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
                 },
-                format, desc, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
-                GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone, SkBackingFit::kExact,
-                SkBudgeted::kNo, GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
+                format, desc, readSwizzle, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
+                GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, GrInternalSurfaceFlags::kNone,
+                SkBackingFit::kExact, SkBudgeted::kNo, GrProtected::kNo,
+                GrSurfaceProxy::UseAllocator::kYes);
 
         SkASSERT(fLazyProxy.get());
 
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 2045421..4037ceb 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -310,6 +310,7 @@
 
         const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
                                                                      GrRenderable::kYes);
+        GrSwizzle readSwizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
 
         fAtlasProxy = GrProxyProvider::MakeFullyLazyProxy(
                 [format](GrResourceProvider* resourceProvider)
@@ -326,6 +327,7 @@
                                                            GrProtected::kNo);
                 },
                 format,
+                readSwizzle,
                 GrRenderable::kYes,
                 1,
                 GrProtected::kNo,
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 959f48d..9b0f174 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -288,10 +288,11 @@
         return GrSurfaceProxy::LazyCallbackResult(std::move(texture));
     };
     GrInternalSurfaceFlags flags = GrInternalSurfaceFlags::kNone;
+    GrSwizzle readSwizzle = caps->getReadSwizzle(format, p.fColorType);
     return proxyProvider->createLazyProxy(
-            callback, format, desc, p.fRenderable, p.fSampleCnt, p.fOrigin, GrMipMapped::kNo,
-            GrMipMapsStatus::kNotAllocated, flags, p.fFit, p.fBudgeted, GrProtected::kNo,
-            GrSurfaceProxy::UseAllocator::kYes);
+            callback, format, desc, readSwizzle, p.fRenderable, p.fSampleCnt, p.fOrigin,
+            GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, flags, p.fFit, p.fBudgeted,
+            GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
 }
 
 // Set up so there are two opsTasks that need to be flushed but the resource allocator thinks