Reland x2 "Assert that all GrCaps colortype/format -> swizzle queries are legal."
This reverts commit e8d2080a34ed3edfee6b979c8b07ad6e96b240d8.
Change-Id: I3e1d586939fbc2763aa7b7eb0b35cd6e34f2922d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280962
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 4d084f9..b6cbdf8 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -31,6 +31,12 @@
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.
@@ -81,18 +87,11 @@
: SkStrokeRec::kFill_InitStyle;
if (key.isValid()) {
- // 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);
- }
+ filteredMaskView = find_filtered_mask(proxyProvider, key);
}
SkIRect drawRect;
- if (filteredMaskView.proxy()) {
+ if (filteredMaskView) {
SkRect devBounds = shape.bounds();
viewMatrix.mapRect(&devBounds);
@@ -157,7 +156,7 @@
return false;
}
- SkASSERT(kTopLeft_GrSurfaceOrigin == filteredMaskView.origin());
+ SkASSERT(kMaskOrigin == filteredMaskView.origin());
drawRect = dstM.fBounds;
@@ -188,7 +187,7 @@
auto approxSize = GrResourceProvider::MakeApprox(maskRect.size());
auto rtContext = GrRenderTargetContext::MakeWithFallback(
context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, approxSize, sampleCnt,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ GrMipMapped::kNo, GrProtected::kNo, kMaskOrigin);
if (!rtContext) {
return nullptr;
}
@@ -202,8 +201,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);
@@ -398,18 +397,10 @@
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
if (maskKey.isValid()) {
- // 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);
- }
+ filteredMaskView = find_filtered_mask(proxyProvider, maskKey);
}
- if (!filteredMaskView.proxy()) {
+ if (!filteredMaskView) {
std::unique_ptr<GrRenderTargetContext> maskRTC(create_mask_GPU(
context,
maskRect,
@@ -431,7 +422,7 @@
}
}
- if (filteredMaskView.proxy()) {
+ if (filteredMaskView) {
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 8c3a0f2..ec6c648 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -352,6 +352,12 @@
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();
@@ -359,16 +365,14 @@
create_clip_mask_key(reducedClip.maskGenID(), reducedClip.scissor(),
reducedClip.numAnalyticFPs(), &key);
- 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};
+ if (auto cachedView = find_mask(context->priv().proxyProvider(), key)) {
+ return cachedView;
}
auto rtc = GrRenderTargetContext::MakeWithFallback(
context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kApprox,
{reducedClip.width(), reducedClip.height()}, 1, GrMipMapped::kNo, GrProtected::kNo,
- kTopLeft_GrSurfaceOrigin);
+ kMaskOrigin);
if (!rtc) {
return {};
}
@@ -382,7 +386,7 @@
return {};
}
- SkASSERT(result.origin() == kTopLeft_GrSurfaceOrigin);
+ SkASSERT(result.origin() == kMaskOrigin);
proxyProvider->assignUniqueKeyToProxy(key, result.asTextureProxy());
add_invalidate_on_pop_message(context, *fStack, reducedClip.maskGenID(), key);
@@ -471,12 +475,9 @@
reducedClip.numAnalyticFPs(), &key);
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- const GrCaps* caps = context->priv().caps();
- 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};
+ if (auto cachedView = find_mask(proxyProvider, key)) {
+ return cachedView;
}
// The mask texture may be larger than necessary. We round out the clip bounds and pin the top
@@ -490,6 +491,7 @@
GrSurfaceProxyView view;
if (taskGroup && renderTargetContext) {
+ const GrCaps* caps = context->priv().caps();
// Create our texture proxy
GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
GrRenderable::kNo);
@@ -525,7 +527,7 @@
taskGroup->add(std::move(drawAndUploadMask));
proxy->texPriv().setDeferredUploader(std::move(uploader));
- view = {std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle};
+ view = {std::move(proxy), kMaskOrigin, swizzle};
} else {
GrSWMaskHelper helper;
if (!helper.init(maskSpaceIBounds)) {
@@ -539,7 +541,7 @@
}
SkASSERT(view);
- SkASSERT(view.origin() == kTopLeft_GrSurfaceOrigin);
+ SkASSERT(view.origin() == kMaskOrigin);
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 f31b711..1fa39c4 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -23,6 +23,7 @@
#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"
@@ -229,6 +230,24 @@
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 1d0bb54..4fbceb6 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -59,6 +59,16 @@
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 2eadfcc..f143003 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -10,6 +10,7 @@
#include "include/core/SkDrawable.h"
#include "include/core/SkVertices.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,6 +34,7 @@
#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"
@@ -241,6 +243,19 @@
}
}
+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,
@@ -253,14 +268,12 @@
GrSurfaceOrigin origin,
SkBudgeted budgeted,
const SkSurfaceProps* 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;
+ 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> GrRenderTargetContext::MakeFromBackendTexture(
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 2806384..c230d35 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -89,6 +89,9 @@
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 a43b9cb..2936b11 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -74,7 +74,10 @@
sk_sp<SkColorSpace> colorSpace,
SkBackingFit fit,
SkBudgeted budgeted) {
- GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, colorType);
+ GrSwizzle swizzle("rgba");
+ if (!context->priv().caps()->isFormatCompressed(format)) {
+ 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 0e602f9..2b3c3c5 100644
--- a/src/gpu/d3d/GrD3DCaps.cpp
+++ b/src/gpu/d3d/GrD3DCaps.cpp
@@ -944,7 +944,8 @@
return ctInfo.fReadSwizzle;
}
}
- return GrSwizzle::RGBA();
+ SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", colorType, dxgiFormat);
+ return {};
}
GrSwizzle GrD3DCaps::getWriteSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
@@ -957,7 +958,8 @@
return ctInfo.fWriteSwizzle;
}
}
- return GrSwizzle::RGBA();
+ SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", colorType, dxgiFormat);
+ return {};
}
uint64_t GrD3DCaps::computeFormatKey(const GrBackendFormat& format) const {
diff --git a/src/gpu/effects/GrRRectBlurEffect.fp b/src/gpu/effects/GrRRectBlurEffect.fp
index 75412a8..643a848 100644
--- a/src/gpu/effects/GrRRectBlurEffect.fp
+++ b/src/gpu/effects/GrRRectBlurEffect.fp
@@ -47,16 +47,17 @@
}
builder.finish();
+ static constexpr auto kMaskOrigin = kBottomLeft_GrSurfaceOrigin;
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- 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};
+ if (auto view = proxyProvider->findCachedProxyWithColorTypeFallback(
+ key, kMaskOrigin, GrColorType::kAlpha_8)) {
+ return view;
}
auto rtc = GrRenderTargetContext::MakeWithFallback(
- context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions);
+ context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions, 1,
+ GrMipMapped::kNo, GrProtected::kNo, kMaskOrigin);
if (!rtc) {
return {};
}
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.h b/src/gpu/effects/generated/GrRRectBlurEffect.h
index b4620b7..a1a2ea4 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.h
@@ -49,16 +49,17 @@
}
builder.finish();
+ static constexpr auto kMaskOrigin = kBottomLeft_GrSurfaceOrigin;
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- 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};
+ if (auto view = proxyProvider->findCachedProxyWithColorTypeFallback(
+ key, kMaskOrigin, GrColorType::kAlpha_8)) {
+ return view;
}
- auto rtc = GrRenderTargetContext::MakeWithFallback(context, GrColorType::kAlpha_8, nullptr,
- SkBackingFit::kExact, dimensions);
+ auto rtc = GrRenderTargetContext::MakeWithFallback(
+ context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions, 1,
+ GrMipMapped::kNo, GrProtected::kNo, kMaskOrigin);
if (!rtc) {
return {};
}
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index a0f7957..2140e89 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -4337,7 +4337,9 @@
return ctInfo.fReadSwizzle;
}
}
- return GrSwizzle::RGBA();
+ SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", colorType,
+ format.asGLFormat());
+ return {};
}
GrSwizzle GrGLCaps::getWriteSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
@@ -4348,7 +4350,9 @@
return ctInfo.fWriteSwizzle;
}
}
- return GrSwizzle::RGBA();
+ SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", colorType,
+ format.asGLFormat());
+ return {};
}
uint64_t GrGLCaps::computeFormatKey(const GrBackendFormat& format) const {
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index aa6f8e8..269977f 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -164,11 +164,13 @@
return {};
}
- GrSwizzle getReadSwizzle(const GrBackendFormat&, GrColorType) const override {
- return GrSwizzle();
+ GrSwizzle getReadSwizzle(const GrBackendFormat& format, GrColorType ct) const override {
+ SkASSERT(this->areColorTypeAndFormatCompatible(ct, format));
+ return GrSwizzle("rgba");
}
GrSwizzle getWriteSwizzle(const GrBackendFormat& format, GrColorType ct) const override {
- return GrSwizzle();
+ SkASSERT(this->areColorTypeAndFormatCompatible(ct, format));
+ return GrSwizzle("rgba");
}
uint64_t computeFormatKey(const GrBackendFormat&) const override;
diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm
index cd2051e..a8fb63c 100644
--- a/src/gpu/mtl/GrMtlCaps.mm
+++ b/src/gpu/mtl/GrMtlCaps.mm
@@ -943,7 +943,9 @@
return ctInfo.fReadSwizzle;
}
}
- return GrSwizzle::RGBA();
+ SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", colorType,
+ static_cast<int>(mtlFormat));
+ return {};
}
GrSwizzle GrMtlCaps::getWriteSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
@@ -956,7 +958,9 @@
return ctInfo.fWriteSwizzle;
}
}
- return GrSwizzle::RGBA();
+ SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", colorType,
+ static_cast<int>(mtlFormat));
+ return {};
}
uint64_t GrMtlCaps::computeFormatKey(const GrBackendFormat& format) const {
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index add08bc..73df0ac 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -1586,6 +1586,13 @@
GrSwizzle GrVkCaps::getReadSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
VkFormat vkFormat;
SkAssertResult(format.asVkFormat(&vkFormat));
+ const auto* ycbcrInfo = format.getVkYcbcrConversionInfo();
+ SkASSERT(ycbcrInfo);
+ if (ycbcrInfo->isValid() && ycbcrInfo->fExternalFormat != 0) {
+ // We allow these to work with any color type and never swizzle. See
+ // onAreColorTypeAndFormatCompatible.
+ return GrSwizzle{"rgba"};
+ }
const auto& info = this->getFormatInfo(vkFormat);
for (int i = 0; i < info.fColorTypeInfoCount; ++i) {
const auto& ctInfo = info.fColorTypeInfos[i];
@@ -1593,7 +1600,8 @@
return ctInfo.fReadSwizzle;
}
}
- return GrSwizzle::RGBA();
+ SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", colorType, vkFormat);
+ return {};
}
GrSwizzle GrVkCaps::getWriteSwizzle(const GrBackendFormat& format, GrColorType colorType) const {
@@ -1606,7 +1614,8 @@
return ctInfo.fWriteSwizzle;
}
}
- return GrSwizzle::RGBA();
+ SkDEBUGFAILF("Illegal color type (%d) and format (%d) combination.", colorType, vkFormat);
+ return {};
}
uint64_t GrVkCaps::computeFormatKey(const GrBackendFormat& format) const {