content/canvas/test/webgl-conformance/conformance/glsl/functions/glsl-function-dot.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-dot.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,89 @@
     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 dot 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 +GLSLGenerator.runFeatureTest({
    1.27 +  feature: "dot",
    1.28 +  args: "$(type) p1, $(type) p2",
    1.29 +  baseArgs: "value$(field)",
    1.30 +  testFunc: "$(func)($(type),$(type))",
    1.31 +  fragmentTolerance: 1,
    1.32 +  emuFuncs: [
    1.33 +    { type: "float",
    1.34 +      code: [
    1.35 +        "float $(func)_emu($(args)) {",
    1.36 +        "   return p1 * p2;",
    1.37 +        "}"].join("\n")
    1.38 +    },
    1.39 +    { type: "vec2",
    1.40 +      code: [
    1.41 +        "float $(func)_emu($(args)) {",
    1.42 +        "   return p1.x * p2.x + p1.y * p2.y;",
    1.43 +        "}"].join("\n")
    1.44 +    },
    1.45 +    { type: "vec3",
    1.46 +      code: [
    1.47 +        "float $(func)_emu($(args)) {",
    1.48 +        "   return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z;",
    1.49 +        "}"].join("\n")
    1.50 +    },
    1.51 +    { type: "vec4",
    1.52 +      code: [
    1.53 +        "float $(func)_emu($(args)) {",
    1.54 +        "   return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z + p1.w * p2.w;",
    1.55 +        "}"].join("\n")
    1.56 +    }
    1.57 +  ],
    1.58 +  gridRes: 8,
    1.59 +  tests: [
    1.60 +    ["$(output) = vec4(",
    1.61 +     "    $(func)(",
    1.62 +     "        $(input).x * 8.0 - 4.0,", 
    1.63 +     "        $(input).y * 8.0 - 4.0) / 8.0,",
    1.64 +     "    0,",
    1.65 +     "    0,",
    1.66 +     "    1);"].join("\n"),
    1.67 +    ["$(output) = vec4(",
    1.68 +     "    0,",
    1.69 +     "    $(func)(",
    1.70 +     "        $(input).xy * 8.0 - 4.0,",
    1.71 +     "        $(input).wz * 8.0 - 4.0) / 8.0,", 
    1.72 +     "    0, 1);"].join("\n"),
    1.73 +    ["$(output) = vec4(",
    1.74 +     "    0, 0,",
    1.75 +     "    $(func)(",
    1.76 +     "        $(input).xyz * 8.0 - 4.0,",
    1.77 +     "        $(input).yzw * 8.0 - 4.0) / 8.0,",
    1.78 +     "    1);"].join("\n"),
    1.79 +    ["$(output) = vec4(",
    1.80 +     "    $(func)(",
    1.81 +     "        vec4($(input).xyz, 0) * 8.0 - 4.0,",
    1.82 +     "        vec4(0, $(input).wzy) * 8.0 - 4.0) / 8.0,",
    1.83 +     "    0, 0, 1);",
    1.84 +    ].join("\n")
    1.85 +  ]
    1.86 +});
    1.87 +successfullyParsed = true;
    1.88 +</script>
    1.89 +</body>
    1.90 +</html>
    1.91 +
    1.92 +

mercurial