glsl-function-normalize.html (1553B)
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 normalize 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 GLSLGenerator.runFeatureTest({ 24 feature: "normalize", 25 args: "$(type) value", 26 testFunc: "$(func)($(type))", 27 simpleEmu: [ 28 "$(type) $(func)_emu($(args)) {", 29 " return value / length(value);", 30 "}"].join("\n"), 31 gridRes: 8, 32 tolerance: 1, 33 tests: [ 34 ["$(output) = vec4(", 35 " $(func)(", 36 " $(input).x * 8.0 - 4.1) * 0.5 + 0.5,", 37 " 0.5,", 38 " 0,", 39 " 1);"].join("\n"), 40 ["$(output) = vec4(", 41 " $(func)(", 42 " $(input).xy * 8.0 - 4.1) * 0.5 + 0.5,", 43 " 0, 1);"].join("\n"), 44 ["$(output) = vec4(", 45 " $(func)(", 46 " $(input).xyz * 8.0 - 4.1) * 0.5 + 0.5,", 47 " 1);"].join("\n"), 48 ["$(output) = ", 49 " $(func)(", 50 " vec4($(input).xyz, 0) * 8.0 - 4.1) * 0.5 + 0.5 + vec4(0,0,0,0.5);", 51 ].join("\n") 52 ] 53 }); 54 var successfullyParsed = true; 55 </script> 56 </body> 57 </html>