|
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 cross 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: "cross", |
|
25 args: "$(type) x, $(type) y", |
|
26 baseArgs: "value$(field)", |
|
27 testFunc: "$(func)($(type),$(type))", |
|
28 emuFuncs: [ |
|
29 { type: "vec3", |
|
30 code: [ |
|
31 "vec3 $(func)_emu($(args)) {", |
|
32 " return vec3(", |
|
33 " x[1] * y[2] - y[1] * x[2],", |
|
34 " x[2] * y[0] - y[2] * x[0],", |
|
35 " x[0] * y[1] - y[0] * x[1]);", |
|
36 "}"].join("\n") |
|
37 }, |
|
38 ], |
|
39 gridRes: 8, |
|
40 tests: [ |
|
41 ["$(output) = vec4(", |
|
42 " $(func)(", |
|
43 " normalize($(input).xyz - 0.5),", |
|
44 " normalize($(input).yzw - 0.5)) * 0.5 + 0.5,", |
|
45 " 1);"].join("\n") |
|
46 ] |
|
47 }); |
|
48 successfullyParsed = true; |
|
49 </script> |
|
50 </body> |
|
51 </html> |
|
52 |