[WebGL] Remove software rendering and simplify context creation on macOS
https://bugs.webkit.org/show_bug.cgi?id=199789

Reviewed by Sam Weinig.

Source/WebCore:

We don't ever want to fall-back to the software renderer. We'd be better
off failing to create the context completely.

Also, the number of fall-back attempts we were making before hitting
the software renderer was overkill. All hardware we support should
handle a 32bpp buffer.

Lastly, we don't want to support supersampling - multisampling only.

I lied… there is one more thing - failing to create the context
was causing an ASSERT trying to remove the GC3D from the global list.

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
* page/Settings.yaml: Remove forceSoftwareWebGL setting.
* platform/graphics/GraphicsContext3DAttributes.h:
* platform/graphics/GraphicsContext3DManager.cpp:
(WebCore::GraphicsContext3DManager::addContext):
(WebCore::GraphicsContext3DManager::removeContext):
(WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::setPixelFormat): Deleted.

Source/WebKit:

Remove force software WebGL setting.

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetForceSoftwareWebGLRendering): Deleted.
(WKPreferencesGetForceSoftwareWebGLRendering): Deleted.
* UIProcess/API/C/WKPreferencesRefPrivate.h:

Source/WebKitLegacy/mac:

Remove force software WebGL setting.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences forceSoftwareWebGLRendering]): Deleted.
(-[WebPreferences setForceSoftwareWebGLRendering:]): Deleted.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@247453 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index f13bf21..736cf73 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2019-07-15  Dean Jackson  <dino@apple.com>
+
+        [WebGL] Remove software rendering and simplify context creation on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=199789
+
+        Reviewed by Sam Weinig.
+
+        We don't ever want to fall-back to the software renderer. We'd be better
+        off failing to create the context completely.
+
+        Also, the number of fall-back attempts we were making before hitting
+        the software renderer was overkill. All hardware we support should
+        handle a 32bpp buffer.
+
+        Lastly, we don't want to support supersampling - multisampling only.
+
+        I lied… there is one more thing - failing to create the context
+        was causing an ASSERT trying to remove the GC3D from the global list.
+
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::create):
+        * page/Settings.yaml: Remove forceSoftwareWebGL setting.
+        * platform/graphics/GraphicsContext3DAttributes.h:
+        * platform/graphics/GraphicsContext3DManager.cpp:
+        (WebCore::GraphicsContext3DManager::addContext):
+        (WebCore::GraphicsContext3DManager::removeContext):
+        (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
+        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        (WebCore::setPixelFormat): Deleted.
+
 2019-07-14  Dean Jackson  <dino@apple.com>
 
         Move more WebGL things into unified builds
diff --git a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp b/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
index c85a8f4..3ece7ee 100644
--- a/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
+++ b/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
@@ -562,9 +562,6 @@
             }
         }
 
-        if (frame->settings().forceSoftwareWebGLRendering())
-            attributes.forceSoftwareRenderer = true;
-
         if (frame->settings().forceWebGLUsesLowPower()) {
             if (attributes.powerPreference == GraphicsContext3DPowerPreference::HighPerformance)
                 LOG(WebGL, "Overriding powerPreference from high-performance to low-power.");
diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml
index 7e7d01a..45625e1 100644
--- a/Source/WebCore/page/Settings.yaml
+++ b/Source/WebCore/page/Settings.yaml
@@ -237,8 +237,6 @@
   initial: true
 unhandledPromiseRejectionToConsoleEnabled:
   initial: true
-forceSoftwareWebGLRendering:
-  initial: false
 forceWebGLUsesLowPower:
   initial: false
 accelerated2dCanvasEnabled:
diff --git a/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h b/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h
index 32a7bbb..97ff17c 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h
+++ b/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h
@@ -46,7 +46,6 @@
     PowerPreference powerPreference { PowerPreference::Default };
 
     // Additional attributes.
-    bool forceSoftwareRenderer { false };
     bool shareResources { true };
     bool isWebGL2 { false };
     bool noExtensions { false };
diff --git a/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp b/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp
index 0880008..89e3e59 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp
+++ b/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp
@@ -160,7 +160,7 @@
     ASSERT(context);
     if (!context)
         return;
-    
+
 #if PLATFORM(MAC) && !ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     if (!m_contexts.size())
         CGDisplayRegisterReconfigurationCallback(displayWasReconfigured, nullptr);
@@ -173,7 +173,8 @@
 
 void GraphicsContext3DManager::removeContext(GraphicsContext3D* context)
 {
-    ASSERT(m_contexts.contains(context));
+    if (!m_contexts.contains(context))
+        return;
     m_contexts.removeFirst(context);
     m_contextWindowMap.remove(context);
     removeContextRequiringHighPerformance(context);
@@ -207,6 +208,9 @@
 
 void GraphicsContext3DManager::removeContextRequiringHighPerformance(GraphicsContext3D* context)
 {
+    if (!context)
+        return;
+
     if (!m_contextsRequiringHighPerformance.contains(context))
         return;
     
diff --git a/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm b/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm
index 0757fa6..892b4a9 100644
--- a/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm
+++ b/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm
@@ -98,57 +98,6 @@
     ~GraphicsContext3DPrivate() { }
 };
 
-#if USE(OPENGL)
-
-static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest, bool antialias, bool isWebGL2, bool allowOfflineRenderers)
-{
-    attribs.clear();
-    
-    attribs.append(kCGLPFAColorSize);
-    attribs.append(static_cast<CGLPixelFormatAttribute>(colorBits));
-    attribs.append(kCGLPFADepthSize);
-    attribs.append(static_cast<CGLPixelFormatAttribute>(depthBits));
-
-    // This attribute, while mentioning offline renderers, is actually
-    // allowing us to request the integrated graphics on a dual GPU
-    // system, and not force the discrete GPU.
-    // See https://developer.apple.com/library/mac/technotes/tn2229/_index.html
-    if (allowOfflineRenderers)
-        attribs.append(kCGLPFAAllowOfflineRenderers);
-
-    if (accelerated)
-        attribs.append(kCGLPFAAccelerated);
-    else {
-        attribs.append(kCGLPFARendererID);
-        attribs.append(static_cast<CGLPixelFormatAttribute>(kCGLRendererGenericFloatID));
-    }
-        
-    if (supersample && !antialias)
-        attribs.append(kCGLPFASupersample);
-
-    if (closest)
-        attribs.append(kCGLPFAClosestPolicy);
-
-    if (antialias) {
-        attribs.append(kCGLPFAMultisample);
-        attribs.append(kCGLPFASampleBuffers);
-        attribs.append(static_cast<CGLPixelFormatAttribute>(1));
-        attribs.append(kCGLPFASamples);
-        attribs.append(static_cast<CGLPixelFormatAttribute>(4));
-    }
-
-    if (isWebGL2) {
-        // FIXME: Instead of backing a WebGL2 GraphicsContext3D with a OpenGL 4 context, we should instead back it with ANGLE.
-        // Use an OpenGL 4 context for now until the ANGLE backend is ready.
-        attribs.append(kCGLPFAOpenGLProfile);
-        attribs.append(static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_GL4_Core));
-    }
-        
-    attribs.append(static_cast<CGLPixelFormatAttribute>(0));
-}
-
-#endif // USE(OPENGL)
-
 RefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3DAttributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
 {
     // This implementation doesn't currently support rendering directly to the HostWindow.
@@ -289,56 +238,51 @@
     if (m_attrs.isWebGL2)
         ::glEnable(GraphicsContext3D::PRIMITIVE_RESTART_FIXED_INDEX);
 #elif USE(OPENGL)
-    Vector<CGLPixelFormatAttribute> attribs;
-    CGLPixelFormatObj pixelFormatObj = 0;
-    GLint numPixelFormats = 0;
-    
+
 #if HAVE(APPLE_GRAPHICS_CONTROL)
     m_powerPreferenceUsedForCreation = (hasLowAndHighPowerGPUs() && attrs.powerPreference == GraphicsContext3DPowerPreference::HighPerformance) ? GraphicsContext3DPowerPreference::HighPerformance : GraphicsContext3DPowerPreference::Default;
 #else
     m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default;
 #endif
 
-    // If we're configured to demand the software renderer, we'll
-    // do so. We attempt to create contexts in this order:
-    //
-    // 1) 32 bit RGBA/32 bit depth/supersampled
-    // 2) 32 bit RGBA/32 bit depth
-    // 3) 32 bit RGBA/16 bit depth
-    //
-    // If we were not forced into software mode already, our final attempt is
-    // to try that:
-    //
-    // 4) closest to 32 bit RGBA/16 bit depth/software renderer
-    //
-    // If none of that works, we fail and leave m_contextObj as nullptr.
-
     bool useMultisampling = m_attrs.antialias;
 
-    setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
-    CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
+    Vector<CGLPixelFormatAttribute> attribs;
+    CGLPixelFormatObj pixelFormatObj = 0;
+    GLint numPixelFormats = 0;
 
-    if (!numPixelFormats) {
-        setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
-        CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
+    attribs.append(kCGLPFAAccelerated);
+    attribs.append(kCGLPFAColorSize);
+    attribs.append(static_cast<CGLPixelFormatAttribute>(32));
+    attribs.append(kCGLPFADepthSize);
+    attribs.append(static_cast<CGLPixelFormatAttribute>(32));
 
-        if (!numPixelFormats) {
-            setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
-            CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
+    // This attribute, while mentioning offline renderers, is actually
+    // allowing us to request the integrated graphics on a dual GPU
+    // system, and not force the discrete GPU.
+    // See https://developer.apple.com/library/mac/technotes/tn2229/_index.html
+    if (allowOfflineRenderers())
+        attribs.append(kCGLPFAAllowOfflineRenderers);
 
-            if (!numPixelFormats) {
-                setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
-                CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
-
-                if (!attrs.forceSoftwareRenderer && !numPixelFormats) {
-                    setPixelFormat(attribs, 32, 16, false, false, true, false, attrs.isWebGL2, allowOfflineRenderers());
-                    CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
-                    useMultisampling = false;
-                }
-            }
-        }
+    if (useMultisampling) {
+        attribs.append(kCGLPFAMultisample);
+        attribs.append(kCGLPFASampleBuffers);
+        attribs.append(static_cast<CGLPixelFormatAttribute>(1));
+        attribs.append(kCGLPFASamples);
+        attribs.append(static_cast<CGLPixelFormatAttribute>(4));
     }
 
+    if (attrs.isWebGL2) {
+        // FIXME: Instead of backing a WebGL2 GraphicsContext3D with a OpenGL 4 context, we should instead back it with ANGLE.
+        // Use an OpenGL 4 context for now until the ANGLE backend is ready.
+        attribs.append(kCGLPFAOpenGLProfile);
+        attribs.append(static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_GL4_Core));
+    }
+
+    attribs.append(static_cast<CGLPixelFormatAttribute>(0));
+
+    CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
+
     if (!numPixelFormats)
         return;
 
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index d1e1188..770d317 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,18 @@
+2019-07-15  Dean Jackson  <dino@apple.com>
+
+        [WebGL] Remove software rendering and simplify context creation on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=199789
+
+        Reviewed by Sam Weinig.
+
+        Remove force software WebGL setting.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetForceSoftwareWebGLRendering): Deleted.
+        (WKPreferencesGetForceSoftwareWebGLRendering): Deleted.
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+
 2019-07-15  Daniel Bates  <dabates@apple.com>
 
         Typing into a cell in a Google Sheet lags behind by one character
diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml
index 6fe8530..1d3412b 100644
--- a/Source/WebKit/Shared/WebPreferences.yaml
+++ b/Source/WebKit/Shared/WebPreferences.yaml
@@ -130,10 +130,6 @@
   type: bool
   defaultValue: true
 
-ForceSoftwareWebGLRendering:
-  type: bool
-  defaultValue: false
-
 Accelerated2dCanvasEnabled:
   type: bool
   defaultValue: false
diff --git a/Source/WebKit/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit/UIProcess/API/C/WKPreferences.cpp
index a031798..2326050 100644
--- a/Source/WebKit/UIProcess/API/C/WKPreferences.cpp
+++ b/Source/WebKit/UIProcess/API/C/WKPreferences.cpp
@@ -469,16 +469,6 @@
     return toImpl(preferencesRef)->webGLEnabled();
 }
 
-void WKPreferencesSetForceSoftwareWebGLRendering(WKPreferencesRef preferencesRef, bool flag)
-{
-    toImpl(preferencesRef)->setForceSoftwareWebGLRendering(flag);
-}
-
-bool WKPreferencesGetForceSoftwareWebGLRendering(WKPreferencesRef preferencesRef)
-{
-    return toImpl(preferencesRef)->forceSoftwareWebGLRendering();
-}
-
 void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setAccelerated2dCanvasEnabled(flag);
diff --git a/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h b/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
index 5c3398c..b47a0ad 100644
--- a/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
+++ b/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
@@ -91,10 +91,6 @@
 WK_EXPORT bool WKPreferencesGetWebGLEnabled(WKPreferencesRef);
 
 // Defaults to false.
-WK_EXPORT void WKPreferencesSetForceSoftwareWebGLRendering(WKPreferencesRef, bool);
-WK_EXPORT bool WKPreferencesGetForceSoftwareWebGLRendering(WKPreferencesRef);
-
-// Defaults to false.
 WK_EXPORT void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef, bool);
 WK_EXPORT bool WKPreferencesGetAccelerated2DCanvasEnabled(WKPreferencesRef);
 
diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog
index f2653b2..412f0e8 100644
--- a/Source/WebKitLegacy/mac/ChangeLog
+++ b/Source/WebKitLegacy/mac/ChangeLog
@@ -1,3 +1,21 @@
+2019-07-15  Dean Jackson  <dino@apple.com>
+
+        [WebGL] Remove software rendering and simplify context creation on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=199789
+
+        Reviewed by Sam Weinig.
+
+        Remove force software WebGL setting.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences forceSoftwareWebGLRendering]): Deleted.
+        (-[WebPreferences setForceSoftwareWebGLRendering:]): Deleted.
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2019-07-13  Zalan Bujtas  <zalan@apple.com>
 
         Cannot bring up custom media controls at all on v.youku.com
diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
index 86addf6..f22f1ff 100644
--- a/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
@@ -118,7 +118,6 @@
 #define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled"
 #define WebKitWebGL2EnabledPreferenceKey @"WebKitWebGL2Enabled"
 #define WebKitWebGPUEnabledPreferenceKey @"WebKitWebGPUEnabled"
-#define WebKitForceSoftwareWebGLRenderingPreferenceKey @"WebKitForceSoftwareWebGLRendering"
 #define WebKitForceWebGLUsesLowPowerPreferenceKey @"WebKitForceWebGLUsesLowPower"
 #define WebKitAccelerated2dCanvasEnabledPreferenceKey @"WebKitAccelerated2dCanvasEnabled"
 #define WebKitFrameFlatteningPreferenceKey @"WebKitFrameFlattening"
diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferences.mm b/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
index ec91327..014adde 100644
--- a/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
+++ b/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
@@ -506,7 +506,6 @@
         [NSNumber numberWithBool:NO],   WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitShowRepaintCounterPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitWebGLEnabledPreferenceKey,
-        [NSNumber numberWithBool:NO],  WebKitForceSoftwareWebGLRenderingPreferenceKey,
         [NSNumber numberWithBool:YES],   WebKitForceWebGLUsesLowPowerPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitAccelerated2dCanvasEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],  WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey,
@@ -2144,16 +2143,6 @@
     [self _setBoolValue:enabled forKey:WebKitWebGL2EnabledPreferenceKey];
 }
 
-- (BOOL)forceSoftwareWebGLRendering
-{
-    return [self _boolValueForKey:WebKitForceSoftwareWebGLRenderingPreferenceKey];
-}
-
-- (void)setForceSoftwareWebGLRendering:(BOOL)forced
-{
-    [self _setBoolValue:forced forKey:WebKitForceSoftwareWebGLRenderingPreferenceKey];
-}
-
 - (BOOL)forceLowPowerGPUForWebGL
 {
     return [self _boolValueForKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h b/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
index a8b9ac7..09a83b2 100644
--- a/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
+++ b/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
@@ -275,9 +275,6 @@
 - (BOOL)webGL2Enabled;
 - (void)setWebGL2Enabled:(BOOL)enabled;
 
-- (BOOL)forceSoftwareWebGLRendering;
-- (void)setForceSoftwareWebGLRendering:(BOOL)forced;
-
 - (BOOL)forceLowPowerGPUForWebGL;
 - (void)setForceWebGLUsesLowPower:(BOOL)forceLowPower;
 
diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm
index cdcc0fc..525c725 100644
--- a/Source/WebKitLegacy/mac/WebView/WebView.mm
+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm
@@ -2939,7 +2939,6 @@
     settings.setSubpixelCSSOMElementMetricsEnabled([preferences subpixelCSSOMElementMetricsEnabled]);
     settings.setSubpixelAntialiasedLayerTextEnabled([preferences subpixelAntialiasedLayerTextEnabled]);
 
-    settings.setForceSoftwareWebGLRendering([preferences forceSoftwareWebGLRendering]);
     settings.setForceWebGLUsesLowPower([preferences forceLowPowerGPUForWebGL]);
     settings.setAccelerated2dCanvasEnabled([preferences accelerated2dCanvasEnabled]);
     settings.setLoadDeferringEnabled(shouldEnableLoadDeferring());