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

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

Issue 304743004: Move ETC1 and LATC enums value to GrPixelConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add isConfigTexturable() 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') | src/gpu/gl/GrGLDefines.h » ('j') | 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 6523e032335f30925587a34e51a6cbe868283f50..663eedbeee538f82cb80b73f5ec29f770c56a352 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -368,8 +368,7 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
}
this->initConfigRenderableTable(ctxInfo);
-
- this->initCompressedTextureSupport(ctxInfo);
+ this->initConfigTexturableTable(ctxInfo);
return true;
}
@@ -404,12 +403,14 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) {
// Same as ES 2.0 except R8 and RGBA8 are supported without extensions (the functions called
// below already account for this).
+ GrGLStandard standard = ctxInfo.standard();
+
enum {
kNo_MSAA = 0,
kYes_MSAA = 1,
};
- if (kGL_GrGLStandard == ctxInfo.standard()) {
+ if (kGL_GrGLStandard == standard) {
// Post 3.0 we will get R8
// Prior to 3.0 we will get ALPHA8 (with GL_ARB_framebuffer_object)
if (ctxInfo.version() >= GR_GL_VER(3,0) ||
@@ -423,7 +424,7 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) {
fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSupport;
}
- if (kGL_GrGLStandard != ctxInfo.standard()) {
+ if (kGL_GrGLStandard != standard) {
// only available in ES
fConfigRenderSupport[kRGB_565_GrPixelConfig][kNo_MSAA] = true;
fConfigRenderSupport[kRGB_565_GrPixelConfig][kYes_MSAA] = true;
@@ -460,36 +461,75 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) {
}
}
-void GrGLCaps::initCompressedTextureSupport(const GrGLContextInfo &ctxInfo) {
+void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo) {
+ // Base texture support
+ fConfigTextureSupport[kAlpha_8_GrPixelConfig] = true;
+ fConfigTextureSupport[kIndex_8_GrPixelConfig] = true;
+ fConfigTextureSupport[kRGB_565_GrPixelConfig] = true;
+ fConfigTextureSupport[kRGBA_4444_GrPixelConfig] = true;
+ fConfigTextureSupport[kRGBA_8888_GrPixelConfig] = true;
+ fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true;
bsalomon 2014/05/29 19:11:29 I think this needs to duplicate the logic to setup
krajcevski 2014/05/29 19:46:42 Done.
+
+ // Compressed texture support
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;
- }
+ bool hasCompressTex2D = (kGL_GrGLStandard != standard || version > GR_GL_VER(1, 3));
// 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");
+ hasETC1 = hasCompressTex2D &&
+ (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"));
+ hasETC1 = hasCompressTex2D &&
+ (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")));
+ }
+ fConfigTextureSupport[kETC1_GrPixelConfig] = hasETC1;
+
+ // Check for LATC under its various forms
+ LATCAlias alias = kLATC_LATCAlias;
+ bool hasLATC = hasCompressTex2D &&
+ (ctxInfo.hasExtension("GL_EXT_texture_compression_latc") ||
+ ctxInfo.hasExtension("GL_NV_texture_compression_latc"));
+
+ // Check for RGTC
+ if (!hasLATC) {
+ // If we're using OpenGL 3.0 or later, then we have RGTC, an identical compression format.
+ if (kGL_GrGLStandard == standard) {
+ hasLATC = version >= GR_GL_VER(3, 0);
+ }
+
+ if (!hasLATC) {
+ hasLATC =
+ ctxInfo.hasExtension("GL_EXT_texture_compression_rgtc") ||
+ ctxInfo.hasExtension("GL_ARB_texture_compression_rgtc");
+ }
+
+ if (hasLATC) {
+ alias = kRGTC_LATCAlias;
+ }
+ }
+
+ // Check for 3DC
+ if (!hasLATC) {
+ hasLATC = ctxInfo.hasExtension("GL_AMD_compressed_3DC_texture");
+ if (hasLATC) {
+ alias = k3DC_LATCAlias;
+ }
}
- fCompressedFormatSupport[kETC1_GrCompressedFormat] = hasETC1;
- fCompressedFormatSupport[kETC2_GrCompressedFormat] = false;
- fCompressedFormatSupport[kDXT1_GrCompressedFormat] = false;
+ fConfigTextureSupport[kLATC_GrPixelConfig] = hasLATC;
+ fLATCAlias = alias;
}
bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLDefines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698