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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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 dot 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 GLSLGenerator.runFeatureTest({
    24   feature: "dot",
    25   args: "$(type) p1, $(type) p2",
    26   baseArgs: "value$(field)",
    27   testFunc: "$(func)($(type),$(type))",
    28   fragmentTolerance: 1,
    29   emuFuncs: [
    30     { type: "float",
    31       code: [
    32         "float $(func)_emu($(args)) {",
    33         "   return p1 * p2;",
    34         "}"].join("\n")
    35     },
    36     { type: "vec2",
    37       code: [
    38         "float $(func)_emu($(args)) {",
    39         "   return p1.x * p2.x + p1.y * p2.y;",
    40         "}"].join("\n")
    41     },
    42     { type: "vec3",
    43       code: [
    44         "float $(func)_emu($(args)) {",
    45         "   return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z;",
    46         "}"].join("\n")
    47     },
    48     { type: "vec4",
    49       code: [
    50         "float $(func)_emu($(args)) {",
    51         "   return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z + p1.w * p2.w;",
    52         "}"].join("\n")
    53     }
    54   ],
    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")
    82   ]
    83 });
    84 successfullyParsed = true;
    85 </script>
    86 </body>
    87 </html>

mercurial