content/canvas/test/webgl-conformance/conformance/glsl/functions/glsl-function-atan-xy.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/webgl-conformance/conformance/glsl/functions/glsl-function-atan-xy.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     1.4 +<!--
     1.5 +Copyright (c) 2011 The Chromium Authors. All rights reserved.
     1.6 +Use of this source code is governed by a BSD-style license that can be
     1.7 +found in the LICENSE file.
     1.8 + -->
     1.9 +<!DOCTYPE html>
    1.10 +<html>
    1.11 +<head>
    1.12 +<meta charset="utf-8">
    1.13 +  <title>GLSL atan-xy function test</title>
    1.14 +  <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
    1.15 +  <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
    1.16 +  <script src="../../../resources/js-test-pre.js"></script>
    1.17 +  <script src="../../resources/webgl-test.js"> </script>
    1.18 +  <script src="../../resources/webgl-test-utils.js"> </script>
    1.19 +  <script src="../../resources/glsl-generator.js"> </script>
    1.20 +</head>
    1.21 +<body>
    1.22 +<div id="description"></div>
    1.23 +<div id="console"></div>
    1.24 +<script>
    1.25 +
    1.26 +var piConstants = [
    1.27 +  "const float kPI     = 3.14159265358979323846;",
    1.28 +  "const float kHalfPI = (kPI * 0.5);",
    1.29 +  "const float k2PI    = (kPI * 2.0);"
    1.30 +].join("\n");
    1.31 +
    1.32 +var kPI = Math.PI;
    1.33 +var kHalfPI = Math.PI * 0.5;
    1.34 +var k2PI = Math.PI * 2.0;
    1.35 +var atan2 = Math.atan2;  // shorthand
    1.36 +
    1.37 +GLSLGenerator.runReferenceImageTest({
    1.38 +  feature: "atan",
    1.39 +  args: "$(type) y, $(type) x",
    1.40 +  testFunc: "$(func)($(type), $(type))",
    1.41 +  gridRes: 8,
    1.42 +  tolerance: 5,
    1.43 +  extra: piConstants,
    1.44 +  tests: [
    1.45 +    {
    1.46 +      source: ["$(output) = vec4(",
    1.47 +               "    $(func)($(input).x + 0.1, $(input).y) / k2PI + 0.5,",
    1.48 +               "    0,",
    1.49 +               "    0,",
    1.50 +               "    1);"].join("\n"),
    1.51 +      generator: function(x, y, z, w) {
    1.52 +        return [ atan2(x + 0.1, y) / k2PI + 0.5,
    1.53 +                 0,
    1.54 +                 0,
    1.55 +                 1 ];
    1.56 +      },
    1.57 +    },
    1.58 +    {
    1.59 +      source: ["$(output) = vec4(",
    1.60 +               "    $(func)($(input).xy + vec2(0.1, 0.1), $(input).yx) / ",
    1.61 +               "            k2PI + vec2(0.5, 0.5),",
    1.62 +               "    0, 1);"].join("\n"),
    1.63 +      generator: function(x, y, z, w) {
    1.64 +        return [ atan2(x + 0.1, y) / k2PI + 0.5,
    1.65 +                 atan2(y + 0.1, x) / k2PI + 0.5,
    1.66 +                 0,
    1.67 +                 1 ];
    1.68 +      },
    1.69 +    },
    1.70 +    {
    1.71 +      source: ["$(output) = vec4(",
    1.72 +               "    $(func)($(input).xyz + vec3(0.1, 0.1, 0.1), $(input).yzx) / ",
    1.73 +               "            k2PI + vec3(0.5, 0.5, 0.5),",
    1.74 +               "    1);"].join("\n"),
    1.75 +      generator: function(x, y, z, w) {
    1.76 +        return [ atan2(x + 0.1, y) / k2PI + 0.5,
    1.77 +                 atan2(y + 0.1, z) / k2PI + 0.5,
    1.78 +                 atan2(z + 0.1, x) / k2PI + 0.5,
    1.79 +                 1 ];
    1.80 +      },
    1.81 +    },
    1.82 +    {
    1.83 +      source: ["$(output) = ",
    1.84 +               "    $(func)($(input) + vec4(0.1, 0.1, 0.1, 0.1), $(input).wzyx) / ",
    1.85 +               "            k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
    1.86 +              ].join("\n"),
    1.87 +      generator: function(x, y, z, w) {
    1.88 +        return [ atan2(x + 0.1, w) / k2PI + 0.5,
    1.89 +                 atan2(y + 0.1, z) / k2PI + 0.5,
    1.90 +                 atan2(z + 0.1, y) / k2PI + 0.5,
    1.91 +                 atan2(w + 0.1, x) / k2PI + 0.5 ];
    1.92 +      },
    1.93 +    },
    1.94 +  ]
    1.95 +});
    1.96 +successfullyParsed = true;
    1.97 +</script>
    1.98 +</body>
    1.99 +</html>
   1.100 +

mercurial