Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Unified Diff: src/gpu/gl/GrGLCaps.cpp

Issue 292323003: Add compressed texture capabilities for GPU devices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Report on other compressed formats Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLCaps.cpp
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index f577e9d740398dc5ca53fec9379b2e7266f544db..6523e032335f30925587a34e51a6cbe868283f50 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -369,6 +369,8 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
this->initConfigRenderableTable(ctxInfo);
+ this->initCompressedTextureSupport(ctxInfo);
+
return true;
}
@@ -458,6 +460,38 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) {
}
}
+void GrGLCaps::initCompressedTextureSupport(const GrGLContextInfo &ctxInfo) {
+ GrGLStandard standard = ctxInfo.standard();
+ GrGLVersion version = ctxInfo.version();
+
+ // glCompressedTexImage2D is available on all OpenGL ES devices...
+ // however, it is only available on standard OpenGL after version 1.3
+ if (kGL_GrGLStandard == standard && version < GR_GL_VER(1, 3)) {
+ return;
+ }
+
+ // Check for ETC1
+ bool hasETC1 = false;
+
+ // First check version for support
+ if (kGL_GrGLStandard == standard) {
+ hasETC1 =
+ version >= GR_GL_VER(4, 3) ||
+ ctxInfo.hasExtension("GL_ARB_ES3_compatibility");
+ } else {
+ hasETC1 =
+ version >= GR_GL_VER(3, 0) ||
+ ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") ||
+ // ETC2 is a superset of ETC1, so we can just check for that, too.
+ (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") &&
+ ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"));
+ }
+ fCompressedFormatSupport[kETC1_GrCompressedFormat] = hasETC1;
+
+ fCompressedFormatSupport[kETC2_GrCompressedFormat] = false;
+ fCompressedFormatSupport[kDXT1_GrCompressedFormat] = false;
+}
+
bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
GrGLenum format,
GrGLenum type) const {
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698