Fix ETC1 support on iOS.

iOS doesn't support the ETC1 GL format, but does support ETC2 which has
ETC1 support as well. We should probably default to ETC2 in any case.

Change-Id: Ifd34fc602a1227f76316a8e27cf5555605c66840
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241045
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2019-09-12 13:04:18 -04:00 committed by Skia Commit-Bot
parent f19510e320
commit c13030169f

View File

@ -4078,6 +4078,10 @@ GrBackendFormat GrGLCaps::getBackendFormatFromCompressionType(
SkImage::CompressionType compressionType) const {
switch (compressionType) {
case SkImage::kETC1_CompressionType:
// if ETC2 is available default to that format
if (this->isFormatTexturable(GrGLFormat::kCOMPRESSED_RGB8_ETC2)) {
return GrBackendFormat::MakeGL(GR_GL_COMPRESSED_RGB8_ETC2, GR_GL_TEXTURE_2D);
}
return GrBackendFormat::MakeGL(GR_GL_COMPRESSED_ETC1_RGB8, GR_GL_TEXTURE_2D);
}
SK_ABORT("Invalid compression type");