Bug 1945965 – remove new tab April Fools logo. r=home-newtab-reviewers,reemhamz
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / glsl / functions / glsl-function-distance.html
blob1efa4f7e4e37a037739e4df620e51f3457630f22
1 <!--
2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
5 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>GLSL distance function test</title>
12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
13 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
14 <script src="../../../js/js-test-pre.js"></script>
15 <script src="../../../js/webgl-test-utils.js"> </script>
16 <script src="../../../js/glsl-generator.js"> </script>
17 </head>
18 <body>
19 <div id="description"></div>
20 <div id="console"></div>
21 <script>
22 "use strict";
24 GLSLGenerator.runFeatureTest({
25 feature: "distance",
26 args: "$(type) p1, $(type) p2",
27 baseArgs: "value$(field)",
28 testFunc: "$(func)($(type),$(type))",
29 emuFuncs: [
30 { type: "float",
31 code: [
32 "float $(func)_emu($(args)) {",
33 " return abs(p1 - p2);",
34 "}"].join("\n")
36 { type: "vec2",
37 code: [
38 "float $(func)_emu($(args)) {",
39 " return length(p1 - p2);",
40 "}"].join("\n")
42 { type: "vec3",
43 code: [
44 "float $(func)_emu($(args)) {",
45 " return length(p1 - p2);",
46 "}"].join("\n")
48 { type: "vec4",
49 code: [
50 "float $(func)_emu($(args)) {",
51 " return length(p1 - p2);",
52 "}"].join("\n")
55 gridRes: 8,
56 tests: [
57 ["$(output) = vec4(",
58 " $(func)(",
59 " $(input).x * 8.0 - 4.0,",
60 " $(input).y * 8.0 - 4.0) / 8.0,",
61 " 0,",
62 " 0,",
63 " 1);"].join("\n"),
64 ["$(output) = vec4(",
65 " 0,",
66 " $(func)(",
67 " $(input).xy * 8.0 - 4.0,",
68 " $(input).wz * 8.0 - 4.0) / 8.0,",
69 " 0, 1);"].join("\n"),
70 ["$(output) = vec4(",
71 " 0, 0,",
72 " $(func)(",
73 " $(input).xyz * 8.0 - 4.0,",
74 " $(input).yzw * 8.0 - 4.0) / 8.0,",
75 " 1);"].join("\n"),
76 ["$(output) = vec4(",
77 " $(func)(",
78 " vec4($(input).xyz, 0) * 8.0 - 4.0,",
79 " vec4(0, $(input).wzy) * 8.0 - 4.0) / 8.0,",
80 " 0, 0, 1);",
81 ].join("\n")
83 });
84 var successfullyParsed = true;
85 </script>
86 </body>
87 </html>