<!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>[162565] trunk</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/162565">162565</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2014-01-22 15:47:24 -0800 (Wed, 22 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/WebCore: [WebGL] Implement ANGLE_instanced_arrays
https://bugs.webkit.org/show_bug.cgi?id=127257

Reviewed by Brent Fulgham.

Implement the instanced drawing WebGL extension,
ANGLE_instanced_arrays. This is currently Mac-only,
but should be portable to other platforms if their
OpenGL exposes the functions. It's also done in a way
that will make exposing it to WebGL2 simple.

Test: fast/canvas/webgl/angle-instanced-arrays.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
Add the new files to all the build systems.

* bindings/js/JSWebGLRenderingContextCustom.cpp:
(WebCore::toJS): Link JS side to C++ side.

* html/canvas/ANGLEInstancedArrays.cpp: Added.
(WebCore::ANGLEInstancedArrays::ANGLEInstancedArrays):
* html/canvas/ANGLEInstancedArrays.h: Added.
* html/canvas/ANGLEInstancedArrays.idl: Added.
New boilerplate files that expose the extension methods.

* html/canvas/WebGLExtension.h: New extension enum.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::validateVertexAttributes): Add an optional
parameter representing the number of instance primitives we are asked
to draw. Use that for the draw count if looking at an instanced attribute.
Also make sure we see at least one non-instanced attribute.
(WebCore::WebGLRenderingContext::validateDrawArrays): Update this so it could
be used from either drawArrays or drawArraysInstanced.
(WebCore::WebGLRenderingContext::drawArrays):
(WebCore::WebGLRenderingContext::validateDrawElements): Same here, now can be
used by the instanced and non-instanced versions.
(WebCore::WebGLRenderingContext::drawElements):
(WebCore::WebGLRenderingContext::getExtension): Create and return the new extension.
(WebCore::WebGLRenderingContext::getSupportedExtensions): Add new extension to the list.
(WebCore::WebGLRenderingContext::getVertexAttrib): Intercept a query to the divisor
attribute and return the value we kept in the state.
(WebCore::WebGLRenderingContext::drawArraysInstanced): Call the GC3D method.
(WebCore::WebGLRenderingContext::drawElementsInstanced): Ditto.
(WebCore::WebGLRenderingContext::vertexAttribDivisor): Ditto.

* html/canvas/WebGLRenderingContext.h: Define the new methods and parameters.

* html/canvas/WebGLVertexArrayObjectOES.cpp:
(WebCore::WebGLVertexArrayObjectOES::setVertexAttribDivisor): Keep a record of the
divisor if we set it.
* html/canvas/WebGLVertexArrayObjectOES.h:
(WebCore::WebGLVertexArrayObjectOES::VertexAttribState::VertexAttribState):

* platform/graphics/GraphicsContext3D.h: New enum.
* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3D::drawArraysInstanced): The actual calls into OpenGL.
(WebCore::GraphicsContext3D::drawElementsInstanced): Ditto.
(WebCore::GraphicsContext3D::vertexAttribDivisor): Ditto.

* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: Empty implementations
for non-mac platforms.

* platform/graphics/ios/GraphicsContext3DIOS.h: Define the iOS names for the
functions.

LayoutTests: Implement ANGLE_instanced_arrays
https://bugs.webkit.org/show_bug.cgi?id=127257

Reviewed by Brent Fulgham.

Copied a slightly modified version of the Khronos instanced
arrays test (mostly modified due to the fact this comes from
an in-progress update to the test suite).

* fast/canvas/webgl/angle-instanced-arrays-expected.txt: Added.
* fast/canvas/webgl/angle-instanced-arrays.html: Added.
* fast/canvas/webgl/resources/webgl-test-utils.js:
(WebGLTestUtils): Added some new functions that were missing, and
some output to a checkColor test.
* platform/efl/TestExpectations: Skip this for EFL.
* platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt: Not
supported on Mountain Lion.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcanvaswebglresourceswebgltestutilsjs">trunk/LayoutTests/fast/canvas/webgl/resources/webgl-test-utils.js</a></li>
<li><a href="#trunkLayoutTestsplatformeflTestExpectations">trunk/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcescpp">trunk/Source/WebCore/DerivedSources.cpp</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSWebGLRenderingContextCustomcpp">trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLExtensionh">trunk/Source/WebCore/html/canvas/WebGLExtension.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContexth">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLVertexArrayObjectOEScpp">trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLVertexArrayObjectOESh">trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContext3Dh">trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsiosGraphicsContext3DIOSh">trunk/Source/WebCore/platform/graphics/ios/GraphicsContext3DIOS.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacGraphicsContext3DMacmm">trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLcpp">trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcanvaswebglangleinstancedarraysexpectedtxt">trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcanvaswebglangleinstancedarrayshtml">trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays.html</a></li>
<li>trunk/LayoutTests/platform/mac-mountainlion/fast/canvas/</li>
<li>trunk/LayoutTests/platform/mac-mountainlion/fast/canvas/webgl/</li>
<li><a href="#trunkLayoutTestsplatformmacmountainlionfastcanvaswebglangleinstancedarraysexpectedtxt">trunk/LayoutTests/platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasANGLEInstancedArrayscpp">trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasANGLEInstancedArraysh">trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasANGLEInstancedArraysidl">trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/LayoutTests/ChangeLog        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-01-22  Dean Jackson  &lt;dino@apple.com&gt;
+
+        Implement ANGLE_instanced_arrays
+        https://bugs.webkit.org/show_bug.cgi?id=127257
+
+        Reviewed by Brent Fulgham.
+
+        Copied a slightly modified version of the Khronos instanced
+        arrays test (mostly modified due to the fact this comes from
+        an in-progress update to the test suite).
+
+        * fast/canvas/webgl/angle-instanced-arrays-expected.txt: Added.
+        * fast/canvas/webgl/angle-instanced-arrays.html: Added.
+        * fast/canvas/webgl/resources/webgl-test-utils.js:
+        (WebGLTestUtils): Added some new functions that were missing, and
+        some output to a checkColor test.
+        * platform/efl/TestExpectations: Skip this for EFL.
+        * platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt: Not
+        supported on Mountain Lion.
+
</ins><span class="cx"> 2014-01-22  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed Apple Windows port gardering after r162553.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvaswebglangleinstancedarraysexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays-expected.txt (0 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays-expected.txt        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+CONSOLE MESSAGE: WebGL: INVALID_ENUM: getVertexAttrib: invalid parameter name
+CONSOLE MESSAGE: WebGL: INVALID_VALUE: vertexAttribDivisor: index out of range
+CONSOLE MESSAGE: WebGL: INVALID_VALUE: drawArraysInstanced: primcount &lt; 0
+CONSOLE MESSAGE: WebGL: INVALID_VALUE: drawArraysInstanced: first or count &lt; 0
+CONSOLE MESSAGE: WebGL: INVALID_OPERATION: drawArraysInstanced: attempt to access out of bounds arrays
+CONSOLE MESSAGE: WebGL: INVALID_ENUM: drawArraysInstanced: invalid draw mode
+CONSOLE MESSAGE: WebGL: INVALID_ENUM: drawArraysInstanced: invalid draw mode
+CONSOLE MESSAGE: WebGL: INVALID_ENUM: drawArraysInstanced: invalid draw mode
+CONSOLE MESSAGE: WebGL: INVALID_VALUE: drawElementsInstanced: primcount &lt; 0
+CONSOLE MESSAGE: WebGL: INVALID_VALUE: drawElementsInstanced: count or offset &lt; 0
+CONSOLE MESSAGE: WebGL: INVALID_OPERATION: drawElementsInstanced: attempt to access out of bounds arrays
+CONSOLE MESSAGE: WebGL: INVALID_ENUM: drawElementsInstanced: invalid draw mode
+CONSOLE MESSAGE: WebGL: INVALID_ENUM: drawElementsInstanced: invalid draw mode
+CONSOLE MESSAGE: WebGL: INVALID_ENUM: drawElementsInstanced: invalid draw mode
+This test verifies the functionality of the ANGLE_instanced_arrays extension, if it is available.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS WebGL context exists
+Testing VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE with extension disabled
+PASS getError was expected value: INVALID_ENUM : VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE should not be queryable if extension is disabled
+PASS Successfully enabled ANGLE_instanced_arrays extension
+PASS ANGLE_instanced_arrays listed as supported and getExtension succeeded
+Testing VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE with extension enabled
+PASS ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE is 0x88FE
+PASS Vertex attribute 0 must has a default divisor of 0
+PASS Vertex attribute 1 must has a default divisor of 0
+PASS Vertex attribute 2 must has a default divisor of 0
+PASS Vertex attribute 3 must has a default divisor of 0
+PASS Vertex attribute 4 must has a default divisor of 0
+PASS Vertex attribute 5 must has a default divisor of 0
+PASS Vertex attribute 6 must has a default divisor of 0
+PASS Vertex attribute 7 must has a default divisor of 0
+PASS Vertex attribute 8 must has a default divisor of 0
+PASS Vertex attribute 9 must has a default divisor of 0
+PASS Vertex attribute 10 must has a default divisor of 0
+PASS Vertex attribute 11 must has a default divisor of 0
+PASS Vertex attribute 12 must has a default divisor of 0
+PASS Vertex attribute 13 must has a default divisor of 0
+PASS Vertex attribute 14 must has a default divisor of 0
+PASS Vertex attribute 15 must has a default divisor of 0
+PASS getError was expected value: INVALID_VALUE : vertexAttribDivisorANGLE index set greater than or equal to MAX_VERTEX_ATTRIBS should be an invalid value
+PASS getError was expected value: NO_ERROR : vertexAttribDivisorANGLE index set less than MAX_VERTEX_ATTRIBS should succeed
+PASS Set value of VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE matches expecation
+Testing that getExtension() returns the same object each time
+PASS gl.getExtension(&quot;ANGLE_instanced_arrays&quot;).myProperty is 2
+Testing various draws for valid built-in function behavior
+Testing drawArraysInstancedANGLE
+PASS Color was 255,0,0,255
+PASS Color was 0,255,0,255
+PASS Color was 0,0,255,255
+PASS Color was 255,255,0,255
+PASS getError was expected value: INVALID_VALUE : drawArraysInstancedANGLE cannot have a primcount less than 0
+PASS getError was expected value: INVALID_VALUE : drawArraysInstancedANGLE cannot have a count less than 0
+PASS getError was expected value: INVALID_OPERATION : There must be at least one vertex attribute with a divisor of zero when calling drawArraysInstancedANGLE
+PASS getError was expected value: NO_ERROR : drawArraysInstancedANGLE with POINTS should succeed
+PASS getError was expected value: NO_ERROR : drawArraysInstancedANGLE with LINES should succeed
+PASS getError was expected value: NO_ERROR : drawArraysInstancedANGLE with LINE_LIST should return succeed
+PASS getError was expected value: NO_ERROR : drawArraysInstancedANGLE with TRIANGLE_LIST should succeed
+PASS getError was expected value: INVALID_ENUM : drawArraysInstancedANGLE with QUAD_STRIP should return INVALID_ENUM
+PASS getError was expected value: INVALID_ENUM : drawArraysInstancedANGLE with QUADS should return INVALID_ENUM
+PASS getError was expected value: INVALID_ENUM : drawArraysInstancedANGLE with POLYGON should return INVALID_ENUM
+Testing drawElementsInstancedANGLE
+PASS Color was 255,0,0,255
+PASS Color was 0,255,0,255
+PASS Color was 0,0,255,255
+PASS Color was 255,255,0,255
+PASS getError was expected value: INVALID_VALUE : drawElementsInstancedANGLE cannot have a primcount less than 0
+PASS getError was expected value: INVALID_VALUE : drawElementsInstancedANGLE cannot have a count less than 0
+PASS getError was expected value: INVALID_OPERATION : There must be at least one vertex attribute with a divisor of zero when calling drawElementsInstancedANGLE
+PASS getError was expected value: NO_ERROR : drawElementsInstancedANGLE with UNSIGNED_BYTE should succeed
+PASS getError was expected value: NO_ERROR : drawElementsInstancedANGLE with POINTS should succeed
+PASS getError was expected value: NO_ERROR : drawElementsInstancedANGLE with LINES should succeed
+PASS getError was expected value: NO_ERROR : drawElementsInstancedANGLE with LINE_LIST should return succeed
+PASS getError was expected value: NO_ERROR : drawElementsInstancedANGLE with TRIANGLE_LIST should succeed
+PASS getError was expected value: INVALID_ENUM : drawElementsInstancedANGLE with QUAD_STRIP should return INVALID_ENUM
+PASS getError was expected value: INVALID_ENUM : drawElementsInstancedANGLE with QUADS should return INVALID_ENUM
+PASS getError was expected value: INVALID_ENUM : drawElementsInstancedANGLE with POLYGON should return INVALID_ENUM
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfastcanvaswebglangleinstancedarrayshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays.html (0 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays.html                                (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays.html        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -0,0 +1,297 @@
</span><ins>+&lt;!--
+/*
+** Copyright (c) 2013 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** &quot;Materials&quot;), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+--&gt;
+
+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;title&gt;WebGL ANGLE_instanced_arrays Conformance Tests&lt;/title&gt;
+&lt;script src=&quot;resources/desktop-gl-constants.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;resources/webgl-test.js&quot;&gt; &lt;/script&gt;
+&lt;script src=&quot;resources/webgl-test-utils.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;description&quot;&gt;&lt;/div&gt;
+&lt;canvas id=&quot;canvas&quot; style=&quot;width: 50px; height: 50px;&quot;&gt; &lt;/canvas&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;!-- Shaders for testing instanced draws --&gt;
+&lt;script id=&quot;outputVertexShader&quot; type=&quot;x-shader/x-vertex&quot;&gt;
+attribute vec4 aPosition;
+attribute vec2 aOffset;
+attribute vec4 aColor;
+varying vec4 vColor;
+void main() {
+    vColor = aColor;
+    gl_Position = aPosition + vec4(aOffset, 0.0, 0.0);
+}
+&lt;/script&gt;
+
+&lt;script id=&quot;outputFragmentShader&quot; type=&quot;x-shader/x-fragment&quot;&gt;
+precision mediump float;
+varying vec4 vColor;
+void main() {
+    gl_FragColor = vColor;
+}
+&lt;/script&gt;
+
+&lt;script&gt;
+&quot;use strict&quot;;
+description(&quot;This test verifies the functionality of the ANGLE_instanced_arrays extension, if it is available.&quot;);
+
+debug(&quot;&quot;);
+
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById(&quot;canvas&quot;);
+var gl = wtu.create3DContext(canvas);
+var ext = null;
+
+var positionLoc = 0;
+var offsetLoc = 2;
+var colorLoc = 3;
+var program;
+
+if (!gl) {
+    testFailed(&quot;WebGL context does not exist&quot;);
+} else {
+    testPassed(&quot;WebGL context exists&quot;);
+
+    runDivisorTestDisabled();
+
+    // Query the extension and store globally so shouldBe can access it
+    ext = wtu.getExtensionWithKnownPrefixes(gl, &quot;ANGLE_instanced_arrays&quot;);
+    if (!ext) {
+        testPassed(&quot;No ANGLE_instanced_arrays support -- this is legal&quot;);
+
+        runSupportedTest(false);
+    } else {
+        testPassed(&quot;Successfully enabled ANGLE_instanced_arrays extension&quot;);
+
+        runSupportedTest(true);
+
+        runDivisorTestEnabled();
+        runUniqueObjectTest();
+
+        setupCanvas();
+        runOutputTests();
+        finishTest();
+    }
+}
+
+function runSupportedTest(extensionEnabled) {
+    var supported = gl.getSupportedExtensions();
+    if (supported.indexOf(&quot;ANGLE_instanced_arrays&quot;) &gt;= 0) {
+        if (extensionEnabled) {
+            testPassed(&quot;ANGLE_instanced_arrays listed as supported and getExtension succeeded&quot;);
+        } else {
+            testFailed(&quot;ANGLE_instanced_arrays listed as supported but getExtension failed&quot;);
+        }
+    } else {
+        if (extensionEnabled) {
+            testFailed(&quot;ANGLE_instanced_arrays not listed as supported but getExtension succeeded&quot;);
+        } else {
+            testPassed(&quot;ANGLE_instanced_arrays not listed as supported and getExtension failed -- this is legal&quot;);
+        }
+    }
+}
+
+function runDivisorTestDisabled() {
+    debug(&quot;Testing VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE with extension disabled&quot;);
+    
+    var VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;
+
+    gl.getVertexAttrib(0, VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE);
+    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, &quot;VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE should not be queryable if extension is disabled&quot;);
+}
+
+function runDivisorTestEnabled() {
+    debug(&quot;Testing VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE with extension enabled&quot;);
+
+    shouldBe(&quot;ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE&quot;, &quot;0x88FE&quot;);
+
+    var max_vertex_attribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
+
+    for (var i = 0; i &lt; max_vertex_attribs; ++i) {
+        var queried_value = gl.getVertexAttrib(i, ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE);
+        if(queried_value == 0){
+            testPassed(&quot;Vertex attribute &quot; + i + &quot; must has a default divisor of 0&quot;);
+        }
+        else{
+            testFailed(&quot;Default divisor of vertex attribute &quot; + i + &quot; should be: 0, returned value was: &quot; + queried_value);
+        }
+    }
+
+    ext.vertexAttribDivisorANGLE(max_vertex_attribs, 2);
+    wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, &quot;vertexAttribDivisorANGLE index set greater than or equal to MAX_VERTEX_ATTRIBS should be an invalid value&quot;);
+
+    ext.vertexAttribDivisorANGLE(max_vertex_attribs-1, 2);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;vertexAttribDivisorANGLE index set less than MAX_VERTEX_ATTRIBS should succeed&quot;);
+
+    var queried_value = gl.getVertexAttrib(max_vertex_attribs-1, ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE);
+    if(queried_value == 2){
+        testPassed(&quot;Set value of VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE matches expecation&quot;);
+    }
+    else{
+        testFailed(&quot;Set value of VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE should be: 2, returned value was: &quot; + queried_value);
+    }
+}
+
+function setupCanvas() {
+    canvas.width = 50; canvas.height = 50;
+    gl.viewport(0, 0, canvas.width, canvas.height);
+    gl.clearColor(0, 0, 0, 0);
+
+    program = wtu.setupProgram(gl, [&quot;outputVertexShader&quot;, &quot;outputFragmentShader&quot;], ['aPosition', 'aOffset', 'aColor'], [positionLoc, offsetLoc, colorLoc]);
+}
+
+function runOutputTests() {
+    var e = 2; // Amount of variance to allow in result pixels - may need to be tweaked higher
+    var instanceCount = 4;
+
+    debug(&quot;Testing various draws for valid built-in function behavior&quot;);
+
+    var offsets = new Float32Array([
+        -1.0,  1.0,
+         1.0,  1.0,
+        -1.0, -1.0,
+         1.0, -1.0,
+    ]);
+    var offsetBuffer = gl.createBuffer();
+    gl.bindBuffer(gl.ARRAY_BUFFER, offsetBuffer);
+    gl.bufferData(gl.ARRAY_BUFFER, offsets, gl.STATIC_DRAW);
+    gl.enableVertexAttribArray(offsetLoc);
+    gl.vertexAttribPointer(offsetLoc, 2, gl.FLOAT, false, 0, 0);
+    ext.vertexAttribDivisorANGLE(offsetLoc, 1);
+
+    var colors = new Float32Array([
+        1.0, 0.0, 0.0, 1.0, // Red
+        0.0, 1.0, 0.0, 1.0, // Green
+        0.0, 0.0, 1.0, 1.0, // Blue
+        1.0, 1.0, 0.0, 1.0, // Yellow
+    ]);
+    var colorBuffer = gl.createBuffer();
+    gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);
+    gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);
+    gl.enableVertexAttribArray(colorLoc);
+    gl.vertexAttribPointer(colorLoc, 4, gl.FLOAT, false, 0, 0);
+    ext.vertexAttribDivisorANGLE(colorLoc, 1);
+
+    // Draw 1: Draw Non-indexed instances
+    debug(&quot;Testing drawArraysInstancedANGLE&quot;);
+    gl.clear(gl.COLOR_BUFFER_BIT);
+    wtu.setupUnitQuad(gl, 0);
+
+    // Test drawArraysInstancedANGLE error conditions
+    ext.drawArraysInstancedANGLE(gl.TRIANGLES, 0, 6, instanceCount);
+    wtu.checkCanvasRect(gl, 0, canvas.height/2, canvas.width/2, canvas.height/2, [255, 0, 0, 255]);
+    wtu.checkCanvasRect(gl, canvas.width/2, canvas.height/2, canvas.width/2, canvas.height/2, [0, 255, 0, 255]);
+    wtu.checkCanvasRect(gl, 0, 0, canvas.width/2, canvas.height/2, [0, 0, 255, 255]);
+    wtu.checkCanvasRect(gl, canvas.width/2, 0, canvas.width/2, canvas.height/2, [255, 255, 0, 255]);
+
+    ext.drawArraysInstancedANGLE(gl.TRIANGLES, 0, 6, -1);
+    wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, &quot;drawArraysInstancedANGLE cannot have a primcount less than 0&quot;);
+
+    ext.drawArraysInstancedANGLE(gl.TRIANGLES, 0, -1, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, &quot;drawArraysInstancedANGLE cannot have a count less than 0&quot;);
+
+    ext.vertexAttribDivisorANGLE(positionLoc, 1);
+    ext.drawArraysInstancedANGLE(gl.TRIANGLES, 0, 6, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, &quot;There must be at least one vertex attribute with a divisor of zero when calling drawArraysInstancedANGLE&quot;);
+    ext.vertexAttribDivisorANGLE(positionLoc, 0);
+
+    ext.drawArraysInstancedANGLE(gl.POINTS, 0, 6, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawArraysInstancedANGLE with POINTS should succeed&quot;);
+    ext.drawArraysInstancedANGLE(gl.LINES, 0, 6, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawArraysInstancedANGLE with LINES should succeed&quot;);
+    ext.drawArraysInstancedANGLE(gl.LINE_LIST, 0, 6, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawArraysInstancedANGLE with LINE_LIST should return succeed&quot;);
+    ext.drawArraysInstancedANGLE(gl.TRIANGLE_LIST, 0, 6, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawArraysInstancedANGLE with TRIANGLE_LIST should succeed&quot;);
+
+    ext.drawArraysInstancedANGLE(desktopGL['QUAD_STRIP'], 0, 6, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, &quot;drawArraysInstancedANGLE with QUAD_STRIP should return INVALID_ENUM&quot;);
+    ext.drawArraysInstancedANGLE(desktopGL['QUADS'], 0, 6, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, &quot;drawArraysInstancedANGLE with QUADS should return INVALID_ENUM&quot;);
+    ext.drawArraysInstancedANGLE(desktopGL['POLYGON'], 0, 6, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, &quot;drawArraysInstancedANGLE with POLYGON should return INVALID_ENUM&quot;);
+
+    // Draw 2: Draw indexed instances
+    debug(&quot;Testing drawElementsInstancedANGLE&quot;);
+    gl.clear(gl.COLOR_BUFFER_BIT);
+    wtu.setupIndexedQuad(gl, 1, 0);
+    ext.drawElementsInstancedANGLE(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.checkCanvasRect(gl, 0, canvas.height/2, canvas.width/2, canvas.height/2, [255, 0, 0, 255]);
+    wtu.checkCanvasRect(gl, canvas.width/2, canvas.height/2, canvas.width/2, canvas.height/2, [0, 255, 0, 255]);
+    wtu.checkCanvasRect(gl, 0, 0, canvas.width/2, canvas.height/2, [0, 0, 255, 255]);
+    wtu.checkCanvasRect(gl, canvas.width/2, 0, canvas.width/2, canvas.height/2, [255, 255, 0, 255]);
+
+    // Test drawElementsInstancedANGLE error conditions
+    ext.drawElementsInstancedANGLE(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0, -1);
+    wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, &quot;drawElementsInstancedANGLE cannot have a primcount less than 0&quot;);
+
+    ext.drawElementsInstancedANGLE(gl.TRIANGLES, -1, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, &quot;drawElementsInstancedANGLE cannot have a count less than 0&quot;);
+
+    ext.vertexAttribDivisorANGLE(positionLoc, 1);
+    ext.drawElementsInstancedANGLE(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, &quot;There must be at least one vertex attribute with a divisor of zero when calling drawElementsInstancedANGLE&quot;);
+    ext.vertexAttribDivisorANGLE(positionLoc, 0);
+
+    ext.drawElementsInstancedANGLE(gl.TRIANGLES, 6, gl.UNSIGNED_BYTE, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawElementsInstancedANGLE with UNSIGNED_BYTE should succeed&quot;);
+
+    ext.drawElementsInstancedANGLE(gl.POINTS, 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawElementsInstancedANGLE with POINTS should succeed&quot;);
+    ext.drawElementsInstancedANGLE(gl.LINES, 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawElementsInstancedANGLE with LINES should succeed&quot;);
+    ext.drawElementsInstancedANGLE(gl.LINE_LIST, 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawElementsInstancedANGLE with LINE_LIST should return succeed&quot;);
+    ext.drawElementsInstancedANGLE(gl.TRIANGLE_LIST, 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.NO_ERROR, &quot;drawElementsInstancedANGLE with TRIANGLE_LIST should succeed&quot;);
+
+    ext.drawElementsInstancedANGLE(desktopGL['QUAD_STRIP'], 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, &quot;drawElementsInstancedANGLE with QUAD_STRIP should return INVALID_ENUM&quot;);
+    ext.drawElementsInstancedANGLE(desktopGL['QUADS'], 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, &quot;drawElementsInstancedANGLE with QUADS should return INVALID_ENUM&quot;);
+    ext.drawElementsInstancedANGLE(desktopGL['POLYGON'], 6, gl.UNSIGNED_SHORT, 0, instanceCount);
+    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, &quot;drawElementsInstancedANGLE with POLYGON should return INVALID_ENUM&quot;);
+}
+
+function runUniqueObjectTest()
+{
+    debug(&quot;Testing that getExtension() returns the same object each time&quot;);
+    gl.getExtension(&quot;ANGLE_instanced_arrays&quot;).myProperty = 2;
+    gc();
+    shouldBe('gl.getExtension(&quot;ANGLE_instanced_arrays&quot;).myProperty', '2');
+}
+
+debug(&quot;&quot;);
+var successfullyParsed = true;
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/fast/canvas/webgl/angle-instanced-arrays.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestsfastcanvaswebglresourceswebgltestutilsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/webgl/resources/webgl-test-utils.js (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/resources/webgl-test-utils.js        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/LayoutTests/fast/canvas/webgl/resources/webgl-test-utils.js        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -361,6 +361,125 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Creates a unit quad with only positions of a given resolution.
+ * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {number} gridRes The resolution of the mesh grid,
+ *     expressed in the number of quads across and down.
+ * @param {number} opt_positionLocation The attrib location for position.
+ */
+var setupIndexedQuad = function (
+    gl, gridRes, opt_positionLocation, opt_flipOddTriangles) {
+  return setupIndexedQuadWithOptions(gl,
+    { gridRes: gridRes,
+      positionLocation: opt_positionLocation,
+      flipOddTriangles: opt_flipOddTriangles
+    });
+};
+
+/**
+ * Creates a quad with various options.
+ * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {!Object) options The options. See below.
+ * @return {!Array.&lt;WebGLBuffer&gt;} The created buffers.
+ *     [positions, &lt;colors&gt;, indices]
+ *
+ * Options:
+ *   gridRes: number of quads across and down grid.
+ *   positionLocation: attrib location for position
+ *   flipOddTriangles: reverse order of vertices of every other
+ *       triangle
+ *   positionOffset: offset added to each vertex
+ *   positionMult: multipier for each vertex
+ *   colorLocation: attrib location for vertex colors. If
+ *      undefined no vertex colors will be created.
+ */
+var setupIndexedQuadWithOptions = function (gl, options) {
+  var positionLocation = options.positionLocation || 0;
+  var objects = [];
+
+  var gridRes = options.gridRes || 1;
+  var positionOffset = options.positionOffset || 0;
+  var positionMult = options.positionMult || 1;
+  var vertsAcross = gridRes + 1;
+  var numVerts = vertsAcross * vertsAcross;
+  var positions = new Float32Array(numVerts * 3);
+  var indices = new Uint16Array(6 * gridRes * gridRes);
+  var poffset = 0;
+
+  for (var yy = 0; yy &lt;= gridRes; ++yy) {
+    for (var xx = 0; xx &lt;= gridRes; ++xx) {
+      positions[poffset + 0] = (-1 + 2 * xx / gridRes) * positionMult + positionOffset;
+      positions[poffset + 1] = (-1 + 2 * yy / gridRes) * positionMult + positionOffset;
+      positions[poffset + 2] = 0;
+
+      poffset += 3;
+    }
+  }
+
+  var buf = gl.createBuffer();
+  gl.bindBuffer(gl.ARRAY_BUFFER, buf);
+  gl.bufferData(gl.ARRAY_BUFFER, positions, gl.STATIC_DRAW);
+  gl.enableVertexAttribArray(positionLocation);
+  gl.vertexAttribPointer(positionLocation, 3, gl.FLOAT, false, 0, 0);
+  objects.push(buf);
+
+  if (options.colorLocation !== undefined) {
+    var colors = new Float32Array(numVerts * 4);
+    for (var yy = 0; yy &lt;= gridRes; ++yy) {
+      for (var xx = 0; xx &lt;= gridRes; ++xx) {
+        if (options.color !== undefined) {
+          colors[poffset + 0] = options.color[0];
+          colors[poffset + 1] = options.color[1];
+          colors[poffset + 2] = options.color[2];
+          colors[poffset + 3] = options.color[3];
+        } else {
+          colors[poffset + 0] = xx / gridRes;
+          colors[poffset + 1] = yy / gridRes;
+          colors[poffset + 2] = (xx / gridRes) * (yy / gridRes);
+          colors[poffset + 3] = (yy % 2) * 0.5 + 0.5;
+        }
+        poffset += 4;
+      }
+    }
+
+    var buf = gl.createBuffer();
+    gl.bindBuffer(gl.ARRAY_BUFFER, buf);
+    gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);
+    gl.enableVertexAttribArray(options.colorLocation);
+    gl.vertexAttribPointer(options.colorLocation, 4, gl.FLOAT, false, 0, 0);
+    objects.push(buf);
+  }
+
+  var tbase = 0;
+  for (var yy = 0; yy &lt; gridRes; ++yy) {
+    var index = yy * vertsAcross;
+    for (var xx = 0; xx &lt; gridRes; ++xx) {
+      indices[tbase + 0] = index + 0;
+      indices[tbase + 1] = index + 1;
+      indices[tbase + 2] = index + vertsAcross;
+      indices[tbase + 3] = index + vertsAcross;
+      indices[tbase + 4] = index + 1;
+      indices[tbase + 5] = index + vertsAcross + 1;
+
+      if (options.flipOddTriangles) {
+        indices[tbase + 4] = index + vertsAcross + 1;
+        indices[tbase + 5] = index + 1;
+      }
+
+      index += 1;
+      tbase += 6;
+    }
+  }
+
+  var buf = gl.createBuffer();
+  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf);
+  gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
+  objects.push(buf);
+
+  return objects;
+};
+
+/**
</ins><span class="cx">  * Fills the given texture with a solid color
</span><span class="cx">  * @param {!WebGLContext} gl The WebGLContext to use.
</span><span class="cx">  * @param {!WebGLTexture} tex The texture to fill.
</span><span class="lines">@@ -475,7 +594,129 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Draws a previously setupIndexedQuad
+ * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use.
+ * @param {number} gridRes Resolution of grid.
+ * @param {!Array.&lt;number&gt;} opt_color The color to fill clear with before
+ *        drawing. A 4 element array where each element is in the range 0 to
+ *        255. Default [255, 255, 255, 255]
+ */
+var clearAndDrawIndexedQuad = function(gl, gridRes, opt_color) {
+  opt_color = opt_color || [255, 255, 255, 255];
+  gl.clearColor(
+      opt_color[0] / 255,
+      opt_color[1] / 255,
+      opt_color[2] / 255,
+      opt_color[3] / 255);
+  gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+  drawIndexedQuad(gl, gridRes);
+};
+
+/**
+ * Clips a range to min, max
+ * (Eg. clipToRange(-5,7,0,20) would return {value:0,extent:2}
+ * @param {number} value start of range
+ * @param {number} extent extent of range
+ * @param {number} min min.
+ * @param {number} max max.
+ * @return {!{value:number,extent:number} The clipped value.
+ */
+var clipToRange = function(value, extent, min, max) {
+  if (value &lt; min) {
+    extent -= min - value;
+    value = min;
+  }
+  var end = value + extent;
+  if (end &gt; max) {
+    extent -= end - max;
+  }
+  if (extent &lt; 0) {
+    value = max;
+    extent = 0;
+  }
+  return {value:value, extent: extent};
+};
+
+/**
+ * Determines if the passed context is an instance of a WebGLRenderingContext
+ * or later variant (like WebGL2RenderingContext)
+ * @param {CanvasRenderingContext} ctx The context to check.
+ */
+var isWebGLContext = function(ctx) {
+  if (ctx instanceof WebGLRenderingContext)
+    return true;
+
+  if ('WebGL2RenderingContext' in window &amp;&amp; ctx instanceof WebGL2RenderingContext)
+    return true;
+
+  return false;
+};
+
+/**
</ins><span class="cx">  * Checks that a portion of a canvas is 1 color.
</span><ins>+ * @param {!WebGLRenderingContext|CanvasRenderingContext2D} gl The
+ *         WebGLRenderingContext or 2D context to use.
+ * @param {number} x left corner of region to check.
+ * @param {number} y bottom corner of region to check in case of checking from
+ *        a GL context or top corner in case of checking from a 2D context.
+ * @param {number} width width of region to check.
+ * @param {number} height width of region to check.
+ * @param {!Array.&lt;number&gt;} color The color expected. A 4 element array where
+ *        each element is in the range 0 to 255.
+ * @param {number} opt_errorRange Optional. Acceptable error in
+ *        color checking. 0 by default.
+ * @param {!function()} sameFn Function to call if all pixels
+ *        are the same as color.
+ * @param {!function()} differentFn Function to call if a pixel
+ *        is different than color
+ * @param {!function()} logFn Function to call for logging.
+ */
+var checkCanvasRectColor = function(gl, x, y, width, height, color, opt_errorRange, sameFn, differentFn, logFn) {
+  if (isWebGLContext(gl) &amp;&amp; !gl.getParameter(gl.FRAMEBUFFER_BINDING)) {
+    // We're reading the backbuffer so clip.
+    var xr = clipToRange(x, width, 0, gl.canvas.width);
+    var yr = clipToRange(y, height, 0, gl.canvas.height);
+    if (!xr.extent || !yr.extent) {
+      logFn(&quot;checking rect: effective width or heigh is zero&quot;);
+      sameFn();
+      return;
+    }
+    x = xr.value;
+    y = yr.value;
+    width = xr.extent;
+    height = yr.extent;
+  }
+  var errorRange = opt_errorRange || 0;
+  if (!errorRange.length) {
+    errorRange = [errorRange, errorRange, errorRange, errorRange]
+  }
+  var buf;
+  if (isWebGLContext(gl)) {
+    buf = new Uint8Array(width * height * 4);
+    gl.readPixels(x, y, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
+  } else {
+    buf = gl.getImageData(x, y, width, height).data;
+  }
+  for (var i = 0; i &lt; width * height; ++i) {
+    var offset = i * 4;
+    for (var j = 0; j &lt; color.length; ++j) {
+      if (Math.abs(buf[offset + j] - color[j]) &gt; errorRange[j]) {
+        differentFn();
+        var was = buf[offset + 0].toString();
+        for (j = 1; j &lt; color.length; ++j) {
+          was += &quot;,&quot; + buf[offset + j];
+        }
+        logFn('at (' + (x + (i % width)) + ', ' + (y + Math.floor(i / width)) +
+              ') expected: ' + color + ' was ' + was);
+        return;
+      }
+    }
+  }
+  sameFn();
+};
+
+/**
+ * Checks that a portion of a canvas is 1 color.
</ins><span class="cx">  * @param {!WebGLContext} gl The WebGLContext to use.
</span><span class="cx">  * @param {number} x left corner of region to check.
</span><span class="cx">  * @param {number} y bottom corner of region to check.
</span><span class="lines">@@ -506,6 +747,9 @@
</span><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">   }
</span><ins>+  if (!msg) {
+      msg = &quot;Color was &quot; + color;
+  }
</ins><span class="cx">   testPassed(msg);
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -1331,11 +1575,13 @@
</span><span class="cx"> 
</span><span class="cx"> return {
</span><span class="cx">   cancelAnimFrame: cancelAnimFrame,
</span><ins>+  clipToRange: clipToRange,
</ins><span class="cx">   create3DContext: create3DContext,
</span><span class="cx">   create3DContextWithWrapperThatThrowsOnGLError:
</span><del>-    create3DContextWithWrapperThatThrowsOnGLError,
</del><ins>+  create3DContextWithWrapperThatThrowsOnGLError,
</ins><span class="cx">   checkCanvas: checkCanvas,
</span><span class="cx">   checkCanvasRect: checkCanvasRect,
</span><ins>+  checkCanvasRectColor: checkCanvasRectColor,
</ins><span class="cx">   createColoredTexture: createColoredTexture,
</span><span class="cx">   drawQuad: drawQuad,
</span><span class="cx">   drawIndexedQuad: drawIndexedQuad,
</span><span class="lines">@@ -1369,6 +1615,8 @@
</span><span class="cx">   setupColorQuad: setupColorQuad,
</span><span class="cx">   setupProgram: setupProgram,
</span><span class="cx">   setupQuad: setupQuad,
</span><ins>+  setupIndexedQuad: setupIndexedQuad,
+  setupIndexedQuadWithOptions: setupIndexedQuadWithOptions,
</ins><span class="cx">   setupSimpleTextureFragmentShader: setupSimpleTextureFragmentShader,
</span><span class="cx">   setupSimpleTextureProgram: setupSimpleTextureProgram,
</span><span class="cx">   setupSimpleTextureVertexShader: setupSimpleTextureVertexShader,
</span></span></pre></div>
<a id="trunkLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/TestExpectations (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/TestExpectations        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/LayoutTests/platform/efl/TestExpectations        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -1681,6 +1681,9 @@
</span><span class="cx"> webgl/conformance/ogles/GL/vec3/vec3_001_to_008.html [ Failure ]
</span><span class="cx"> webgl/conformance/textures/texture-attachment-formats.html [ Failure ]
</span><span class="cx"> 
</span><ins>+# ANGLE_instanced_arrays not implemented on efl
+fast/canvas/webgl/angle-instanced-arrays.html [ Skip ]
+
</ins><span class="cx"> # Text rendering is overflowing region
</span><span class="cx"> webkit.org/b/122511 fast/regions/selection/selecting-text-ignoring-region-horiz-bt.html [ ImageOnlyFailure ]
</span><span class="cx"> webkit.org/b/122511 fast/regions/selection/selecting-text-ignoring-region-vert-lr.html [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacmountainlionfastcanvaswebglangleinstancedarraysexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt (0 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+CONSOLE MESSAGE: WebGL: INVALID_ENUM: getVertexAttrib: invalid parameter name
+This test verifies the functionality of the ANGLE_instanced_arrays extension, if it is available.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS WebGL context exists
+Testing VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE with extension disabled
+PASS getError was expected value: INVALID_ENUM : VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE should not be queryable if extension is disabled
+PASS No ANGLE_instanced_arrays support -- this is legal
+PASS ANGLE_instanced_arrays not listed as supported and getExtension failed -- this is legal
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -496,6 +496,7 @@
</span><span class="cx">     html/ValidityState.idl
</span><span class="cx">     html/VoidCallback.idl
</span><span class="cx"> 
</span><ins>+    html/canvas/ANGLEInstancedArrays.idl
</ins><span class="cx">     html/canvas/CanvasGradient.idl
</span><span class="cx">     html/canvas/CanvasPattern.idl
</span><span class="cx">     html/canvas/CanvasProxy.idl
</span><span class="lines">@@ -1492,6 +1493,7 @@
</span><span class="cx">     html/ValidationMessage.cpp
</span><span class="cx">     html/WeekInputType.cpp
</span><span class="cx"> 
</span><ins>+    html/canvas/ANGLEInstancedArrays.cpp
</ins><span class="cx">     html/canvas/CanvasContextAttributes.cpp
</span><span class="cx">     html/canvas/CanvasGradient.cpp
</span><span class="cx">     html/canvas/CanvasPathMethods.cpp
</span><span class="lines">@@ -2664,6 +2666,7 @@
</span><span class="cx">     add_definitions(-DWTF_USE_3D_GRAPHICS=1)
</span><span class="cx"> 
</span><span class="cx">     list(APPEND WebCore_SOURCES
</span><ins>+        html/canvas/ANGLEInstancedArrays.cpp
</ins><span class="cx">         html/canvas/EXTDrawBuffers.cpp
</span><span class="cx">         html/canvas/EXTTextureFilterAnisotropic.cpp
</span><span class="cx">         html/canvas/OESElementIndexUint.cpp
</span><span class="lines">@@ -2700,6 +2703,7 @@
</span><span class="cx">         html/canvas/WebGLVertexArrayObjectOES.cpp
</span><span class="cx">     )
</span><span class="cx">     list(APPEND WebCore_IDL_FILES
</span><ins>+        html/canvas/ANGLEInstancedArrays.idl
</ins><span class="cx">         html/canvas/EXTDrawBuffers.idl
</span><span class="cx">         html/canvas/EXTTextureFilterAnisotropic.idl
</span><span class="cx">         html/canvas/OESElementIndexUint.idl
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/ChangeLog        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2014-01-22  Dean Jackson  &lt;dino@apple.com&gt;
+
+        [WebGL] Implement ANGLE_instanced_arrays
+        https://bugs.webkit.org/show_bug.cgi?id=127257
+
+        Reviewed by Brent Fulgham.
+
+        Implement the instanced drawing WebGL extension,
+        ANGLE_instanced_arrays. This is currently Mac-only,
+        but should be portable to other platforms if their
+        OpenGL exposes the functions. It's also done in a way
+        that will make exposing it to WebGL2 simple.
+
+        Test: fast/canvas/webgl/angle-instanced-arrays.html
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * GNUmakefile.list.am:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        Add the new files to all the build systems.
+
+        * bindings/js/JSWebGLRenderingContextCustom.cpp:
+        (WebCore::toJS): Link JS side to C++ side.
+
+        * html/canvas/ANGLEInstancedArrays.cpp: Added.
+        (WebCore::ANGLEInstancedArrays::ANGLEInstancedArrays):
+        * html/canvas/ANGLEInstancedArrays.h: Added.
+        * html/canvas/ANGLEInstancedArrays.idl: Added.
+        New boilerplate files that expose the extension methods.
+
+        * html/canvas/WebGLExtension.h: New extension enum.
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::validateVertexAttributes): Add an optional
+        parameter representing the number of instance primitives we are asked
+        to draw. Use that for the draw count if looking at an instanced attribute.
+        Also make sure we see at least one non-instanced attribute.
+        (WebCore::WebGLRenderingContext::validateDrawArrays): Update this so it could
+        be used from either drawArrays or drawArraysInstanced.
+        (WebCore::WebGLRenderingContext::drawArrays):
+        (WebCore::WebGLRenderingContext::validateDrawElements): Same here, now can be
+        used by the instanced and non-instanced versions.
+        (WebCore::WebGLRenderingContext::drawElements):
+        (WebCore::WebGLRenderingContext::getExtension): Create and return the new extension.
+        (WebCore::WebGLRenderingContext::getSupportedExtensions): Add new extension to the list.
+        (WebCore::WebGLRenderingContext::getVertexAttrib): Intercept a query to the divisor
+        attribute and return the value we kept in the state.
+        (WebCore::WebGLRenderingContext::drawArraysInstanced): Call the GC3D method.
+        (WebCore::WebGLRenderingContext::drawElementsInstanced): Ditto.
+        (WebCore::WebGLRenderingContext::vertexAttribDivisor): Ditto.
+
+        * html/canvas/WebGLRenderingContext.h: Define the new methods and parameters.
+
+        * html/canvas/WebGLVertexArrayObjectOES.cpp:
+        (WebCore::WebGLVertexArrayObjectOES::setVertexAttribDivisor): Keep a record of the
+        divisor if we set it.
+        * html/canvas/WebGLVertexArrayObjectOES.h:
+        (WebCore::WebGLVertexArrayObjectOES::VertexAttribState::VertexAttribState):
+
+        * platform/graphics/GraphicsContext3D.h: New enum.
+        * platform/graphics/mac/GraphicsContext3DMac.mm:
+        (WebCore::GraphicsContext3D::drawArraysInstanced): The actual calls into OpenGL.
+        (WebCore::GraphicsContext3D::drawElementsInstanced): Ditto.
+        (WebCore::GraphicsContext3D::vertexAttribDivisor): Ditto.
+
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: Empty implementations
+        for non-mac platforms.
+
+        * platform/graphics/ios/GraphicsContext3DIOS.h: Define the iOS names for the
+        functions.
+
</ins><span class="cx"> 2014-01-22  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Shapes] shape-inside rectangle layout can fail
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.cpp (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.cpp        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/DerivedSources.cpp        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -27,6 +27,9 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;HTMLElementFactory.cpp&quot;
</span><span class="cx"> #include &quot;HTMLEntityTable.cpp&quot;
</span><ins>+#if ENABLE(WEBGL)
+#include &quot;JSANGLEInstancedArrays.cpp&quot;
+#endif
</ins><span class="cx"> #include &quot;JSAbstractWorker.cpp&quot;
</span><span class="cx"> #include &quot;JSAttr.cpp&quot;
</span><span class="cx"> #include &quot;JSBarProp.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/DerivedSources.make        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -408,6 +408,7 @@
</span><span class="cx">     $(WebCore)/html/TimeRanges.idl \
</span><span class="cx">     $(WebCore)/html/ValidityState.idl \
</span><span class="cx">     $(WebCore)/html/VoidCallback.idl \
</span><ins>+    $(WebCore)/html/canvas/ANGLEInstancedArrays.idl \
</ins><span class="cx">     $(WebCore)/html/canvas/CanvasGradient.idl \
</span><span class="cx">     $(WebCore)/html/canvas/CanvasPattern.idl \
</span><span class="cx">     $(WebCore)/html/canvas/CanvasProxy.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx">         DerivedSources/WebCore/InspectorWebFrontendDispatchers.h \
</span><span class="cx">         DerivedSources/WebCore/InspectorWebTypeBuilders.cpp \
</span><span class="cx">         DerivedSources/WebCore/InspectorWebTypeBuilders.h \
</span><ins>+        DerivedSources/WebCore/JSANGLEInstancedArrays.cpp \
+        DerivedSources/WebCore/JSANGLEInstancedArrays.h \
</ins><span class="cx">         DerivedSources/WebCore/JSAbstractWorker.cpp \
</span><span class="cx">         DerivedSources/WebCore/JSAbstractWorker.h \
</span><span class="cx">         DerivedSources/WebCore/JSAllAudioCapabilities.cpp \
</span><span class="lines">@@ -1506,6 +1508,7 @@
</span><span class="cx">         $(WebCore)/html/TimeRanges.idl \
</span><span class="cx">         $(WebCore)/html/ValidityState.idl \
</span><span class="cx">         $(WebCore)/html/VoidCallback.idl \
</span><ins>+        $(WebCore)/html/canvas/ANGLEInstancedArrays.idl \
</ins><span class="cx">         $(WebCore)/html/canvas/CanvasGradient.idl \
</span><span class="cx">         $(WebCore)/html/canvas/CanvasPattern.idl \
</span><span class="cx">         $(WebCore)/html/canvas/CanvasProxy.idl \
</span><span class="lines">@@ -3240,6 +3243,8 @@
</span><span class="cx">         Source/WebCore/html/BaseTextInputType.h \
</span><span class="cx">         Source/WebCore/html/ButtonInputType.cpp \
</span><span class="cx">         Source/WebCore/html/ButtonInputType.h \
</span><ins>+        Source/WebCore/html/canvas/ANGLEInstancedArrays.cpp \
+        Source/WebCore/html/canvas/ANGLEInstancedArrays.h \
</ins><span class="cx">         Source/WebCore/html/canvas/CanvasContextAttributes.cpp \
</span><span class="cx">         Source/WebCore/html/canvas/CanvasContextAttributes.h \
</span><span class="cx">         Source/WebCore/html/canvas/CanvasGradient.cpp \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -290,6 +290,20 @@
</span><span class="cx">     &lt;/ClCompile&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\CSSPropertyNames.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\CSSValueKeywords.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSANGLEInstancedArrays.cpp&quot;&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='DebugSuffix|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Release|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Release|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Production|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Production|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSEXTDrawBuffers.cpp&quot;&gt;
</span><span class="cx">       &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
</span><span class="cx">       &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
</span><span class="lines">@@ -6542,6 +6556,7 @@
</span><span class="cx">       &lt;ForcedIncludeFiles Condition=&quot;'$(Configuration)|$(Platform)'=='Production|Win32'&quot;&gt;ICUVersion.h&lt;/ForcedIncludeFiles&gt;
</span><span class="cx">       &lt;ForcedIncludeFiles Condition=&quot;'$(Configuration)|$(Platform)'=='Production|x64'&quot;&gt;ICUVersion.h&lt;/ForcedIncludeFiles&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\html\canvas\ANGLEInstancedArrays.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\html\canvas\CanvasContextAttributes.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\html\canvas\CanvasPathMethods.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\html\canvas\EXTDrawBuffers.cpp&quot; /&gt;
</span><span class="lines">@@ -18553,6 +18568,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\XMLViewerCSS.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\XMLViewerJS.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\XPathGrammar.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSANGLEInstancedArrays.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSEXTDrawBuffers.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSEXTTextureFilterAnisotropic.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSOESElementIndexUint.h&quot; /&gt;
</span><span class="lines">@@ -18653,6 +18669,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\ForwardingHeaders\runtime\WeakGCMap.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\ForwardingHeaders\runtime\WriteBarrier.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\ForwardingHeaders\yarr\YarrJIT.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\html\canvas\ANGLEInstancedArrays.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\html\canvas\CanvasContextAttributes.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\html\canvas\CanvasPathMethods.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\html\canvas\EXTDrawBuffers.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -6592,6 +6592,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSWebGLVertexArrayObjectOES.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;DerivedSources&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSANGLEInstancedArrays.cpp&quot;&gt;
+      &lt;Filter&gt;DerivedSources&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSEXTDrawBuffers.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;DerivedSources&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><span class="lines">@@ -6619,6 +6622,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSOESVertexArrayObject.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;DerivedSources&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\html\canvas\ANGLEInstancedArrays.cpp&quot;&gt;
+      &lt;Filter&gt;html\canvas&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\html\canvas\WebGLBuffer.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;html\canvas&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><span class="lines">@@ -14464,6 +14470,12 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSOESVertexArrayObject.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;DerivedSources&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><ins>+    &lt;ClInclude Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSANGLEInstancedArrays.h&quot;&gt;
+      &lt;Filter&gt;DerivedSources&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
+    &lt;ClInclude Include=&quot;..\html\canvas\ANGLEInstancedArrays.h&quot;&gt;
+      &lt;Filter&gt;html\canvas&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\html\canvas\WebGLActiveInfo.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;html\canvas&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -1194,6 +1194,9 @@
</span><span class="cx">                 319AE063142D6B24006563A1 /* StyleFilterData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 319AE061142D6B24006563A1 /* StyleFilterData.cpp */; };
</span><span class="cx">                 319AE064142D6B24006563A1 /* StyleFilterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 319AE062142D6B24006563A1 /* StyleFilterData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 319FBD5F15D2F464009640A6 /* CachedImageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 319FBD5D15D2F444009640A6 /* CachedImageClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                31A795C61888BADC00382F90 /* JSANGLEInstancedArrays.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31A795C41888BAD100382F90 /* JSANGLEInstancedArrays.cpp */; };
+                31A795C71888BCB200382F90 /* ANGLEInstancedArrays.h in Headers */ = {isa = PBXBuildFile; fileRef = 31A795C21888B72400382F90 /* ANGLEInstancedArrays.h */; };
+                31A795C81888BCB500382F90 /* ANGLEInstancedArrays.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31A795C11888B72400382F90 /* ANGLEInstancedArrays.cpp */; };
</ins><span class="cx">                 31AB5000122878A2001A7DB0 /* GraphicsContext3DIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 31AB4FFF122878A2001A7DB0 /* GraphicsContext3DIOS.h */; };
</span><span class="cx">                 31C0FF210E4CEB6E007D6FE5 /* WebKitAnimationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31C0FF1B0E4CEB6E007D6FE5 /* WebKitAnimationEvent.cpp */; };
</span><span class="cx">                 31C0FF220E4CEB6E007D6FE5 /* WebKitAnimationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF1C0E4CEB6E007D6FE5 /* WebKitAnimationEvent.h */; };
</span><span class="lines">@@ -8068,6 +8071,11 @@
</span><span class="cx">                 319AE061142D6B24006563A1 /* StyleFilterData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StyleFilterData.cpp; path = style/StyleFilterData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 319AE062142D6B24006563A1 /* StyleFilterData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleFilterData.h; path = style/StyleFilterData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 319FBD5D15D2F444009640A6 /* CachedImageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedImageClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                31A795C11888B72400382F90 /* ANGLEInstancedArrays.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ANGLEInstancedArrays.cpp; path = canvas/ANGLEInstancedArrays.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                31A795C21888B72400382F90 /* ANGLEInstancedArrays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ANGLEInstancedArrays.h; path = canvas/ANGLEInstancedArrays.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                31A795C31888B72400382F90 /* ANGLEInstancedArrays.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ANGLEInstancedArrays.idl; path = canvas/ANGLEInstancedArrays.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
+                31A795C41888BAD100382F90 /* JSANGLEInstancedArrays.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSANGLEInstancedArrays.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                31A795C51888BAD100382F90 /* JSANGLEInstancedArrays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSANGLEInstancedArrays.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 31AB4FFF122878A2001A7DB0 /* GraphicsContext3DIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContext3DIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31C0FF1B0E4CEB6E007D6FE5 /* WebKitAnimationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitAnimationEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31C0FF1C0E4CEB6E007D6FE5 /* WebKitAnimationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitAnimationEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -15437,6 +15445,9 @@
</span><span class="cx">                 49484FAE102CF01E00187DD3 /* canvas */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                31A795C11888B72400382F90 /* ANGLEInstancedArrays.cpp */,
+                                31A795C21888B72400382F90 /* ANGLEInstancedArrays.h */,
+                                31A795C31888B72400382F90 /* ANGLEInstancedArrays.idl */,
</ins><span class="cx">                                 6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */,
</span><span class="cx">                                 6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */,
</span><span class="cx">                                 49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */,
</span><span class="lines">@@ -18192,6 +18203,8 @@
</span><span class="cx">                 A83B79080CCAFF2B000B0825 /* HTML */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                31A795C41888BAD100382F90 /* JSANGLEInstancedArrays.cpp */,
+                                31A795C51888BAD100382F90 /* JSANGLEInstancedArrays.h */,
</ins><span class="cx">                                 BE8EF03E171C8FF9009B48C3 /* JSAudioTrack.cpp */,
</span><span class="cx">                                 BE8EF03F171C8FF9009B48C3 /* JSAudioTrack.h */,
</span><span class="cx">                                 BE8EF040171C8FF9009B48C3 /* JSAudioTrackList.cpp */,
</span><span class="lines">@@ -23664,6 +23677,7 @@
</span><span class="cx">                                 498391520F1E76B400C23782 /* DOMWebKitCSSMatrixInternal.h in Headers */,
</span><span class="cx">                                 8AD0A59614C88358000D83C5 /* DOMWebKitCSSRegionRule.h in Headers */,
</span><span class="cx">                                 8AD0A59814C88358000D83C5 /* DOMWebKitCSSRegionRuleInternal.h in Headers */,
</span><ins>+                                31A795C71888BCB200382F90 /* ANGLEInstancedArrays.h in Headers */,
</ins><span class="cx">                                 31611E610E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.h in Headers */,
</span><span class="cx">                                 31611E630E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h in Headers */,
</span><span class="cx">                                 3F2B33EB165AF15600E3987C /* DOMWebKitCSSViewportRule.h in Headers */,
</span><span class="lines">@@ -28844,6 +28858,7 @@
</span><span class="cx">                                 9393E604151A9A1800066F06 /* StyleCachedImageSet.cpp in Sources */,
</span><span class="cx">                                 5038BE2F1472AD230095E0D1 /* StyleCachedShader.cpp in Sources */,
</span><span class="cx">                                 50E18CD816F9285800C65486 /* StyleCustomFilterProgram.cpp in Sources */,
</span><ins>+                                31A795C81888BCB500382F90 /* ANGLEInstancedArrays.cpp in Sources */,
</ins><span class="cx">                                 A5840E24187B8AC200843B10 /* PageInjectedScriptHost.cpp in Sources */,
</span><span class="cx">                                 50E18CD916F9285800C65486 /* StyleCustomFilterProgramCache.cpp in Sources */,
</span><span class="cx">                                 A8C4A7FE09D563270003AC8D /* StyledElement.cpp in Sources */,
</span><span class="lines">@@ -29289,6 +29304,7 @@
</span><span class="cx">                                 AAF5B7B71524B6C50004CB49 /* WebSocketFrame.cpp in Sources */,
</span><span class="cx">                                 97AABD2614FA09D5007457AE /* WebSocketHandshake.cpp in Sources */,
</span><span class="cx">                                 0F580FA41496939100FB5BD8 /* WebTiledBackingLayer.mm in Sources */,
</span><ins>+                                31A795C61888BADC00382F90 /* JSANGLEInstancedArrays.cpp in Sources */,
</ins><span class="cx">                                 CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */,
</span><span class="cx">                                 CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */,
</span><span class="cx">                                 F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSWebGLRenderingContextCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -29,11 +29,13 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSWebGLRenderingContext.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;ANGLEInstancedArrays.h&quot;
</ins><span class="cx"> #include &quot;EXTDrawBuffers.h&quot;
</span><span class="cx"> #include &quot;EXTTextureFilterAnisotropic.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;HTMLCanvasElement.h&quot;
</span><span class="cx"> #include &quot;HTMLImageElement.h&quot;
</span><ins>+#include &quot;JSANGLEInstancedArrays.h&quot;
</ins><span class="cx"> #include &quot;JSEXTDrawBuffers.h&quot;
</span><span class="cx"> #include &quot;JSEXTTextureFilterAnisotropic.h&quot;
</span><span class="cx"> #include &quot;JSHTMLCanvasElement.h&quot;
</span><span class="lines">@@ -233,6 +235,8 @@
</span><span class="cx">         return toJS(exec, globalObject, static_cast&lt;WebGLCompressedTextureS3TC*&gt;(extension));
</span><span class="cx">     case WebGLExtension::WebGLDepthTextureName:
</span><span class="cx">         return toJS(exec, globalObject, static_cast&lt;WebGLDepthTexture*&gt;(extension));
</span><ins>+    case WebGLExtension::ANGLEInstancedArraysName:
+        return toJS(exec, globalObject, static_cast&lt;ANGLEInstancedArrays*&gt;(extension));
</ins><span class="cx">     }
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx">     return jsNull();
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasANGLEInstancedArrayscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.cpp (0 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.cpp                                (rev 0)
+++ trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.cpp        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#if ENABLE(WEBGL)
+#include &quot;ANGLEInstancedArrays.h&quot;
+
+namespace WebCore {
+
+ANGLEInstancedArrays::ANGLEInstancedArrays(WebGLRenderingContext* context)
+    : WebGLExtension(context)
+{
+}
+
+ANGLEInstancedArrays::~ANGLEInstancedArrays()
+{
+}
+
+WebGLExtension::ExtensionName ANGLEInstancedArrays::getName() const
+{
+    return ANGLEInstancedArraysName;
+}
+
+OwnPtr&lt;ANGLEInstancedArrays&gt; ANGLEInstancedArrays::create(WebGLRenderingContext* context)
+{
+    return adoptPtr(new ANGLEInstancedArrays(context));
+}
+
+bool ANGLEInstancedArrays::supported(WebGLRenderingContext*)
+{
+#if PLATFORM(IOS) || PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
+    return true;
+#else
+    return false;
+#endif
+}
+
+void ANGLEInstancedArrays::drawArraysInstancedANGLE(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
+{
+    if (m_context-&gt;isContextLost())
+        return;
+    m_context-&gt;drawArraysInstanced(mode, first, count, primcount);
+}
+
+void ANGLEInstancedArrays::drawElementsInstancedANGLE(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)
+{
+    if (m_context-&gt;isContextLost())
+        return;
+    m_context-&gt;drawElementsInstanced(mode, count, type, offset, primcount);
+}
+
+void ANGLEInstancedArrays::vertexAttribDivisorANGLE(GC3Duint index, GC3Duint divisor)
+{
+    if (m_context-&gt;isContextLost())
+        return;
+    m_context-&gt;vertexAttribDivisor(index, divisor);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGL)
</ins><span class="cx">Property changes on: trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCorehtmlcanvasANGLEInstancedArraysh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.h (0 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.h                                (rev 0)
+++ trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.h        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ANGLEInstancedArrays_h
+#define ANGLEInstancedArrays_h
+
+#include &quot;WebGLExtension.h&quot;
+#include &lt;wtf/PassOwnPtr.h&gt;
+
+namespace WebCore {
+
+class WebGLRenderingContext;
+
+class ANGLEInstancedArrays : public WebGLExtension {
+public:
+    static OwnPtr&lt;ANGLEInstancedArrays&gt; create(WebGLRenderingContext*);
+    virtual ~ANGLEInstancedArrays();
+    virtual ExtensionName getName() const;
+
+    static bool supported(WebGLRenderingContext*);
+
+    void drawArraysInstancedANGLE(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount);
+    void drawElementsInstancedANGLE(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount);
+    void vertexAttribDivisorANGLE(GC3Duint index, GC3Duint divisor);
+
+private:
+    ANGLEInstancedArrays(WebGLRenderingContext*);
+};
+
+} // namespace WebCore
+
+#endif // ANGLEInstancedArrays_h
</ins><span class="cx">Property changes on: trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCorehtmlcanvasANGLEInstancedArraysidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.idl (0 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.idl                                (rev 0)
+++ trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.idl        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    NoInterfaceObject,
+    Conditional=WEBGL,
+    GenerateIsReachable=ImplWebGLRenderingContext,
+] interface ANGLEInstancedArrays {
+    const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;
+
+    [StrictTypeChecking] void drawArraysInstancedANGLE(unsigned long mode, long first, long count, long primcount);
+    [StrictTypeChecking] void drawElementsInstancedANGLE(unsigned long mode, long count, unsigned long type, long long offset, long primcount);
+    [StrictTypeChecking] void vertexAttribDivisorANGLE(unsigned long index, unsigned long divisor);
+};
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLExtensionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLExtension.h (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLExtension.h        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/html/canvas/WebGLExtension.h        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx">         OESElementIndexUintName,
</span><span class="cx">         WebGLCompressedTextureATCName,
</span><span class="cx">         WebGLCompressedTexturePVRTCName,
</span><ins>+        ANGLEInstancedArraysName,
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     void ref() { m_context-&gt;ref(); }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;WebGLRenderingContext.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;ANGLEInstancedArrays.h&quot;
</ins><span class="cx"> #include &quot;CachedImage.h&quot;
</span><span class="cx"> #include &quot;DOMWindow.h&quot;
</span><span class="cx"> #include &quot;EXTDrawBuffers.h&quot;
</span><span class="lines">@@ -1886,7 +1887,7 @@
</span><span class="cx">     return numElementsRequired &gt; 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebGLRenderingContext::validateVertexAttributes(unsigned numElementsRequired)
</del><ins>+bool WebGLRenderingContext::validateVertexAttributes(unsigned elementCount, unsigned primitiveCount)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_currentProgram)
</span><span class="cx">         return false;
</span><span class="lines">@@ -1897,17 +1898,20 @@
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (numElementsRequired &lt;= 0)
</del><ins>+    if (elementCount &lt;= 0)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    // Look in each consumed vertex attrib (by the current program) and find the smallest buffer size
-    unsigned smallestNumElements = UINT_MAX;
</del><ins>+
+    // Look in each consumed vertex attrib (by the current program).
+    bool sawNonInstancedAttrib = false;
+    bool sawEnabledAttrib = false;
</ins><span class="cx">     int numActiveAttribLocations = m_currentProgram-&gt;numActiveAttribLocations();
</span><span class="cx">     for (int i = 0; i &lt; numActiveAttribLocations; ++i) {
</span><span class="cx">         int loc = m_currentProgram-&gt;getActiveAttribLocation(i);
</span><span class="cx">         if (loc &gt;= 0 &amp;&amp; loc &lt; static_cast&lt;int&gt;(m_maxVertexAttribs)) {
</span><span class="cx">             const WebGLVertexArrayObjectOES::VertexAttribState&amp; state = m_boundVertexArrayObject-&gt;getVertexAttribState(loc);
</span><span class="cx">             if (state.enabled) {
</span><ins>+                sawEnabledAttrib = true;
</ins><span class="cx">                 // Avoid off-by-one errors in numElements computation.
</span><span class="cx">                 // For the last element, we will only touch the data for the
</span><span class="cx">                 // element and nothing beyond it.
</span><span class="lines">@@ -1916,16 +1920,18 @@
</span><span class="cx">                 ASSERT(state.stride &gt; 0);
</span><span class="cx">                 if (bytesRemaining &gt;= state.bytesPerElement)
</span><span class="cx">                     numElements = 1 + (bytesRemaining - state.bytesPerElement) / state.stride;
</span><del>-                if (numElements &lt; smallestNumElements)
-                    smallestNumElements = numElements;
</del><ins>+                if (!state.divisor)
+                    sawNonInstancedAttrib = true;
+                if ((!state.divisor &amp;&amp; elementCount &gt; numElements) || (state.divisor &amp;&amp; primitiveCount &gt; numElements))
+                    return false;
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (smallestNumElements == INT_MAX)
-        smallestNumElements = 0;
</del><ins>+    if (!sawNonInstancedAttrib &amp;&amp; sawEnabledAttrib)
+        return false;
</ins><span class="cx"> 
</span><del>-    return numElementsRequired &lt;= smallestNumElements;
</del><ins>+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebGLRenderingContext::validateWebGLObject(const char* functionName, WebGLObject* object)
</span><span class="lines">@@ -1941,48 +1947,62 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count, ExceptionCode&amp; ec)
</del><ins>+bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(ec);
</del><ins>+    if (isContextLost() || !validateDrawMode(functionName, mode))
+        return false;
</ins><span class="cx"> 
</span><del>-    if (isContextLost() || !validateDrawMode(&quot;drawArrays&quot;, mode))
-        return;
</del><ins>+    if (!validateStencilSettings(functionName))
+        return false;
</ins><span class="cx"> 
</span><del>-    if (!validateStencilSettings(&quot;drawArrays&quot;))
-        return;
-
</del><span class="cx">     if (first &lt; 0 || count &lt; 0) {
</span><del>-        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;drawArrays&quot;, &quot;first or count &lt; 0&quot;);
-        return;
</del><ins>+        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, &quot;first or count &lt; 0&quot;);
+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!count) {
</span><span class="cx">         cleanupAfterGraphicsCall(true);
</span><del>-        return;
</del><ins>+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (primcount &lt; 0) {
+        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, &quot;primcount &lt; 0&quot;);
+        return false;
+    }
+
</ins><span class="cx">     if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
</span><span class="cx">         // Ensure we have a valid rendering state
</span><span class="cx">         Checked&lt;GC3Dint, RecordOverflow&gt; checkedFirst(first);
</span><span class="cx">         Checked&lt;GC3Dint, RecordOverflow&gt; checkedCount(count);
</span><span class="cx">         Checked&lt;GC3Dint, RecordOverflow&gt; checkedSum = checkedFirst + checkedCount;
</span><del>-        if (checkedSum.hasOverflowed() || !validateVertexAttributes(checkedSum.unsafeGet())) {
-            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, &quot;drawArrays&quot;, &quot;attempt to access out of bounds arrays&quot;);
-            return;
</del><ins>+        Checked&lt;GC3Dint, RecordOverflow&gt; checkedPrimCount(primcount);
+        if (checkedSum.hasOverflowed() || checkedPrimCount.hasOverflowed() || !validateVertexAttributes(checkedSum.unsafeGet(), checkedPrimCount.unsafeGet())) {
+            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, &quot;attempt to access out of bounds arrays&quot;);
+            return false;
</ins><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         if (!validateVertexAttributes(0)) {
</span><del>-            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, &quot;drawArrays&quot;, &quot;attribs not setup correctly&quot;);
-            return;
</del><ins>+            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, &quot;attribs not setup correctly&quot;);
+            return false;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     const char* reason = &quot;framebuffer incomplete&quot;;
</span><span class="cx">     if (m_framebufferBinding &amp;&amp; !m_framebufferBinding-&gt;onAccess(graphicsContext3D(), !isResourceSafe(), &amp;reason)) {
</span><del>-        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, &quot;drawArrays&quot;, reason);
-        return;
</del><ins>+        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    return true;
+}
+
+void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count, ExceptionCode&amp; ec)
+{
+    UNUSED_PARAM(ec);
+
+    if (!validateDrawArrays(&quot;drawArrays&quot;, mode, first, count, 0))
+        return;
+
</ins><span class="cx">     clearIfComposited();
</span><span class="cx"> 
</span><span class="cx">     bool vertexAttrib0Simulated = false;
</span><span class="lines">@@ -1998,16 +2018,14 @@
</span><span class="cx">     cleanupAfterGraphicsCall(true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, ExceptionCode&amp; ec)
</del><ins>+bool WebGLRenderingContext::validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned&amp; numElements)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(ec);
</del><ins>+    if (isContextLost() || !validateDrawMode(functionName, mode))
+        return false;
</ins><span class="cx"> 
</span><del>-    if (isContextLost() || !validateDrawMode(&quot;drawElements&quot;, mode))
-        return;
</del><ins>+    if (!validateStencilSettings(functionName))
+        return false;
</ins><span class="cx"> 
</span><del>-    if (!validateStencilSettings(&quot;drawElements&quot;))
-        return;
-
</del><span class="cx">     switch (type) {
</span><span class="cx">     case GraphicsContext3D::UNSIGNED_BYTE:
</span><span class="cx">     case GraphicsContext3D::UNSIGNED_SHORT:
</span><span class="lines">@@ -2015,55 +2033,66 @@
</span><span class="cx">     case GraphicsContext3D::UNSIGNED_INT:
</span><span class="cx">         if (m_oesElementIndexUint)
</span><span class="cx">             break;
</span><del>-        synthesizeGLError(GraphicsContext3D::INVALID_ENUM, &quot;drawElements&quot;, &quot;invalid type&quot;);
-        return;
</del><ins>+        synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, &quot;invalid type&quot;);
+        return false;
</ins><span class="cx">     default:
</span><del>-        synthesizeGLError(GraphicsContext3D::INVALID_ENUM, &quot;drawElements&quot;, &quot;invalid type&quot;);
-        return;
</del><ins>+        synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, &quot;invalid type&quot;);
+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (count &lt; 0 || offset &lt; 0) {
</span><del>-        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;drawElements&quot;, &quot;count or offset &lt; 0&quot;);
-        return;
</del><ins>+        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, &quot;count or offset &lt; 0&quot;);
+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!count) {
</span><span class="cx">         cleanupAfterGraphicsCall(true);
</span><del>-        return;
</del><ins>+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!m_boundVertexArrayObject-&gt;getElementArrayBuffer()) {
</span><del>-        synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, &quot;drawElements&quot;, &quot;no ELEMENT_ARRAY_BUFFER bound&quot;);
-        return;
</del><ins>+        synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, &quot;no ELEMENT_ARRAY_BUFFER bound&quot;);
+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    unsigned numElements = 0;
</del><span class="cx">     if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
</span><span class="cx">         // Ensure we have a valid rendering state
</span><span class="cx">         if (!validateElementArraySize(count, type, static_cast&lt;GC3Dintptr&gt;(offset))) {
</span><del>-            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, &quot;drawElements&quot;, &quot;request out of bounds for current ELEMENT_ARRAY_BUFFER&quot;);
-            return;
</del><ins>+            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, &quot;request out of bounds for current ELEMENT_ARRAY_BUFFER&quot;);
+            return false;
</ins><span class="cx">         }
</span><span class="cx">         if (!count)
</span><del>-            return;
</del><ins>+            return false;
</ins><span class="cx">         if (!validateIndexArrayConservative(type, numElements) || !validateVertexAttributes(numElements)) {
</span><span class="cx">             if (!validateIndexArrayPrecise(count, type, static_cast&lt;GC3Dintptr&gt;(offset), numElements) || !validateVertexAttributes(numElements)) {
</span><del>-                synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, &quot;drawElements&quot;, &quot;attempt to access out of bounds arrays&quot;);
-                return;
</del><ins>+                synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, &quot;attempt to access out of bounds arrays&quot;);
+                return false;
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         if (!validateVertexAttributes(0)) {
</span><del>-            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, &quot;drawElements&quot;, &quot;attribs not setup correctly&quot;);
-            return;
</del><ins>+            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, &quot;attribs not setup correctly&quot;);
+            return false;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     const char* reason = &quot;framebuffer incomplete&quot;;
</span><span class="cx">     if (m_framebufferBinding &amp;&amp; !m_framebufferBinding-&gt;onAccess(graphicsContext3D(), !isResourceSafe(), &amp;reason)) {
</span><del>-        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, &quot;drawElements&quot;, reason);
</del><ins>+        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
+        return false;
+    }
+
+    return true;
+}
+
+void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, ExceptionCode&amp; ec)
+{
+    UNUSED_PARAM(ec);
+
+    unsigned numElements = 0;
+    if (!validateDrawElements(&quot;drawElements&quot;, mode, count, type, offset, numElements))
</ins><span class="cx">         return;
</span><del>-    }
</del><ins>+
</ins><span class="cx">     clearIfComposited();
</span><span class="cx"> 
</span><span class="cx">     bool vertexAttrib0Simulated = false;
</span><span class="lines">@@ -2477,6 +2506,13 @@
</span><span class="cx">         }
</span><span class="cx">         return m_extDrawBuffers.get();
</span><span class="cx">     }
</span><ins>+    if (equalIgnoringCase(name, &quot;ANGLE_instanced_arrays&quot;) &amp;&amp; ANGLEInstancedArrays::supported(this)) {
+        if (!m_angleInstancedArrays) {
+            m_context-&gt;getExtensions()-&gt;ensureEnabled(&quot;GL_ANGLE_instanced_arrays&quot;);
+            m_angleInstancedArrays = ANGLEInstancedArrays::create(this);
+        }
+        return m_angleInstancedArrays.get();
+    }
</ins><span class="cx">     if (allowPrivilegedExtensions()) {
</span><span class="cx">         if (equalIgnoringCase(name, &quot;WEBGL_debug_renderer_info&quot;)) {
</span><span class="cx">             if (!m_webglDebugRendererInfo)
</span><span class="lines">@@ -2998,6 +3034,8 @@
</span><span class="cx">         result.append(&quot;WEBGL_depth_texture&quot;);
</span><span class="cx">     if (supportsDrawBuffers())
</span><span class="cx">         result.append(&quot;EXT_draw_buffers&quot;);
</span><ins>+    if (ANGLEInstancedArrays::supported(this))
+        result.append(&quot;ANGLE_instanced_arrays&quot;);
</ins><span class="cx"> 
</span><span class="cx">     if (allowPrivilegedExtensions()) {
</span><span class="cx">         if (m_context-&gt;getExtensions()-&gt;supports(&quot;GL_ANGLE_translated_shader_source&quot;))
</span><span class="lines">@@ -3210,14 +3248,22 @@
</span><span class="cx"> WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GC3Duint index, GC3Denum pname, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(ec);
</span><ins>+
</ins><span class="cx">     if (isContextLost())
</span><span class="cx">         return WebGLGetInfo();
</span><ins>+
</ins><span class="cx">     WebGLStateRestorer(this, false);
</span><ins>+
</ins><span class="cx">     if (index &gt;= m_maxVertexAttribs) {
</span><span class="cx">         synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;getVertexAttrib&quot;, &quot;index out of range&quot;);
</span><span class="cx">         return WebGLGetInfo();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     const WebGLVertexArrayObjectOES::VertexAttribState&amp; state = m_boundVertexArrayObject-&gt;getVertexAttribState(index);
</span><ins>+
+    if (m_angleInstancedArrays &amp;&amp; pname == GraphicsContext3D::VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)
+        return WebGLGetInfo(state.divisor);
+
</ins><span class="cx">     switch (pname) {
</span><span class="cx">     case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
</span><span class="cx">         if ((!isGLES2Compliant() &amp;&amp; !index &amp;&amp; m_boundVertexArrayObject-&gt;getVertexAttribState(0).bufferBinding == m_vertexAttrib0Buffer)
</span><span class="lines">@@ -6102,6 +6148,86 @@
</span><span class="cx">     return m_drawBuffersSupported;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebGLRenderingContext::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
+{
+    if (!validateDrawArrays(&quot;drawArraysInstanced&quot;, mode, first, count, primcount))
+        return;
+
+    if (primcount &lt; 0) {
+        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;drawArraysInstanced&quot;, &quot;primcount &lt; 0&quot;);
+        return;
+    }
+
+    if (!primcount) {
+        cleanupAfterGraphicsCall(true);
+        return;
+    }
+
+    clearIfComposited();
+
+    bool vertexAttrib0Simulated = false;
+    if (!isGLES2Compliant())
+        vertexAttrib0Simulated = simulateVertexAttrib0(first + count - 1);
+    if (!isGLES2NPOTStrict())
+        checkTextureCompleteness(&quot;drawArraysInstanced&quot;, true);
+    UNUSED_PARAM(primcount);
+    m_context-&gt;drawArraysInstanced(mode, first, count, primcount);
+    if (!isGLES2Compliant() &amp;&amp; vertexAttrib0Simulated)
+        restoreStatesAfterVertexAttrib0Simulation();
+    if (!isGLES2NPOTStrict())
+        checkTextureCompleteness(&quot;drawArraysInstanced&quot;, false);
+    cleanupAfterGraphicsCall(true);
+}
+
+void WebGLRenderingContext::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)
+{
+    unsigned numElements = 0;
+    if (!validateDrawElements(&quot;drawElementsInstanced&quot;, mode, count, type, offset, numElements))
+        return;
+
+    if (primcount &lt; 0) {
+        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;drawElementsInstanced&quot;, &quot;primcount &lt; 0&quot;);
+        return;
+    }
+
+    if (!primcount) {
+        cleanupAfterGraphicsCall(true);
+        return;
+    }
+
+    clearIfComposited();
+
+    bool vertexAttrib0Simulated = false;
+    if (!isGLES2Compliant()) {
+        if (!numElements)
+            validateIndexArrayPrecise(count, type, static_cast&lt;GC3Dintptr&gt;(offset), numElements);
+        vertexAttrib0Simulated = simulateVertexAttrib0(numElements);
+    }
+    if (!isGLES2NPOTStrict())
+        checkTextureCompleteness(&quot;drawElementsInstanced&quot;, true);
+    m_context-&gt;drawElementsInstanced(mode, count, type, static_cast&lt;GC3Dintptr&gt;(offset), primcount);
+    if (!isGLES2Compliant() &amp;&amp; vertexAttrib0Simulated)
+        restoreStatesAfterVertexAttrib0Simulation();
+    if (!isGLES2NPOTStrict())
+        checkTextureCompleteness(&quot;drawElementsInstanced&quot;, false);
+    cleanupAfterGraphicsCall(true);
+}
+
+void WebGLRenderingContext::vertexAttribDivisor(GC3Duint index, GC3Duint divisor)
+{
+    if (isContextLost())
+        return;
+
+    if (index &gt;= m_maxVertexAttribs) {
+        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, &quot;vertexAttribDivisor&quot;, &quot;index out of range&quot;);
+        return;
+    }
+
+    m_boundVertexArrayObject-&gt;setVertexAttribDivisor(index, divisor);
+    m_context-&gt;vertexAttribDivisor(index, divisor);
+}
+
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBGL)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class ANGLEInstancedArrays;
</ins><span class="cx"> class EXTDrawBuffers;
</span><span class="cx"> class EXTTextureFilterAnisotropic;
</span><span class="cx"> class HTMLImageElement;
</span><span class="lines">@@ -323,6 +324,11 @@
</span><span class="cx">     
</span><span class="cx">     unsigned getMaxVertexAttribs() const { return m_maxVertexAttribs; }
</span><span class="cx"> 
</span><ins>+    // ANGLE_instanced_arrays extension functions.
+    void drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount);
+    void drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount);
+    void vertexAttribDivisor(GC3Duint index, GC3Duint divisor);
+
</ins><span class="cx"> private:
</span><span class="cx">     friend class EXTDrawBuffers;
</span><span class="cx">     friend class WebGLFramebuffer;
</span><span class="lines">@@ -378,11 +384,13 @@
</span><span class="cx"> 
</span><span class="cx">     // Precise but slow index validation -- only done if conservative checks fail
</span><span class="cx">     bool validateIndexArrayPrecise(GC3Dsizei count, GC3Denum type, GC3Dintptr offset, unsigned&amp; numElementsRequired);
</span><del>-    // If numElements &lt;= 0, we only check if each enabled vertex attribute is bound to a buffer.
-    bool validateVertexAttributes(unsigned numElements);
</del><ins>+    bool validateVertexAttributes(unsigned elementCount, unsigned primitiveCount = 0);
</ins><span class="cx"> 
</span><span class="cx">     bool validateWebGLObject(const char*, WebGLObject*);
</span><span class="cx"> 
</span><ins>+    bool validateDrawArrays(const char* functionName, GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount);
+    bool validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned&amp; numElements);
+
</ins><span class="cx">     // Adds a compressed texture format.
</span><span class="cx">     void addCompressedTextureFormat(GC3Denum);
</span><span class="cx"> 
</span><span class="lines">@@ -540,6 +548,7 @@
</span><span class="cx">     OwnPtr&lt;WebGLCompressedTexturePVRTC&gt; m_webglCompressedTexturePVRTC;
</span><span class="cx">     OwnPtr&lt;WebGLCompressedTextureS3TC&gt; m_webglCompressedTextureS3TC;
</span><span class="cx">     OwnPtr&lt;WebGLDepthTexture&gt; m_webglDepthTexture;
</span><ins>+    OwnPtr&lt;ANGLEInstancedArrays&gt; m_angleInstancedArrays;
</ins><span class="cx"> 
</span><span class="cx">     // Helpers for getParameter and others
</span><span class="cx">     WebGLGetInfo getBooleanParameter(GC3Denum);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLVertexArrayObjectOEScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.cpp (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.cpp        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.cpp        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -143,6 +143,12 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebGLVertexArrayObjectOES::setVertexAttribDivisor(GC3Duint index, GC3Duint divisor)
+{
+    VertexAttribState&amp; state = m_vertexAttribState[index];
+    state.divisor = divisor;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif // ENABLE(WEBGL)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLVertexArrayObjectOESh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx">             , stride(16)
</span><span class="cx">             , originalStride(0)
</span><span class="cx">             , offset(0)
</span><ins>+            , divisor(0)
</ins><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="lines">@@ -70,6 +71,7 @@
</span><span class="cx">         GC3Dsizei stride;
</span><span class="cx">         GC3Dsizei originalStride;
</span><span class="cx">         GC3Dintptr offset;
</span><ins>+        GC3Duint divisor;
</ins><span class="cx">     };
</span><span class="cx">     
</span><span class="cx">     bool isDefaultObject() const { return m_type == VaoTypeDefault; }
</span><span class="lines">@@ -84,6 +86,8 @@
</span><span class="cx">     void setVertexAttribState(GC3Duint, GC3Dsizei, GC3Dint, GC3Denum, GC3Dboolean, GC3Dsizei, GC3Dintptr, PassRefPtr&lt;WebGLBuffer&gt;);
</span><span class="cx">     void unbindBuffer(PassRefPtr&lt;WebGLBuffer&gt;);
</span><span class="cx"> 
</span><ins>+    void setVertexAttribDivisor(GC3Duint index, GC3Duint divisor);
+
</ins><span class="cx"> private:
</span><span class="cx">     WebGLVertexArrayObjectOES(WebGLRenderingContext*, VaoType);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContext3Dh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -425,7 +425,8 @@
</span><span class="cx">         UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241,
</span><span class="cx">         CONTEXT_LOST_WEBGL = 0x9242,
</span><span class="cx">         UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243,
</span><del>-        BROWSER_DEFAULT_WEBGL = 0x9244
</del><ins>+        BROWSER_DEFAULT_WEBGL = 0x9244,
+        VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     // Context creation attributes.
</span><span class="lines">@@ -827,6 +828,10 @@
</span><span class="cx"> 
</span><span class="cx">     void reshape(int width, int height);
</span><span class="cx"> 
</span><ins>+    void drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount);
+    void drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount);
+    void vertexAttribDivisor(GC3Duint index, GC3Duint divisor);
+
</ins><span class="cx"> #if PLATFORM(GTK) || PLATFORM(EFL) || USE(CAIRO)
</span><span class="cx">     void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
</span><span class="cx">                        int canvasWidth, int canvasHeight, PlatformContextCairo* context);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsiosGraphicsContext3DIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ios/GraphicsContext3DIOS.h (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ios/GraphicsContext3DIOS.h        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/platform/graphics/ios/GraphicsContext3DIOS.h        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -43,6 +43,10 @@
</span><span class="cx"> #define glRenderbufferStorageEXT glRenderbufferStorage
</span><span class="cx"> #define glRenderbufferStorageMultisampleEXT glRenderbufferStorageMultisampleAPPLE
</span><span class="cx"> 
</span><ins>+#define glDrawArraysInstancedARB glDrawArraysInstancedEXT
+#define glDrawElementsInstancedARB glDrawElementsInstancedEXT
+#define glVertexAttribDivisorARB glVertexAttribDivisorEXT
+
</ins><span class="cx"> #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0
</span><span class="cx"> #define GL_DEPTH24_STENCIL8_EXT GL_DEPTH24_STENCIL8_OES
</span><span class="cx"> #define GL_DEPTH_ATTACHMENT_EXT  GL_DEPTH_ATTACHMENT
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacGraphicsContext3DMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -370,6 +370,44 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext3D::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
+{
+#if PLATFORM(IOS) || PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
+    makeContextCurrent();
+    ::glDrawArraysInstancedARB(mode, first, count, primcount);
+#else
+    UNUSED_PARAM(mode);
+    UNUSED_PARAM(first);
+    UNUSED_PARAM(count);
+    UNUSED_PARAM(primcount);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext3D::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)
+{
+#if PLATFORM(IOS) || PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
+    makeContextCurrent();
+    ::glDrawElementsInstancedARB(mode, count, type, reinterpret_cast&lt;GLvoid*&gt;(static_cast&lt;intptr_t&gt;(offset)), primcount);
+#else
+    UNUSED_PARAM(mode);
+    UNUSED_PARAM(count);
+    UNUSED_PARAM(type);
+    UNUSED_PARAM(offset);
+    UNUSED_PARAM(primcount);
+#endif
+}
+
+void GraphicsContext3D::vertexAttribDivisor(GC3Duint index, GC3Duint divisor)
+{
+#if PLATFORM(IOS) || PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
+    makeContextCurrent();
+    ::glVertexAttribDivisorARB(index, divisor);
+#else
+    UNUSED_PARAM(index);
+    UNUSED_PARAM(divisor);
+#endif
+}
+
+}
+
</ins><span class="cx"> #endif // USE(3D_GRAPHICS)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (162564 => 162565)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp        2014-01-22 23:27:06 UTC (rev 162564)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp        2014-01-22 23:47:24 UTC (rev 162565)
</span><span class="lines">@@ -351,6 +351,31 @@
</span><span class="cx">         ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(MAC)
+void GraphicsContext3D::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
+{
+    UNUSED_PARAM(mode);
+    UNUSED_PARAM(first);
+    UNUSED_PARAM(count);
+    UNUSED_PARAM(primcount);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext3D::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)
+{
+    UNUSED_PARAM(mode);
+    UNUSED_PARAM(count);
+    UNUSED_PARAM(type);
+    UNUSED_PARAM(offset);
+    UNUSED_PARAM(primcount);
+}
+
+void GraphicsContext3D::vertexAttribDivisor(GC3Duint index, GC3Duint divisor)
+{
+    UNUSED_PARAM(index);
+    UNUSED_PARAM(divisor);
+}
+#endif
+
+}
+
</ins><span class="cx"> #endif // USE(3D_GRAPHICS)
</span></span></pre>
</div>
</div>

</body>
</html>