glsl-function-abs.html (1287B)
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 abs 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: "abs", 25 testFunc: "$(func)($(arg0))", 26 emuFunc: ["float $(func)_base(float value) {", 27 " return value >= 0.0 ? value : -value;", 28 "}"].join("\n"), 29 gridRes: 4, 30 tests: [ 31 ["$(output) = vec4(", 32 " $(func)($(input).x * 2.0 - 1.0),", 33 " 0.5,", 34 " 0,", 35 " 1);"].join("\n"), 36 "$(output) = vec4(0, $(func)($(input).xy * 2.0 - vec2(1, 1)), 1);", 37 "$(output) = vec4($(func)($(input).xyz * 2.0 - vec3(1, 1, 1)), 1);", 38 "$(output) = $(func)($(input) * 2.0 - vec4(1, 1, 1, 1));" 39 ] 40 }); 41 var successfullyParsed = true; 42 </script> 43 </body> 44 </html>