Disallow SFCs w/ GrColorType::kUnknown in makeSFCFromBackendTexture

We're being stricter in V2 wrt this. This CL is an experiment to see if this fallback is actually relied on.

If this sticks we can unify the two (SFC & SDC) code paths in makeSFCFromBackendTexture.

Change-Id: I77815e0aa63d0910d8f8f38ec1f047b83750e109
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449678
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2021-09-16 16:51:12 -04:00 committed by SkCQ
parent b42cea955f
commit 4e4715b9b8

View File

@ -397,16 +397,18 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFCFromBa
SkSurfaceProps(),
std::move(releaseHelper));
}
const GrBackendFormat& format = tex.getBackendFormat();
GrSwizzle readSwizzle, writeSwizzle;
if (info.colorType() != GrColorType::kUnknown) {
if (!this->caps()->areColorTypeAndFormatCompatible(info.colorType(), format)) {
return nullptr;
}
readSwizzle = this->caps()->getReadSwizzle (format, info.colorType());
writeSwizzle = this->caps()->getWriteSwizzle(format, info.colorType());
if (info.colorType() == GrColorType::kUnknown) {
return nullptr;
}
const GrBackendFormat& format = tex.getBackendFormat();
if (!this->caps()->areColorTypeAndFormatCompatible(info.colorType(), format)) {
return nullptr;
}
GrSwizzle readSwizzle = this->caps()->getReadSwizzle (format, info.colorType());
GrSwizzle writeSwizzle = this->caps()->getWriteSwizzle(format, info.colorType());
sk_sp<GrTextureProxy> proxy(this->proxyProvider()->wrapRenderableBackendTexture(
tex, sampleCount, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
std::move(releaseHelper)));