glsl-function-mix-float.html (1661B)
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 mix-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: "mix", 25 args: "$(type) startValue, $(type) endValue, float mixValue", 26 baseArgs: "startValue$(field), endValue$(field), mixValue", 27 testFunc: "$(func)($(type), $(type), float)", 28 emuFunc: [ 29 "float $(func)_base(float startValue, float endValue, float mixValue) {", 30 " return startValue * (1.0 - mixValue) + endValue * mixValue;", 31 "}"].join("\n"), 32 gridRes: 8, 33 tests: [ 34 ["$(output) = vec4(", 35 " $(func)(1.0, 0.0, $(input).x),", 36 " ($(func)(-2.0, 3.0, $(input).y) + 2.0) / 5.0,", 37 " 0,", 38 " 1);"].join("\n"), 39 ["$(output) = vec4(", 40 " $(func)(vec2(1, -2), vec2(0, 2), $(input).z), ", 41 " 0, 1);"].join("\n"), 42 ["$(output) = vec4(", 43 " $(func)(vec3(1, -2, -1), vec3(0, 2, 3), $(input).y),", 44 " 1);"].join("\n"), 45 ["$(output) = ", 46 " $(func)(vec4(1, -2, -1, 0.5), vec4(0, 2, 3, 1), $(input).w);" 47 ].join("\n") 48 ] 49 }); 50 var successfullyParsed = true; 51 </script> 52 </body> 53 </html>