glsl-function-mod-float.html (1613B)
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 mod-float 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: "mod", 25 args: "$(type) value, float divisor", 26 baseArgs: "value$(field), divisor", 27 testFunc: "$(func)($(arg0), float)", 28 fragmentTolerance: 1, 29 emuFunc: ["float $(func)_base(float value, float divisor) {", 30 " return value - divisor * floor(value / divisor);", 31 "}"].join("\n"), 32 gridRes: 8, 33 tests: [ 34 ["$(output) = vec4(", 35 " $(func)($(input).x * 6.0 - 3.0, 1.5) / 1.5,", 36 " $(func)($(input).y * 6.0 - 3.0, 1.5) / 1.5,", 37 " 0,", 38 " 1);"].join("\n"), 39 ["$(output) = vec4(", 40 " $(func)($(input).xy * 6.0 - vec2(3, 3), 1.5) / 1.5,", 41 " 0, 1);"].join("\n"), 42 ["$(output) = vec4(", 43 " $(func)($(input).xyz * 6.0 - vec3(3, 3, 3), 1.5) / 1.5,", 44 " 1);"].join("\n"), 45 ["$(output) = ", 46 " $(func)($(input) * 6.0 - vec4(3, 3, 3, 3), 1.5) / 1.5;"].join("\n") 47 ] 48 }); 49 var successfullyParsed = true; 50 </script> 51 </body> 52 </html>