skia: Prevent GL_RED from being used with MESA
MESA unfortunately doesn't support GL_RED or GL_RG when used with frame buffers.
Don't allow fTextureRedSupport to be set when using MESA.
BUG=skia:3181
Review URL: https://codereview.chromium.org/769073003
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 414f06d..b4ee4a6 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -178,20 +178,17 @@
ctxInfo.hasExtension("GL_EXT_texture_storage");
}
- // ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support it if
- // it doesn't have ARB_texture_rg extension.
- if (kGL_GrGLStandard == standard) {
- if (ctxInfo.isMesa()) {
- fTextureRedSupport = ctxInfo.hasExtension("GL_ARB_texture_rg");
- } else {
+ // ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support GL_RED
+ // and GL_RG on FBO textures.
+ if (!ctxInfo.isMesa()) {
+ if (kGL_GrGLStandard == standard) {
fTextureRedSupport = version >= GR_GL_VER(3,0) ||
ctxInfo.hasExtension("GL_ARB_texture_rg");
+ } else {
+ fTextureRedSupport = version >= GR_GL_VER(3,0) ||
+ ctxInfo.hasExtension("GL_EXT_texture_rg");
}
- } else {
- fTextureRedSupport = version >= GR_GL_VER(3,0) ||
- ctxInfo.hasExtension("GL_EXT_texture_rg");
}
-
fImagingSupport = kGL_GrGLStandard == standard &&
ctxInfo.hasExtension("GL_ARB_imaging");