Bug 1918529 - fix some subpixel misalignment issues with gfx.webrender.svg-filter...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / glsl / functions / glsl-function-length.html
blobf3f04f45432d656846d1b2bac5ba118f9c65a81d
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 length 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: "length",
26 args: "$(type) value",
27 baseArgs: "value$(field)",
28 testFunc: "$(func)($(type))",
29 fragmentTolerance: 1,
30 emuFuncs: [
31 { type: "float",
32 code: [
33 "float $(func)_emu($(args)) {",
34 " return abs($(baseArgs));",
35 "}"].join("\n")
37 { type: "vec2",
38 code: [
39 "float $(func)_emu($(args)) {",
40 " return sqrt(",
41 " $(baseArgsX) * $(baseArgsX) + ",
42 " $(baseArgsY) * $(baseArgsY));",
43 "}"].join("\n")
45 { type: "vec3",
46 code: [
47 "float $(func)_emu($(args)) {",
48 " return sqrt(",
49 " $(baseArgsX) * $(baseArgsX) + ",
50 " $(baseArgsY) * $(baseArgsY) + ",
51 " $(baseArgsZ) * $(baseArgsZ));",
52 "}"].join("\n")
54 { type: "vec4",
55 code: [
56 "float $(func)_emu($(args)) {",
57 " return sqrt(",
58 " $(baseArgsX) * $(baseArgsX) + ",
59 " $(baseArgsY) * $(baseArgsY) + ",
60 " $(baseArgsZ) * $(baseArgsZ) + ",
61 " $(baseArgsW) * $(baseArgsW));",
62 "}"].join("\n")
65 gridRes: 8,
66 tests: [
67 ["$(output) = vec4(",
68 " $(func)($(input).x * 8.0 - 4.0) / 4.0,",
69 " $(func)($(input).y * 8.0 - 4.0) / 4.0,",
70 " 0,",
71 " 1);"].join("\n"),
72 ["$(output) = vec4(",
73 " $(func)($(input).xy * 8.0 - 4.0) / 4.0,",
74 " 0, 0, 1);"].join("\n"),
75 ["$(output) = vec4(",
76 " $(func)($(input).xyz * 8.0 - 4.0) / 4.0,",
77 " 0, 0, 1);"].join("\n"),
78 ["$(output) = vec4(",
79 " $(func)($(input) * 8.0 - 4.0) / 4.0, 0, 0, 1);",
80 ].join("\n")
82 });
83 var successfullyParsed = true;
84 </script>
85 </body>
86 </html>