Bug 1371190 - Part5: Force enable alpha channel to prevent ANGLE from using incompatible backbuffer format draft
authorChih-Yi Leu <subsevenx2001@gmail.com>
Wed, 06 Sep 2017 10:50:14 +0800
changeset 673341 0410877111e95c23faaceb8f743b9f4ceba7e42c
parent 673340 ab130645357873e1e6193d03a5464459f080c703
child 673342 a1b0c0efa9378118c1419896344dc830bb71797d
push id82540
push userbmo:cleu@mozilla.com
push dateMon, 02 Oct 2017 10:12:46 +0000
bugs1371190
milestone58.0a1
Bug 1371190 - Part5: Force enable alpha channel to prevent ANGLE from using incompatible backbuffer format MozReview-Commit-ID: JtbKebUiroM
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -759,18 +759,22 @@ WebGLContext::CreateAndInitGL(bool force
             return CreateAndInitGLWith(CreateGLWithEGL, baseCaps, flags, out_failReasons);
 
         if (CreateAndInitGLWith(CreateGLWithDefault, baseCaps, flags, out_failReasons))
             return true;
     }
 
     //////
 
-    if (tryANGLE)
-        return CreateAndInitGLWith(CreateGLWithANGLE, baseCaps, flags, out_failReasons);
+    if (tryANGLE) {
+        // Force enable alpha channel to make sure ANGLE use correct framebuffer formart
+        gl::SurfaceCaps& angleCaps = const_cast<gl::SurfaceCaps&>(baseCaps);
+        angleCaps.alpha = true;
+        return CreateAndInitGLWith(CreateGLWithANGLE, angleCaps, flags, out_failReasons);
+    }
 
     //////
 
     out_failReasons->push_back(FailureReason("FEATURE_FAILURE_WEBGL_EXHAUSTED_DRIVERS",
                                              "Exhausted GL driver options."));
     return false;
 }