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 refract 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 GLSLGenerator.runFeatureTest({ |
| 23 feature: "refract", |
| 24 args: "$(type) I, $(type) N, float eta", |
| 25 baseArgs: "value$(field)", |
| 26 testFunc: "$(func)($(type),$(type),float)", |
| 27 simpleEmu: [ |
| 28 "$(type) $(func)_emu($(args)) {", |
| 29 " float dotNI = dot(N, I);", |
| 30 " float k = 1.0 - eta * eta * (1.0 - dotNI * dotNI);", |
| 31 " if (k < 0.0) {", |
| 32 " return $(type)(0.0);", |
| 33 " }", |
| 34 " return eta * I - (eta * dotNI * sqrt(k)) * N;", |
| 35 "}"].join("\n"), |
| 36 gridRes: 8, |
| 37 tests: [ |
| 38 ["$(output) = vec4(", |
| 39 " $(func)(", |
| 40 " $(input).x * 2.0 - 1.0,", |
| 41 " $(input).y * 2.0 - 1.0,", |
| 42 " $(input).w),", |
| 43 " 0,", |
| 44 " 0,", |
| 45 " 1);"].join("\n"), |
| 46 ["$(output) = vec4(", |
| 47 " $(func)(", |
| 48 " $(input).xy * 2.0 - 1.0,", |
| 49 " $(input).yz * 2.0 - 1.0,", |
| 50 " $(input).w),", |
| 51 " 0, 1);"].join("\n"), |
| 52 ["$(output) = vec4(", |
| 53 " $(func)(", |
| 54 " $(input).xyz * 2.0 - 1.0,", |
| 55 " $(input).yzw * 2.0 - 1.0,", |
| 56 " $(input).w),", |
| 57 " 1);"].join("\n"), |
| 58 ["$(output) = ", |
| 59 " $(func)(", |
| 60 " $(input).xyzw * 2.0 - 1.0,", |
| 61 " $(input).yzwx * 2.0 - 1.0,", |
| 62 " $(input).w);" |
| 63 ].join("\n") |
| 64 ] |
| 65 }); |
| 66 successfullyParsed = true; |
| 67 </script> |
| 68 </body> |
| 69 </html> |
| 70 |
| 71 |
OLD | NEW |