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

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 <!--
     2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
     3 Use of this source code is governed by a BSD-style license that can be
     4 found in the LICENSE file.
     5  -->
     6 <!DOCTYPE html>
     7 <html>
     8 <head>
     9 <meta charset="utf-8">
    10   <title>GLSL atan function test</title>
    11   <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
    12   <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
    13   <script src="../../../resources/js-test-pre.js"></script>
    14   <script src="../../resources/webgl-test.js"> </script>
    15   <script src="../../resources/webgl-test-utils.js"> </script>
    16   <script src="../../resources/glsl-generator.js"> </script>
    17 </head>
    18 <body>
    19 <div id="description"></div>
    20 <div id="console"></div>
    21 <script>
    23 var piConstants = [
    24   "const float kPI     = 3.14159265358979323846;",
    25   "const float kHalfPI = (kPI * 0.5);",
    26   "const float k2PI    = (kPI * 2.0);"
    27 ].join("\n");
    29 var kPI = Math.PI;
    30 var kHalfPI = Math.PI * 0.5;
    31 var k2PI = Math.PI * 2.0;
    32 var atan = Math.atan;  // shorthand
    34 GLSLGenerator.runReferenceImageTest({
    35   feature: "atan",
    36   args: "$(type) value",
    37   testFunc: "$(func)($(type))",
    38   gridRes: 8,
    39   tolerance: 4,
    40   extra: piConstants,
    41   tests: [
    42     {
    43       source: ["$(output) = vec4(",
    44                "    $(func)($(input).x * 8.0 - 4.0) / k2PI + 0.5,",
    45                "    0.5,",
    46                "    0,",
    47                "    1);"].join("\n"),
    48       generator: function(x, y, z, w) {
    49         return [ atan(x * 8.0 - 4.0) / k2PI + 0.5,
    50                  0.5,
    51                  0,
    52                  1 ];
    53       },
    54     },
    55     {
    56       source: ["$(output) = vec4(",
    57                "    $(func)($(input).xy * 8.0 - vec2(4, 4)) / k2PI + vec2(0.5, 0.5),",
    58                "    0, 1);"].join("\n"),
    59       generator: function(x, y, z, w) {
    60         return [ atan(x * 8.0 - 4) / k2PI + 0.5,
    61                  atan(y * 8.0 - 4) / k2PI + 0.5,
    62                  0,
    63                  1 ];
    64       },
    65     },
    66     {
    67       source: ["$(output) = vec4(",
    68                "    $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / k2PI + vec3(0.5, 0.5, 0.5),",
    69                "    1);"].join("\n"),
    70       generator: function(x, y, z, w) {
    71         return [ atan(x * 8.0 - 4) / k2PI + 0.5,
    72                  atan(y * 8.0 - 4) / k2PI + 0.5,
    73                  atan(z * 8.0 - 4) / k2PI + 0.5,
    74                  1 ];
    75       },
    76     },
    77     {
    78       source: ["$(output) = ",
    79                "    $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
    80               ].join("\n"),
    81       generator: function(x, y, z, w) {
    82         return [ atan(x * 8.0 - 4) / k2PI + 0.5,
    83                  atan(y * 8.0 - 4) / k2PI + 0.5,
    84                  atan(z * 8.0 - 4) / k2PI + 0.5,
    85                  atan(w * 8.0 - 4) / k2PI + 0.5 ];
    86       },
    87     },
    88   ]
    89 });
    90 successfullyParsed = true;
    91 </script>
    92 </body>
    93 </html>

mercurial