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