Bug 1413500 - Use GLSL 100 for blitting on ES r=jgilbert a=eager-gchang
☠☠ backed out by 96ccac75a2f7 ☠ ☠
authorJames Willcox <snorp@snorp.net>
Fri, 17 Nov 2017 08:47:39 -0600
changeset 444827 8f6a7ac9d726b343d9ba5067ffaccdb62e397263
parent 444826 b9e65f782b6bd6228ffdbfee166b6dbdaeed208e
child 444828 f155e109bb419696beb422b5afbfd7299b2b2500
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, eager-gchang
bugs1413500
milestone58.0
Bug 1413500 - Use GLSL 100 for blitting on ES r=jgilbert a=eager-gchang MozReview-Commit-ID: KlSRfeP7PVi
gfx/gl/GLBlitHelper.cpp
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -50,21 +50,20 @@ const char* const kFragHeader_Tex2DRect 
     #define SAMPLER sampler2DRect                                            \n\
     #if __VERSION__ >= 130                                                   \n\
         #define TEXTURE texture                                              \n\
     #else                                                                    \n\
         #define TEXTURE texture2DRect                                        \n\
     #endif                                                                   \n\
 ";
 const char* const kFragHeader_TexExt = "\
+    #extension GL_OES_EGL_image_external : require                           \n\
     #if __VERSION__ >= 130                                                   \n\
-        #extension GL_OES_EGL_image_external_essl3 : require                 \n\
         #define TEXTURE texture                                              \n\
     #else                                                                    \n\
-        #extension GL_OES_EGL_image_external : require                       \n\
         #define TEXTURE texture2D                                            \n\
     #endif                                                                   \n\
     #define SAMPLER samplerExternalOES                                       \n\
 ";
 
 const char* const kFragBody_RGBA = "\
     VARYING vec2 vTexCoord0;                                                 \n\
     uniform SAMPLER uTex0;                                                   \n\
@@ -545,24 +544,24 @@ GLBlitHelper::GLBlitHelper(GLContext* co
 
             mGL->fBindVertexArray(prev);
         }
     }
 
     // --
 
     const auto glslVersion = mGL->ShadingLanguageVersion();
+
+    // Always use 100 on ES because some devices have OES_EGL_image_external but not
+    // OES_EGL_image_external_essl3. We could just use 100 in that particular case, but
+    // this is a lot easier and is not harmful to other usages.
     if (mGL->IsGLES()) {
-        if (glslVersion >= 300) {
-            mDrawBlitProg_VersionLine = nsPrintfCString("#version %u es\n", glslVersion);
-        }
-    } else {
-        if (glslVersion >= 130) {
-            mDrawBlitProg_VersionLine = nsPrintfCString("#version %u\n", glslVersion);
-        }
+        mDrawBlitProg_VersionLine = nsCString("#version 100\n");
+    } else if (glslVersion >= 130) {
+        mDrawBlitProg_VersionLine = nsPrintfCString("#version %u\n", glslVersion);
     }
 
     const char kVertSource[] = "\
         #if __VERSION__ >= 130                                               \n\
             #define ATTRIBUTE in                                             \n\
             #define VARYING out                                              \n\
         #else                                                                \n\
             #define ATTRIBUTE attribute                                      \n\