summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions
diff options
context:
space:
mode:
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions')
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/00_test_list.txt36
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-abs.html45
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-acos.html95
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-asin.html95
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-atan-xy.html98
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-atan.html95
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-ceil.html53
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-clamp-float.html56
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-clamp-gentype.html59
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-cos.html99
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-cross.html53
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-distance.html88
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-dot.html90
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-faceforward.html66
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-floor.html52
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-fract.html50
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-length.html87
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-lessThan.html52
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-max-float.html52
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-max-gentype.html52
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-min-float.html52
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-min-gentype.html52
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mix-float.html54
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mix-gentype.html54
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mod-float.html53
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mod-gentype.html56
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-normalize.html59
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-reflect.html61
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-refract.html70
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-sign.html52
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-sin.html96
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-smoothstep-float.html97
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-smoothstep-gentype.html56
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-step-float.html52
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-step-gentype.html51
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function.html39
36 files changed, 2327 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/00_test_list.txt
new file mode 100644
index 0000000000..dd06ea0520
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/00_test_list.txt
@@ -0,0 +1,36 @@
+glsl-function.html
+glsl-function-abs.html
+glsl-function-acos.html
+glsl-function-asin.html
+glsl-function-atan.html
+glsl-function-atan-xy.html
+glsl-function-ceil.html
+glsl-function-clamp-float.html
+glsl-function-clamp-gentype.html
+glsl-function-cos.html
+glsl-function-cross.html
+glsl-function-distance.html
+glsl-function-dot.html
+glsl-function-faceforward.html
+glsl-function-floor.html
+glsl-function-fract.html
+glsl-function-length.html
+#glsl-function-lessThan.html
+glsl-function-max-float.html
+glsl-function-max-gentype.html
+glsl-function-min-float.html
+glsl-function-min-gentype.html
+glsl-function-mix-float.html
+glsl-function-mix-gentype.html
+glsl-function-mod-float.html
+glsl-function-mod-gentype.html
+glsl-function-normalize.html
+glsl-function-reflect.html
+#glsl-function-refract.html
+glsl-function-sign.html
+glsl-function-sin.html
+glsl-function-step-float.html
+glsl-function-step-gentype.html
+glsl-function-smoothstep-float.html
+glsl-function-smoothstep-gentype.html
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-abs.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-abs.html
new file mode 100644
index 0000000000..e7e3b19207
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-abs.html
@@ -0,0 +1,45 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL abs function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "abs",
+ testFunc: "$(func)($(arg0))",
+ emuFunc: ["float $(func)_base(float value) {",
+ " return value >= 0.0 ? value : -value;",
+ "}"].join("\n"),
+ gridRes: 4,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 2.0 - 1.0),",
+ " 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ "$(output) = vec4(0, $(func)($(input).xy * 2.0 - vec2(1, 1)), 1);",
+ "$(output) = vec4($(func)($(input).xyz * 2.0 - vec3(1, 1, 1)), 1);",
+ "$(output) = $(func)($(input) * 2.0 - vec4(1, 1, 1, 1));"
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-acos.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-acos.html
new file mode 100644
index 0000000000..ba6b9ab33f
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-acos.html
@@ -0,0 +1,95 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL acos function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+var piConstants = [
+ "const float kPI = 3.14159265358979323846;",
+ "const float kHalfPI = (kPI * 0.5);",
+ "const float k2PI = (kPI * 2.0);"
+].join("\n");
+
+var kPI = Math.PI;
+var kHalfPI = Math.PI * 0.5;
+var k2PI = Math.PI * 2.0;
+var acos = Math.acos; // shorthand
+
+GLSLGenerator.runReferenceImageTest({
+ feature: "acos",
+ args: "$(type) value",
+ testFunc: "$(func)($(type))",
+ gridRes: 8,
+ tolerance: 2,
+ extra: piConstants,
+ tests: [
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).x * 0.8) / kPI,",
+ " $(func)($(input).y * 0.8) / kPI,",
+ " 0,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ acos(x * 0.8) / kPI,
+ acos(y * 0.8) / kPI,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xy * 0.8) / kPI,",
+ " 0, 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ acos(x * 0.8) / kPI,
+ acos(y * 0.8) / kPI,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xyz * 0.8) / kPI,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ acos(x * 0.8) / kPI,
+ acos(y * 0.8) / kPI,
+ acos(z * 0.8) / kPI,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = ",
+ " $(func)($(input) * 0.8) / kPI;",
+ ].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ acos(x * 0.8) / kPI,
+ acos(y * 0.8) / kPI,
+ acos(z * 0.8) / kPI,
+ acos(w * 0.8) / kPI ];
+ },
+ },
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-asin.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-asin.html
new file mode 100644
index 0000000000..051c4f7d81
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-asin.html
@@ -0,0 +1,95 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL asin function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+var piConstants = [
+ "const float kPI = 3.14159265358979323846;",
+ "const float kHalfPI = (kPI * 0.5);",
+ "const float k2PI = (kPI * 2.0);"
+].join("\n");
+
+var kPI = Math.PI;
+var kHalfPI = Math.PI * 0.5;
+var k2PI = Math.PI * 2.0;
+var asin = Math.asin; // shorthand
+
+GLSLGenerator.runReferenceImageTest({
+ feature: "asin",
+ args: "$(type) value",
+ testFunc: "$(func)($(type))",
+ gridRes: 8,
+ tolerance: 2,
+ extra: piConstants,
+ tests: [
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).x * 0.8) / kPI + 0.5,",
+ " $(func)($(input).y * 0.8) / kPI + 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ asin(x * 0.8) / kPI + 0.5,
+ asin(y * 0.8) / kPI + 0.5,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xy * 0.8) / kPI + 0.5,",
+ " 0, 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ asin(x * 0.8) / kPI + 0.5,
+ asin(y * 0.8) / kPI + 0.5,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xyz * 0.8) / kPI + 0.5,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ asin(x * 0.8) / kPI + 0.5,
+ asin(y * 0.8) / kPI + 0.5,
+ asin(z * 0.8) / kPI + 0.5,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = ",
+ " $(func)($(input) * 0.8) / kPI + 0.5;",
+ ].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ asin(x * 0.8) / kPI + 0.5,
+ asin(y * 0.8) / kPI + 0.5,
+ asin(z * 0.8) / kPI + 0.5,
+ asin(w * 0.8) / kPI + 0.5 ];
+ },
+ },
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-atan-xy.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-atan-xy.html
new file mode 100644
index 0000000000..e20d18d2c0
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-atan-xy.html
@@ -0,0 +1,98 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL atan-xy function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+var piConstants = [
+ "const float kPI = 3.14159265358979323846;",
+ "const float kHalfPI = (kPI * 0.5);",
+ "const float k2PI = (kPI * 2.0);"
+].join("\n");
+
+var kPI = Math.PI;
+var kHalfPI = Math.PI * 0.5;
+var k2PI = Math.PI * 2.0;
+var atan2 = Math.atan2; // shorthand
+
+GLSLGenerator.runReferenceImageTest({
+ feature: "atan",
+ args: "$(type) y, $(type) x",
+ testFunc: "$(func)($(type), $(type))",
+ gridRes: 8,
+ tolerance: 5,
+ extra: piConstants,
+ tests: [
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).x + 0.1, $(input).y) / k2PI + 0.5,",
+ " 0,",
+ " 0,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ atan2(x + 0.1, y) / k2PI + 0.5,
+ 0,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xy + vec2(0.1, 0.1), $(input).yx) / ",
+ " k2PI + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ atan2(x + 0.1, y) / k2PI + 0.5,
+ atan2(y + 0.1, x) / k2PI + 0.5,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xyz + vec3(0.1, 0.1, 0.1), $(input).yzx) / ",
+ " k2PI + vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ atan2(x + 0.1, y) / k2PI + 0.5,
+ atan2(y + 0.1, z) / k2PI + 0.5,
+ atan2(z + 0.1, x) / k2PI + 0.5,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = ",
+ " $(func)($(input) + vec4(0.1, 0.1, 0.1, 0.1), $(input).wzyx) / ",
+ " k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
+ ].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ atan2(x + 0.1, w) / k2PI + 0.5,
+ atan2(y + 0.1, z) / k2PI + 0.5,
+ atan2(z + 0.1, y) / k2PI + 0.5,
+ atan2(w + 0.1, x) / k2PI + 0.5 ];
+ },
+ },
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-atan.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-atan.html
new file mode 100644
index 0000000000..20d1366f70
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-atan.html
@@ -0,0 +1,95 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL atan function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+var piConstants = [
+ "const float kPI = 3.14159265358979323846;",
+ "const float kHalfPI = (kPI * 0.5);",
+ "const float k2PI = (kPI * 2.0);"
+].join("\n");
+
+var kPI = Math.PI;
+var kHalfPI = Math.PI * 0.5;
+var k2PI = Math.PI * 2.0;
+var atan = Math.atan; // shorthand
+
+GLSLGenerator.runReferenceImageTest({
+ feature: "atan",
+ args: "$(type) value",
+ testFunc: "$(func)($(type))",
+ gridRes: 8,
+ tolerance: 4,
+ extra: piConstants,
+ tests: [
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).x * 8.0 - 4.0) / k2PI + 0.5,",
+ " 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ atan(x * 8.0 - 4.0) / k2PI + 0.5,
+ 0.5,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xy * 8.0 - vec2(4, 4)) / k2PI + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ atan(x * 8.0 - 4) / k2PI + 0.5,
+ atan(y * 8.0 - 4) / k2PI + 0.5,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / k2PI + vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ atan(x * 8.0 - 4) / k2PI + 0.5,
+ atan(y * 8.0 - 4) / k2PI + 0.5,
+ atan(z * 8.0 - 4) / k2PI + 0.5,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = ",
+ " $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
+ ].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ atan(x * 8.0 - 4) / k2PI + 0.5,
+ atan(y * 8.0 - 4) / k2PI + 0.5,
+ atan(z * 8.0 - 4) / k2PI + 0.5,
+ atan(w * 8.0 - 4) / k2PI + 0.5 ];
+ },
+ },
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-ceil.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-ceil.html
new file mode 100644
index 0000000000..a031b93fa3
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-ceil.html
@@ -0,0 +1,53 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL ceil function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "ceil",
+ testFunc: "$(func)($(arg0))",
+ emuFunc: ["float $(func)_base(float value) {",
+ " float m = mod(value, 1.0);",
+ " return m != 0.0 ? (value + 1.0 - m) : value;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 8.0 - 4.0) / 8.0 + 0.5,",
+ " $(func)($(input).y * 8.0 - 4.0) / 8.0 + 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * 8.0 - vec2(4, 4)) / 8.0 + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / 8.0 + ",
+ " vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / 8.0 + ",
+ " vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-clamp-float.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-clamp-float.html
new file mode 100644
index 0000000000..bb74a30961
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-clamp-float.html
@@ -0,0 +1,56 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL clamp-gentype function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "clamp",
+ args: "$(type) value, float minValue, float maxValue",
+ baseArgs: "value$(field), minValue, maxValue",
+ testFunc: "$(func)($(type), float, float)",
+ emuFunc: ["float $(func)_base(float value, float minValue, float maxValue) {",
+ " return min(max(value, minValue), maxValue);",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 6.0 - 3.0, -1.5, 1.5) / 3.0 + 0.5,",
+ " $(func)($(input).y * 10.0 - 5.0, -2.5, 2.5) / 5.0 + 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * vec2(6, 10) - vec2(3, 5), -1.5, 2.0) / ",
+ " vec2(3.0, 5.0) + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * vec3(6, 10, 8) - vec3(3, 5, 4), -1.5, 2.0) / ",
+ " vec3(3, 5, 4) + vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * vec4(6, 10, 8, 4) - vec4(3, 5, 4, 2),",
+ " -1.5, 2.2) / vec4(3, 5, 4, 2) + ",
+ " vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-clamp-gentype.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-clamp-gentype.html
new file mode 100644
index 0000000000..2967bdc57d
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-clamp-gentype.html
@@ -0,0 +1,59 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL clamp-gentype function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "clamp",
+ args: "$(type) value, $(type) minValue, $(type) maxValue",
+ baseArgs: "value$(field), minValue$(field), maxValue$(field)",
+ testFunc: "$(func)($(type), $(type), $(type))",
+ emuFunc: ["float $(func)_base(float value, float minValue, float maxValue) {",
+ " return min(max(value, minValue), maxValue);",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 6.0 - 3.0, -1.5, 1.5) / 3.0 + 0.5,",
+ " $(func)($(input).y * 10.0 - 5.0, -2.5, 2.5) / 5.0 + 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * vec2(6, 10) - vec2(3, 5), ",
+ " vec2(-1.5, -2.5), vec2(1.5, 2.5)) / ",
+ " vec2(3.0, 5.0) + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * vec3(6, 10, 8) - vec3(3, 5, 4), ",
+ " vec3(-1.5, -2.5, -2), vec3(1.5, 2.5, 2)) / vec3(3, 5, 4) + ",
+ " vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * vec4(6, 10, 8, 4) - vec4(3, 5, 4, 2),",
+ " vec4(-1.5, -2.5, -2, -1), vec4(1.5, 2.5, 2, 1)) / ",
+ " vec4(3, 5, 4, 2) + ",
+ " vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-cos.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-cos.html
new file mode 100644
index 0000000000..a62ffc76fc
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-cos.html
@@ -0,0 +1,99 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL cos function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+var piConstants = [
+ "const float kPI = 3.14159265358979323846;",
+ "const float kHalfPI = (kPI * 0.5);",
+ "const float k2PI = (kPI * 2.0);"
+].join("\n");
+
+var kPI = Math.PI;
+var kHalfPI = Math.PI * 0.5;
+var k2PI = Math.PI * 2.0;
+var cos = Math.cos; // shorthand
+
+GLSLGenerator.runReferenceImageTest({
+ feature: "cos",
+ args: "$(type) value",
+ testFunc: "$(func)($(type))",
+ gridRes: 8,
+ tolerance: 3,
+ extra: piConstants,
+ tests: [
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).x * kHalfPI + kHalfPI),",
+ " $(func)($(input).y * kHalfPI),",
+ " 0,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ cos(x * kHalfPI + kHalfPI),
+ cos(y * kHalfPI),
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xy * vec2(kPI, k2PI)) * 0.5 + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ cos(x * kPI) * 0.5 + 0.5,
+ cos(y * k2PI) * 0.5 + 0.5,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ // FIXME: for some reason, this test requires a higher tolerance when run in a vertex shader.
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xyz * vec3(kPI, k2PI, 4.0)) * ",
+ " 0.5 + vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ cos(x * kPI) * 0.5 + 0.5,
+ cos(y * k2PI) * 0.5 + 0.5,
+ cos(z * 4.0) * 0.5 + 0.5,
+ 1 ];
+ },
+ tolerance: 7,
+ },
+ {
+ source: ["$(output) = ",
+ " $(func)($(input) * vec4(k2PI, 4.0, kHalfPI, kPI)) *",
+ " 0.5 + vec4(0.5, 0.5, 0.5, 1);",
+ ].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ cos(x * k2PI) * 0.5 + 0.5,
+ cos(y * 4.0) * 0.5 + 0.5,
+ cos(z * kHalfPI) * 0.5 + 0.5,
+ cos(w * kPI) * 0.5 + 1.0 ];
+ },
+ },
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-cross.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-cross.html
new file mode 100644
index 0000000000..37d17a4eda
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-cross.html
@@ -0,0 +1,53 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL cross function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+GLSLGenerator.runFeatureTest({
+ feature: "cross",
+ args: "$(type) x, $(type) y",
+ baseArgs: "value$(field)",
+ testFunc: "$(func)($(type),$(type))",
+ emuFuncs: [
+ { type: "vec3",
+ code: [
+ "vec3 $(func)_emu($(args)) {",
+ " return vec3(",
+ " x[1] * y[2] - y[1] * x[2],",
+ " x[2] * y[0] - y[2] * x[0],",
+ " x[0] * y[1] - y[0] * x[1]);",
+ "}"].join("\n")
+ },
+ ],
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(",
+ " normalize($(input).xyz - 0.5),",
+ " normalize($(input).yzw - 0.5)) * 0.5 + 0.5,",
+ " 1);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-distance.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-distance.html
new file mode 100644
index 0000000000..1efa4f7e4e
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-distance.html
@@ -0,0 +1,88 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL distance function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+GLSLGenerator.runFeatureTest({
+ feature: "distance",
+ args: "$(type) p1, $(type) p2",
+ baseArgs: "value$(field)",
+ testFunc: "$(func)($(type),$(type))",
+ emuFuncs: [
+ { type: "float",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return abs(p1 - p2);",
+ "}"].join("\n")
+ },
+ { type: "vec2",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return length(p1 - p2);",
+ "}"].join("\n")
+ },
+ { type: "vec3",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return length(p1 - p2);",
+ "}"].join("\n")
+ },
+ { type: "vec4",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return length(p1 - p2);",
+ "}"].join("\n")
+ }
+ ],
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).x * 8.0 - 4.0,",
+ " $(input).y * 8.0 - 4.0) / 8.0,",
+ " 0,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " 0,",
+ " $(func)(",
+ " $(input).xy * 8.0 - 4.0,",
+ " $(input).wz * 8.0 - 4.0) / 8.0,",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " 0, 0,",
+ " $(func)(",
+ " $(input).xyz * 8.0 - 4.0,",
+ " $(input).yzw * 8.0 - 4.0) / 8.0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " vec4($(input).xyz, 0) * 8.0 - 4.0,",
+ " vec4(0, $(input).wzy) * 8.0 - 4.0) / 8.0,",
+ " 0, 0, 1);",
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-dot.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-dot.html
new file mode 100644
index 0000000000..c29e43e464
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-dot.html
@@ -0,0 +1,90 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL dot function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+GLSLGenerator.runFeatureTest({
+ feature: "dot",
+ args: "$(type) p1, $(type) p2",
+ baseArgs: "value$(field)",
+ testFunc: "$(func)($(type),$(type))",
+ fragmentTolerance: 1,
+ emuFuncs: [
+ { type: "float",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return p1 * p2;",
+ "}"].join("\n")
+ },
+ { type: "vec2",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return p1.x * p2.x + p1.y * p2.y;",
+ "}"].join("\n")
+ },
+ { type: "vec3",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z;",
+ "}"].join("\n")
+ },
+ { type: "vec4",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z + p1.w * p2.w;",
+ "}"].join("\n")
+ }
+ ],
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).x * 8.0 - 4.0,",
+ " $(input).y * 8.0 - 4.0) / 8.0,",
+ " 0,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " 0,",
+ " $(func)(",
+ " $(input).xy * 8.0 - 4.0,",
+ " $(input).wz * 8.0 - 4.0) / 8.0,",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " 0, 0,",
+ " $(func)(",
+ " $(input).xyz * 8.0 - 4.0,",
+ " $(input).yzw * 8.0 - 4.0) / 8.0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " vec4($(input).xyz, 0) * 8.0 - 4.0,",
+ " vec4(0, $(input).wzy) * 8.0 - 4.0) / 8.0,",
+ " 0, 0, 1);",
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-faceforward.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-faceforward.html
new file mode 100644
index 0000000000..16a4e72ef7
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-faceforward.html
@@ -0,0 +1,66 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL faceforward function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+GLSLGenerator.runFeatureTest({
+ feature: "faceforward",
+ args: "$(type) N, $(type) I, $(type) Nref",
+ baseArgs: "value$(field)",
+ testFunc: "$(func)($(type),$(type),$(type))",
+ simpleEmu: [
+ "$(type) $(func)_emu($(args)) {",
+ " return dot(Nref, I) < 0.0 ? N : -N;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).x * 2.0 - 1.0,",
+ " $(input).y * 2.0 - 1.0,",
+ " $(input).z * 2.0 - 1.0),",
+ " 0,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).xy * 2.0 - 1.0,",
+ " $(input).yz * 2.0 - 1.0,",
+ " $(input).zw * 2.0 - 1.0),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).xyz * 2.0 - 1.0,",
+ " $(input).yzw * 2.0 - 1.0,",
+ " $(input).zwx * 2.0 - 1.0),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)(",
+ " $(input).xyzw * 2.0 - 1.0,",
+ " $(input).yzwx * 2.0 - 1.0,",
+ " $(input).zwxy * 2.0 - 1.0);"
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-floor.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-floor.html
new file mode 100644
index 0000000000..371ebd746b
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-floor.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL floor function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "floor",
+ testFunc: "$(func)($(arg0))",
+ emuFunc: ["float $(func)_base(float value) {",
+ " return value - mod(value, 1.0);",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 8.0 - 4.0) / 8.0 + 0.5,",
+ " $(func)($(input).y * 8.0 - 4.0) / 8.0 + 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * 8.0 - vec2(4, 4)) / 8.0 + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / 8.0 + ",
+ " vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / 8.0 + ",
+ " vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-fract.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-fract.html
new file mode 100644
index 0000000000..90e1c0bf13
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-fract.html
@@ -0,0 +1,50 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL fract function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "fract",
+ testFunc: "$(func)($(arg0))",
+ emuFunc: ["float $(func)_base(float value) {",
+ " return value - floor(value);",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 4.0 - 2.0),",
+ " $(func)($(input).y * 4.0 - 2.0),",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * 4.0 - vec2(2, 2)),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * 4.0 - vec3(2, 2, 2)),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * 4.0 - vec4(2, 2, 2, 2));"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-length.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-length.html
new file mode 100644
index 0000000000..f3f04f4543
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-length.html
@@ -0,0 +1,87 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL length function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+GLSLGenerator.runFeatureTest({
+ feature: "length",
+ args: "$(type) value",
+ baseArgs: "value$(field)",
+ testFunc: "$(func)($(type))",
+ fragmentTolerance: 1,
+ emuFuncs: [
+ { type: "float",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return abs($(baseArgs));",
+ "}"].join("\n")
+ },
+ { type: "vec2",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return sqrt(",
+ " $(baseArgsX) * $(baseArgsX) + ",
+ " $(baseArgsY) * $(baseArgsY));",
+ "}"].join("\n")
+ },
+ { type: "vec3",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return sqrt(",
+ " $(baseArgsX) * $(baseArgsX) + ",
+ " $(baseArgsY) * $(baseArgsY) + ",
+ " $(baseArgsZ) * $(baseArgsZ));",
+ "}"].join("\n")
+ },
+ { type: "vec4",
+ code: [
+ "float $(func)_emu($(args)) {",
+ " return sqrt(",
+ " $(baseArgsX) * $(baseArgsX) + ",
+ " $(baseArgsY) * $(baseArgsY) + ",
+ " $(baseArgsZ) * $(baseArgsZ) + ",
+ " $(baseArgsW) * $(baseArgsW));",
+ "}"].join("\n")
+ }
+ ],
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 8.0 - 4.0) / 4.0,",
+ " $(func)($(input).y * 8.0 - 4.0) / 4.0,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * 8.0 - 4.0) / 4.0,",
+ " 0, 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * 8.0 - 4.0) / 4.0,",
+ " 0, 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input) * 8.0 - 4.0) / 4.0, 0, 0, 1);",
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-lessThan.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-lessThan.html
new file mode 100644
index 0000000000..d461c2ee16
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-lessThan.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL lessThan function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "lessThan",
+ args: "$(type) x, $(type) y",
+ bvecTest: true,
+ baseArgs: "x, y",
+ testFunc: "$(func)($(type), $(type))",
+ emuFunc: ["bool $(func) _base(float x, float y) {",
+ " return x < y;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["bvec2 r = bvec2($(func)($(input).xy, $(input).yw));",
+ "$(output) = vec4(",
+ " r.x ? 0.2: 0.8,",
+ " r.y ? 0.2: 0.8,",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / 8.0 + ",
+ " vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / 8.0 + ",
+ " vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-max-float.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-max-float.html
new file mode 100644
index 0000000000..880fa24b48
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-max-float.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL max-float function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "max",
+ args: "$(type) value, float maxValue",
+ baseArgs: "value$(field), maxValue",
+ testFunc: "$(func)($(arg0), float)",
+ emuFunc: ["float $(func)_base(float value, float maxValue) {",
+ " return value > maxValue ? value : maxValue;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x, 0.5),",
+ " $(func)($(input).y, 0.5),",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy, 0.5),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz, 0.5),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input), 0.5);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-max-gentype.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-max-gentype.html
new file mode 100644
index 0000000000..8d30dacdf9
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-max-gentype.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL max-gentype function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "max",
+ args: "$(type) value, $(type) maxValue",
+ baseArgs: "value$(field), maxValue$(field)",
+ testFunc: "$(func)($(type), $(type))",
+ emuFunc: ["float $(func)_base(float value, float maxValue) {",
+ " return value > maxValue ? value : maxValue;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x, 0.5),",
+ " $(func)($(input).y, 0.5),",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy, vec2(0.5, 0.5)),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz, vec3(0.5, 0.5, 0.5)),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input), vec4(0.5, 0.5, 0.5, 0.5));"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-min-float.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-min-float.html
new file mode 100644
index 0000000000..1cb140ce45
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-min-float.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL min-float function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "min",
+ args: "$(type) value, float divisor",
+ baseArgs: "value$(field), divisor",
+ testFunc: "$(func)($(arg0), float)",
+ emuFunc: ["float $(func)_base(float value, float divisor) {",
+ " return value < divisor ? value : divisor;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x, 0.5),",
+ " $(func)($(input).y, 0.5),",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy, 0.5),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz, 0.5),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input), 0.5);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-min-gentype.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-min-gentype.html
new file mode 100644
index 0000000000..4ff565112a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-min-gentype.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL min-gentype function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "min",
+ args: "$(type) value, $(type) minValue",
+ baseArgs: "value$(field), minValue$(field)",
+ testFunc: "$(func)($(type), $(type))",
+ emuFunc: ["float $(func)_base(float value, float minValue) {",
+ " return value < minValue ? value : minValue;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x, 0.5),",
+ " $(func)($(input).y, 0.5),",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy, vec2(0.5, 0.5)),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz, vec3(0.5, 0.5, 0.5)),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input), vec4(0.5, 0.5, 0.5, 0.5));"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mix-float.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mix-float.html
new file mode 100644
index 0000000000..34e70068c2
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mix-float.html
@@ -0,0 +1,54 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL mix-float function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "mix",
+ args: "$(type) startValue, $(type) endValue, float mixValue",
+ baseArgs: "startValue$(field), endValue$(field), mixValue",
+ testFunc: "$(func)($(type), $(type), float)",
+ emuFunc: [
+ "float $(func)_base(float startValue, float endValue, float mixValue) {",
+ " return startValue * (1.0 - mixValue) + endValue * mixValue;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(1.0, 0.0, $(input).x),",
+ " ($(func)(-2.0, 3.0, $(input).y) + 2.0) / 5.0,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(vec2(1, -2), vec2(0, 2), $(input).z), ",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(vec3(1, -2, -1), vec3(0, 2, 3), $(input).y),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)(vec4(1, -2, -1, 0.5), vec4(0, 2, 3, 1), $(input).w);"
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mix-gentype.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mix-gentype.html
new file mode 100644
index 0000000000..2fa3330e7e
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mix-gentype.html
@@ -0,0 +1,54 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL mix-gentype function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "mix",
+ args: "$(type) startValue, $(type) endValue, $(type) mixValue",
+ baseArgs: "startValue$(field), endValue$(field), mixValue$(field)",
+ testFunc: "$(func)($(type), $(type), $(type))",
+ emuFunc: [
+ "float $(func)_base(float startValue, float endValue, float mixValue) {",
+ " return startValue * (1.0 - mixValue) + endValue * mixValue;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(1.0, 0.0, $(input).x),",
+ " ($(func)(-2.0, 3.0, $(input).y) + 2.0) / 5.0,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(vec2(1, -2), vec2(0, 2), $(input).xy), ",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(vec3(1, -2, -1), vec3(0, 2, 3), $(input).xyz),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)(vec4(1, -2, -1, 0.5), vec4(0, 2, 3, 1), $(input));"
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mod-float.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mod-float.html
new file mode 100644
index 0000000000..83bcf76715
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mod-float.html
@@ -0,0 +1,53 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL mod-float function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "mod",
+ args: "$(type) value, float divisor",
+ baseArgs: "value$(field), divisor",
+ testFunc: "$(func)($(arg0), float)",
+ fragmentTolerance: 1,
+ emuFunc: ["float $(func)_base(float value, float divisor) {",
+ " return value - divisor * floor(value / divisor);",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 6.0 - 3.0, 1.5) / 1.5,",
+ " $(func)($(input).y * 6.0 - 3.0, 1.5) / 1.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * 6.0 - vec2(3, 3), 1.5) / 1.5,",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * 6.0 - vec3(3, 3, 3), 1.5) / 1.5,",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * 6.0 - vec4(3, 3, 3, 3), 1.5) / 1.5;"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mod-gentype.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mod-gentype.html
new file mode 100644
index 0000000000..9b562300b9
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-mod-gentype.html
@@ -0,0 +1,56 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL mod-gentype function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "mod",
+ args: "$(type) value, $(type) divisor",
+ baseArgs: "value$(field), divisor$(field)",
+ testFunc: "$(func)($(type), $(type))",
+ emuFunc: ["float $(func)_base(float value, float divisor) {",
+ " return value - divisor * floor(value / divisor);",
+ "}"].join("\n"),
+ gridRes: 8,
+ tolerance: 1,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 6.0 - 3.0, 1.5) / 1.5,",
+ " $(func)($(input).y * 10.0 - 5.0, 2.1) / 2.1,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * vec2(6, 10) - vec2(3, 5), ",
+ " vec2(1.5, 2.1)) / vec2(1.5, 2.1),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * vec3(6, 10, 8) - vec3(3, 5, 4), ",
+ " vec3(1.5, 2.1, 3.2)) / vec3(1.5, 2.1, 3.2),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * vec4(6, 10, 8, 4) - vec4(3, 5, 4, 2),",
+ " vec4(1.5, 2.1, 3.2, 1.1)) / vec4(1.5, 2.1, 3.2, 1.1);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-normalize.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-normalize.html
new file mode 100644
index 0000000000..bd5f8844d9
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-normalize.html
@@ -0,0 +1,59 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL normalize function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "normalize",
+ args: "$(type) value",
+ testFunc: "$(func)($(type))",
+ simpleEmu: [
+ "$(type) $(func)_emu($(args)) {",
+ " return value / length(value);",
+ "}"].join("\n"),
+ gridRes: 8,
+ tolerance: 1,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).x * 8.0 - 4.1) * 0.5 + 0.5,",
+ " 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).xy * 8.0 - 4.1) * 0.5 + 0.5,",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).xyz * 8.0 - 4.1) * 0.5 + 0.5,",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)(",
+ " vec4($(input).xyz, 0) * 8.0 - 4.1) * 0.5 + 0.5 + vec4(0,0,0,0.5);",
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-reflect.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-reflect.html
new file mode 100644
index 0000000000..70d9e557f7
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-reflect.html
@@ -0,0 +1,61 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL reflect function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "reflect",
+ args: "$(type) I, $(type) N",
+ baseArgs: "value$(field)",
+ testFunc: "$(func)($(type),$(type))",
+ simpleEmu: [
+ "$(type) $(func)_emu($(args)) {",
+ " return I - 2.0 * dot(N, I) * N;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).x * 2.0 - 1.0,",
+ " $(input).y * 2.0 - 1.0),",
+ " 0,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).xy * 2.0 - 1.0,",
+ " $(input).yz * 2.0 - 1.0),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).xyz * 2.0 - 1.0,",
+ " $(input).yzw * 2.0 - 1.0),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)(",
+ " $(input).xyzw * 2.0 - 1.0,",
+ " $(input).yzwx * 2.0 - 1.0);"
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-refract.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-refract.html
new file mode 100644
index 0000000000..1ee43b2f60
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-refract.html
@@ -0,0 +1,70 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL refract function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "refract",
+ args: "$(type) I, $(type) N, float eta",
+ baseArgs: "value$(field)",
+ testFunc: "$(func)($(type),$(type),float)",
+ simpleEmu: [
+ "$(type) $(func)_emu($(args)) {",
+ " float dotNI = dot(N, I);",
+ " float k = 1.0 - eta * eta * (1.0 - dotNI * dotNI);",
+ " if (k < 0.0) {",
+ " return $(type)(0.0);",
+ " }",
+ " return eta * I - (eta * dotNI * sqrt(k)) * N;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).x * 2.0 - 1.0,",
+ " $(input).y * 2.0 - 1.0,",
+ " $(input).w),",
+ " 0,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).xy * 2.0 - 1.0,",
+ " $(input).yz * 2.0 - 1.0,",
+ " $(input).w),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(",
+ " $(input).xyz * 2.0 - 1.0,",
+ " $(input).yzw * 2.0 - 1.0,",
+ " $(input).w),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)(",
+ " $(input).xyzw * 2.0 - 1.0,",
+ " $(input).yzwx * 2.0 - 1.0,",
+ " $(input).w);"
+ ].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-sign.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-sign.html
new file mode 100644
index 0000000000..3185c647ea
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-sign.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL sign function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "sign",
+ testFunc: "$(func)($(arg0))",
+ emuFunc: ["float $(func)_base(float value) {",
+ " if (value == 0.0) return 0.0;",
+ " return value > 0.0 ? 1.0 : -1.0;",
+ "}"].join("\n"),
+ gridRes: 4,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)($(input).x * 2.0 - 1.0) * 0.5 + 0.5,",
+ " 0.5,",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xy * 2.0 - vec2(1, 1)) * 0.5 + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)($(input).xyz * 2.0 - vec3(1, 1, 1)) * 0.5 + ",
+ " vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)($(input) * 2.0 - vec4(1, 1, 1, 1)) * 0.5 + ",
+ " vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-sin.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-sin.html
new file mode 100644
index 0000000000..b27e6ace1a
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-sin.html
@@ -0,0 +1,96 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL sin function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+var piConstants = [
+ "const float kPI = 3.14159265358979323846;",
+ "const float kHalfPI = (kPI * 0.5);",
+ "const float k2PI = (kPI * 2.0);"
+].join("\n");
+
+var kPI = Math.PI;
+var kHalfPI = Math.PI * 0.5;
+var k2PI = Math.PI * 2.0;
+var sin = Math.sin; // shorthand
+
+GLSLGenerator.runReferenceImageTest({
+ feature: "sin",
+ args: "$(type) value",
+ testFunc: "$(func)($(type))",
+ gridRes: 8,
+ tolerance: 4,
+ extra: piConstants,
+ tests: [
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).x * kHalfPI + kHalfPI),",
+ " $(func)($(input).y * kHalfPI),",
+ " 0,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ sin(x * kHalfPI + kHalfPI),
+ sin(y * kHalfPI),
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xy * vec2(kPI, k2PI)) * 0.5 + vec2(0.5, 0.5),",
+ " 0, 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ sin(x * kPI) * 0.5 + 0.5,
+ sin(y * k2PI) * 0.5 + 0.5,
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = vec4(",
+ " $(func)($(input).xyz * vec3(kPI, k2PI, 4.0)) * ",
+ " 0.5 + vec3(0.5, 0.5, 0.5),",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ sin(x * kPI) * 0.5 + 0.5,
+ sin(y * k2PI) * 0.5 + 0.5,
+ sin(z * 4.0) * 0.5 + 0.5,
+ 1 ];
+ },
+ },
+ {
+ source: ["$(output) = ",
+ " $(func)($(input) * vec4(k2PI, 4.0, kHalfPI, kPI)) *",
+ " 0.5 + vec4(0.5, 0.5, 0.5, 1);",
+ ].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ sin(x * k2PI) * 0.5 + 0.5,
+ sin(y * 4.0) * 0.5 + 0.5,
+ sin(z * kHalfPI) * 0.5 + 0.5,
+ sin(w * kPI) * 0.5 + 1 ];
+ },
+ },
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-smoothstep-float.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-smoothstep-float.html
new file mode 100644
index 0000000000..a963ec0fb7
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-smoothstep-float.html
@@ -0,0 +1,97 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL smoothstep-float function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+function clamp(value, min, max) {
+ return Math.max(min, Math.min(value, max));
+}
+
+function smoothstep(edge0, edge1, value) {
+ var t = clamp((value - edge0) / (edge1 - edge0), 0, 1);
+ return t * t * (3 - 2 * t);
+}
+
+GLSLGenerator.runReferenceImageTest({
+ feature: "smoothstep",
+ args: "float edge0, float edge1, $(type) value",
+ testFunc: "$(func)(float, float, $(type))",
+ gridRes: 8,
+ tolerance: 4,
+ tests: [
+ {
+ source: ["$(output) = vec4(",
+ " $(func)(0.3, 0.7, $(input).x),",
+ " $(func)(0.2, 0.8, $(input).y),",
+ " 0,",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ smoothstep(0.3, 0.7, x),
+ smoothstep(0.2, 0.8, y),
+ 0,
+ 1 ];
+ },
+ },
+ {
+ source: [ "$(output) = vec4(",
+ " $(func)(0.4, 0.8, $(input).xy),",
+ " 0, 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ smoothstep(0.4, 0.8, x),
+ smoothstep(0.4, 0.8, y),
+ 0,
+ 1 ];
+ },
+ },
+ {
+ // FIXME: this test seems to need a higher tolerance when run in a vertex shader.
+ source: [ "$(output) = vec4(",
+ " $(func)(0.3, 0.7, $(input).xyz),",
+ " 1);"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ smoothstep(0.3, 0.7, x),
+ smoothstep(0.3, 0.7, y),
+ smoothstep(0.3, 0.7, z),
+ 1 ];
+ },
+ tolerance: 12,
+ fragmentTolerance: 3,
+ },
+ {
+ // FIXME: this test seems to need a higher tolerance when run in a vertex shader.
+ source: ["$(output) = ",
+ " $(func)(0.3, 0.9, $(input));"].join("\n"),
+ generator: function(x, y, z, w) {
+ return [ smoothstep(0.3, 0.9, x),
+ smoothstep(0.3, 0.9, y),
+ smoothstep(0.3, 0.9, z),
+ smoothstep(0.3, 0.9, w) ];
+ },
+ tolerance: 7,
+ fragmentTolerance: 3,
+ },
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-smoothstep-gentype.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-smoothstep-gentype.html
new file mode 100644
index 0000000000..84c992ed64
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-smoothstep-gentype.html
@@ -0,0 +1,56 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL smoothstep-gentype function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+
+GLSLGenerator.runFeatureTest({
+ feature: "smoothstep",
+ args: "$(type) edge0, $(type) edge1, $(type) value",
+ baseArgs: "edge0$(field), edge1$(field), value$(field)",
+ testFunc: "$(func)($(type), $(type), $(type))",
+ emuFunc: ["float $(func)_base(float edge0, float edge1, float value) {",
+ " float t = clamp((value - edge0) / (edge1 - edge0), 0.0, 1.0);",
+ " return t * t * (3.0 - 2.0 * t);",
+ "}"].join("\n"),
+ gridRes: 8,
+ tolerance: 1,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(0.3, 0.7, $(input).x),",
+ " $(func)(0.2, 0.8, $(input).y),",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(vec2(0.4, 0.6), vec2(0.8, 0.9), $(input).xy),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(vec3(0.3, 0.5, 0.7), vec3(0.7, 0.9, 1.0), $(input).xyz),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)(vec4(0.3, 0.4, 0.5, 0.2), ",
+ " vec4(0.7, 0.6, 0.9, 0.8), ",
+ " $(input));"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-step-float.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-step-float.html
new file mode 100644
index 0000000000..09f6e38612
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-step-float.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL step-float function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "step",
+ args: "float edge, $(type) value",
+ baseArgs: "edge, value$(field)",
+ testFunc: "$(func)(float, $(type))",
+ emuFunc: ["float $(func)_base(float edge, float value) {",
+ " return value < edge ? 0.0 : 1.0;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(0.3, $(input).x),",
+ " $(func)(0.7, $(input).y),",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(0.4, $(input).xy),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(0.4, $(input).xyz),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)(0.4, $(input));"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-step-gentype.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-step-gentype.html
new file mode 100644
index 0000000000..8b267265f6
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function-step-gentype.html
@@ -0,0 +1,51 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL step-gentype function test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "step",
+ args: "$(type) edge, $(type) value",
+ baseArgs: "edge$(field), value$(field)",
+ testFunc: "$(func)($(type), $(type))",
+ emuFunc: ["float $(func)_base(float edge, float value) {",
+ " return value < edge ? 0.0 : 1.0;",
+ "}"].join("\n"),
+ gridRes: 8,
+ tests: [
+ ["$(output) = vec4(",
+ " $(func)(0.3, $(input).x),",
+ " $(func)(0.7, $(input).y),",
+ " 0,",
+ " 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(vec2(0.4, 0.6), $(input).xy),",
+ " 0, 1);"].join("\n"),
+ ["$(output) = vec4(",
+ " $(func)(vec3(0.3, 0.5, 0.7), $(input).xyz),",
+ " 1);"].join("\n"),
+ ["$(output) = ",
+ " $(func)( vec4(0.3, 0.4, 0.5, 0.2), $(input));"].join("\n")
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function.html
new file mode 100644
index 0000000000..51acf0dae2
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/functions/glsl-function.html
@@ -0,0 +1,39 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>GLSL function test test</title>
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
+<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
+<script src="../../../js/js-test-pre.js"></script>
+<script src="../../../js/webgl-test-utils.js"> </script>
+<script src="../../../js/glsl-generator.js"> </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+GLSLGenerator.runFeatureTest({
+ feature: "the_GLSL_test_harness",
+ testFunc: "pass through",
+ emuFunc: "float $(func)_base(float value) { return 0.0; }",
+ gridRes: 4,
+ tests: [
+ "$(output) = vec4($(input).x, 0, 0, 1);",
+ "$(output) = vec4(0, $(input).xy, 1);",
+ "$(output) = vec4($(input).xyz, 1);",
+ "$(output) = $(input);"
+ ]
+});
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+