Bug 1414961 - check for EXT_blend_func_extended when using GL ES. r=gw
authorLee Salzman <lsalzman@mozilla.com>
Wed, 24 Apr 2019 05:15:04 +0000
changeset 529513 a2c91afc264b92185833dfb6ace3ca2d4a7c8c7e
parent 529512 f159c693907a490bd9fd8eea3a9e7faf83110e4e
child 529514 4ec3f8bab9f32fbcbe04dfda2aa32f8a59389d37
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1414961
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1414961 - check for EXT_blend_func_extended when using GL ES. r=gw Differential Revision: https://phabricator.services.mozilla.com/D28569
gfx/wr/webrender/res/shared.glsl
gfx/wr/webrender/src/renderer.rs
--- a/gfx/wr/webrender/res/shared.glsl
+++ b/gfx/wr/webrender/res/shared.glsl
@@ -14,18 +14,22 @@
 
 #ifdef WR_FEATURE_TEXTURE_EXTERNAL
 // Please check https://www.khronos.org/registry/OpenGL/extensions/OES/OES_EGL_image_external_essl3.txt
 // for this extension.
 #extension GL_OES_EGL_image_external_essl3 : require
 #endif
 
 #ifdef WR_FEATURE_DUAL_SOURCE_BLENDING
+#ifdef GL_ES
+#extension GL_EXT_blend_func_extended : require
+#else
 #extension GL_ARB_explicit_attrib_location : require
 #endif
+#endif
 
 #include base
 
 #if defined(WR_FEATURE_TEXTURE_EXTERNAL) || defined(WR_FEATURE_TEXTURE_RECT) || defined(WR_FEATURE_TEXTURE_2D)
 #define TEX_SAMPLE(sampler, tex_coord) texture(sampler, tex_coord.xy)
 #else
 #define TEX_SAMPLE(sampler, tex_coord) texture(sampler, tex_coord)
 #endif
--- a/gfx/wr/webrender/src/renderer.rs
+++ b/gfx/wr/webrender/src/renderer.rs
@@ -2013,23 +2013,27 @@ impl Renderer {
         let mut device = Device::new(
             gl,
             options.resource_override_path.clone(),
             options.upload_method.clone(),
             options.cached_programs.take(),
             options.allow_pixel_local_storage_support,
         );
 
-        let ext_dual_source_blending =
+        let supports_dual_source_blending = match gl_type {
+            gl::GlType::Gl => device.supports_extension("GL_ARB_blend_func_extended") &&
+                device.supports_extension("GL_ARB_explicit_attrib_location"),
+            gl::GlType::Gles => device.supports_extension("GL_EXT_blend_func_extended"),
+        };
+        let use_dual_source_blending =
+            supports_dual_source_blending &&
             !options.disable_dual_source_blending &&
             // If using pixel local storage, subpixel AA isn't supported (we disable it on all
             // mobile devices explicitly anyway).
-            !device.get_capabilities().supports_pixel_local_storage &&
-            device.supports_extension("GL_ARB_blend_func_extended") &&
-            device.supports_extension("GL_ARB_explicit_attrib_location");
+            !device.get_capabilities().supports_pixel_local_storage;
 
         // 512 is the minimum that the texture cache can work with.
         const MIN_TEXTURE_SIZE: i32 = 512;
         if let Some(user_limit) = options.max_texture_size {
             assert!(user_limit >= MIN_TEXTURE_SIZE);
             device.clamp_max_texture_size(user_limit);
         }
         if device.max_texture_size() < MIN_TEXTURE_SIZE {
@@ -2190,17 +2194,17 @@ impl Renderer {
             (true, true) => FontRenderMode::Subpixel,
             (true, false) => FontRenderMode::Alpha,
             (false, _) => FontRenderMode::Mono,
         };
 
         let config = FrameBuilderConfig {
             default_font_render_mode,
             dual_source_blending_is_enabled: true,
-            dual_source_blending_is_supported: ext_dual_source_blending,
+            dual_source_blending_is_supported: use_dual_source_blending,
             chase_primitive: options.chase_primitive,
             enable_picture_caching: options.enable_picture_caching,
             testing: options.testing,
             gpu_supports_fast_clears: options.gpu_supports_fast_clears,
         };
 
         let device_pixel_ratio = options.device_pixel_ratio;
         let debug_flags = options.debug_flags;