summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/resources
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/canvas/test/webgl-conf/checkout/resources
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/resources')
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/1-channel.jpgbin0 -> 16799 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/3x3.pngbin0 -> 2806 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/blue-1x1.jpgbin0 -> 319 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/boolUniformShader.vert43
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/bug-32888-texture.pngbin0 -> 10050 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/floatUniformShader.vert43
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/fragmentShader.frag32
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/glsl-feature-tests.css29
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/glsl-generator.js1251
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-1024x1024.jpgbin0 -> 10314 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-256-with-128-alpha.pngbin0 -> 81 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-256.pngbin0 -> 78 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-default-gamma.pngbin0 -> 123 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma0.1.pngbin0 -> 133 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma1.0.pngbin0 -> 133 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma2.0.pngbin0 -> 133 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma4.0.pngbin0 -> 133 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma9.0.pngbin0 -> 133 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/gray-ramp.pngbin0 -> 123 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/green-2x2-16bit.pngbin0 -> 134 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/intArrayUniformShader.vert8
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/intUniformShader.vert43
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/js-test-style.css17
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/matForWebGL2UniformShader.vert42
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/matUniformShader.vert40
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/noopUniformShader.frag34
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/noopUniformShader.vert4
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/noopUniformShaderES3.frag40
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/noopUniformShaderES3.vert6
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/npot-video.mp4bin0 -> 38215 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/npot-video.theora.ogvbin0 -> 24630 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/npot-video.webmvp8.webmbin0 -> 51240 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/ogles-tests.css30
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/opengl_logo.jpgbin0 -> 5827 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green-blue-cyan-4x4.pngbin0 -> 469 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green-blue-cyan-4x4.psdbin0 -> 20380 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green-semi-transparent.pngbin0 -> 101 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green.mp4bin0 -> 92225 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green.pngbin0 -> 144 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green.svg6
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green.theora.ogvbin0 -> 10292 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green.webmvp8.webmbin0 -> 10979 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-green.webmvp9.webmbin0 -> 4309 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/red-indexed.pngbin0 -> 168 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/samplerForWebGL2UniformShader.frag34
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/samplerUniformShader.frag8
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/small-square-with-cie-rgb-profile.pngbin0 -> 868 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colormatch-profile.pngbin0 -> 871 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colorspin-profile.jpgbin0 -> 9145 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colorspin-profile.pngbin0 -> 841 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/small-square-with-e-srgb-profile.pngbin0 -> 1985 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/small-square-with-smpte-c-profile.pngbin0 -> 871 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/small-square-with-srgb-iec61966-2.1-profile.pngbin0 -> 3201 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/structUniformShader.vert53
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/thunderbird-logo-64x64.pngbin0 -> 63843 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/transparent-on-left-indexed.pngbin0 -> 972 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/uintUniformShader.vert38
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/uniformBlockShader.frag36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/uniformBlockShader.vert43
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/vertexShader.vert36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/webgl-logo.pngbin0 -> 9077 bytes
-rw-r--r--dom/canvas/test/webgl-conf/checkout/resources/zero-alpha.pngbin0 -> 89 bytes
62 files changed, 1916 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/1-channel.jpg b/dom/canvas/test/webgl-conf/checkout/resources/1-channel.jpg
new file mode 100644
index 000000000..2b16f42ab
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/1-channel.jpg
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/3x3.png b/dom/canvas/test/webgl-conf/checkout/resources/3x3.png
new file mode 100644
index 000000000..6cf1e7447
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/3x3.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/blue-1x1.jpg b/dom/canvas/test/webgl-conf/checkout/resources/blue-1x1.jpg
new file mode 100644
index 000000000..a70bbb021
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/blue-1x1.jpg
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/boolUniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/boolUniformShader.vert
new file mode 100644
index 000000000..9226b3b5c
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/boolUniformShader.vert
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+*/
+
+uniform bool bval;
+uniform bvec2 bval2;
+uniform bvec3 bval3;
+uniform bvec4 bval4;
+
+void main()
+{
+ bool allSet = bval
+ && bval2[0] && bval2[1]
+ && bval3[0] && bval3[1] && bval3[2]
+ && bval4[0] && bval4[1] && bval4[2] && bval4[3];
+ gl_Position = vec4((allSet ? 1.0 : -1.0), 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/bug-32888-texture.png b/dom/canvas/test/webgl-conf/checkout/resources/bug-32888-texture.png
new file mode 100644
index 000000000..e78cfe799
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/bug-32888-texture.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/floatUniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/floatUniformShader.vert
new file mode 100644
index 000000000..58991b474
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/floatUniformShader.vert
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+*/
+
+uniform float fval;
+uniform vec2 fval2;
+uniform vec3 fval3;
+uniform vec4 fval4;
+
+void main()
+{
+ float sum = fval
+ + fval2[0] + fval2[1]
+ + fval3[0] + fval3[1] + fval3[2]
+ + fval4[0] + fval4[1] + fval4[2] + fval4[3];
+ gl_Position = vec4(sum, 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/fragmentShader.frag b/dom/canvas/test/webgl-conf/checkout/resources/fragmentShader.frag
new file mode 100644
index 000000000..08596ed5d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/fragmentShader.frag
@@ -0,0 +1,32 @@
+/*
+Copyright (C) 2009 Apple Computer, 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 COMPUTER, INC. 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 COMPUTER, INC. OR
+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.
+*/
+
+// Workaround for non-compliant WebGL implementations (FIXME)
+varying mediump vec3 v_normal;
+
+void main()
+{
+ gl_FragColor = vec4(v_normal/2.0+vec3(0.5), 1);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/glsl-feature-tests.css b/dom/canvas/test/webgl-conf/checkout/resources/glsl-feature-tests.css
new file mode 100644
index 000000000..c8063d92b
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/glsl-feature-tests.css
@@ -0,0 +1,29 @@
+canvas {
+ background-color: white;
+ background-image: linear-gradient(0, rgba(200, 200, 200, .5) 50%, transparent 50%), linear-gradient(rgba(200, 200, 200, .5) 50%, transparent 50%);
+ background-size: 8px 8px;
+}
+
+.shader-source {
+ border: 1px dashed black;
+ padding: 1em;
+}
+
+.shader-source li:nth-child(odd) { background: #f8f8f8; }
+.shader-source li:nth-child(even) { background: #f0f0f0; }
+
+.testimages {
+}
+
+.testimages br {
+ clear: both;
+}
+
+.testimages > div {
+ float: left;
+ margin: 1em;
+}
+
+IMG {
+ border: 1px solid black;
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/glsl-generator.js b/dom/canvas/test/webgl-conf/checkout/resources/glsl-generator.js
new file mode 100644
index 000000000..dbb97eb02
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/glsl-generator.js
@@ -0,0 +1,1251 @@
+/*
+** 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.
+*/
+GLSLGenerator = (function() {
+
+var vertexShaderTemplate = [
+ "attribute vec4 aPosition;",
+ "",
+ "varying vec4 vColor;",
+ "",
+ "$(extra)",
+ "$(emu)",
+ "",
+ "void main()",
+ "{",
+ " gl_Position = aPosition;",
+ " vec2 texcoord = vec2(aPosition.xy * 0.5 + vec2(0.5, 0.5));",
+ " vec4 color = vec4(",
+ " texcoord,",
+ " texcoord.x * texcoord.y,",
+ " (1.0 - texcoord.x) * texcoord.y * 0.5 + 0.5);",
+ " $(test)",
+ "}"
+].join("\n");
+
+var fragmentShaderTemplate = [
+ "precision mediump float;",
+ "",
+ "varying vec4 vColor;",
+ "",
+ "$(extra)",
+ "$(emu)",
+ "",
+ "void main()",
+ "{",
+ " $(test)",
+ "}"
+].join("\n");
+
+var baseVertexShader = [
+ "attribute vec4 aPosition;",
+ "",
+ "varying vec4 vColor;",
+ "",
+ "void main()",
+ "{",
+ " gl_Position = aPosition;",
+ " vec2 texcoord = vec2(aPosition.xy * 0.5 + vec2(0.5, 0.5));",
+ " vColor = vec4(",
+ " texcoord,",
+ " texcoord.x * texcoord.y,",
+ " (1.0 - texcoord.x) * texcoord.y * 0.5 + 0.5);",
+ "}"
+].join("\n");
+
+var baseVertexShaderWithColor = [
+ "attribute vec4 aPosition;",
+ "attribute vec4 aColor;",
+ "",
+ "varying vec4 vColor;",
+ "",
+ "void main()",
+ "{",
+ " gl_Position = aPosition;",
+ " vColor = aColor;",
+ "}"
+].join("\n");
+
+var baseFragmentShader = [
+ "precision mediump float;",
+ "varying vec4 vColor;",
+ "",
+ "void main()",
+ "{",
+ " gl_FragColor = vColor;",
+ "}"
+].join("\n");
+
+var types = [
+ { type: "float",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return $(func)_base($(baseArgs));",
+ "}"].join("\n")
+ },
+ { type: "vec2",
+ code: [
+ "vec2 $(func)_emu($(args)) {",
+ " return vec2(",
+ " $(func)_base($(baseArgsX)),",
+ " $(func)_base($(baseArgsY)));",
+ "}"].join("\n")
+ },
+ { type: "vec3",
+ code: [
+ "vec3 $(func)_emu($(args)) {",
+ " return vec3(",
+ " $(func)_base($(baseArgsX)),",
+ " $(func)_base($(baseArgsY)),",
+ " $(func)_base($(baseArgsZ)));",
+ "}"].join("\n")
+ },
+ { type: "vec4",
+ code: [
+ "vec4 $(func)_emu($(args)) {",
+ " return vec4(",
+ " $(func)_base($(baseArgsX)),",
+ " $(func)_base($(baseArgsY)),",
+ " $(func)_base($(baseArgsZ)),",
+ " $(func)_base($(baseArgsW)));",
+ "}"].join("\n")
+ }
+];
+
+var bvecTypes = [
+ { type: "bvec2",
+ code: [
+ "bvec2 $(func)_emu($(args)) {",
+ " return bvec2(",
+ " $(func)_base($(baseArgsX)),",
+ " $(func)_base($(baseArgsY)));",
+ "}"].join("\n")
+ },
+ { type: "bvec3",
+ code: [
+ "bvec3 $(func)_emu($(args)) {",
+ " return bvec3(",
+ " $(func)_base($(baseArgsX)),",
+ " $(func)_base($(baseArgsY)),",
+ " $(func)_base($(baseArgsZ)));",
+ "}"].join("\n")
+ },
+ { type: "bvec4",
+ code: [
+ "vec4 $(func)_emu($(args)) {",
+ " return bvec4(",
+ " $(func)_base($(baseArgsX)),",
+ " $(func)_base($(baseArgsY)),",
+ " $(func)_base($(baseArgsZ)),",
+ " $(func)_base($(baseArgsW)));",
+ "}"].join("\n")
+ }
+];
+
+var replaceRE = /\$\((\w+)\)/g;
+
+var replaceParams = function(str) {
+ var args = arguments;
+ return str.replace(replaceRE, function(str, p1, offset, s) {
+ for (var ii = 1; ii < args.length; ++ii) {
+ if (args[ii][p1] !== undefined) {
+ return args[ii][p1];
+ }
+ }
+ throw "unknown string param '" + p1 + "'";
+ });
+};
+
+var generateReferenceShader = function(
+ shaderInfo, template, params, typeInfo, test) {
+ var input = shaderInfo.input;
+ var output = shaderInfo.output;
+ var feature = params.feature;
+ var testFunc = params.testFunc;
+ var emuFunc = params.emuFunc || "";
+ var extra = params.extra || '';
+ var args = params.args || "$(type) value";
+ var type = typeInfo.type;
+ var typeCode = typeInfo.code;
+
+ var baseArgs = params.baseArgs || "value$(field)";
+ var baseArgsX = replaceParams(baseArgs, {field: ".x"});
+ var baseArgsY = replaceParams(baseArgs, {field: ".y"});
+ var baseArgsZ = replaceParams(baseArgs, {field: ".z"});
+ var baseArgsW = replaceParams(baseArgs, {field: ".w"});
+ var baseArgs = replaceParams(baseArgs, {field: ""});
+
+ test = replaceParams(test, {
+ input: input,
+ output: output,
+ func: feature + "_emu"
+ });
+ emuFunc = replaceParams(emuFunc, {
+ func: feature
+ });
+ args = replaceParams(args, {
+ type: type
+ });
+ typeCode = replaceParams(typeCode, {
+ func: feature,
+ type: type,
+ args: args,
+ baseArgs: baseArgs,
+ baseArgsX: baseArgsX,
+ baseArgsY: baseArgsY,
+ baseArgsZ: baseArgsZ,
+ baseArgsW: baseArgsW
+ });
+ var shader = replaceParams(template, {
+ extra: extra,
+ emu: emuFunc + "\n\n" + typeCode,
+ test: test
+ });
+ return shader;
+};
+
+var generateTestShader = function(
+ shaderInfo, template, params, test) {
+ var input = shaderInfo.input;
+ var output = shaderInfo.output;
+ var feature = params.feature;
+ var testFunc = params.testFunc;
+ var extra = params.extra || '';
+
+ test = replaceParams(test, {
+ input: input,
+ output: output,
+ func: feature
+ });
+ var shader = replaceParams(template, {
+ extra: extra,
+ emu: '',
+ test: test
+ });
+ return shader;
+};
+
+function _reportResults(refData, refImg, testData, testImg, tolerance,
+ width, height, ctx, imgData, wtu, canvas2d, consoleDiv) {
+ var same = true;
+ var firstFailure = null;
+ for (var yy = 0; yy < height; ++yy) {
+ for (var xx = 0; xx < width; ++xx) {
+ var offset = (yy * width + xx) * 4;
+ var imgOffset = ((height - yy - 1) * width + xx) * 4;
+ imgData.data[imgOffset + 0] = 0;
+ imgData.data[imgOffset + 1] = 0;
+ imgData.data[imgOffset + 2] = 0;
+ imgData.data[imgOffset + 3] = 255;
+ if (Math.abs(refData[offset + 0] - testData[offset + 0]) > tolerance ||
+ Math.abs(refData[offset + 1] - testData[offset + 1]) > tolerance ||
+ Math.abs(refData[offset + 2] - testData[offset + 2]) > tolerance ||
+ Math.abs(refData[offset + 3] - testData[offset + 3]) > tolerance) {
+ var detail = 'at (' + xx + ',' + yy + '): ref=(' +
+ refData[offset + 0] + ',' +
+ refData[offset + 1] + ',' +
+ refData[offset + 2] + ',' +
+ refData[offset + 3] + ') test=(' +
+ testData[offset + 0] + ',' +
+ testData[offset + 1] + ',' +
+ testData[offset + 2] + ',' +
+ testData[offset + 3] + ') tolerance=' + tolerance;
+ consoleDiv.appendChild(document.createTextNode(detail));
+ consoleDiv.appendChild(document.createElement('br'));
+ if (!firstFailure) {
+ firstFailure = ": " + detail;
+ }
+ imgData.data[imgOffset] = 255;
+ same = false;
+ }
+ }
+ }
+
+ var diffImg = null;
+ if (!same) {
+ ctx.putImageData(imgData, 0, 0);
+ diffImg = wtu.makeImageFromCanvas(canvas2d);
+ }
+
+ var div = document.createElement("div");
+ div.className = "testimages";
+ wtu.insertImage(div, "ref", refImg);
+ wtu.insertImage(div, "test", testImg);
+ if (diffImg) {
+ wtu.insertImage(div, "diff", diffImg);
+ }
+ div.appendChild(document.createElement('br'));
+
+ consoleDiv.appendChild(div);
+
+ if (!same) {
+ testFailed("images are different" + (firstFailure ? firstFailure : ""));
+ } else {
+ testPassed("images are the same");
+ }
+
+ consoleDiv.appendChild(document.createElement('hr'));
+}
+
+var runFeatureTest = function(params) {
+ var wtu = WebGLTestUtils;
+ var gridRes = params.gridRes;
+ var vertexTolerance = params.tolerance || 0;
+ var fragmentTolerance = params.tolerance || 1;
+ if ('fragmentTolerance' in params)
+ fragmentTolerance = params.fragmentTolerance;
+
+ description("Testing GLSL feature: " + params.feature);
+
+ var width = 32;
+ var height = 32;
+
+ var consoleDiv = document.getElementById("console");
+ var canvas = document.createElement('canvas');
+ canvas.width = width;
+ canvas.height = height;
+ var gl = wtu.create3DContext(canvas, { premultipliedAlpha: false });
+ if (!gl) {
+ testFailed("context does not exist");
+ finishTest();
+ return;
+ }
+
+ var canvas2d = document.createElement('canvas');
+ canvas2d.width = width;
+ canvas2d.height = height;
+ var ctx = canvas2d.getContext("2d");
+ var imgData = ctx.getImageData(0, 0, width, height);
+
+ var shaderInfos = [
+ { type: "vertex",
+ input: "color",
+ output: "vColor",
+ vertexShaderTemplate: vertexShaderTemplate,
+ fragmentShaderTemplate: baseFragmentShader,
+ tolerance: vertexTolerance
+ },
+ { type: "fragment",
+ input: "vColor",
+ output: "gl_FragColor",
+ vertexShaderTemplate: baseVertexShader,
+ fragmentShaderTemplate: fragmentShaderTemplate,
+ tolerance: fragmentTolerance
+ }
+ ];
+ for (var ss = 0; ss < shaderInfos.length; ++ss) {
+ var shaderInfo = shaderInfos[ss];
+ var tests = params.tests;
+ var testTypes = params.emuFuncs || (params.bvecTest ? bvecTypes : types);
+ // Test vertex shaders
+ for (var ii = 0; ii < tests.length; ++ii) {
+ var type = testTypes[ii];
+ if (params.simpleEmu) {
+ type = {
+ type: type.type,
+ code: params.simpleEmu
+ };
+ }
+ debug("");
+ var str = replaceParams(params.testFunc, {
+ func: params.feature,
+ type: type.type,
+ arg0: type.type
+ });
+ var passMsg = "Testing: " + str + " in " + shaderInfo.type + " shader";
+ debug(passMsg);
+
+ var referenceVertexShaderSource = generateReferenceShader(
+ shaderInfo,
+ shaderInfo.vertexShaderTemplate,
+ params,
+ type,
+ tests[ii]);
+ var referenceFragmentShaderSource = generateReferenceShader(
+ shaderInfo,
+ shaderInfo.fragmentShaderTemplate,
+ params,
+ type,
+ tests[ii]);
+ var testVertexShaderSource = generateTestShader(
+ shaderInfo,
+ shaderInfo.vertexShaderTemplate,
+ params,
+ tests[ii]);
+ var testFragmentShaderSource = generateTestShader(
+ shaderInfo,
+ shaderInfo.fragmentShaderTemplate,
+ params,
+ tests[ii]);
+
+
+ debug("");
+ var referenceVertexShader = wtu.loadShader(gl, referenceVertexShaderSource, gl.VERTEX_SHADER, testFailed, true, 'reference');
+ var referenceFragmentShader = wtu.loadShader(gl, referenceFragmentShaderSource, gl.FRAGMENT_SHADER, testFailed, true, 'reference');
+ var testVertexShader = wtu.loadShader(gl, testVertexShaderSource, gl.VERTEX_SHADER, testFailed, true, 'test');
+ var testFragmentShader = wtu.loadShader(gl, testFragmentShaderSource, gl.FRAGMENT_SHADER, testFailed, true, 'test');
+ debug("");
+
+ if (parseInt(wtu.getUrlOptions().dumpShaders)) {
+ var vRefInfo = {
+ shader: referenceVertexShader,
+ shaderSuccess: true,
+ label: "reference vertex shader",
+ source: referenceVertexShaderSource
+ };
+ var fRefInfo = {
+ shader: referenceFragmentShader,
+ shaderSuccess: true,
+ label: "reference fragment shader",
+ source: referenceFragmentShaderSource
+ };
+ wtu.dumpShadersInfo(gl, window.location.pathname, passMsg, vRefInfo, fRefInfo);
+
+ var vTestInfo = {
+ shader: testVertexShader,
+ shaderSuccess: true,
+ label: "test vertex shader",
+ source: testVertexShaderSource
+ };
+ var fTestInfo = {
+ shader: testFragmentShader,
+ shaderSuccess: true,
+ label: "test fragment shader",
+ source: testFragmentShaderSource
+ };
+ wtu.dumpShadersInfo(gl, window.location.pathname, passMsg, vTestInfo, fTestInfo);
+ }
+
+ var refData = draw(
+ referenceVertexShader, referenceFragmentShader);
+ var refImg = wtu.makeImageFromCanvas(canvas);
+ if (ss == 0) {
+ var testData = draw(
+ testVertexShader, referenceFragmentShader);
+ } else {
+ var testData = draw(
+ referenceVertexShader, testFragmentShader);
+ }
+ var testImg = wtu.makeImageFromCanvas(canvas);
+
+ _reportResults(refData, refImg, testData, testImg, shaderInfo.tolerance,
+ width, height, ctx, imgData, wtu, canvas2d, consoleDiv);
+ }
+ }
+
+ finishTest();
+
+ function draw(vertexShader, fragmentShader) {
+ var program = wtu.createProgram(gl, vertexShader, fragmentShader, testFailed);
+
+ var posLoc = gl.getAttribLocation(program, "aPosition");
+ wtu.setupIndexedQuad(gl, gridRes, posLoc);
+
+ gl.useProgram(program);
+ wtu.clearAndDrawIndexedQuad(gl, gridRes, [0, 0, 255, 255]);
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
+
+ var img = new Uint8Array(width * height * 4);
+ gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
+ return img;
+ }
+
+};
+
+var runBasicTest = function(params) {
+ var wtu = WebGLTestUtils;
+ var gridRes = params.gridRes;
+ var vertexTolerance = params.tolerance || 0;
+ var fragmentTolerance = vertexTolerance;
+ if ('fragmentTolerance' in params)
+ fragmentTolerance = params.fragmentTolerance || 0;
+
+ description("Testing : " + document.getElementsByTagName("title")[0].innerText);
+
+ var width = 32;
+ var height = 32;
+
+ var consoleDiv = document.getElementById("console");
+ var canvas = document.createElement('canvas');
+ canvas.width = width;
+ canvas.height = height;
+ var gl = wtu.create3DContext(canvas);
+ if (!gl) {
+ testFailed("context does not exist");
+ finishTest();
+ return;
+ }
+
+ var canvas2d = document.createElement('canvas');
+ canvas2d.width = width;
+ canvas2d.height = height;
+ var ctx = canvas2d.getContext("2d");
+ var imgData = ctx.getImageData(0, 0, width, height);
+
+ var shaderInfos = [
+ { type: "vertex",
+ input: "color",
+ output: "vColor",
+ vertexShaderTemplate: vertexShaderTemplate,
+ fragmentShaderTemplate: baseFragmentShader,
+ tolerance: vertexTolerance
+ },
+ { type: "fragment",
+ input: "vColor",
+ output: "gl_FragColor",
+ vertexShaderTemplate: baseVertexShader,
+ fragmentShaderTemplate: fragmentShaderTemplate,
+ tolerance: fragmentTolerance
+ }
+ ];
+ for (var ss = 0; ss < shaderInfos.length; ++ss) {
+ var shaderInfo = shaderInfos[ss];
+ var tests = params.tests;
+// var testTypes = params.emuFuncs || (params.bvecTest ? bvecTypes : types);
+ // Test vertex shaders
+ for (var ii = 0; ii < tests.length; ++ii) {
+ var test = tests[ii];
+ debug("");
+ var passMsg = "Testing: " + test.name + " in " + shaderInfo.type + " shader";
+ debug(passMsg);
+
+ function genShader(shaderInfo, template, shader, subs) {
+ shader = replaceParams(shader, subs, {
+ input: shaderInfo.input,
+ output: shaderInfo.output
+ });
+ shader = replaceParams(template, subs, {
+ test: shader,
+ emu: "",
+ extra: ""
+ });
+ return shader;
+ }
+
+ var referenceVertexShaderSource = genShader(
+ shaderInfo,
+ shaderInfo.vertexShaderTemplate,
+ test.reference.shader,
+ test.reference.subs);
+ var referenceFragmentShaderSource = genShader(
+ shaderInfo,
+ shaderInfo.fragmentShaderTemplate,
+ test.reference.shader,
+ test.reference.subs);
+ var testVertexShaderSource = genShader(
+ shaderInfo,
+ shaderInfo.vertexShaderTemplate,
+ test.test.shader,
+ test.test.subs);
+ var testFragmentShaderSource = genShader(
+ shaderInfo,
+ shaderInfo.fragmentShaderTemplate,
+ test.test.shader,
+ test.test.subs);
+
+ debug("");
+ var referenceVertexShader = wtu.loadShader(gl, referenceVertexShaderSource, gl.VERTEX_SHADER, testFailed, true, 'reference');
+ var referenceFragmentShader = wtu.loadShader(gl, referenceFragmentShaderSource, gl.FRAGMENT_SHADER, testFailed, true, 'reference');
+ var testVertexShader = wtu.loadShader(gl, testVertexShaderSource, gl.VERTEX_SHADER, testFailed, true, 'test');
+ var testFragmentShader = wtu.loadShader(gl, testFragmentShaderSource, gl.FRAGMENT_SHADER, testFailed, true, 'test');
+ debug("");
+
+ if (parseInt(wtu.getUrlOptions().dumpShaders)) {
+ var vRefInfo = {
+ shader: referenceVertexShader,
+ shaderSuccess: true,
+ label: "reference vertex shader",
+ source: referenceVertexShaderSource
+ };
+ var fRefInfo = {
+ shader: referenceFragmentShader,
+ shaderSuccess: true,
+ label: "reference fragment shader",
+ source: referenceFragmentShaderSource
+ };
+ wtu.dumpShadersInfo(gl, window.location.pathname, passMsg, vRefInfo, fRefInfo);
+
+ var vTestInfo = {
+ shader: testVertexShader,
+ shaderSuccess: true,
+ label: "test vertex shader",
+ source: testVertexShaderSource
+ };
+ var fTestInfo = {
+ shader: testFragmentShader,
+ shaderSuccess: true,
+ label: "test fragment shader",
+ source: testFragmentShaderSource
+ };
+ wtu.dumpShadersInfo(gl, window.location.pathname, passMsg, vTestInfo, fTestInfo);
+ }
+
+ var refData = draw(referenceVertexShader, referenceFragmentShader);
+ var refImg = wtu.makeImageFromCanvas(canvas);
+ if (ss == 0) {
+ var testData = draw(testVertexShader, referenceFragmentShader);
+ } else {
+ var testData = draw(referenceVertexShader, testFragmentShader);
+ }
+ var testImg = wtu.makeImageFromCanvas(canvas);
+
+ _reportResults(refData, refImg, testData, testImg, shaderInfo.tolerance,
+ width, height, ctx, imgData, wtu, canvas2d, consoleDiv);
+ }
+ }
+
+ finishTest();
+
+ function draw(vertexShader, fragmentShader) {
+ var program = wtu.createProgram(gl, vertexShader, fragmentShader, testFailed);
+
+ var posLoc = gl.getAttribLocation(program, "aPosition");
+ wtu.setupIndexedQuad(gl, gridRes, posLoc);
+
+ gl.useProgram(program);
+ wtu.clearAndDrawIndexedQuad(gl, gridRes, [0, 0, 255, 255]);
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
+
+ var img = new Uint8Array(width * height * 4);
+ gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
+ return img;
+ }
+
+};
+
+var runReferenceImageTest = function(params) {
+ var wtu = WebGLTestUtils;
+ var gridRes = params.gridRes;
+ var vertexTolerance = params.tolerance || 0;
+ var fragmentTolerance = vertexTolerance;
+ if ('fragmentTolerance' in params)
+ fragmentTolerance = params.fragmentTolerance || 0;
+
+ description("Testing GLSL feature: " + params.feature);
+
+ var width = 32;
+ var height = 32;
+
+ var consoleDiv = document.getElementById("console");
+ var canvas = document.createElement('canvas');
+ canvas.width = width;
+ canvas.height = height;
+ var gl = wtu.create3DContext(canvas, { antialias: false, premultipliedAlpha: false });
+ if (!gl) {
+ testFailed("context does not exist");
+ finishTest();
+ return;
+ }
+
+ var canvas2d = document.createElement('canvas');
+ canvas2d.width = width;
+ canvas2d.height = height;
+ var ctx = canvas2d.getContext("2d");
+ var imgData = ctx.getImageData(0, 0, width, height);
+
+ // State for reference images for vertex shader tests.
+ // These are drawn with the same tessellated grid as the test vertex
+ // shader so that the interpolation is identical. The grid is reused
+ // from test to test; the colors are changed.
+
+ var indexedQuadForReferenceVertexShader =
+ wtu.setupIndexedQuad(gl, gridRes, 0);
+ var referenceVertexShaderProgram =
+ wtu.setupProgram(gl, [ baseVertexShaderWithColor, baseFragmentShader ],
+ ["aPosition", "aColor"]);
+ var referenceVertexShaderColorBuffer = gl.createBuffer();
+
+ var shaderInfos = [
+ { type: "vertex",
+ input: "color",
+ output: "vColor",
+ vertexShaderTemplate: vertexShaderTemplate,
+ fragmentShaderTemplate: baseFragmentShader,
+ tolerance: vertexTolerance
+ },
+ { type: "fragment",
+ input: "vColor",
+ output: "gl_FragColor",
+ vertexShaderTemplate: baseVertexShader,
+ fragmentShaderTemplate: fragmentShaderTemplate,
+ tolerance: fragmentTolerance
+ }
+ ];
+ for (var ss = 0; ss < shaderInfos.length; ++ss) {
+ var shaderInfo = shaderInfos[ss];
+ var tests = params.tests;
+ var testTypes = params.emuFuncs || (params.bvecTest ? bvecTypes : types);
+ // Test vertex shaders
+ for (var ii = 0; ii < tests.length; ++ii) {
+ var type = testTypes[ii];
+ var isVertex = (ss == 0);
+ debug("");
+ var str = replaceParams(params.testFunc, {
+ func: params.feature,
+ type: type.type,
+ arg0: type.type
+ });
+ var passMsg = "Testing: " + str + " in " + shaderInfo.type + " shader";
+ debug(passMsg);
+
+ var referenceVertexShaderSource = generateReferenceShader(
+ shaderInfo,
+ shaderInfo.vertexShaderTemplate,
+ params,
+ type,
+ tests[ii].source);
+ var referenceFragmentShaderSource = generateReferenceShader(
+ shaderInfo,
+ shaderInfo.fragmentShaderTemplate,
+ params,
+ type,
+ tests[ii].source);
+ var testVertexShaderSource = generateTestShader(
+ shaderInfo,
+ shaderInfo.vertexShaderTemplate,
+ params,
+ tests[ii].source);
+ var testFragmentShaderSource = generateTestShader(
+ shaderInfo,
+ shaderInfo.fragmentShaderTemplate,
+ params,
+ tests[ii].source);
+ var referenceTextureOrArray = generateReferenceImage(
+ gl,
+ tests[ii].generator,
+ isVertex ? gridRes : width,
+ isVertex ? gridRes : height,
+ isVertex);
+
+ debug("");
+ var testVertexShader = wtu.loadShader(gl, testVertexShaderSource, gl.VERTEX_SHADER, testFailed, true);
+ var testFragmentShader = wtu.loadShader(gl, testFragmentShaderSource, gl.FRAGMENT_SHADER, testFailed, true);
+ debug("");
+
+
+ if (parseInt(wtu.getUrlOptions().dumpShaders)) {
+ var vRefInfo = {
+ shader: referenceVertexShader,
+ shaderSuccess: true,
+ label: "reference vertex shader",
+ source: referenceVertexShaderSource
+ };
+ var fRefInfo = {
+ shader: referenceFragmentShader,
+ shaderSuccess: true,
+ label: "reference fragment shader",
+ source: referenceFragmentShaderSource
+ };
+ wtu.dumpShadersInfo(gl, window.location.pathname, passMsg, vRefInfo, fRefInfo);
+
+ var vTestInfo = {
+ shader: testVertexShader,
+ shaderSuccess: true,
+ label: "test vertex shader",
+ source: testVertexShaderSource
+ };
+ var fTestInfo = {
+ shader: testFragmentShader,
+ shaderSuccess: true,
+ label: "test fragment shader",
+ source: testFragmentShaderSource
+ };
+ wtu.dumpShadersInfo(gl, window.location.pathname, passMsg, vTestInfo, fTestInfo);
+ }
+
+ var refData;
+ if (isVertex) {
+ refData = drawVertexReferenceImage(referenceTextureOrArray);
+ } else {
+ refData = drawFragmentReferenceImage(referenceTextureOrArray);
+ }
+ var refImg = wtu.makeImageFromCanvas(canvas);
+ var testData;
+ if (isVertex) {
+ var referenceFragmentShader = wtu.loadShader(gl, referenceFragmentShaderSource, gl.FRAGMENT_SHADER, testFailed);
+ testData = draw(
+ testVertexShader, referenceFragmentShader);
+ } else {
+ var referenceVertexShader = wtu.loadShader(gl, referenceVertexShaderSource, gl.VERTEX_SHADER, testFailed);
+ testData = draw(
+ referenceVertexShader, testFragmentShader);
+ }
+ var testImg = wtu.makeImageFromCanvas(canvas);
+ var testTolerance = shaderInfo.tolerance;
+ // Provide per-test tolerance so that we can increase it only for those desired.
+ if ('tolerance' in tests[ii])
+ testTolerance = tests[ii].tolerance || 0;
+ _reportResults(refData, refImg, testData, testImg, testTolerance,
+ width, height, ctx, imgData, wtu, canvas2d, consoleDiv);
+ }
+ }
+
+ finishTest();
+
+ function draw(vertexShader, fragmentShader) {
+ var program = wtu.createProgram(gl, vertexShader, fragmentShader, testFailed);
+
+ var posLoc = gl.getAttribLocation(program, "aPosition");
+ wtu.setupIndexedQuad(gl, gridRes, posLoc);
+
+ gl.useProgram(program);
+ wtu.clearAndDrawIndexedQuad(gl, gridRes, [0, 0, 255, 255]);
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
+
+ var img = new Uint8Array(width * height * 4);
+ gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
+ return img;
+ }
+
+ function drawVertexReferenceImage(colors) {
+ gl.bindBuffer(gl.ARRAY_BUFFER, indexedQuadForReferenceVertexShader[0]);
+ gl.enableVertexAttribArray(0);
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+ gl.bindBuffer(gl.ARRAY_BUFFER, referenceVertexShaderColorBuffer);
+ gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);
+ gl.enableVertexAttribArray(1);
+ gl.vertexAttribPointer(1, 4, gl.UNSIGNED_BYTE, true, 0, 0);
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexedQuadForReferenceVertexShader[1]);
+ gl.useProgram(referenceVertexShaderProgram);
+ wtu.clearAndDrawIndexedQuad(gl, gridRes);
+ gl.disableVertexAttribArray(0);
+ gl.disableVertexAttribArray(1);
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
+
+ var img = new Uint8Array(width * height * 4);
+ gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
+ return img;
+ }
+
+ function drawFragmentReferenceImage(texture) {
+ var program = wtu.setupTexturedQuad(gl);
+
+ gl.activeTexture(gl.TEXTURE0);
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ var texLoc = gl.getUniformLocation(program, "tex");
+ gl.uniform1i(texLoc, 0);
+ wtu.clearAndDrawUnitQuad(gl);
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
+
+ var img = new Uint8Array(width * height * 4);
+ gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
+ return img;
+ }
+
+ /**
+ * Creates and returns either a Uint8Array (for vertex shaders) or
+ * WebGLTexture (for fragment shaders) containing the reference
+ * image for the function being tested. Exactly how the function is
+ * evaluated, and the size of the returned texture or array, depends on
+ * whether we are testing a vertex or fragment shader. If a fragment
+ * shader, the function is evaluated at the pixel centers. If a
+ * vertex shader, the function is evaluated at the triangle's
+ * vertices.
+ *
+ * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use to generate texture objects.
+ * @param {!function(number,number,number,number): !Array.<number>} generator The reference image generator function.
+ * @param {number} width The width of the texture to generate if testing a fragment shader; the grid resolution if testing a vertex shader.
+ * @param {number} height The height of the texture to generate if testing a fragment shader; the grid resolution if testing a vertex shader.
+ * @param {boolean} isVertex True if generating a reference image for a vertex shader; false if for a fragment shader.
+ * @return {!WebGLTexture|!Uint8Array} The texture object or array that was generated.
+ */
+ function generateReferenceImage(
+ gl,
+ generator,
+ width,
+ height,
+ isVertex) {
+
+ // Note: the math in this function must match that in the vertex and
+ // fragment shader templates above.
+ function computeTexCoord(x) {
+ return x * 0.5 + 0.5;
+ }
+
+ function computeVertexColor(texCoordX, texCoordY) {
+ return [ texCoordX,
+ texCoordY,
+ texCoordX * texCoordY,
+ (1.0 - texCoordX) * texCoordY * 0.5 + 0.5 ];
+ }
+
+ /**
+ * Computes fragment color according to the algorithm used for interpolation
+ * in OpenGL (GLES 2.0 spec 3.5.1, OpenGL 4.3 spec 14.6.1).
+ */
+ function computeInterpolatedColor(texCoordX, texCoordY) {
+ // Calculate grid line indexes below and to the left from texCoord.
+ var gridBottom = Math.floor(texCoordY * gridRes);
+ if (gridBottom == gridRes) {
+ --gridBottom;
+ }
+ var gridLeft = Math.floor(texCoordX * gridRes);
+ if (gridLeft == gridRes) {
+ --gridLeft;
+ }
+
+ // Calculate coordinates relative to the grid cell.
+ var cellX = texCoordX * gridRes - gridLeft;
+ var cellY = texCoordY * gridRes - gridBottom;
+
+ // Barycentric coordinates inside either triangle ACD or ABC
+ // are used as weights for the vertex colors in the corners:
+ // A--B
+ // |\ |
+ // | \|
+ // D--C
+
+ var aColor = computeVertexColor(gridLeft / gridRes, (gridBottom + 1) / gridRes);
+ var bColor = computeVertexColor((gridLeft + 1) / gridRes, (gridBottom + 1) / gridRes);
+ var cColor = computeVertexColor((gridLeft + 1) / gridRes, gridBottom / gridRes);
+ var dColor = computeVertexColor(gridLeft / gridRes, gridBottom / gridRes);
+
+ // Calculate weights.
+ var a, b, c, d;
+
+ if (cellX + cellY < 1) {
+ // In bottom triangle ACD.
+ a = cellY; // area of triangle C-D-(cellX, cellY) relative to ACD
+ c = cellX; // area of triangle D-A-(cellX, cellY) relative to ACD
+ d = 1 - a - c;
+ b = 0;
+ } else {
+ // In top triangle ABC.
+ a = 1 - cellX; // area of the triangle B-C-(cellX, cellY) relative to ABC
+ c = 1 - cellY; // area of the triangle A-B-(cellX, cellY) relative to ABC
+ b = 1 - a - c;
+ d = 0;
+ }
+
+ var interpolated = [];
+ for (var ii = 0; ii < aColor.length; ++ii) {
+ interpolated.push(a * aColor[ii] + b * bColor[ii] + c * cColor[ii] + d * dColor[ii]);
+ }
+ return interpolated;
+ }
+
+ function clamp(value, minVal, maxVal) {
+ return Math.max(minVal, Math.min(value, maxVal));
+ }
+
+ // Evaluates the function at clip coordinates (px,py), storing the
+ // result in the array "pixel". Each channel's result is clamped
+ // between 0 and 255.
+ function evaluateAtClipCoords(px, py, pixel, colorFunc) {
+ var tcx = computeTexCoord(px);
+ var tcy = computeTexCoord(py);
+
+ var color = colorFunc(tcx, tcy);
+
+ var output = generator(color[0], color[1], color[2], color[3]);
+
+ // Multiply by 256 to get even distribution for all values between 0 and 1.
+ // Use rounding rather than truncation to more closely match the GPU's behavior.
+ pixel[0] = clamp(Math.round(256 * output[0]), 0, 255);
+ pixel[1] = clamp(Math.round(256 * output[1]), 0, 255);
+ pixel[2] = clamp(Math.round(256 * output[2]), 0, 255);
+ pixel[3] = clamp(Math.round(256 * output[3]), 0, 255);
+ }
+
+ function generateFragmentReference() {
+ var data = new Uint8Array(4 * width * height);
+
+ var horizTexel = 1.0 / width;
+ var vertTexel = 1.0 / height;
+ var halfHorizTexel = 0.5 * horizTexel;
+ var halfVertTexel = 0.5 * vertTexel;
+
+ var pixel = new Array(4);
+
+ for (var yi = 0; yi < height; ++yi) {
+ for (var xi = 0; xi < width; ++xi) {
+ // The function must be evaluated at pixel centers.
+
+ // Compute desired position in clip space
+ var px = -1.0 + 2.0 * (halfHorizTexel + xi * horizTexel);
+ var py = -1.0 + 2.0 * (halfVertTexel + yi * vertTexel);
+
+ evaluateAtClipCoords(px, py, pixel, computeInterpolatedColor);
+ var index = 4 * (width * yi + xi);
+ data[index + 0] = pixel[0];
+ data[index + 1] = pixel[1];
+ data[index + 2] = pixel[2];
+ data[index + 3] = pixel[3];
+ }
+ }
+
+ var texture = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0,
+ gl.RGBA, gl.UNSIGNED_BYTE, data);
+ return texture;
+ }
+
+ function generateVertexReference() {
+ // We generate a Uint8Array which contains the evaluation of the
+ // function at the vertices of the triangle mesh. It is expected
+ // that the width and the height are identical, and equivalent
+ // to the grid resolution.
+ if (width != height) {
+ throw "width and height must be equal";
+ }
+
+ var texSize = 1 + width;
+ var data = new Uint8Array(4 * texSize * texSize);
+
+ var step = 2.0 / width;
+
+ var pixel = new Array(4);
+
+ for (var yi = 0; yi < texSize; ++yi) {
+ for (var xi = 0; xi < texSize; ++xi) {
+ // The function is evaluated at the triangles' vertices.
+
+ // Compute desired position in clip space
+ var px = -1.0 + (xi * step);
+ var py = -1.0 + (yi * step);
+
+ evaluateAtClipCoords(px, py, pixel, computeVertexColor);
+ var index = 4 * (texSize * yi + xi);
+ data[index + 0] = pixel[0];
+ data[index + 1] = pixel[1];
+ data[index + 2] = pixel[2];
+ data[index + 3] = pixel[3];
+ }
+ }
+
+ return data;
+ }
+
+ //----------------------------------------------------------------------
+ // Body of generateReferenceImage
+ //
+
+ if (isVertex) {
+ return generateVertexReference();
+ } else {
+ return generateFragmentReference();
+ }
+ }
+};
+
+return {
+ /**
+ * runs a bunch of GLSL tests using the passed in parameters
+ * The parameters are:
+ *
+ * feature:
+ * the name of the function being tested (eg, sin, dot,
+ * normalize)
+ *
+ * testFunc:
+ * The prototype of function to be tested not including the
+ * return type.
+ *
+ * emuFunc:
+ * A base function that can be used to generate emulation
+ * functions. Example for 'ceil'
+ *
+ * float $(func)_base(float value) {
+ * float m = mod(value, 1.0);
+ * return m != 0.0 ? (value + 1.0 - m) : value;
+ * }
+ *
+ * args:
+ * The arguments to the function
+ *
+ * baseArgs: (optional)
+ * The arguments when a base function is used to create an
+ * emulation function. For example 'float sign_base(float v)'
+ * is used to implemenent vec2 sign_emu(vec2 v).
+ *
+ * simpleEmu:
+ * if supplied, the code that can be used to generate all
+ * functions for all types.
+ *
+ * Example for 'normalize':
+ *
+ * $(type) $(func)_emu($(args)) {
+ * return value / length(value);
+ * }
+ *
+ * gridRes: (optional)
+ * The resolution of the mesh to generate. The default is a
+ * 1x1 grid but many vertex shaders need a higher resolution
+ * otherwise the only values passed in are the 4 corners
+ * which often have the same value.
+ *
+ * tests:
+ * The code for each test. It is assumed the tests are for
+ * float, vec2, vec3, vec4 in that order.
+ *
+ * tolerance: (optional)
+ * Allow some tolerance in the comparisons. The tolerance is applied to
+ * both vertex and fragment shaders. The default tolerance is 0, meaning
+ * the values have to be identical.
+ *
+ * fragmentTolerance: (optional)
+ * Specify a tolerance which only applies to fragment shaders. The
+ * fragment-only tolerance will override the shared tolerance for
+ * fragment shaders if both are specified. Fragment shaders usually
+ * use mediump float precision so they sometimes require higher tolerance
+ * than vertex shaders which use highp by default.
+ */
+ runFeatureTest: runFeatureTest,
+
+ /*
+ * Runs a bunch of GLSL tests using the passed in parameters
+ *
+ * The parameters are:
+ *
+ * tests:
+ * Array of tests. For each test the following parameters are expected
+ *
+ * name:
+ * some description of the test
+ * reference:
+ * parameters for the reference shader (see below)
+ * test:
+ * parameters for the test shader (see below)
+ *
+ * The parameter for the reference and test shaders are
+ *
+ * shader: the GLSL for the shader
+ * subs: any substitutions you wish to define for the shader.
+ *
+ * Each shader is created from a basic template that
+ * defines an input and an output. You can see the
+ * templates at the top of this file. The input and output
+ * change depending on whether or not we are generating
+ * a vertex or fragment shader.
+ *
+ * All this code function does is a bunch of string substitutions.
+ * A substitution is defined by $(name). If name is found in
+ * the 'subs' parameter it is replaced. 4 special names exist.
+ *
+ * 'input' the input to your GLSL. Always a vec4. All change
+ * from 0 to 1 over the quad to be drawn.
+ *
+ * 'output' the output color. Also a vec4
+ *
+ * 'emu' a place to insert extra stuff
+ * 'extra' a place to insert extra stuff.
+ *
+ * You can think of the templates like this
+ *
+ * $(extra)
+ * $(emu)
+ *
+ * void main() {
+ * // do math to calculate input
+ * ...
+ *
+ * $(shader)
+ * }
+ *
+ * Your shader first has any subs you provided applied as well
+ * as 'input' and 'output'
+ *
+ * It is then inserted into the template which is also provided
+ * with your subs.
+ *
+ * gridRes: (optional)
+ * The resolution of the mesh to generate. The default is a
+ * 1x1 grid but many vertex shaders need a higher resolution
+ * otherwise the only values passed in are the 4 corners
+ * which often have the same value.
+ *
+ * tolerance: (optional)
+ * Allow some tolerance in the comparisons. The tolerance is applied to
+ * both vertex and fragment shaders. The default tolerance is 0, meaning
+ * the values have to be identical.
+ *
+ * fragmentTolerance: (optional)
+ * Specify a tolerance which only applies to fragment shaders. The
+ * fragment-only tolerance will override the shared tolerance for
+ * fragment shaders if both are specified. Fragment shaders usually
+ * use mediump float precision so they sometimes require higher tolerance
+ * than vertex shaders which use highp.
+ */
+ runBasicTest: runBasicTest,
+
+ /**
+ * Runs a bunch of GLSL tests using the passed in parameters. The
+ * expected results are computed as a reference image in JavaScript
+ * instead of on the GPU. The parameters are:
+ *
+ * feature:
+ * the name of the function being tested (eg, sin, dot,
+ * normalize)
+ *
+ * testFunc:
+ * The prototype of function to be tested not including the
+ * return type.
+ *
+ * args:
+ * The arguments to the function
+ *
+ * gridRes: (optional)
+ * The resolution of the mesh to generate. The default is a
+ * 1x1 grid but many vertex shaders need a higher resolution
+ * otherwise the only values passed in are the 4 corners
+ * which often have the same value.
+ *
+ * tests:
+ * Array of tests. It is assumed the tests are for float, vec2,
+ * vec3, vec4 in that order. For each test the following
+ * parameters are expected:
+ *
+ * source: the GLSL source code for the tests
+ *
+ * generator: a JavaScript function taking four parameters
+ * which evaluates the same function as the GLSL source,
+ * returning its result as a newly allocated array.
+ *
+ * tolerance: (optional) a per-test tolerance.
+ *
+ * extra: (optional)
+ * Extra GLSL code inserted at the top of each test's shader.
+ *
+ * tolerance: (optional)
+ * Allow some tolerance in the comparisons. The tolerance is applied to
+ * both vertex and fragment shaders. The default tolerance is 0, meaning
+ * the values have to be identical.
+ *
+ * fragmentTolerance: (optional)
+ * Specify a tolerance which only applies to fragment shaders. The
+ * fragment-only tolerance will override the shared tolerance for
+ * fragment shaders if both are specified. Fragment shaders usually
+ * use mediump float precision so they sometimes require higher tolerance
+ * than vertex shaders which use highp.
+ */
+ runReferenceImageTest: runReferenceImageTest,
+
+ none: false
+};
+
+}());
+
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-1024x1024.jpg b/dom/canvas/test/webgl-conf/checkout/resources/gray-1024x1024.jpg
new file mode 100644
index 000000000..e06e7f5ee
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-1024x1024.jpg
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-256-with-128-alpha.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-256-with-128-alpha.png
new file mode 100644
index 000000000..183e55de2
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-256-with-128-alpha.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-256.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-256.png
new file mode 100644
index 000000000..01e486b5a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-256.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-default-gamma.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-default-gamma.png
new file mode 100644
index 000000000..a5a89beb7
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-default-gamma.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma0.1.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma0.1.png
new file mode 100644
index 000000000..637c792da
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma0.1.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma1.0.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma1.0.png
new file mode 100644
index 000000000..40ceeb046
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma1.0.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma2.0.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma2.0.png
new file mode 100644
index 000000000..73fcf7b41
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma2.0.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma4.0.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma4.0.png
new file mode 100644
index 000000000..d878f1e96
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma4.0.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma9.0.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma9.0.png
new file mode 100644
index 000000000..8a69ed1f3
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp-gamma9.0.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp.png b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp.png
new file mode 100644
index 000000000..a5a89beb7
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/gray-ramp.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/green-2x2-16bit.png b/dom/canvas/test/webgl-conf/checkout/resources/green-2x2-16bit.png
new file mode 100644
index 000000000..7fcb96960
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/green-2x2-16bit.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/intArrayUniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/intArrayUniformShader.vert
new file mode 100644
index 000000000..d82074e47
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/intArrayUniformShader.vert
@@ -0,0 +1,8 @@
+uniform int ival;
+uniform int ival2[2];
+
+void main()
+{
+ int sum = ival + ival2[0] + ival2[1];
+ gl_Position = vec4(sum, 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/intUniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/intUniformShader.vert
new file mode 100644
index 000000000..051c05e2b
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/intUniformShader.vert
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+*/
+
+uniform int ival;
+uniform ivec2 ival2;
+uniform ivec3 ival3;
+uniform ivec4 ival4;
+
+void main()
+{
+ int sum = ival
+ + ival2[0] + ival2[1]
+ + ival3[0] + ival3[1] + ival3[2]
+ + ival4[0] + ival4[1] + ival4[2] + ival4[3];
+ gl_Position = vec4(sum, 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/js-test-style.css b/dom/canvas/test/webgl-conf/checkout/resources/js-test-style.css
new file mode 100644
index 000000000..bb7d5148e
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/js-test-style.css
@@ -0,0 +1,17 @@
+.pass {
+ font-weight: bold;
+ color: green;
+}
+.fail {
+ font-weight: bold;
+ color: red;
+}
+.warn {
+ font-weight: bold;
+ color: yellow;
+ text-shadow: 1px 1px #ff0000
+}
+#console {
+ white-space: pre-wrap;
+ font-family: monospace;
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/matForWebGL2UniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/matForWebGL2UniformShader.vert
new file mode 100644
index 000000000..56bf75826
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/matForWebGL2UniformShader.vert
@@ -0,0 +1,42 @@
+#version 300 es
+
+/*
+** Copyright (c) 2015 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.
+*/
+
+uniform mat2x3 mval2x3;
+uniform mat2x4 mval2x4;
+uniform mat3x2 mval3x2;
+uniform mat3x4 mval3x4;
+uniform mat4x2 mval4x2;
+uniform mat4x3 mval4x3;
+
+void main()
+{
+
+ gl_Position = vec4(mval2x3 * vec2(1.0, 2.0), 0.0) +
+ mval2x4 * vec2(1.0, 2.0) +
+ vec4(mval3x2 * vec3(1.0, 2.0, 3.0), 0.0, 0.0) +
+ mval3x4 * vec3(1.0, 2.0, 3.0) +
+ vec4(mval4x2 * vec4(1.0, 2.0, 3.0, 4.0), 0.0, 0.0) +
+ vec4(mval4x3 * vec4(1.0, 2.0, 3.0, 4.0), 0.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/matUniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/matUniformShader.vert
new file mode 100644
index 000000000..123a4be03
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/matUniformShader.vert
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+ */
+
+uniform mat2 mval2;
+uniform mat3 mval3;
+uniform mat4 mval4;
+
+void main()
+{
+ gl_Position = vec4(mval2 * vec2(1.0, 2.0), 0.0, 0.0)
+ + vec4(mval3 * vec3(1.0, 2.0, 3.0), 0.0)
+ + mval4 * vec4(1.0, 2.0, 3.0, 4.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShader.frag b/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShader.frag
new file mode 100644
index 000000000..b2dfc9f1d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShader.frag
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+*/
+
+void main()
+{
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShader.vert
new file mode 100644
index 000000000..821e440d4
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShader.vert
@@ -0,0 +1,4 @@
+void main()
+{
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShaderES3.frag b/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShaderES3.frag
new file mode 100644
index 000000000..00af837a5
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShaderES3.frag
@@ -0,0 +1,40 @@
+#version 300 es
+
+/*
+ * Copyright (c) 2015 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+*/
+
+precision mediump float;
+
+out vec4 fragColor;
+
+void main()
+{
+ fragColor = vec4(0.0, 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShaderES3.vert b/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShaderES3.vert
new file mode 100644
index 000000000..e213a4bb3
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/noopUniformShaderES3.vert
@@ -0,0 +1,6 @@
+#version 300 es
+
+void main()
+{
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/npot-video.mp4 b/dom/canvas/test/webgl-conf/checkout/resources/npot-video.mp4
new file mode 100644
index 000000000..59f5f774a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/npot-video.mp4
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/npot-video.theora.ogv b/dom/canvas/test/webgl-conf/checkout/resources/npot-video.theora.ogv
new file mode 100644
index 000000000..4458678fb
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/npot-video.theora.ogv
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/npot-video.webmvp8.webm b/dom/canvas/test/webgl-conf/checkout/resources/npot-video.webmvp8.webm
new file mode 100644
index 000000000..47277bdaa
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/npot-video.webmvp8.webm
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/ogles-tests.css b/dom/canvas/test/webgl-conf/checkout/resources/ogles-tests.css
new file mode 100644
index 000000000..42269c8b6
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/ogles-tests.css
@@ -0,0 +1,30 @@
+canvas {
+ background-color: white;
+ background-size: 8px 8px;
+}
+
+.shader-source {
+ border: 1px dashed black;
+ padding: 1em;
+}
+
+.shader-source li:nth-child(odd) { background: #f8f8f8; }
+.shader-source li:nth-child(even) { background: #f0f0f0; }
+
+.testimages {
+}
+
+.testimages br {
+ clear: both;
+}
+
+.testimages > div {
+ float: left;
+ margin: 1em;
+}
+
+IMG {
+ border: 1px solid black;
+ width: 250px;
+ height: 250px;
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/opengl_logo.jpg b/dom/canvas/test/webgl-conf/checkout/resources/opengl_logo.jpg
new file mode 100644
index 000000000..e3b70bef3
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/opengl_logo.jpg
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green-blue-cyan-4x4.png b/dom/canvas/test/webgl-conf/checkout/resources/red-green-blue-cyan-4x4.png
new file mode 100644
index 000000000..80b2d1d42
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green-blue-cyan-4x4.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green-blue-cyan-4x4.psd b/dom/canvas/test/webgl-conf/checkout/resources/red-green-blue-cyan-4x4.psd
new file mode 100644
index 000000000..9cf26f941
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green-blue-cyan-4x4.psd
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green-semi-transparent.png b/dom/canvas/test/webgl-conf/checkout/resources/red-green-semi-transparent.png
new file mode 100644
index 000000000..11f2928ae
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green-semi-transparent.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green.mp4 b/dom/canvas/test/webgl-conf/checkout/resources/red-green.mp4
new file mode 100644
index 000000000..4bd6d5965
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green.mp4
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green.png b/dom/canvas/test/webgl-conf/checkout/resources/red-green.png
new file mode 100644
index 000000000..605ac9ba1
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green.svg b/dom/canvas/test/webgl-conf/checkout/resources/red-green.svg
new file mode 100644
index 000000000..fe4d20718
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2">
+ <rect fill="#f00" width="2" height="1"/>
+ <rect fill="#0f0" y="1" width="2" height="1"/>
+</svg>
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green.theora.ogv b/dom/canvas/test/webgl-conf/checkout/resources/red-green.theora.ogv
new file mode 100644
index 000000000..1543915a1
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green.theora.ogv
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green.webmvp8.webm b/dom/canvas/test/webgl-conf/checkout/resources/red-green.webmvp8.webm
new file mode 100644
index 000000000..fde59a18b
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green.webmvp8.webm
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-green.webmvp9.webm b/dom/canvas/test/webgl-conf/checkout/resources/red-green.webmvp9.webm
new file mode 100644
index 000000000..23dd3051c
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-green.webmvp9.webm
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/red-indexed.png b/dom/canvas/test/webgl-conf/checkout/resources/red-indexed.png
new file mode 100644
index 000000000..3188d2d75
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/red-indexed.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/samplerForWebGL2UniformShader.frag b/dom/canvas/test/webgl-conf/checkout/resources/samplerForWebGL2UniformShader.frag
new file mode 100644
index 000000000..44cf1b11a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/samplerForWebGL2UniformShader.frag
@@ -0,0 +1,34 @@
+#version 300 es
+
+/*
+** Copyright (c) 2015 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.
+*/
+
+precision mediump float;
+uniform mediump sampler3D s3D;
+uniform mediump sampler2DArray s2DArray;
+out vec4 fragColor;
+void main()
+{
+ fragColor = texture(s3D, vec3(0.5, 0.5, 0.5)) +
+ texture(s2DArray, vec3(0.5, 0.5, 0.5));
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/samplerUniformShader.frag b/dom/canvas/test/webgl-conf/checkout/resources/samplerUniformShader.frag
new file mode 100644
index 000000000..11cba1274
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/samplerUniformShader.frag
@@ -0,0 +1,8 @@
+precision mediump float;
+uniform sampler2D s2D;
+uniform samplerCube sCube;
+void main()
+{
+ gl_FragColor = texture2D(s2D, vec2(0.5, 0.5)) +
+ textureCube(sCube, vec3(0.5, 0.5, 0.5));
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-cie-rgb-profile.png b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-cie-rgb-profile.png
new file mode 100644
index 000000000..aa8bf3771
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-cie-rgb-profile.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colormatch-profile.png b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colormatch-profile.png
new file mode 100644
index 000000000..63454ec0d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colormatch-profile.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colorspin-profile.jpg b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colorspin-profile.jpg
new file mode 100644
index 000000000..a9186968f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colorspin-profile.jpg
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colorspin-profile.png b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colorspin-profile.png
new file mode 100644
index 000000000..592262737
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-colorspin-profile.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-e-srgb-profile.png b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-e-srgb-profile.png
new file mode 100644
index 000000000..2792b0ac5
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-e-srgb-profile.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-smpte-c-profile.png b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-smpte-c-profile.png
new file mode 100644
index 000000000..2904e8952
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-smpte-c-profile.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-srgb-iec61966-2.1-profile.png b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-srgb-iec61966-2.1-profile.png
new file mode 100644
index 000000000..a0201f113
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/small-square-with-srgb-iec61966-2.1-profile.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/structUniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/structUniformShader.vert
new file mode 100644
index 000000000..59c719a00
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/structUniformShader.vert
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+ */
+
+attribute vec4 a_vertex;
+attribute vec3 a_normal;
+
+uniform mat4 u_modelViewProjMatrix;
+
+struct MyStruct
+{
+ int x;
+ int y;
+};
+
+uniform MyStruct u_struct;
+uniform float u_array[4];
+
+varying vec3 v_normal;
+
+void main()
+{
+ v_normal = a_normal;
+ gl_Position = u_modelViewProjMatrix * a_vertex +
+ vec4(u_struct.x, u_struct.y, 0, 1) +
+ vec4(u_array[0], u_array[1], u_array[2], u_array[3]);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/thunderbird-logo-64x64.png b/dom/canvas/test/webgl-conf/checkout/resources/thunderbird-logo-64x64.png
new file mode 100644
index 000000000..e2326f551
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/thunderbird-logo-64x64.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/transparent-on-left-indexed.png b/dom/canvas/test/webgl-conf/checkout/resources/transparent-on-left-indexed.png
new file mode 100644
index 000000000..2be312744
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/transparent-on-left-indexed.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/uintUniformShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/uintUniformShader.vert
new file mode 100644
index 000000000..5f9501c75
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/uintUniformShader.vert
@@ -0,0 +1,38 @@
+#version 300 es
+
+/*
+** Copyright (c) 2015 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.
+*/
+
+uniform uint uval;
+uniform uvec2 uval2;
+uniform uvec3 uval3;
+uniform uvec4 uval4;
+
+void main()
+{
+ uint sum = uval
+ + uval2[0] + uval2[1]
+ + uval3[0] + uval3[1] + uval3[2]
+ + uval4[0] + uval4[1] + uval4[2] + uval4[3];
+ gl_Position = vec4(sum, 0.0, 0.0, 1.0);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/uniformBlockShader.frag b/dom/canvas/test/webgl-conf/checkout/resources/uniformBlockShader.frag
new file mode 100644
index 000000000..8718ee86c
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/uniformBlockShader.frag
@@ -0,0 +1,36 @@
+#version 300 es
+
+/*
+** Copyright (c) 2015 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.
+*/
+
+precision mediump float;
+
+in vec3 normal;
+in vec4 ecPosition;
+
+out vec4 fragColor;
+
+void main()
+{
+ fragColor = vec4(normal/2.0+vec3(0.5), 1);
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/uniformBlockShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/uniformBlockShader.vert
new file mode 100644
index 000000000..ba02029c3
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/uniformBlockShader.vert
@@ -0,0 +1,43 @@
+#version 300 es
+
+/*
+** Copyright (c) 2015 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.
+*/
+
+in vec4 a_vertex;
+in vec3 a_normal;
+
+uniform Transform {
+ mat4 u_modelViewMatrix;
+ mat4 u_projectionMatrix;
+ mat3 u_normalMatrix;
+};
+
+out vec3 normal;
+out vec4 ecPosition;
+
+void main()
+{
+ normal = normalize(u_normalMatrix * a_normal);
+ ecPosition = u_modelViewMatrix * a_vertex;
+ gl_Position = u_projectionMatrix * ecPosition;
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/vertexShader.vert b/dom/canvas/test/webgl-conf/checkout/resources/vertexShader.vert
new file mode 100644
index 000000000..fe6640b75
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/vertexShader.vert
@@ -0,0 +1,36 @@
+/*
+Copyright (C) 2009 Apple Computer, 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 COMPUTER, INC. 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 COMPUTER, INC. OR
+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.
+*/
+attribute vec4 a_vertex;
+attribute vec3 a_normal;
+
+uniform mediump mat4 u_modelViewProjMatrix;
+
+varying vec3 v_normal;
+
+void main()
+{
+ v_normal = a_normal;
+ gl_Position = u_modelViewProjMatrix * a_vertex;
+}
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/webgl-logo.png b/dom/canvas/test/webgl-conf/checkout/resources/webgl-logo.png
new file mode 100644
index 000000000..b9b22e1ab
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/webgl-logo.png
Binary files differ
diff --git a/dom/canvas/test/webgl-conf/checkout/resources/zero-alpha.png b/dom/canvas/test/webgl-conf/checkout/resources/zero-alpha.png
new file mode 100644
index 000000000..e55630c11
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/resources/zero-alpha.png
Binary files differ