Add GrCaps::isFormatCompressed
This is part of trying to remove uses of GrPixelConfig from the proxy provider
Change-Id: I12d085cfbff86d0e44829ce3ee36744b937b804e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230576
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 6051cc1..48a24fe 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -440,12 +440,13 @@
SkBudgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags) {
- if (GrPixelConfigIsCompressed(desc.fConfig)) {
+ const GrCaps* caps = this->caps();
+
+ if (caps->isFormatCompressed(format)) {
// Deferred proxies for compressed textures are not supported.
return nullptr;
}
- const GrCaps* caps = this->caps();
GrColorType colorType = GrPixelConfigToColorType(desc.fConfig);
SkASSERT(GrCaps::AreConfigsCompatible(desc.fConfig,
@@ -483,14 +484,16 @@
sk_sp<GrTextureProxy> GrProxyProvider::createCompressedTextureProxy(
int width, int height, SkBudgeted budgeted, SkImage::CompressionType compressionType,
sk_sp<SkData> data) {
- GrBackendFormat format = this->caps()->getBackendFormatFromCompressionType(compressionType);
GrSurfaceDesc desc;
desc.fConfig = GrCompressionTypePixelConfig(compressionType);
desc.fWidth = width;
desc.fHeight = height;
- if (!this->caps()->isConfigTexturable(desc.fConfig)) {
+ GrColorType grColorType = GrCompressionTypeClosestColorType(compressionType);
+ GrBackendFormat format = this->caps()->getBackendFormatFromCompressionType(compressionType);
+
+ if (!this->caps()->isFormatTexturable(grColorType, format)) {
return nullptr;
}