OLD | NEW |
| (Empty) |
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> | |
22 | |
23 GLSLGenerator.runFeatureTest({ | |
24 feature: "dot", | |
25 args: "$(type) p1, $(type) p2", | |
26 baseArgs: "value$(field)", | |
27 testFunc: "$(func)($(type),$(type))", | |
28 emuFuncs: [ | |
29 { type: "float", | |
30 code: [ | |
31 "float $(func)_emu($(args)) {", | |
32 " return p1 * p2;", | |
33 "}"].join("\n") | |
34 }, | |
35 { type: "vec2", | |
36 code: [ | |
37 "float $(func)_emu($(args)) {", | |
38 " return p1.x * p2.x + p1.y * p2.y;", | |
39 "}"].join("\n") | |
40 }, | |
41 { type: "vec3", | |
42 code: [ | |
43 "float $(func)_emu($(args)) {", | |
44 " return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z;", | |
45 "}"].join("\n") | |
46 }, | |
47 { type: "vec4", | |
48 code: [ | |
49 "float $(func)_emu($(args)) {", | |
50 " return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z + p1.w * p2.w;", | |
51 "}"].join("\n") | |
52 } | |
53 ], | |
54 gridRes: 8, | |
55 tests: [ | |
56 ["$(output) = vec4(", | |
57 " $(func)(", | |
58 " $(input).x * 8.0 - 4.0,", | |
59 " $(input).y * 8.0 - 4.0) / 8.0,", | |
60 " 0,", | |
61 " 0,", | |
62 " 1);"].join("\n"), | |
63 ["$(output) = vec4(", | |
64 " 0,", | |
65 " $(func)(", | |
66 " $(input).xy * 8.0 - 4.0,", | |
67 " $(input).wz * 8.0 - 4.0) / 8.0,", | |
68 " 0, 1);"].join("\n"), | |
69 ["$(output) = vec4(", | |
70 " 0, 0,", | |
71 " $(func)(", | |
72 " $(input).xyz * 8.0 - 4.0,", | |
73 " $(input).yzw * 8.0 - 4.0) / 8.0,", | |
74 " 1);"].join("\n"), | |
75 ["$(output) = vec4(", | |
76 " $(func)(", | |
77 " vec4($(input).xyz, 0) * 8.0 - 4.0,", | |
78 " vec4(0, $(input).wzy) * 8.0 - 4.0) / 8.0,", | |
79 " 0, 0, 1);", | |
80 ].join("\n") | |
81 ] | |
82 }); | |
83 successfullyParsed = true; | |
84 </script> | |
85 </body> | |
86 </html> | |
87 | |
88 | |
OLD | NEW |