Adds the WebGL Conformance Tests attrib folder.
https://bugs.webkit.org/show_bug.cgi?id=108901
Reviewed by Kenneth Russell.
* platform/chromium/TestExpectations:
* webgl/conformance/attribs/gl-disabled-vertex-attrib-expected.txt: Added.
* webgl/conformance/attribs/gl-disabled-vertex-attrib.html: Added.
* webgl/conformance/attribs/gl-enable-vertex-attrib-expected.txt: Added.
* webgl/conformance/attribs/gl-enable-vertex-attrib.html: Added.
* webgl/conformance/attribs/gl-vertex-attrib-expected.txt: Added.
* webgl/conformance/attribs/gl-vertex-attrib-render-expected.txt: Added.
* webgl/conformance/attribs/gl-vertex-attrib-render.html: Added.
* webgl/conformance/attribs/gl-vertex-attrib-zero-issues-expected.txt: Added.
* webgl/conformance/attribs/gl-vertex-attrib-zero-issues.html: Added.
* webgl/conformance/attribs/gl-vertex-attrib.html: Added.
* webgl/conformance/attribs/gl-vertexattribpointer-expected.txt: Added.
* webgl/conformance/attribs/gl-vertexattribpointer-offsets-expected.txt: Added.
* webgl/conformance/attribs/gl-vertexattribpointer-offsets.html: Added.
* webgl/conformance/attribs/gl-vertexattribpointer.html: Added.
* webgl/resources/webgl_test_files/conformance/attribs/00_test_list.txt: Added.
* webgl/resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html: Added.
* webgl/resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html: Added.
* webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html: Added.
* webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html: Added.
* webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html: Added.
* webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html: Added.
* webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4b4e458..70e484e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,34 @@
+2013-02-05 Gregg Tavares <gman@chromium.org>
+
+ Adds the WebGL Conformance Tests attrib folder.
+ https://bugs.webkit.org/show_bug.cgi?id=108901
+
+ Reviewed by Kenneth Russell.
+
+ * platform/chromium/TestExpectations:
+ * webgl/conformance/attribs/gl-disabled-vertex-attrib-expected.txt: Added.
+ * webgl/conformance/attribs/gl-disabled-vertex-attrib.html: Added.
+ * webgl/conformance/attribs/gl-enable-vertex-attrib-expected.txt: Added.
+ * webgl/conformance/attribs/gl-enable-vertex-attrib.html: Added.
+ * webgl/conformance/attribs/gl-vertex-attrib-expected.txt: Added.
+ * webgl/conformance/attribs/gl-vertex-attrib-render-expected.txt: Added.
+ * webgl/conformance/attribs/gl-vertex-attrib-render.html: Added.
+ * webgl/conformance/attribs/gl-vertex-attrib-zero-issues-expected.txt: Added.
+ * webgl/conformance/attribs/gl-vertex-attrib-zero-issues.html: Added.
+ * webgl/conformance/attribs/gl-vertex-attrib.html: Added.
+ * webgl/conformance/attribs/gl-vertexattribpointer-expected.txt: Added.
+ * webgl/conformance/attribs/gl-vertexattribpointer-offsets-expected.txt: Added.
+ * webgl/conformance/attribs/gl-vertexattribpointer-offsets.html: Added.
+ * webgl/conformance/attribs/gl-vertexattribpointer.html: Added.
+ * webgl/resources/webgl_test_files/conformance/attribs/00_test_list.txt: Added.
+ * webgl/resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html: Added.
+ * webgl/resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html: Added.
+ * webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html: Added.
+ * webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html: Added.
+ * webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html: Added.
+ * webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html: Added.
+ * webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html: Added.
+
2013-02-05 Matt Falkenhagen <falken@chromium.org>
Unreviewed gardening. Rebaseline navigator-detached-no-crash.html,
diff --git a/LayoutTests/platform/chromium/TestExpectations b/LayoutTests/platform/chromium/TestExpectations
index d823dc1d..a264bfc 100644
--- a/LayoutTests/platform/chromium/TestExpectations
+++ b/LayoutTests/platform/chromium/TestExpectations
@@ -1432,6 +1432,11 @@
webkit.org/b/75276 [ Android ] fast/repaint/shadow-multiple-strict-vertical.html [ ImageOnlyFailure ]
# -----------------------------------------------------------------
+# WebGL Tests
+# -----------------------------------------------------------------
+crbug.com/174268 webgl/conformance/attribs/gl-vertex-attrib-zero-issues.html [ Skip ]
+
+# -----------------------------------------------------------------
# Other failures
# -----------------------------------------------------------------
diff --git a/LayoutTests/webgl/conformance/attribs/gl-disabled-vertex-attrib-expected.txt b/LayoutTests/webgl/conformance/attribs/gl-disabled-vertex-attrib-expected.txt
new file mode 100644
index 0000000..67b02b4
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-disabled-vertex-attrib-expected.txt
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/attribs/gl-disabled-vertex-attrib.html b/LayoutTests/webgl/conformance/attribs/gl-disabled-vertex-attrib.html
new file mode 100644
index 0000000..dc4a829
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-disabled-vertex-attrib.html
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for gl-disabled-vertex-attrib.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html">../../resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/attribs/gl-enable-vertex-attrib-expected.txt b/LayoutTests/webgl/conformance/attribs/gl-enable-vertex-attrib-expected.txt
new file mode 100644
index 0000000..0fdb23b
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-enable-vertex-attrib-expected.txt
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/attribs/gl-enable-vertex-attrib.html b/LayoutTests/webgl/conformance/attribs/gl-enable-vertex-attrib.html
new file mode 100644
index 0000000..6a6d731
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-enable-vertex-attrib.html
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for gl-enable-vertex-attrib.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html">../../resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-expected.txt b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-expected.txt
new file mode 100644
index 0000000..67524926
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-expected.txt
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-render-expected.txt b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-render-expected.txt
new file mode 100644
index 0000000..58306ae
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-render-expected.txt
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-render.html b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-render.html
new file mode 100644
index 0000000..cfcc3f7
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-render.html
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for gl-vertex-attrib-render.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html">../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-zero-issues-expected.txt b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-zero-issues-expected.txt
new file mode 100644
index 0000000..fa8eae5
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-zero-issues-expected.txt
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-zero-issues.html b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-zero-issues.html
new file mode 100644
index 0000000..91d4690
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib-zero-issues.html
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for gl-vertex-attrib-zero-issues.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html">../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib.html b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib.html
new file mode 100644
index 0000000..6bb0d93
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertex-attrib.html
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for gl-vertex-attrib.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html">../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-expected.txt b/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-expected.txt
new file mode 100644
index 0000000..e7c9bab
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-expected.txt
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-offsets-expected.txt b/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-offsets-expected.txt
new file mode 100644
index 0000000..09292b8
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-offsets-expected.txt
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-offsets.html b/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-offsets.html
new file mode 100644
index 0000000..f5384af
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer-offsets.html
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for gl-vertexattribpointer-offsets.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html">../../resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer.html b/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer.html
new file mode 100644
index 0000000..cdf4bf9
--- /dev/null
+++ b/LayoutTests/webgl/conformance/attribs/gl-vertexattribpointer.html
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for gl-vertexattribpointer.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html">../../resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/00_test_list.txt b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/00_test_list.txt
new file mode 100644
index 0000000..358bb65
--- /dev/null
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/00_test_list.txt
@@ -0,0 +1,8 @@
+gl-enable-vertex-attrib.html
+--min-version 1.0.2 gl-vertex-attrib-render.html
+--min-version 1.0.2 gl-disabled-vertex-attrib.html
+gl-vertex-attrib-zero-issues.html
+gl-vertex-attrib.html
+gl-vertexattribpointer-offsets.html
+gl-vertexattribpointer.html
+
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html
new file mode 100644
index 0000000..ff8081f
--- /dev/null
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html
@@ -0,0 +1,101 @@
+<!--
+
+/*
+** Copyright (c) 2012 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
+** "Materials"), 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 "AS IS", 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.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Disabled Vertex Attrib Test</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"> </script>
+<script src="../resources/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="50" height="50">
+</canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 a_position;
+attribute vec4 a_color;
+varying vec4 v_color;
+void main() {
+ gl_Position = a_position;
+ v_color = a_color;
+}
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+precision mediump float;
+varying vec4 v_color;
+bool isCorrectColor(vec4 v) {
+ return v.x == 0.0 && v.y == 0.0 && v.z == 0.0 && v.w == 1.0;
+}
+void main() {
+ gl_FragColor = isCorrectColor(v_color) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+}
+</script>
+
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+description();
+
+var gl = wtu.create3DContext("example");
+
+var numVertexAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
+for (var ii = 0; ii < numVertexAttribs; ++ii) {
+ var colorLocation = (ii + 1) % numVertexAttribs;
+ var positionLocation = colorLocation ? 0 : 1;
+
+ if (positionLocation != 0) {
+ // We need to create a new 3d context for testing attrib 0
+ // since we've already effected attrib 0 on other tests.
+ gl = wtu.create3DContext();
+ }
+
+ debug("testing attrib: " + colorLocation);
+ var program = wtu.setupProgram(
+ gl,
+ ['vshader', 'fshader'],
+ ['a_position', 'a_color'],
+ [positionLocation, colorLocation]);
+ var gridRes = 1;
+ wtu.setupQuad(gl, gridRes, positionLocation);
+ wtu.drawIndexedQuad(gl, gridRes);
+ wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green");
+}
+glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors");
+
+var successfullyParsed = true;
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
+
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html
new file mode 100644
index 0000000..79703a0
--- /dev/null
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-enable-vertex-attrib.html
@@ -0,0 +1,83 @@
+<!--
+
+/*
+** Copyright (c) 2012 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
+** "Materials"), 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 "AS IS", 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.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+<meta charset="utf-8">
+ <title>WebGL Enable Vertex Attrib Test</title>
+ <link rel="stylesheet" href="../../resources/js-test-style.css"/>
+ <script src="../../resources/js-test-pre.js"></script>
+ <script src="../resources/webgl-test.js"> </script>
+ <script src="../resources/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="50" height="50">
+</canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vshader" type="x-shader/x-vertex">
+ attribute vec4 vPosition;
+ void main()
+ {
+ gl_Position = vPosition;
+ }
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+ void main()
+ {
+ gl_FragColor = vec4(1.0,0.0,0.0,1.0);
+ }
+</script>
+
+<script>
+"use strict";
+description("tests that turning on attribs that have no buffer bound fails to draw");
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["vPosition"]);
+
+var vertexObject = gl.createBuffer();
+gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5,0, 0.5,-0.5,0 ]), gl.STATIC_DRAW);
+gl.enableVertexAttribArray(0);
+gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+
+gl.enableVertexAttribArray(3);
+glErrorShouldBe(gl, gl.NO_ERROR);
+
+gl.drawArrays(gl.TRIANGLES, 0, 3);
+glErrorShouldBe(gl, gl.INVALID_OPERATION);
+
+var successfullyParsed = true;
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
+
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html
new file mode 100644
index 0000000..22cfcf9
--- /dev/null
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-render.html
@@ -0,0 +1,111 @@
+<!--
+
+/*
+** Copyright (c) 2012 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
+** "Materials"), 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 "AS IS", 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.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <link rel="stylesheet" href="../../resources/js-test-style.css"/>
+ <script src="../../resources/js-test-pre.js"></script>
+ <script src="../resources/webgl-test.js"></script>
+ <script src="../resources/webgl-test-utils.js"></script>
+ <script id='vshader' type='x-shader'>
+ attribute vec4 a;
+ attribute vec2 p;
+ void main() {
+ gl_Position = vec4(p.x + a.x + a.y + a.z + a.w, p.y, 0.0, 1.0);
+ }
+ </script>
+ <script id='fshader' type='x-shader'>
+ precision mediump float;
+ void main() {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ }
+ </script>
+ <script>
+ "use strict";
+ function checkRedPortion(gl, w, low, high) {
+ var buf = new Uint8Array(w * w * 4);
+ gl.readPixels(0, 0, w, w, gl.RGBA, gl.UNSIGNED_BYTE, buf);
+ var i = 0;
+ for (; i < w; ++i) {
+ if (buf[i * 4 + 0] == 255 && buf[i * 4 + 1] == 0 && buf[i * 4 + 2] == 0 && buf[i * 4 + 3] == 255) {
+ break;
+ }
+ }
+ return low <= i && i <= high;
+ }
+
+ function runTest() {
+ var wtu = WebGLTestUtils;
+ var gl = wtu.create3DContext('testbed', { preserveDrawingBuffer : true });
+ if (!gl) {
+ testFailed('could not create context');
+ return;
+ }
+ var program = wtu.setupProgram(gl, ['vshader', 'fshader'], ['p', 'a'])
+
+ gl.enableVertexAttribArray(gl.p);
+ var pos = gl.createBuffer();
+ pos.type = gl.FLOAT;
+ pos.size = 2;
+ pos.num = 4;
+ gl.bindBuffer(gl.ARRAY_BUFFER, pos);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);
+
+ gl.vertexAttribPointer(0, pos.size, pos.type, false, 0, 0);
+
+ debug('Test vertexAttrib[1..4]fv by setting different combinations that add up to 1.5 and use that when rendering.');
+ var vals = [[0.5], [0.1,0.4], [0.2,-0.2,0.5], [-1.0,0.3,0.2,2.0]];
+
+ for (var j = 0; j < 4; ++j) {
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+ gl['vertexAttrib' + (j+1) + 'fv'](1, vals[j]);
+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, pos.num);
+
+ if (checkRedPortion(gl, 50, 50 * 0.7, 50 * 0.8)) {
+ testPassed('Attribute of size ' + (j+1) + ' was set correctly');
+ } else {
+ testFailed('Attribute of size ' + (j+1) + ' was not set correctly');
+ }
+ }
+ }
+ </script>
+ </head>
+ <body>
+ <canvas id="testbed" width="50" height="50"></canvas>
+ <div id="description"></div>
+ <div id="console"></div>
+ <script>
+ "use strict";
+ description('Verify that using constant attributes works.');
+ runTest();
+ var successfullyParsed = true;
+ </script>
+ <script src="../../resources/js-test-post.js"></script>
+ </body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html
new file mode 100644
index 0000000..9d89849
--- /dev/null
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib-zero-issues.html
@@ -0,0 +1,153 @@
+<!--
+
+/*
+** Copyright (c) 2012 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
+** "Materials"), 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 "AS IS", 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.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Enable Vertex Attrib Zero Test</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"> </script>
+<script src="../resources/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="50" height="50">
+</canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vshader" type="x-shader/x-vertex">
+ attribute vec4 vPosition;
+ void main()
+ {
+ gl_Position = vPosition;
+ }
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+ void main()
+ {
+ gl_FragColor = vec4(0.0,1.0,0.0,1.0);
+ }
+</script>
+
+<script>
+"use strict";
+description("Test some of the issues of the difference between attrib 0 on OpenGL vs WebGL");
+debug("");
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+var g_program;
+var g_attribLocation;
+function setup(attribIndex) {
+ var program = wtu.setupProgram(
+ gl, ['vshader', 'fshader'], ['vPosition'], [attribIndex]);
+ g_program = program;
+ g_attribLocation = attribIndex;
+ shouldBe("g_attribLocation", "gl.getAttribLocation(g_program, 'vPosition')");
+ return program;
+}
+
+function setupVerts(numVerts) {
+ var verts = [
+ 1.0, 1.0, 0.0,
+ -1.0, 1.0, 0.0,
+ -1.0, -1.0, 0.0,
+ 1.0, 1.0, 0.0,
+ -1.0, -1.0, 0.0,
+ 1.0, -1.0, 0.0
+ ];
+ var positions = new Float32Array(numVerts * 3);
+ var indices = new Uint16Array(numVerts);
+ for (var ii = 0; ii < numVerts; ++ii) {
+ var ndx = ii % 6;
+ var dst = ii * 3;
+ var src = ndx * 3;
+ for (var jj = 0; jj < 3; ++jj) {
+ positions[dst + jj] = verts[src + jj];
+ }
+ indices[ii] = ii;
+ }
+ var vertexObject = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+ gl.bufferData(gl.ARRAY_BUFFER, positions, gl.STATIC_DRAW);
+ var indexBuffer = gl.createBuffer();
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
+ gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
+}
+
+var p0 = setup(0);
+var p3 = setup(3);
+setupVerts(60000);
+
+for (var ii = 0; ii < 5; ++ii) {
+ // test drawing with attrib 0
+ gl.useProgram(p0);
+ gl.enableVertexAttribArray(0);
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ gl.drawElements(gl.TRIANGLES, 60000, gl.UNSIGNED_SHORT, 0);
+ glErrorShouldBe(
+ gl, gl.NO_ERROR,
+ "drawing using attrib 0 with 6 verts");
+ wtu.checkCanvas(gl, [0, 255, 0, 255], "canvas should be green");
+ gl.disableVertexAttribArray(0);
+
+ // test drawing without attrib 0
+ gl.useProgram(p3);
+ gl.enableVertexAttribArray(3);
+ gl.vertexAttribPointer(3, 3, gl.FLOAT, false, 0, 0);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ gl.drawArrays(gl.TRIANGLES, 0, 60000);
+ glErrorShouldBe(
+ gl, gl.NO_ERROR,
+ "drawing using attrib 3 with 60000 verts");
+ wtu.checkCanvas(gl, [0, 255, 0, 255], "canvas should be green");
+ gl.disableVertexAttribArray(3);
+
+ // This second test of drawing without attrib0 unconvered a bug in chrome
+ // where after the draw without attrib0 the attrib 0 emulation code disabled
+ // attrib 0 and it was never re-enabled so this next draw failed.
+ gl.useProgram(p3);
+ gl.enableVertexAttribArray(3);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ gl.drawElements(gl.TRIANGLES, 60000, gl.UNSIGNED_SHORT, 0);
+ glErrorShouldBe(
+ gl, gl.NO_ERROR,
+ "drawing using attrib 3 with 60000 verts");
+ wtu.checkCanvas(gl, [0, 255, 0, 255], "canvas should be green");
+ gl.disableVertexAttribArray(3);
+}
+
+
+var successfullyParsed = true;
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
+
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html
new file mode 100644
index 0000000..49caaa3
--- /dev/null
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertex-attrib.html
@@ -0,0 +1,119 @@
+<!--
+
+/*
+** Copyright (c) 2012 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
+** "Materials"), 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 "AS IS", 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.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL vertexAttrib Conformance Tests</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas" width="2" height="2"> </canvas>
+<script>
+"use strict";
+description("This test ensures WebGL implementations vertexAttrib can be set and read.");
+
+debug("");
+debug("Canvas.getContext");
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("canvas");
+if (!gl) {
+ testFailed("context does not exist");
+} else {
+ testPassed("context exists");
+
+ debug("");
+ debug("Checking gl.vertexAttrib.");
+
+ var numVertexAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
+ for (var ii = 0; ii < numVertexAttribs; ++ii) {
+ gl.vertexAttrib1fv(ii, [1]);
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '1');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '0');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '0');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1');
+
+ gl.vertexAttrib2fv(ii, [1, 2]);
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '1');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '2');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '0');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1');
+
+ gl.vertexAttrib3fv(ii, [1, 2, 3]);
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '1');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '2');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '3');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1');
+
+ gl.vertexAttrib4fv(ii, [1, 2, 3, 4]);
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '1');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '2');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '3');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '4');
+
+ gl.vertexAttrib1f(ii, 5);
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '5');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '0');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '0');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1');
+
+ gl.vertexAttrib2f(ii, 6, 7);
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '6');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '7');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '0');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1');
+
+ gl.vertexAttrib3f(ii, 7, 8, 9);
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '7');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '8');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '9');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '1');
+
+ gl.vertexAttrib4f(ii, 6, 7, 8, 9);
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[0]', '6');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[1]', '7');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[2]', '8');
+ shouldBe('gl.getVertexAttrib(' + ii + ', gl.CURRENT_VERTEX_ATTRIB)[3]', '9');
+ }
+ glErrorShouldBe(gl, gl.NO_ERROR);
+}
+
+debug("");
+var successfullyParsed = true;
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html
new file mode 100644
index 0000000..4e62835
--- /dev/null
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer-offsets.html
@@ -0,0 +1,182 @@
+<!--
+
+/*
+** Copyright (c) 2012 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
+** "Materials"), 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 "AS IS", 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.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+<meta charset="utf-8">
+ <title>vertexattribpointer offsets test</title>
+ <link rel="stylesheet" href="../../resources/js-test-style.css"/>
+ <script src="../../resources/js-test-pre.js"></script>
+ <script src="../resources/webgl-test.js"> </script>
+ <script src="../resources/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="50" height="50">
+There is supposed to be an example drawing here, but it's not important.
+</canvas>
+<div id="description"></div>
+<div id="console"></div>
+ <script id="vshader" type="x-shader/x-vertex">
+ attribute vec4 vPosition;
+ void main()
+ {
+ gl_Position = vPosition;
+ }
+ </script>
+
+ <script id="fshader" type="x-shader/x-fragment">
+ precision mediump float;
+ uniform vec4 color;
+ void main()
+ {
+ gl_FragColor = color;
+ }
+ </script>
+
+ <script>
+ "use strict";
+ function init()
+ {
+ description("test vertexattribpointer offsets work");
+
+ var wtu = WebGLTestUtils;
+ var gl = wtu.create3DContext("example");
+ var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["vPosition"]);
+
+ var tests = [
+ { data: new Float32Array([ 0, 1, 0, 1, 0, 0, 0, 0, 0 ]),
+ type: gl.FLOAT,
+ componentSize: 4,
+ normalize: false,
+ },
+ { data: new Float32Array([ 0, 1, 0, 1, 0, 0, 0, 0, 0 ]),
+ type: gl.FLOAT,
+ componentSize: 4,
+ normalize: false,
+ },
+ { data: new Uint16Array([ 0, 32767, 0, 32767, 0, 0, 0, 0, 0 ]),
+ type: gl.SHORT,
+ componentSize: 2,
+ normalize: true,
+ },
+ { data: new Uint16Array([ 0, 65535, 0, 65535, 0, 0, 0, 0, 0 ]),
+ type: gl.UNSIGNED_SHORT,
+ componentSize: 2,
+ normalize: true,
+ },
+ { data: new Uint16Array([ 0, 1, 0, 1, 0, 0, 0, 0, 0 ]),
+ type: gl.UNSIGNED_SHORT,
+ componentSize: 2,
+ normalize: false,
+ },
+ { data: new Uint16Array([ 0, 1, 0, 1, 0, 0, 0, 0, 0 ]),
+ type: gl.SHORT,
+ componentSize: 2,
+ normalize: false,
+ },
+ { data: new Uint8Array([ 0, 127, 0, 127, 0, 0, 0, 0, 0 ]),
+ type: gl.BYTE,
+ componentSize: 1,
+ normalize: true,
+ },
+ { data: new Uint8Array([ 0, 255, 0, 255, 0, 0, 0, 0, 0 ]),
+ type: gl.UNSIGNED_BYTE,
+ componentSize: 1,
+ normalize: true,
+ },
+ { data: new Uint8Array([ 0, 1, 0, 1, 0, 0, 0, 0, 0 ]),
+ type: gl.BYTE,
+ componentSize: 1,
+ normalize: false,
+ },
+ { data: new Uint8Array([ 0, 1, 0, 1, 0, 0, 0, 0, 0 ]),
+ type: gl.UNSIGNED_BYTE,
+ componentSize: 1,
+ normalize: false,
+ }
+ ];
+
+ var vertexObject = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+ gl.bufferData(gl.ARRAY_BUFFER, 1024, gl.STATIC_DRAW);
+ gl.enableVertexAttribArray(0);
+
+ var colorLoc = gl.getUniformLocation(program, "color");
+ var kNumVerts = 3;
+ var kNumComponents = 3;
+
+ var count = 0;
+ for (var tt = 0; tt < tests.length; ++tt) {
+ var test = tests[tt];
+ for (var oo = 0; oo < 3; ++oo) {
+ for (var ss = 0; ss < 3; ++ss) {
+ var offset = (oo + 1) * test.componentSize;
+ var color = (count % 2) ? [1, 0, 0, 1] : [0, 1, 0, 1];
+ var stride = test.componentSize * kNumComponents + test.componentSize * ss;
+ debug("");
+ debug("check with " + wtu.glEnumToString(gl, test.type) + " at offset: " + offset + " with stride:" + stride + " normalize: " + test.normalize);
+ gl.uniform4fv(colorLoc, color);
+ var data = new Uint8Array(test.componentSize * kNumVerts * kNumComponents + stride * (kNumVerts - 1));
+ var view = new Uint8Array(test.data.buffer);
+ var size = test.componentSize * kNumComponents;
+ for (var jj = 0; jj < kNumVerts; ++jj) {
+ var off1 = jj * size;
+ var off2 = jj * stride;
+ for (var zz = 0; zz < size; ++zz) {
+ data[off2 + zz] = view[off1 + zz];
+ }
+ }
+ gl.bufferSubData(gl.ARRAY_BUFFER, offset, data);
+ gl.vertexAttribPointer(0, 3, test.type, test.normalize, stride, offset);
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+
+ var buf = new Uint8Array(50 * 50 * 4);
+ gl.readPixels(0, 0, 50, 50, gl.RGBA, gl.UNSIGNED_BYTE, buf);
+
+ var black = [0, 0, 0, 0];
+ var other = [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];
+ var otherMsg = "should be " + ((count % 2) ? "red" : "green")
+ wtu.checkCanvasRect(gl, 0, 0, 1, 1, black, "should be black", 0);
+ wtu.checkCanvasRect(gl, 0, 49, 1, 1, black, "should be black", 0);
+ wtu.checkCanvasRect(gl, 26, 40, 1, 1, other, otherMsg, 0);
+ wtu.checkCanvasRect(gl, 26, 27, 1, 1, other, otherMsg, 0);
+ wtu.checkCanvasRect(gl, 40, 27, 1, 1, other, otherMsg, 0);
+ ++count;
+ }
+ }
+ }
+ }
+
+ init();
+ var successfullyParsed = true;
+ </script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html
new file mode 100644
index 0000000..bea029d
--- /dev/null
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/attribs/gl-vertexattribpointer.html
@@ -0,0 +1,156 @@
+<!--
+
+/*
+** Copyright (c) 2012 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
+** "Materials"), 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 "AS IS", 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.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL vertexAttribPointer Conformance Tests</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas" width="2" height="2"> </canvas>
+<script>
+"use strict";
+description("This test checks vertexAttribPointer behaviors in WebGL.");
+
+debug("");
+debug("Canvas.getContext");
+
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("canvas");
+if (!gl) {
+ testFailed("context does not exist");
+} else {
+ testPassed("context exists");
+
+ debug("");
+ debug("Checking gl.vertexAttribPointer.");
+
+ if (!gl.FIXED) {
+ gl.FIXED = 0x140C;
+ }
+
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, 0, 0, 12);
+ glErrorShouldBe(gl, gl.INVALID_OPERATION,
+ "vertexAttribPointer should fail if no buffer is bound");
+
+ var vertexObject = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(0), gl.STATIC_DRAW);
+
+ gl.vertexAttribPointer(0, 1, gl.INT, 0, 0, 0);
+ glErrorShouldBe(gl, gl.INVALID_ENUM,
+ "vertexAttribPointer should not support INT");
+ gl.vertexAttribPointer(0, 1, gl.UNSIGNED_INT, 0, 0, 0);
+ glErrorShouldBe(gl, gl.INVALID_ENUM,
+ "vertexAttribPointer should not support UNSIGNED_INT");
+ gl.vertexAttribPointer(0, 1, gl.FIXED, 0, 0, 0);
+ glErrorShouldBe(gl, gl.INVALID_ENUM,
+ "vertexAttribPointer should not support FIXED");
+
+ var checkVertexAttribPointer = function(
+ gl, err, reason, size, type, normalize, stride, offset) {
+ gl.vertexAttribPointer(0, size, type, normalize, stride, offset);
+ glErrorShouldBe(gl, err,
+ "gl.vertexAttribPointer(0, " + size +
+ ", gl." + wtu.glEnumToString(gl, type) +
+ ", " + normalize +
+ ", " + stride +
+ ", " + offset +
+ ") should " + (err == gl.NO_ERROR ? "succeed " : "fail ") + reason);
+ }
+
+ var types = [
+ { type:gl.BYTE, bytesPerComponent: 1 },
+ { type:gl.UNSIGNED_BYTE, bytesPerComponent: 1 },
+ { type:gl.SHORT, bytesPerComponent: 2 },
+ { type:gl.UNSIGNED_SHORT, bytesPerComponent: 2 },
+ { type:gl.FLOAT, bytesPerComponent: 4 },
+ ];
+
+ for (var ii = 0; ii < types.length; ++ii) {
+ var info = types[ii];
+ debug("");
+ for (var size = 1; size <= 4; ++size) {
+ debug("");
+ debug("checking: " + wtu.glEnumToString(gl, info.type) + " with size " + size);
+ var bytesPerElement = size * info.bytesPerComponent;
+ var offsetSet = [
+ 0,
+ 1,
+ info.bytesPerComponent - 1,
+ info.bytesPerComponent,
+ info.bytesPerComponent + 1,
+ info.bytesPerComponent * 2];
+ for (var jj = 0; jj < offsetSet.length; ++jj) {
+ var offset = offsetSet[jj];
+ for (var kk = 0; kk < offsetSet.length; ++kk) {
+ var stride = offsetSet[kk];
+ var err = gl.NO_ERROR;
+ var reason = ""
+ if (offset % info.bytesPerComponent != 0) {
+ reason = "because offset is bad";
+ err = gl.INVALID_OPERATION;
+ }
+ if (stride % info.bytesPerComponent != 0) {
+ reason = "because stride is bad";
+ err = gl.INVALID_OPERATION;
+ }
+ checkVertexAttribPointer(
+ gl, err, reason, size, info.type, false, stride, offset);
+ }
+ var stride = Math.floor(255 / info.bytesPerComponent) * info.bytesPerComponent;
+
+ if (offset == 0) {
+ checkVertexAttribPointer(
+ gl, gl.NO_ERROR, "at stride limit",
+ size, info.type, false, stride, offset);
+ checkVertexAttribPointer(
+ gl, gl.INVALID_VALUE, "over stride limit",
+ size, info.type, false,
+ stride + info.bytesPerComponent, offset);
+ }
+ }
+ }
+ }
+}
+
+debug("");
+var successfullyParsed = true;
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>