glsl-function-faceforward.html (1861B)
1 <!-- 2 Copyright (c) 2019 The Khronos Group Inc. 3 Use of this source code is governed by an MIT-style license that can be 4 found in the LICENSE.txt file. 5 --> 6 7 <!DOCTYPE html> 8 <html> 9 <head> 10 <meta charset="utf-8"> 11 <title>GLSL faceforward function test</title> 12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/> 13 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/> 14 <script src="../../../js/js-test-pre.js"></script> 15 <script src="../../../js/webgl-test-utils.js"> </script> 16 <script src="../../../js/glsl-generator.js"> </script> 17 </head> 18 <body> 19 <div id="description"></div> 20 <div id="console"></div> 21 <script> 22 "use strict"; 23 24 GLSLGenerator.runFeatureTest({ 25 feature: "faceforward", 26 args: "$(type) N, $(type) I, $(type) Nref", 27 baseArgs: "value$(field)", 28 testFunc: "$(func)($(type),$(type),$(type))", 29 simpleEmu: [ 30 "$(type) $(func)_emu($(args)) {", 31 " return dot(Nref, I) < 0.0 ? N : -N;", 32 "}"].join("\n"), 33 gridRes: 8, 34 tests: [ 35 ["$(output) = vec4(", 36 " $(func)(", 37 " $(input).x * 2.0 - 1.0,", 38 " $(input).y * 2.0 - 1.0,", 39 " $(input).z * 2.0 - 1.0),", 40 " 0,", 41 " 0,", 42 " 1);"].join("\n"), 43 ["$(output) = vec4(", 44 " $(func)(", 45 " $(input).xy * 2.0 - 1.0,", 46 " $(input).yz * 2.0 - 1.0,", 47 " $(input).zw * 2.0 - 1.0),", 48 " 0, 1);"].join("\n"), 49 ["$(output) = vec4(", 50 " $(func)(", 51 " $(input).xyz * 2.0 - 1.0,", 52 " $(input).yzw * 2.0 - 1.0,", 53 " $(input).zwx * 2.0 - 1.0),", 54 " 1);"].join("\n"), 55 ["$(output) = ", 56 " $(func)(", 57 " $(input).xyzw * 2.0 - 1.0,", 58 " $(input).yzwx * 2.0 - 1.0,", 59 " $(input).zwxy * 2.0 - 1.0);" 60 ].join("\n") 61 ] 62 }); 63 var successfullyParsed = true; 64 </script> 65 </body> 66 </html>