Add fPreferExternalImagesOverES3 to GrContextOptions
This forces us to use the ES2 shading language when we have an ES3
context, but the driver claims to only support GL_OES_EGL_image_external
(and not the _essl3 variant). Many of these devices will work correctly
if we blindly enable both extensions, but there are some that won't.
Bug: skia:
Change-Id: Id632003a1905ea61b46166befd30905a57cead69
Reviewed-on: https://skia-review.googlesource.com/126681
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index ffbae86..a2a5a3b 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -53,6 +53,21 @@
args.fGLSLGeneration = k110_GrGLSLGeneration;
}
+ // Many ES3 drivers only advertise the ES2 image_external extension, but support the _essl3
+ // extension, and require that it be enabled to work with ESSL3. Other devices require the ES2
+ // extension to be enabled, even when using ESSL3. Some devices appear to only support the ES2
+ // extension. As an extreme (optional) solution, we can fallback to using ES2 shading language
+ // if we want to prioritize external texture support. skbug.com/7713
+ if (kGLES_GrGLStandard == interface->fStandard &&
+ options.fPreferExternalImagesOverES3 &&
+ !options.fDisableDriverCorrectnessWorkarounds &&
+ interface->hasExtension("GL_OES_EGL_image_external") &&
+ args.fGLSLGeneration >= k330_GrGLSLGeneration &&
+ !interface->hasExtension("GL_OES_EGL_image_external_essl3") &&
+ !interface->hasExtension("OES_EGL_image_external_essl3")) {
+ args.fGLSLGeneration = k110_GrGLSLGeneration;
+ }
+
GrGLGetDriverInfo(interface->fStandard, args.fVendor, renderer, ver,
&args.fDriver, &args.fDriverVersion);