<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209885] branches/safari-602-branch</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209885">209885</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-12-15 16:04:50 -0800 (Thu, 15 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/204618">r204618</a>. rdar://problem/29690089</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsChangeLog">branches/safari-602-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebCoreChangeLog">branches/safari-602-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebCorehtmlcanvasWebGLContextAttributescpp">branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCorehtmlcanvasWebGLContextAttributesh">branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.h</a></li>
<li><a href="#branchessafari602branchSourceWebCorehtmlcanvasWebGLContextAttributesidl">branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.idl</a></li>
<li><a href="#branchessafari602branchSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp">branches/safari-602-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformgraphicsGraphicsContext3Dh">branches/safari-602-branch/Source/WebCore/platform/graphics/GraphicsContext3D.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsfastcanvaswebglcontextcreationattributesexpectedtxt">branches/safari-602-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt</a></li>
<li><a href="#branchessafari602branchLayoutTestsfastcanvaswebglcontextcreationattributeshtml">branches/safari-602-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/LayoutTests/ChangeLog (209884 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/ChangeLog        2016-12-15 23:58:35 UTC (rev 209884)
+++ branches/safari-602-branch/LayoutTests/ChangeLog        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2016-12-15 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r204618.
+
+ 2016-08-18 Dean Jackson <dino@apple.com>
+
+ Support passing preferLowPowerToHighPerformance and failIfMajorPerformanceCaveat
+ https://bugs.webkit.org/show_bug.cgi?id=160982
+ <rdar://problem/27915946>
+
+ Reviewed by Simon Fraser.
+
+ Very simple test that creates some WebGL contexts with various
+ creation attributes and outputs the result.
+
+ * fast/canvas/webgl/context-creation-attributes-expected.txt: Added.
+ * fast/canvas/webgl/context-creation-attributes.html: Added.
+
+2016-12-15 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Roll out r204664.
</span><span class="cx">
</span><span class="cx"> 2016-12-15 Babak Shafiei <bshafiei@apple.com>
</span></span></pre></div>
<a id="branchessafari602branchLayoutTestsfastcanvaswebglcontextcreationattributesexpectedtxtfromrev204618trunkLayoutTestsfastcanvaswebglcontextcreationattributesexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-602-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt (from rev 204618, trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt) (0 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt         (rev 0)
+++ branches/safari-602-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+Note that some of the values tested here might not be supported, and thus should return the default values.
+
+{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
+{"alpha":true,"depth":true,"stencil":true,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
+{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
+{"alpha":true,"depth":true,"stencil":false,"antialias":true,"premultipliedAlpha":true,"preserveDrawingBuffer":false,"preferLowPowerToHighPerformance":false,"failIfMajorPerformanceCaveat":false}
</ins></span></pre></div>
<a id="branchessafari602branchLayoutTestsfastcanvaswebglcontextcreationattributeshtmlfromrev204618trunkLayoutTestsfastcanvaswebglcontextcreationattributeshtml"></a>
<div class="copfile"><h4>Copied: branches/safari-602-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes.html (from rev 204618, trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes.html) (0 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes.html         (rev 0)
+++ branches/safari-602-branch/LayoutTests/fast/canvas/webgl/context-creation-attributes.html        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+<script>
+if (window.testRunner)
+ window.testRunner.dumpAsText();
+
+function describe(object) {
+ result = {};
+ if (typeof object === "function")
+ object = object.prototype;
+ for (let o = object; o; o = o.__proto__) {
+ for (let name of Object.getOwnPropertyNames(o)) {
+ result[name] = object[name];
+ }
+ }
+ return result;
+}
+
+function testContextCreation(parameters)
+{
+ var canvas = document.createElement("canvas");
+ var gl = canvas.getContext("webgl", parameters || {});
+ var attributes = gl.getContextAttributes();
+ var result = document.createElement("pre");
+ result.textContent = JSON.stringify(describe(attributes));
+ document.body.appendChild(result);
+}
+
+function run() {
+ testContextCreation({});
+ testContextCreation({stencil: true});
+ testContextCreation({preferLowPowerToHighPerformance: true});
+ testContextCreation({failIfMajorPerformanceCaveat: true});
+}
+
+window.addEventListener("load", run, false);
+</script>
+<p>
+ Note that some of the values tested here might not be supported, and thus should return the default values.
+</p>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (209884 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/ChangeLog        2016-12-15 23:58:35 UTC (rev 209884)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -1,5 +1,36 @@
</span><span class="cx"> 2016-12-15 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r204618.
+
+ 2016-08-18 Dean Jackson <dino@apple.com>
+
+ Support passing preferLowPowerToHighPerformance and failIfMajorPerformanceCaveat
+ https://bugs.webkit.org/show_bug.cgi?id=160982
+ <rdar://problem/27915946>
+
+ Reviewed by Simon Fraser.
+
+ Update WebGLContextAttributes to be compliant with the specification,
+ by adding preferLowPowerToHighPerformance and failIfMajorPerformanceCaveat.
+ They are not implemented yet, so asking the created context what
+ values it used should give the default.
+
+ Test: fast/canvas/webgl/context-creation-attributes.html
+
+ * html/canvas/WebGLContextAttributes.cpp:
+ (WebCore::WebGLContextAttributes::preferLowPowerToHighPerformance):
+ (WebCore::WebGLContextAttributes::setPreferLowPowerToHighPerformance):
+ (WebCore::WebGLContextAttributes::failIfMajorPerformanceCaveat):
+ (WebCore::WebGLContextAttributes::setFailIfMajorPerformanceCaveat):
+ * html/canvas/WebGLContextAttributes.h:
+ * html/canvas/WebGLContextAttributes.idl:
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::create): Deleted.
+ * platform/graphics/GraphicsContext3D.h:
+ (WebCore::GraphicsContext3D::Attributes::Attributes): Deleted.
+
+2016-12-15 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Roll out r204664.
</span><span class="cx">
</span><span class="cx"> 2016-12-15 Babak Shafiei <bshafiei@apple.com>
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCorehtmlcanvasWebGLContextAttributescpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.cpp (209884 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.cpp        2016-12-15 23:58:35 UTC (rev 209884)
+++ branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.cpp        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -117,6 +117,26 @@
</span><span class="cx"> m_attrs.preserveDrawingBuffer = preserveDrawingBuffer;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebGLContextAttributes::preferLowPowerToHighPerformance() const
+{
+ return m_attrs.preferLowPowerToHighPerformance;
+}
+
+void WebGLContextAttributes::setPreferLowPowerToHighPerformance(bool preferLowPower)
+{
+ m_attrs.preferLowPowerToHighPerformance = preferLowPower;
+}
+
+bool WebGLContextAttributes::failIfMajorPerformanceCaveat() const
+{
+ return m_attrs.failIfMajorPerformanceCaveat;
+}
+
+void WebGLContextAttributes::setFailIfMajorPerformanceCaveat(bool fail)
+{
+ m_attrs.failIfMajorPerformanceCaveat = fail;
+}
+
</ins><span class="cx"> GraphicsContext3D::Attributes WebGLContextAttributes::attributes() const
</span><span class="cx"> {
</span><span class="cx"> return m_attrs;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCorehtmlcanvasWebGLContextAttributesh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.h (209884 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.h        2016-12-15 23:58:35 UTC (rev 209884)
+++ branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.h        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -42,33 +42,43 @@
</span><span class="cx"> // Create a new attributes object initialized with preexisting attributes
</span><span class="cx"> static Ref<WebGLContextAttributes> create(GraphicsContext3D::Attributes);
</span><span class="cx">
</span><del>- // Whether or not the drawing buffer has an alpha channel; default=true
</del><ins>+ // Whether or not the drawing buffer has an alpha channel. Default is true.
</ins><span class="cx"> bool alpha() const;
</span><span class="cx"> void setAlpha(bool alpha);
</span><span class="cx">
</span><del>- // Whether or not the drawing buffer has a depth buffer; default=true
</del><ins>+ // Whether or not the drawing buffer has a depth buffer. Default is true.
</ins><span class="cx"> bool depth() const;
</span><span class="cx"> void setDepth(bool depth);
</span><span class="cx">
</span><del>- // Whether or not the drawing buffer has a stencil buffer; default=true
</del><ins>+ // Whether or not the drawing buffer has a stencil buffer. Default is true.
</ins><span class="cx"> bool stencil() const;
</span><span class="cx"> void setStencil(bool stencil);
</span><span class="cx">
</span><del>- // Whether or not the drawing buffer is antialiased; default=true
</del><ins>+ // Whether or not the drawing buffer is antialiased. Default is true.
</ins><span class="cx"> bool antialias() const;
</span><span class="cx"> void setAntialias(bool antialias);
</span><span class="cx">
</span><span class="cx"> // Whether or not to treat the values in the drawing buffer as
</span><span class="cx"> // though their alpha channel has already been multiplied into the
</span><del>- // color channels; default=true
</del><ins>+ // color channels. Default is true.
</ins><span class="cx"> bool premultipliedAlpha() const;
</span><span class="cx"> void setPremultipliedAlpha(bool premultipliedAlpha);
</span><span class="cx">
</span><span class="cx"> // Whether or not to preserve the drawing buffer after presentation to the
</span><del>- // screen; default=false
</del><ins>+ // screen. Default is false.
</ins><span class="cx"> bool preserveDrawingBuffer() const;
</span><span class="cx"> void setPreserveDrawingBuffer(bool);
</span><span class="cx">
</span><ins>+ // Whether or not to attempt to use a lower-power GPU if it is available.
+ // Default is false.
+ bool preferLowPowerToHighPerformance() const;
+ void setPreferLowPowerToHighPerformance(bool);
+
+ // Whether or not to immediately fail if a performant GPU is not available.
+ // Default is false.
+ bool failIfMajorPerformanceCaveat() const;
+ void setFailIfMajorPerformanceCaveat(bool);
+
</ins><span class="cx"> // Fetches a copy of the attributes stored in this object in a
</span><span class="cx"> // form that can be used to initialize a GraphicsContext3D.
</span><span class="cx"> GraphicsContext3D::Attributes attributes() const;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCorehtmlcanvasWebGLContextAttributesidl"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.idl (209884 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.idl        2016-12-15 23:58:35 UTC (rev 209884)
+++ branches/safari-602-branch/Source/WebCore/html/canvas/WebGLContextAttributes.idl        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -34,4 +34,6 @@
</span><span class="cx"> attribute boolean antialias;
</span><span class="cx"> attribute boolean premultipliedAlpha;
</span><span class="cx"> attribute boolean preserveDrawingBuffer;
</span><ins>+ attribute boolean preferLowPowerToHighPerformance;
+ attribute boolean failIfMajorPerformanceCaveat;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (209884 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2016-12-15 23:58:35 UTC (rev 209884)
+++ branches/safari-602-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -397,7 +397,6 @@
</span><span class="cx">
</span><span class="cx"> attributes.noExtensions = true;
</span><span class="cx"> attributes.shareResources = false;
</span><del>- attributes.preferDiscreteGPU = true;
</del><span class="cx">
</span><span class="cx"> if (frame->settings().forceSoftwareWebGLRendering())
</span><span class="cx"> attributes.forceSoftwareRenderer = true;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformgraphicsGraphicsContext3Dh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/graphics/GraphicsContext3D.h (209884 => 209885)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/graphics/GraphicsContext3D.h        2016-12-15 23:58:35 UTC (rev 209884)
+++ branches/safari-602-branch/Source/WebCore/platform/graphics/GraphicsContext3D.h        2016-12-16 00:04:50 UTC (rev 209885)
</span><span class="lines">@@ -717,34 +717,19 @@
</span><span class="cx">
</span><span class="cx"> // Context creation attributes.
</span><span class="cx"> struct Attributes {
</span><del>- Attributes()
- : alpha(true)
- , depth(true)
- , stencil(false)
- , antialias(true)
- , premultipliedAlpha(true)
- , preserveDrawingBuffer(false)
- , noExtensions(false)
- , shareResources(true)
- , preferDiscreteGPU(false)
- , forceSoftwareRenderer(false)
- , useGLES3(false)
- , devicePixelRatio(1)
- {
- }
-
- bool alpha;
- bool depth;
- bool stencil;
- bool antialias;
- bool premultipliedAlpha;
- bool preserveDrawingBuffer;
- bool noExtensions;
- bool shareResources;
- bool preferDiscreteGPU;
- bool forceSoftwareRenderer;
- bool useGLES3;
- float devicePixelRatio;
</del><ins>+ bool alpha { true };
+ bool depth { true };
+ bool stencil { false };
+ bool antialias { true };
+ bool premultipliedAlpha { true };
+ bool preserveDrawingBuffer { false };
+ bool noExtensions { false };
+ bool shareResources { true };
+ bool preferLowPowerToHighPerformance { false };
+ bool forceSoftwareRenderer { false };
+ bool failIfMajorPerformanceCaveat { false };
+ bool useGLES3 { false };
+ float devicePixelRatio { 1 };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> enum RenderStyle {
</span></span></pre>
</div>
</div>
</body>
</html>