r?jrmuizel - Add webgl.disable-wgl. (default: false) draft
authorJeff Gilbert <jdashg@gmail.com>
Thu, 19 May 2016 19:40:30 -0700
changeset 369930 415460694fc9f13df72999c3d42b9441e293b6c1
parent 369929 45889e7f540e40392d5a97cd87c31dff855d1c5e
child 369931 bd8d3fbdebfef7608503205a0ba5fc7bb394116b
push id18953
push userjgilbert@mozilla.com
push dateTue, 24 May 2016 00:19:59 +0000
milestone49.0a1
r?jrmuizel - Add webgl.disable-wgl. (default: false) From 7f233590e15bb0fcce396b4b8aadc82f9dcd981f Mon Sep 17 00:00:00 2001 --- dom/canvas/WebGLContext.cpp | 12 ++++++++++-- gfx/thebes/gfxPrefs.h | 1 + modules/libpref/init/all.js | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) MozReview-Commit-ID: BhADAWpI1CG
dom/canvas/WebGLContext.cpp
gfx/thebes/gfxPrefs.h
modules/libpref/init/all.js
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -706,18 +706,26 @@ WebGLContext::CreateAndInitGL(bool force
     //////
 
     if (!blacklistOpenGL) {
         const bool useEGL = PR_GetEnv("MOZ_WEBGL_FORCE_EGL");
 
         if (useEGL)
             return CreateAndInitGLWith(CreateGLWithEGL, baseCaps, flags, out_failReasons);
 
-        if (CreateAndInitGLWith(CreateGLWithNative, baseCaps, flags, out_failReasons))
-            return true;
+        bool tryNativeGL = true;
+#ifdef XP_WIN
+        if (gfxPrefs::WebGLDisableWGL()) {
+            tryNativeGL = false;
+        }
+#endif
+        if (tryNativeGL) {
+            if (CreateAndInitGLWith(CreateGLWithNative, baseCaps, flags, out_failReasons))
+                return true;
+        }
     }
 
     //////
 
     bool useANGLE = false;
 #ifdef XP_WIN
     const bool disableANGLE = (gfxPrefs::WebGLDisableANGLE() ||
                                PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL"));
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -430,16 +430,17 @@ private:
   DECL_GFX_PREF(Live, "webgl.all-angle-options",               WebGLAllANGLEOptions, bool, false);
   DECL_GFX_PREF(Live, "webgl.angle.force-d3d11",               WebGLANGLEForceD3D11, bool, false);
   DECL_GFX_PREF(Live, "webgl.angle.try-d3d11",                 WebGLANGLETryD3D11, bool, false);
   DECL_GFX_PREF(Live, "webgl.angle.force-warp",                WebGLANGLEForceWARP, bool, false);
   DECL_GFX_PREF(Live, "webgl.bypass-shader-validation",        WebGLBypassShaderValidator, bool, true);
   DECL_GFX_PREF(Live, "webgl.can-lose-context-in-foreground",  WebGLCanLoseContextInForeground, bool, true);
   DECL_GFX_PREF(Live, "webgl.default-no-alpha",                WebGLDefaultNoAlpha, bool, false);
   DECL_GFX_PREF(Live, "webgl.disable-angle",                   WebGLDisableANGLE, bool, false);
+  DECL_GFX_PREF(Live, "webgl.disable-wgl",                     WebGLDisableWGL, bool, false);
   DECL_GFX_PREF(Live, "webgl.disable-extensions",              WebGLDisableExtensions, bool, false);
   DECL_GFX_PREF(Live, "webgl.dxgl.enabled",                    WebGLDXGLEnabled, bool, false);
   DECL_GFX_PREF(Live, "webgl.dxgl.needs-finish",               WebGLDXGLNeedsFinish, bool, false);
 
   DECL_GFX_PREF(Live, "webgl.disable-fail-if-major-performance-caveat",
                 WebGLDisableFailIfMajorPerformanceCaveat, bool, false);
   DECL_GFX_PREF(Live, "webgl.disable-DOM-blit-uploads",
                 WebGLDisableDOMBlitUploads, bool, false);
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4306,16 +4306,17 @@ pref("gl.msaa-level", 2);
 pref("gl.require-hardware", false);
 #ifdef XP_MACOSX
 pref("gl.multithreaded", true);
 #endif
 
 pref("webgl.force-enabled", false);
 pref("webgl.disabled", false);
 pref("webgl.disable-angle", false);
+pref("webgl.disable-wgl", false);
 pref("webgl.min_capability_mode", false);
 pref("webgl.disable-extensions", false);
 pref("webgl.msaa-force", false);
 pref("webgl.prefer-16bpp", false);
 pref("webgl.default-no-alpha", false);
 pref("webgl.force-layers-readback", false);
 pref("webgl.lose-context-on-memory-pressure", false);
 pref("webgl.can-lose-context-in-foreground", true);