Title: [212529] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (212528 => 212529)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-17 05:28:16 UTC (rev 212529)
@@ -1,5 +1,25 @@
 2017-02-16  Matthew Hanson  <[email protected]>
 
+        Merge r212316. rdar://problem/30504444
+
+    2017-02-13  Dean Jackson  <[email protected]>
+
+            Rename preferLowPowerToHighPerformance to powerPreference
+            https://bugs.webkit.org/show_bug.cgi?id=168269
+            <rdar://problem/30504444>
+
+            Reviewed by Chris Dumez.
+
+            Handle the rename in the test case. Since Settings.in has
+            preferLowPowerWebGLRendering initial=true
+            we will override the incoming request and set the value to
+            "low-power". This behaviour will change in a subsequent bug.
+
+            * fast/canvas/webgl/context-creation-attributes-expected.txt:
+            * fast/canvas/webgl/context-creation-attributes.html:
+
+2017-02-16  Matthew Hanson  <[email protected]>
+
         Merge r212314. rdar://problem/27685077
 
     2017-02-14  Jeremy Jones  <[email protected]>

Modified: branches/safari-603-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt (212528 => 212529)


--- branches/safari-603-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt	2017-02-17 05:28:16 UTC (rev 212529)
@@ -1,6 +1,6 @@
 Note that some of the values tested here might not be supported, and thus should return the default values.
 
-{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"preferLowPowerToHighPerformance":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}
-{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"preferLowPowerToHighPerformance":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":true}
-{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"preferLowPowerToHighPerformance":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}
-{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":true,"preferLowPowerToHighPerformance":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}
+{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"powerPreference":"low-power","premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}
+{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"powerPreference":"low-power","premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":true}
+{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":false,"powerPreference":"low-power","premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}
+{"alpha":true,"antialias":true,"depth":true,"failIfMajorPerformanceCaveat":true,"powerPreference":"low-power","premultipliedAlpha":true,"preserveDrawingBuffer":false,"stencil":false}

Modified: branches/safari-603-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes.html (212528 => 212529)


--- branches/safari-603-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes.html	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes.html	2017-02-17 05:28:16 UTC (rev 212529)
@@ -27,7 +27,7 @@
 function run() {
     testContextCreation({});
     testContextCreation({stencil: true});
-    testContextCreation({preferLowPowerToHighPerformance: true});
+    testContextCreation({powerPreference: "default"});
     testContextCreation({failIfMajorPerformanceCaveat: true});
 }
 

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (212528 => 212529)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-17 05:28:16 UTC (rev 212529)
@@ -1,5 +1,40 @@
 2017-02-16  Matthew Hanson  <[email protected]>
 
+        Merge r212316. rdar://problem/30504444
+
+    2017-02-13  Dean Jackson  <[email protected]>
+
+            Rename preferLowPowerToHighPerformance to powerPreference
+            https://bugs.webkit.org/show_bug.cgi?id=168269
+            <rdar://problem/30504444>
+
+            Reviewed by Chris Dumez.
+
+            Based on the discussion in https://github.com/KhronosGroup/WebGL/pull/2283.
+
+            Change WebGLContextAttributes's preferLowPowerToHighPerformance boolean
+            into a powerPreference enum taking three values. The implementation
+            of the enum is in GraphicsContext3DAttributes.
+
+            While the name and values have changed, there should be no change in
+            behaviour caused by this patch.
+
+            * html/canvas/WebGLContextAttributes.h: Use GraphicsContext3DAttributes
+            enum GraphicsContext3DPowerPreference.
+            * html/canvas/WebGLContextAttributes.idl: Rename and add the WebIDL enum.
+            * html/canvas/WebGLRenderingContextBase.cpp: Use the new values.
+            (WebCore::WebGLRenderingContextBase::create):
+            (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
+            * platform/WebGLStateTracker.cpp:
+            * platform/WebGLStateTracker.h: Update the state tracker to use the new
+            values.
+            * platform/graphics/GraphicsContext3DAttributes.h:
+            * platform/graphics/mac/GraphicsContext3DMac.mm:
+            (WebCore::setPixelFormat): Accept GraphicsContext3DPowerPreference as a parameter.
+            (WebCore::GraphicsContext3D::GraphicsContext3D):
+
+2017-02-16  Matthew Hanson  <[email protected]>
+
         Merge r212314. rdar://problem/27685077
 
     2017-02-14  Jeremy Jones  <[email protected]>

Modified: branches/safari-603-branch/Source/WebCore/html/canvas/WebGLContextAttributes.h (212528 => 212529)


--- branches/safari-603-branch/Source/WebCore/html/canvas/WebGLContextAttributes.h	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/Source/WebCore/html/canvas/WebGLContextAttributes.h	2017-02-17 05:28:16 UTC (rev 212529)
@@ -31,6 +31,7 @@
 
 namespace WebCore {
 
+using WebGLPowerPreference = GraphicsContext3DPowerPreference;
 using WebGLContextAttributes = GraphicsContext3DAttributes;
 
 } // namespace WebCore

Modified: branches/safari-603-branch/Source/WebCore/html/canvas/WebGLContextAttributes.idl (212528 => 212529)


--- branches/safari-603-branch/Source/WebCore/html/canvas/WebGLContextAttributes.idl	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/Source/WebCore/html/canvas/WebGLContextAttributes.idl	2017-02-17 05:28:16 UTC (rev 212529)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2010, Google Inc. All rights reserved.
+ * Copyright (c) 2017, Apple, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -26,6 +27,12 @@
 
 typedef boolean GLboolean;
 
+enum WebGLPowerPreference {
+    "default",
+    "low-power",
+    "high-performance"
+};
+
 [
     Conditional=WEBGL,
     JSGenerateToJSObject
@@ -36,6 +43,6 @@
     GLboolean antialias = true;
     GLboolean premultipliedAlpha = true;
     GLboolean preserveDrawingBuffer = false;
-    GLboolean preferLowPowerToHighPerformance = false;
+    WebGLPowerPreference powerPreference = "default";
     GLboolean failIfMajorPerformanceCaveat = false;
 };

Modified: branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (212528 => 212529)


--- branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2017-02-17 05:28:16 UTC (rev 212529)
@@ -402,9 +402,9 @@
     if (frame->settings().forceSoftwareWebGLRendering())
         attributes.forceSoftwareRenderer = true;
 
-    attributes.initialPreferLowPowerToHighPerformance = attributes.preferLowPowerToHighPerformance;
+    attributes.initialPowerPreference = attributes.powerPreference;
     if (frame->settings().preferLowPowerWebGLRendering())
-        attributes.preferLowPowerToHighPerformance = true;
+        attributes.powerPreference = GraphicsContext3DPowerPreference::LowPower;
 
     if (page)
         attributes.devicePixelRatio = page->deviceScaleFactor();
@@ -536,7 +536,7 @@
     if (!tracker)
         return;
 
-    m_trackerToken = tracker->token(m_attributes.initialPreferLowPowerToHighPerformance);
+    m_trackerToken = tracker->token(m_attributes.initialPowerPreference);
 }
 
 void WebGLRenderingContextBase::initializeNewContext()

Modified: branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.cpp (212528 => 212529)


--- branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.cpp	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.cpp	2017-02-17 05:28:16 UTC (rev 212529)
@@ -34,10 +34,10 @@
 {
 }
 
-auto WebGLStateTracker::token(bool preferLowPower) -> Token
+auto WebGLStateTracker::token(GraphicsContext3DPowerPreference powerPreference) -> Token
 {
     // We only track high performance WebGL contexts at the moment.
-    if (preferLowPower)
+    if (powerPreference != GraphicsContext3DPowerPreference::HighPerformance)
         return { };
     return m_webGLContextCounter.count();
 }

Modified: branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.h (212528 => 212529)


--- branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.h	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/Source/WebCore/platform/WebGLStateTracker.h	2017-02-17 05:28:16 UTC (rev 212529)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "GraphicsContext3DAttributes.h"
 #include <wtf/Function.h>
 #include <wtf/RefCounter.h>
 
@@ -39,7 +40,7 @@
     using WebGLContextCounter = RefCounter<WebGLContextCounterType>;
     using Token = WebGLContextCounter::Token;
 
-    Token token(bool preferLowPower);
+    Token token(GraphicsContext3DPowerPreference);
 
 private:
     void updateWebGLState();

Modified: branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h (212528 => 212529)


--- branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h	2017-02-17 05:28:16 UTC (rev 212529)
@@ -27,6 +27,12 @@
 
 namespace WebCore {
 
+enum class GraphicsContext3DPowerPreference {
+    Default,
+    LowPower,
+    HighPerformance
+};
+
 struct GraphicsContext3DAttributes {
     // WebGLContextAttributes
     bool alpha { true };
@@ -35,8 +41,9 @@
     bool antialias { true };
     bool premultipliedAlpha { true };
     bool preserveDrawingBuffer { false };
-    bool preferLowPowerToHighPerformance { false };
     bool failIfMajorPerformanceCaveat { false };
+    using PowerPreference = GraphicsContext3DPowerPreference;
+    PowerPreference powerPreference { PowerPreference::Default };
 
     // Additional attributes.
     bool forceSoftwareRenderer { false };
@@ -44,7 +51,7 @@
     bool useGLES3 { false };
     bool noExtensions { false };
     float devicePixelRatio { 1 };
-    bool initialPreferLowPowerToHighPerformance { false };
+    PowerPreference initialPowerPreference { PowerPreference::Default };
 };
 
 }

Modified: branches/safari-603-branch/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm (212528 => 212529)


--- branches/safari-603-branch/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm	2017-02-17 05:28:11 UTC (rev 212528)
+++ branches/safari-603-branch/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm	2017-02-17 05:28:16 UTC (rev 212529)
@@ -195,8 +195,10 @@
     return canMux;
 }
 
-static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest, bool antialias, bool allowOffline, bool useGLES3)
+static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest, bool antialias, GraphicsContext3DPowerPreference powerPreference, bool useGLES3)
 {
+    bool allowOffline = powerPreference != GraphicsContext3DPowerPreference::HighPerformance;
+
     attribs.clear();
     
     attribs.append(kCGLPFAColorSize);
@@ -317,19 +319,19 @@
 
     bool useMultisampling = m_attrs.antialias;
 
-    setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.preferLowPowerToHighPerformance, attrs.useGLES3);
+    setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.powerPreference, attrs.useGLES3);
     CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
 
     if (!numPixelFormats) {
-        setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.preferLowPowerToHighPerformance, attrs.useGLES3);
+        setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.powerPreference, attrs.useGLES3);
         CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
 
         if (!numPixelFormats) {
-            setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.preferLowPowerToHighPerformance, attrs.useGLES3);
+            setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.powerPreference, attrs.useGLES3);
             CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
 
             if (!attrs.forceSoftwareRenderer && !numPixelFormats) {
-                setPixelFormat(attribs, 32, 16, false, false, true, false, false, attrs.useGLES3);
+                setPixelFormat(attribs, 32, 16, false, false, true, false, GraphicsContext3DPowerPreference::Default, attrs.useGLES3);
                 CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
                 useMultisampling = false;
             }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to