From 06d374694a515d064a26e6c5391bce9a0c5c8aa0 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Tue, 8 May 2018 13:00:42 -0400 Subject: 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 Commit-Queue: Brian Osman --- src/gpu/gl/GrGLContext.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/gpu/gl') diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp index ffbae86bc9..a2a5a3b130 100644 --- a/src/gpu/gl/GrGLContext.cpp +++ b/src/gpu/gl/GrGLContext.cpp @@ -53,6 +53,21 @@ std::unique_ptr GrGLContext::Make(sk_sp interf 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); -- cgit v1.2.3