Bug 1371190 - Part 5: Force enable alpha channel to prevent ANGLE from using incompatible backbuffer format. r=jgilbert
authorChih-Yi Leu <subsevenx2001@gmail.com>
Wed, 06 Sep 2017 10:50:14 +0800
changeset 427935 162ddc0d22f6467495781edf7f7985bdbccf9433
parent 427934 5cf9988a5a11c4eb2708619b93a8e00d853dbd2c
child 427936 bafc5511aee80b5021da5815e1f19dbaa5c2cde2
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersjgilbert
bugs1371190
milestone58.0a1
Bug 1371190 - Part 5: Force enable alpha channel to prevent ANGLE from using incompatible backbuffer format. r=jgilbert MozReview-Commit-ID: JtbKebUiroM
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -758,18 +758,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;
 }