Separate compressed and uncompressed texture functions
Change-Id: Iccf31e1e4dbebde8aab4bb9b57cfb0341bb05912
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223802
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 95d64a8..33a30d8 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -3358,6 +3358,16 @@
return GrBackendFormat::MakeGL(this->configSizedInternalFormat(config), GR_GL_TEXTURE_2D);
}
+GrBackendFormat GrGLCaps::getBackendFormatFromCompressionType(
+ SkImage::CompressionType compressionType) const {
+ switch (compressionType) {
+ case SkImage::kETC1_CompressionType:
+ return GrBackendFormat::MakeGL(GR_GL_COMPRESSED_ETC1_RGB8, GR_GL_TEXTURE_2D);
+ }
+ SK_ABORT("Invalid compression type");
+ return {};
+}
+
#ifdef SK_DEBUG
static bool format_color_type_valid_pair(GrGLenum format, GrColorType colorType) {
switch (colorType) {
@@ -3372,7 +3382,10 @@
case GrColorType::kRGBA_8888:
return GR_GL_RGBA8 == format || GR_GL_SRGB8_ALPHA8 == format;
case GrColorType::kRGB_888x:
- return GR_GL_RGB8 == format || GR_GL_RGBA8 == format;
+ GR_STATIC_ASSERT(GrCompressionTypeClosestColorType(SkImage::kETC1_CompressionType) ==
+ GrColorType::kRGB_888x);
+ return GR_GL_RGB8 == format || GR_GL_RGBA8 == format ||
+ GR_GL_COMPRESSED_RGB8_ETC2 == format || GR_GL_COMPRESSED_ETC1_RGB8 == format;
case GrColorType::kRG_88:
return GR_GL_RG8 == format;
case GrColorType::kBGRA_8888:
@@ -3391,8 +3404,6 @@
return GR_GL_RG32F == format;
case GrColorType::kRGBA_F32:
return GR_GL_RGBA32F == format;
- case GrColorType::kRGB_ETC1:
- return GR_GL_COMPRESSED_RGB8_ETC2 == format || GR_GL_COMPRESSED_ETC1_RGB8 == format;
case GrColorType::kR_16:
return GR_GL_R16 == format;
case GrColorType::kRG_1616: