Diff
Modified: trunk/LayoutTests/ChangeLog (204617 => 204618)
--- trunk/LayoutTests/ChangeLog 2016-08-19 00:12:27 UTC (rev 204617)
+++ trunk/LayoutTests/ChangeLog 2016-08-19 00:50:36 UTC (rev 204618)
@@ -1,3 +1,17 @@
+2016-08-18 Dean Jackson <[email protected]>
+
+ 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-08-17 Ryosuke Niwa <[email protected]>
Add basic support for connected and disconnected callbacks
Added: trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt (0 => 204618)
--- trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt 2016-08-19 00:50:36 UTC (rev 204618)
@@ -0,0 +1,6 @@
+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}
Property changes on: trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes-expected.txt
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/plain
\ No newline at end of property
Added: trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes.html (0 => 204618)
--- trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes.html 2016-08-19 00:50:36 UTC (rev 204618)
@@ -0,0 +1,38 @@
+<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>
\ No newline at end of file
Property changes on: trunk/LayoutTests/fast/canvas/webgl/context-creation-attributes.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/Source/WebCore/ChangeLog (204617 => 204618)
--- trunk/Source/WebCore/ChangeLog 2016-08-19 00:12:27 UTC (rev 204617)
+++ trunk/Source/WebCore/ChangeLog 2016-08-19 00:50:36 UTC (rev 204618)
@@ -1,3 +1,30 @@
+2016-08-18 Dean Jackson <[email protected]>
+
+ 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-08-18 Anders Carlsson <[email protected]>
Move an NPAPI-only function from WebCore to WebKit
Modified: trunk/Source/WebCore/html/canvas/WebGLContextAttributes.cpp (204617 => 204618)
--- trunk/Source/WebCore/html/canvas/WebGLContextAttributes.cpp 2016-08-19 00:12:27 UTC (rev 204617)
+++ trunk/Source/WebCore/html/canvas/WebGLContextAttributes.cpp 2016-08-19 00:50:36 UTC (rev 204618)
@@ -117,6 +117,26 @@
m_attrs.preserveDrawingBuffer = preserveDrawingBuffer;
}
+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;
+}
+
GraphicsContext3D::Attributes WebGLContextAttributes::attributes() const
{
return m_attrs;
Modified: trunk/Source/WebCore/html/canvas/WebGLContextAttributes.h (204617 => 204618)
--- trunk/Source/WebCore/html/canvas/WebGLContextAttributes.h 2016-08-19 00:12:27 UTC (rev 204617)
+++ trunk/Source/WebCore/html/canvas/WebGLContextAttributes.h 2016-08-19 00:50:36 UTC (rev 204618)
@@ -42,33 +42,43 @@
// Create a new attributes object initialized with preexisting attributes
static Ref<WebGLContextAttributes> create(GraphicsContext3D::Attributes);
- // Whether or not the drawing buffer has an alpha channel; default=true
+ // Whether or not the drawing buffer has an alpha channel. Default is true.
bool alpha() const;
void setAlpha(bool alpha);
- // Whether or not the drawing buffer has a depth buffer; default=true
+ // Whether or not the drawing buffer has a depth buffer. Default is true.
bool depth() const;
void setDepth(bool depth);
- // Whether or not the drawing buffer has a stencil buffer; default=true
+ // Whether or not the drawing buffer has a stencil buffer. Default is true.
bool stencil() const;
void setStencil(bool stencil);
- // Whether or not the drawing buffer is antialiased; default=true
+ // Whether or not the drawing buffer is antialiased. Default is true.
bool antialias() const;
void setAntialias(bool antialias);
// Whether or not to treat the values in the drawing buffer as
// though their alpha channel has already been multiplied into the
- // color channels; default=true
+ // color channels. Default is true.
bool premultipliedAlpha() const;
void setPremultipliedAlpha(bool premultipliedAlpha);
// Whether or not to preserve the drawing buffer after presentation to the
- // screen; default=false
+ // screen. Default is false.
bool preserveDrawingBuffer() const;
void setPreserveDrawingBuffer(bool);
+ // 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);
+
// Fetches a copy of the attributes stored in this object in a
// form that can be used to initialize a GraphicsContext3D.
GraphicsContext3D::Attributes attributes() const;
Modified: trunk/Source/WebCore/html/canvas/WebGLContextAttributes.idl (204617 => 204618)
--- trunk/Source/WebCore/html/canvas/WebGLContextAttributes.idl 2016-08-19 00:12:27 UTC (rev 204617)
+++ trunk/Source/WebCore/html/canvas/WebGLContextAttributes.idl 2016-08-19 00:50:36 UTC (rev 204618)
@@ -34,4 +34,6 @@
attribute boolean antialias;
attribute boolean premultipliedAlpha;
attribute boolean preserveDrawingBuffer;
+ attribute boolean preferLowPowerToHighPerformance;
+ attribute boolean failIfMajorPerformanceCaveat;
};
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (204617 => 204618)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2016-08-19 00:12:27 UTC (rev 204617)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2016-08-19 00:50:36 UTC (rev 204618)
@@ -397,7 +397,6 @@
attributes.noExtensions = true;
attributes.shareResources = false;
- attributes.preferDiscreteGPU = true;
if (frame->settings().forceSoftwareWebGLRendering())
attributes.forceSoftwareRenderer = true;
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (204617 => 204618)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2016-08-19 00:12:27 UTC (rev 204617)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2016-08-19 00:50:36 UTC (rev 204618)
@@ -717,34 +717,19 @@
// Context creation attributes.
struct Attributes {
- 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;
+ 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 };
};
enum RenderStyle {