Revert x2 "Assert that all GrCaps colortype/format -> swizzle queries are legal."

This reverts commit b16f30bb92efcbb6a15db9c39e651f4c1412934e.

Bug: chromium:1066850

Change-Id: I57e233d370a7248867f709d52012726d19959379
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280900
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index b6cbdf8..4d084f9 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -31,12 +31,6 @@
     return clipBounds.isEmpty() || rect.isEmpty() || !SkIRect::Intersects(clipBounds, rect);
 }
 
-static constexpr auto kMaskOrigin = kTopLeft_GrSurfaceOrigin;
-
-static GrSurfaceProxyView find_filtered_mask(GrProxyProvider* provider, const GrUniqueKey& key) {
-    return provider->findCachedProxyWithColorTypeFallback(key, kMaskOrigin, GrColorType::kAlpha_8);
-}
-
 // Draw a mask using the supplied paint. Since the coverage/geometry
 // is already burnt into the mask this boils down to a rect draw.
 // Return true if the mask was successfully drawn.
@@ -87,11 +81,18 @@
                                                     : SkStrokeRec::kFill_InitStyle;
 
     if (key.isValid()) {
-        filteredMaskView = find_filtered_mask(proxyProvider, key);
+        // TODO: this cache look up is duplicated in draw_shape_with_mask_filter for gpu
+        static const GrSurfaceOrigin kCacheOrigin = kTopLeft_GrSurfaceOrigin;
+        auto filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(key);
+        if (filteredMask) {
+            GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(
+                    filteredMask->backendFormat(), GrColorType::kAlpha_8);
+            filteredMaskView = GrSurfaceProxyView(std::move(filteredMask), kCacheOrigin, swizzle);
+        }
     }
 
     SkIRect drawRect;
-    if (filteredMaskView) {
+    if (filteredMaskView.proxy()) {
         SkRect devBounds = shape.bounds();
         viewMatrix.mapRect(&devBounds);
 
@@ -156,7 +157,7 @@
             return false;
         }
 
-        SkASSERT(kMaskOrigin == filteredMaskView.origin());
+        SkASSERT(kTopLeft_GrSurfaceOrigin == filteredMaskView.origin());
 
         drawRect = dstM.fBounds;
 
@@ -187,7 +188,7 @@
     auto approxSize = GrResourceProvider::MakeApprox(maskRect.size());
     auto rtContext = GrRenderTargetContext::MakeWithFallback(
             context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, approxSize, sampleCnt,
-            GrMipMapped::kNo, GrProtected::kNo, kMaskOrigin);
+            GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
     if (!rtContext) {
         return nullptr;
     }
@@ -201,8 +202,8 @@
     const SkIRect clipRect = SkIRect::MakeWH(maskRect.width(), maskRect.height());
     GrFixedClip clip(clipRect);
 
-    // Draw the mask into maskTexture with the path's integerized top-left at the origin using
-    // maskPaint.
+    // Draw the mask into maskTexture with the path's integerized top-left at
+    // the origin using maskPaint.
     SkMatrix viewMatrix = origViewMatrix;
     viewMatrix.postTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.fTop));
     rtContext->drawShape(clip, std::move(maskPaint), GrAA::kYes, viewMatrix, shape);
@@ -397,10 +398,18 @@
         GrProxyProvider* proxyProvider = context->priv().proxyProvider();
 
         if (maskKey.isValid()) {
-            filteredMaskView = find_filtered_mask(proxyProvider, maskKey);
+            // TODO: this cache look up is duplicated in sw_draw_with_mask_filter for raster
+            static const GrSurfaceOrigin kCacheOrigin = kTopLeft_GrSurfaceOrigin;
+            auto filteredMask = proxyProvider->findOrCreateProxyByUniqueKey(maskKey);
+            if (filteredMask) {
+                GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(
+                        filteredMask->backendFormat(), GrColorType::kAlpha_8);
+                filteredMaskView = GrSurfaceProxyView(std::move(filteredMask), kCacheOrigin,
+                                                      swizzle);
+            }
         }
 
-        if (!filteredMaskView) {
+        if (!filteredMaskView.proxy()) {
             std::unique_ptr<GrRenderTargetContext> maskRTC(create_mask_GPU(
                                                            context,
                                                            maskRect,
@@ -422,7 +431,7 @@
             }
         }
 
-        if (filteredMaskView) {
+        if (filteredMaskView.proxy()) {
             if (draw_mask(renderTargetContext, clip, viewMatrix, maskRect, std::move(paint),
                           std::move(filteredMaskView))) {
                 // This path is completely drawn
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index ec6c648..8c3a0f2 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -352,12 +352,6 @@
     SkDEBUGFAIL("Gen ID was not found in stack.");
 }
 
-static constexpr auto kMaskOrigin = kTopLeft_GrSurfaceOrigin;
-
-static GrSurfaceProxyView find_mask(GrProxyProvider* provider, const GrUniqueKey& key) {
-    return provider->findCachedProxyWithColorTypeFallback(key, kMaskOrigin, GrColorType::kAlpha_8);
-}
-
 GrSurfaceProxyView GrClipStackClip::createAlphaClipMask(GrRecordingContext* context,
                                                         const GrReducedClip& reducedClip) const {
     GrProxyProvider* proxyProvider = context->priv().proxyProvider();
@@ -365,14 +359,16 @@
     create_clip_mask_key(reducedClip.maskGenID(), reducedClip.scissor(),
                          reducedClip.numAnalyticFPs(), &key);
 
-    if (auto cachedView = find_mask(context->priv().proxyProvider(), key)) {
-        return cachedView;
+    if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
+        GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
+                                                                   GrColorType::kAlpha_8);
+        return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
     }
 
     auto rtc = GrRenderTargetContext::MakeWithFallback(
             context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kApprox,
             {reducedClip.width(), reducedClip.height()}, 1, GrMipMapped::kNo, GrProtected::kNo,
-            kMaskOrigin);
+            kTopLeft_GrSurfaceOrigin);
     if (!rtc) {
         return {};
     }
@@ -386,7 +382,7 @@
         return {};
     }
 
-    SkASSERT(result.origin() == kMaskOrigin);
+    SkASSERT(result.origin() == kTopLeft_GrSurfaceOrigin);
     proxyProvider->assignUniqueKeyToProxy(key, result.asTextureProxy());
     add_invalidate_on_pop_message(context, *fStack, reducedClip.maskGenID(), key);
 
@@ -475,9 +471,12 @@
                          reducedClip.numAnalyticFPs(), &key);
 
     GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+    const GrCaps* caps = context->priv().caps();
 
-    if (auto cachedView = find_mask(proxyProvider, key)) {
-        return cachedView;
+    if (sk_sp<GrTextureProxy> proxy = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
+        GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
+                                                                   GrColorType::kAlpha_8);
+        return {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
     }
 
     // The mask texture may be larger than necessary. We round out the clip bounds and pin the top
@@ -491,7 +490,6 @@
 
     GrSurfaceProxyView view;
     if (taskGroup && renderTargetContext) {
-        const GrCaps* caps = context->priv().caps();
         // Create our texture proxy
         GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
                                                                GrRenderable::kNo);
@@ -527,7 +525,7 @@
         taskGroup->add(std::move(drawAndUploadMask));
         proxy->texPriv().setDeferredUploader(std::move(uploader));
 
-        view = {std::move(proxy), kMaskOrigin, swizzle};
+        view = {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
     } else {
         GrSWMaskHelper helper;
         if (!helper.init(maskSpaceIBounds)) {
@@ -541,7 +539,7 @@
     }
 
     SkASSERT(view);
-    SkASSERT(view.origin() == kMaskOrigin);
+    SkASSERT(view.origin() == kTopLeft_GrSurfaceOrigin);
     proxyProvider->assignUniqueKeyToProxy(key, view.asTextureProxy());
     add_invalidate_on_pop_message(context, *fStack, reducedClip.maskGenID(), key);
     return view;
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 1fa39c4..f31b711 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -23,7 +23,6 @@
 #include "src/gpu/GrContextPriv.h"
 #include "src/gpu/GrImageContextPriv.h"
 #include "src/gpu/GrRenderTarget.h"
-#include "src/gpu/GrRenderTargetContext.h"
 #include "src/gpu/GrResourceProvider.h"
 #include "src/gpu/GrSurfaceProxy.h"
 #include "src/gpu/GrSurfaceProxyPriv.h"
@@ -230,24 +229,6 @@
     return result;
 }
 
-GrSurfaceProxyView GrProxyProvider::findCachedProxyWithColorTypeFallback(const GrUniqueKey& key,
-                                                                         GrSurfaceOrigin origin,
-                                                                         GrColorType ct) {
-    auto proxy = this->findOrCreateProxyByUniqueKey(key);
-    if (!proxy) {
-        return {};
-    }
-    // Assume that we used a fallback color type if and only if the proxy is renderable.
-    if (proxy->asRenderTargetProxy()) {
-        GrBackendFormat expectedFormat;
-        std::tie(ct, expectedFormat) =
-                GrRenderTargetContext::GetFallbackColorTypeAndFormat(fImageContext, ct);
-        SkASSERT(expectedFormat == proxy->backendFormat());
-    }
-    GrSwizzle swizzle = fImageContext->priv().caps()->getReadSwizzle(proxy->backendFormat(), ct);
-    return {std::move(proxy), origin, swizzle};
-}
-
 sk_sp<GrTextureProxy> GrProxyProvider::createProxyFromBitmap(const SkBitmap& bitmap,
                                                              GrMipMapped mipMapped,
                                                              SkBackingFit fit,
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index 4fbceb6..1d0bb54 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -59,16 +59,6 @@
     sk_sp<GrTextureProxy> findOrCreateProxyByUniqueKey(const GrUniqueKey&,
                                                        UseAllocator = UseAllocator::kYes);
 
-    /**
-     * A helper that uses findOrCreateProxyByUniqueKey() to find a proxy and if found creates a view
-     *a view for the found proxy using the passed in origin and color type. It is assumed that if
-     * the proxy is renderable then it was created by GrRenderTargetContext::MakeWithFallback and
-     * the fallback color type will be used to create the view.
-     */
-    GrSurfaceProxyView findCachedProxyWithColorTypeFallback(const GrUniqueKey&,
-                                                            GrSurfaceOrigin,
-                                                            GrColorType);
-
     /*
      * Creates a new texture proxy for the bitmap, optionally with mip levels generated by the cpu.
      * The bitmap is uploaded to the texture proxy assuming a kTopLeft_GrSurfaceOrigin.
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index e5dc4c5..5f30567 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -9,7 +9,6 @@
 
 #include "include/core/SkDrawable.h"
 #include "include/gpu/GrBackendSemaphore.h"
-#include "include/private/GrImageContext.h"
 #include "include/private/GrRecordingContext.h"
 #include "include/private/SkShadowFlags.h"
 #include "include/utils/SkShadowUtils.h"
@@ -33,7 +32,6 @@
 #include "src/gpu/GrDrawingManager.h"
 #include "src/gpu/GrFixedClip.h"
 #include "src/gpu/GrGpuResourcePriv.h"
-#include "src/gpu/GrImageContextPriv.h"
 #include "src/gpu/GrImageInfo.h"
 #include "src/gpu/GrMemoryPool.h"
 #include "src/gpu/GrPathRenderer.h"
@@ -242,19 +240,6 @@
     }
 }
 
-std::tuple<GrColorType, GrBackendFormat> GrRenderTargetContext::GetFallbackColorTypeAndFormat(
-        GrImageContext* context, GrColorType colorType) {
-    do {
-        auto format =
-                context->priv().caps()->getDefaultBackendFormat(colorType, GrRenderable::kYes);
-        if (format.isValid()) {
-            return {colorType, format};
-        }
-        colorType = color_type_fallback(colorType);
-    } while (colorType != GrColorType::kUnknown);
-    return {GrColorType::kUnknown, {}};
-}
-
 std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeWithFallback(
         GrRecordingContext* context,
         GrColorType colorType,
@@ -267,12 +252,14 @@
         GrSurfaceOrigin origin,
         SkBudgeted budgeted,
         const SkSurfaceProps* surfaceProps) {
-    auto [ct, format] = GetFallbackColorTypeAndFormat(context, colorType);
-    if (ct == GrColorType::kUnknown) {
-        return nullptr;
-    }
-    return GrRenderTargetContext::Make(context, ct, colorSpace, fit, dimensions, sampleCnt,
-                                       mipMapped, isProtected, origin, budgeted, surfaceProps);
+    std::unique_ptr<GrRenderTargetContext> rtc;
+    do {
+        rtc = GrRenderTargetContext::Make(context, colorType, colorSpace, fit, dimensions,
+                                          sampleCnt, mipMapped, isProtected, origin, budgeted,
+                                          surfaceProps);
+        colorType = color_type_fallback(colorType);
+    } while (!rtc && colorType != GrColorType::kUnknown);
+    return rtc;
 }
 
 std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendTexture(
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index a5f9008..6befa9e 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -89,9 +89,6 @@
             SkBudgeted = SkBudgeted::kYes,
             const SkSurfaceProps* = nullptr);
 
-    static std::tuple<GrColorType, GrBackendFormat> GetFallbackColorTypeAndFormat(GrImageContext*,
-                                                                                  GrColorType);
-
     // Same as previous factory but will try to use fallback GrColorTypes if the one passed in
     // fails. The fallback GrColorType will have at least the number of channels and precision per
     // channel as the passed in GrColorType. It may also swizzle the changes (e.g., BGRA -> RGBA).
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 4d1b23b..3e4edaf 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -74,10 +74,7 @@
                                                          sk_sp<SkColorSpace> colorSpace,
                                                          SkBackingFit fit,
                                                          SkBudgeted budgeted) {
-    GrSwizzle swizzle("rgba");
-    if (!context->priv().caps()->isFormatCompressed(format)) {
-        swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
-    }
+    GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
 
     sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
             format, dimensions, renderable, renderTargetSampleCnt, mipMapped, fit, budgeted,
diff --git a/src/gpu/d3d/GrD3DCaps.cpp b/src/gpu/d3d/GrD3DCaps.cpp
index 13b70b2..4759e07 100644
--- a/src/gpu/d3d/GrD3DCaps.cpp
+++ b/src/gpu/d3d/GrD3DCaps.cpp
@@ -944,8 +944,7 @@
             return ctInfo.fReadSwizzle;
         }
     }
-    SkDEBUGFAIL("Illegal color type/format combination.");
-    return {};
+    return GrSwizzle::RGBA();
 }
 
 GrSwizzle GrD3DCaps::getWriteSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
@@ -958,8 +957,7 @@
             return ctInfo.fWriteSwizzle;
         }
     }
-    SkDEBUGFAIL("Illegal color type/format combination.");
-    return {};
+    return GrSwizzle::RGBA();
 }
 
 uint64_t GrD3DCaps::computeFormatKey(const GrBackendFormat& format) const {
diff --git a/src/gpu/effects/GrRRectBlurEffect.fp b/src/gpu/effects/GrRRectBlurEffect.fp
index 643a848..75412a8 100644
--- a/src/gpu/effects/GrRRectBlurEffect.fp
+++ b/src/gpu/effects/GrRRectBlurEffect.fp
@@ -47,17 +47,16 @@
         }
         builder.finish();
 
-        static constexpr auto kMaskOrigin = kBottomLeft_GrSurfaceOrigin;
         GrProxyProvider* proxyProvider = context->priv().proxyProvider();
 
-        if (auto view = proxyProvider->findCachedProxyWithColorTypeFallback(
-                key, kMaskOrigin, GrColorType::kAlpha_8)) {
-            return view;
+        if (sk_sp<GrTextureProxy> mask = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
+            GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(mask->backendFormat(),
+                                                                       GrColorType::kAlpha_8);
+            return {std::move(mask), kBottomLeft_GrSurfaceOrigin, swizzle};
         }
 
         auto rtc = GrRenderTargetContext::MakeWithFallback(
-                context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions, 1,
-                GrMipMapped::kNo, GrProtected::kNo, kMaskOrigin);
+                context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions);
         if (!rtc) {
             return {};
         }
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.h b/src/gpu/effects/generated/GrRRectBlurEffect.h
index a1a2ea4..b4620b7 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.h
@@ -49,17 +49,16 @@
         }
         builder.finish();
 
-        static constexpr auto kMaskOrigin = kBottomLeft_GrSurfaceOrigin;
         GrProxyProvider* proxyProvider = context->priv().proxyProvider();
 
-        if (auto view = proxyProvider->findCachedProxyWithColorTypeFallback(
-                    key, kMaskOrigin, GrColorType::kAlpha_8)) {
-            return view;
+        if (sk_sp<GrTextureProxy> mask = proxyProvider->findOrCreateProxyByUniqueKey(key)) {
+            GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(mask->backendFormat(),
+                                                                       GrColorType::kAlpha_8);
+            return {std::move(mask), kBottomLeft_GrSurfaceOrigin, swizzle};
         }
 
-        auto rtc = GrRenderTargetContext::MakeWithFallback(
-                context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions, 1,
-                GrMipMapped::kNo, GrProtected::kNo, kMaskOrigin);
+        auto rtc = GrRenderTargetContext::MakeWithFallback(context, GrColorType::kAlpha_8, nullptr,
+                                                           SkBackingFit::kExact, dimensions);
         if (!rtc) {
             return {};
         }
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 1700c09..8439a57 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -4331,8 +4331,7 @@
             return ctInfo.fReadSwizzle;
         }
     }
-    SkDEBUGFAIL("Illegal color type/format combination.");
-    return {};
+    return GrSwizzle::RGBA();
 }
 
 GrSwizzle GrGLCaps::getWriteSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
@@ -4343,8 +4342,7 @@
             return ctInfo.fWriteSwizzle;
         }
     }
-    SkDEBUGFAIL("Illegal color type/format combination.");
-    return {};
+    return GrSwizzle::RGBA();
 }
 
 uint64_t GrGLCaps::computeFormatKey(const GrBackendFormat& format) const {
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index 269977f..aa6f8e8 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -164,13 +164,11 @@
         return {};
     }
 
-    GrSwizzle getReadSwizzle(const GrBackendFormat& format, GrColorType ct) const override {
-        SkASSERT(this->areColorTypeAndFormatCompatible(ct, format));
-        return GrSwizzle("rgba");
+    GrSwizzle getReadSwizzle(const GrBackendFormat&, GrColorType) const override {
+        return GrSwizzle();
     }
     GrSwizzle getWriteSwizzle(const GrBackendFormat& format, GrColorType ct) const override {
-        SkASSERT(this->areColorTypeAndFormatCompatible(ct, format));
-        return GrSwizzle("rgba");
+        return GrSwizzle();
     }
 
     uint64_t computeFormatKey(const GrBackendFormat&) const override;
diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm
index 28d98bc..cd2051e 100644
--- a/src/gpu/mtl/GrMtlCaps.mm
+++ b/src/gpu/mtl/GrMtlCaps.mm
@@ -943,8 +943,7 @@
             return ctInfo.fReadSwizzle;
         }
     }
-    SkDEBUGFAIL("Illegal color type/format combination.");
-    return {};
+    return GrSwizzle::RGBA();
 }
 
 GrSwizzle GrMtlCaps::getWriteSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
@@ -957,8 +956,7 @@
             return ctInfo.fWriteSwizzle;
         }
     }
-    SkDEBUGFAIL("Illegal color type/format combination.");
-    return {};
+    return GrSwizzle::RGBA();
 }
 
 uint64_t GrMtlCaps::computeFormatKey(const GrBackendFormat& format) const {
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index a35d103..add08bc 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -1593,8 +1593,7 @@
             return ctInfo.fReadSwizzle;
         }
     }
-    SkDEBUGFAIL("Illegal color type/format combination.");
-    return {};
+    return GrSwizzle::RGBA();
 }
 
 GrSwizzle GrVkCaps::getWriteSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
@@ -1607,8 +1606,7 @@
             return ctInfo.fWriteSwizzle;
         }
     }
-    SkDEBUGFAIL("Illegal color type/format combination.");
-    return {};
+    return GrSwizzle::RGBA();
 }
 
 uint64_t GrVkCaps::computeFormatKey(const GrBackendFormat& format) const {