|
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 acos 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 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"); |
|
28 |
|
29 var kPI = Math.PI; |
|
30 var kHalfPI = Math.PI * 0.5; |
|
31 var k2PI = Math.PI * 2.0; |
|
32 var acos = Math.acos; // shorthand |
|
33 |
|
34 GLSLGenerator.runReferenceImageTest({ |
|
35 feature: "acos", |
|
36 args: "$(type) value", |
|
37 testFunc: "$(func)($(type))", |
|
38 gridRes: 8, |
|
39 tolerance: 2, |
|
40 extra: piConstants, |
|
41 tests: [ |
|
42 { |
|
43 source: ["$(output) = vec4(", |
|
44 " $(func)($(input).x * 0.8) / kPI,", |
|
45 " $(func)($(input).y * 0.8) / kPI,", |
|
46 " 0,", |
|
47 " 1);"].join("\n"), |
|
48 generator: function(x, y, z, w) { |
|
49 return [ acos(x * 0.8) / kPI, |
|
50 acos(y * 0.8) / kPI, |
|
51 0, |
|
52 1 ]; |
|
53 }, |
|
54 }, |
|
55 { |
|
56 source: ["$(output) = vec4(", |
|
57 " $(func)($(input).xy * 0.8) / kPI,", |
|
58 " 0, 1);"].join("\n"), |
|
59 generator: function(x, y, z, w) { |
|
60 return [ acos(x * 0.8) / kPI, |
|
61 acos(y * 0.8) / kPI, |
|
62 0, |
|
63 1 ]; |
|
64 }, |
|
65 }, |
|
66 { |
|
67 source: ["$(output) = vec4(", |
|
68 " $(func)($(input).xyz * 0.8) / kPI,", |
|
69 " 1);"].join("\n"), |
|
70 generator: function(x, y, z, w) { |
|
71 return [ acos(x * 0.8) / kPI, |
|
72 acos(y * 0.8) / kPI, |
|
73 acos(z * 0.8) / kPI, |
|
74 1 ]; |
|
75 }, |
|
76 }, |
|
77 { |
|
78 source: ["$(output) = ", |
|
79 " $(func)($(input) * 0.8) / kPI;", |
|
80 ].join("\n"), |
|
81 generator: function(x, y, z, w) { |
|
82 return [ acos(x * 0.8) / kPI, |
|
83 acos(y * 0.8) / kPI, |
|
84 acos(z * 0.8) / kPI, |
|
85 acos(w * 0.8) / kPI ]; |
|
86 }, |
|
87 }, |
|
88 ] |
|
89 }); |
|
90 successfullyParsed = true; |
|
91 </script> |
|
92 </body> |
|
93 </html> |
|
94 |