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.
10 <meta charset=
"utf-8">
11 <title>GLSL sign 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>
19 <div id=
"description"></div>
20 <div id=
"console"></div>
23 GLSLGenerator
.runFeatureTest({
25 testFunc
: "$(func)($(arg0))",
26 emuFunc
: ["float $(func)_base(float value) {",
27 " if (value == 0.0) return 0.0;",
28 " return value > 0.0 ? 1.0 : -1.0;",
33 " $(func)($(input).x * 2.0 - 1.0) * 0.5 + 0.5,",
38 " $(func)($(input).xy * 2.0 - vec2(1, 1)) * 0.5 + vec2(0.5, 0.5),",
39 " 0, 1);"].join("\n"),
41 " $(func)($(input).xyz * 2.0 - vec3(1, 1, 1)) * 0.5 + ",
42 " vec3(0.5, 0.5, 0.5),",
45 " $(func)($(input) * 2.0 - vec4(1, 1, 1, 1)) * 0.5 + ",
46 " vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
49 var successfullyParsed
= true;