Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (c) 2011 The Chromium Authors. All rights reserved. |
michael@0 | 3 | Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | found in the LICENSE file. |
michael@0 | 5 | --> |
michael@0 | 6 | <!DOCTYPE html> |
michael@0 | 7 | <html> |
michael@0 | 8 | <head> |
michael@0 | 9 | <meta charset="utf-8"> |
michael@0 | 10 | <title>GLSL refract function test</title> |
michael@0 | 11 | <link rel="stylesheet" href="../../../resources/js-test-style.css"/> |
michael@0 | 12 | <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/> |
michael@0 | 13 | <script src="../../../resources/js-test-pre.js"></script> |
michael@0 | 14 | <script src="../../resources/webgl-test.js"> </script> |
michael@0 | 15 | <script src="../../resources/webgl-test-utils.js"> </script> |
michael@0 | 16 | <script src="../../resources/glsl-generator.js"> </script> |
michael@0 | 17 | </head> |
michael@0 | 18 | <body> |
michael@0 | 19 | <div id="description"></div> |
michael@0 | 20 | <div id="console"></div> |
michael@0 | 21 | <script> |
michael@0 | 22 | GLSLGenerator.runFeatureTest({ |
michael@0 | 23 | feature: "refract", |
michael@0 | 24 | args: "$(type) I, $(type) N, float eta", |
michael@0 | 25 | baseArgs: "value$(field)", |
michael@0 | 26 | testFunc: "$(func)($(type),$(type),float)", |
michael@0 | 27 | simpleEmu: [ |
michael@0 | 28 | "$(type) $(func)_emu($(args)) {", |
michael@0 | 29 | " float dotNI = dot(N, I);", |
michael@0 | 30 | " float k = 1.0 - eta * eta * (1.0 - dotNI * dotNI);", |
michael@0 | 31 | " if (k < 0.0) {", |
michael@0 | 32 | " return $(type)(0.0);", |
michael@0 | 33 | " }", |
michael@0 | 34 | " return eta * I - (eta * dotNI * sqrt(k)) * N;", |
michael@0 | 35 | "}"].join("\n"), |
michael@0 | 36 | gridRes: 8, |
michael@0 | 37 | tests: [ |
michael@0 | 38 | ["$(output) = vec4(", |
michael@0 | 39 | " $(func)(", |
michael@0 | 40 | " $(input).x * 2.0 - 1.0,", |
michael@0 | 41 | " $(input).y * 2.0 - 1.0,", |
michael@0 | 42 | " $(input).w),", |
michael@0 | 43 | " 0,", |
michael@0 | 44 | " 0,", |
michael@0 | 45 | " 1);"].join("\n"), |
michael@0 | 46 | ["$(output) = vec4(", |
michael@0 | 47 | " $(func)(", |
michael@0 | 48 | " $(input).xy * 2.0 - 1.0,", |
michael@0 | 49 | " $(input).yz * 2.0 - 1.0,", |
michael@0 | 50 | " $(input).w),", |
michael@0 | 51 | " 0, 1);"].join("\n"), |
michael@0 | 52 | ["$(output) = vec4(", |
michael@0 | 53 | " $(func)(", |
michael@0 | 54 | " $(input).xyz * 2.0 - 1.0,", |
michael@0 | 55 | " $(input).yzw * 2.0 - 1.0,", |
michael@0 | 56 | " $(input).w),", |
michael@0 | 57 | " 1);"].join("\n"), |
michael@0 | 58 | ["$(output) = ", |
michael@0 | 59 | " $(func)(", |
michael@0 | 60 | " $(input).xyzw * 2.0 - 1.0,", |
michael@0 | 61 | " $(input).yzwx * 2.0 - 1.0,", |
michael@0 | 62 | " $(input).w);" |
michael@0 | 63 | ].join("\n") |
michael@0 | 64 | ] |
michael@0 | 65 | }); |
michael@0 | 66 | successfullyParsed = true; |
michael@0 | 67 | </script> |
michael@0 | 68 | </body> |
michael@0 | 69 | </html> |
michael@0 | 70 | |
michael@0 | 71 |