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 asin 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 asinImplementation = [ |
| 30 "float asin_impl(float v) {", |
| 31 " return v + (1.0 / 2.0) * pow(v, 3.0) / 3.0 +", |
| 32 " ((1.0 * 3.0) / (2.0 * 4.0)) * pow(v, 5.0) / 5.0 +", |
| 33 " ((1.0 * 3.0 * 5.0) / (2.0 * 4.0 * 6.0)) * pow(v, 7.0) / 7.0 +", |
| 34 " ((1.0 * 3.0 * 5.0 * 7.0) / (2.0 * 4.0 * 6.0 * 8.0)) * pow(v, 9.0
) / 9.0;", |
| 35 "}" |
| 36 ].join("\n"); |
| 37 |
| 38 GLSLGenerator.runFeatureTest({ |
| 39 feature: "asin", |
| 40 args: "$(type) value", |
| 41 baseArgs: "value$(field)", |
| 42 testFunc: "$(func)($(type))", |
| 43 emuFunc: [ |
| 44 asinImplementation, |
| 45 "float $(func)_base(float value) {", |
| 46 " return asin_impl(value);", |
| 47 "}" |
| 48 ].join("\n"), |
| 49 gridRes: 8, |
| 50 tolerance: 2, |
| 51 extra: piConstants, |
| 52 tests: [ |
| 53 ["$(output) = vec4(", |
| 54 " $(func)($(input).x * 0.8) / kPI + 0.5,", |
| 55 " $(func)($(input).y * 0.8) / kPI + 0.5,", |
| 56 " 0,", |
| 57 " 1);"].join("\n"), |
| 58 ["$(output) = vec4(", |
| 59 " $(func)($(input).xy * 0.8) / kPI + 0.5,", |
| 60 " 0, 1);"].join("\n"), |
| 61 ["$(output) = vec4(", |
| 62 " $(func)($(input).xyz * 0.8) / kPI + 0.5,", |
| 63 " 1);"].join("\n"), |
| 64 ["$(output) = ", |
| 65 " $(func)($(input) * 0.8) / kPI + 0.5;", |
| 66 ].join("\n") |
| 67 ] |
| 68 }); |
| 69 successfullyParsed = true; |
| 70 </script> |
| 71 </body> |
| 72 </html> |
| 73 |
OLD | NEW |