|
1 <!-- |
|
2 Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
3 Use of this source code is governed by a BSD-style license that can be |
|
4 found in the LICENSE file. |
|
5 --> |
|
6 <!DOCTYPE html> |
|
7 <html> |
|
8 <head> |
|
9 <meta charset="utf-8"> |
|
10 <title>GLSL smoothstep-gentype function test</title> |
|
11 <link rel="stylesheet" href="../../../resources/js-test-style.css"/> |
|
12 <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/> |
|
13 <script src="../../../resources/js-test-pre.js"></script> |
|
14 <script src="../../resources/webgl-test.js"> </script> |
|
15 <script src="../../resources/webgl-test-utils.js"> </script> |
|
16 <script src="../../resources/glsl-generator.js"> </script> |
|
17 </head> |
|
18 <body> |
|
19 <div id="description"></div> |
|
20 <div id="console"></div> |
|
21 <script> |
|
22 |
|
23 |
|
24 GLSLGenerator.runFeatureTest({ |
|
25 feature: "smoothstep", |
|
26 args: "float edge0, float edge1, $(type) value", |
|
27 baseArgs: "edge0, edge1, value$(field)", |
|
28 testFunc: "$(func)(float, float, $(type))", |
|
29 emuFunc: ["float $(func)_base(float edge0, float edge1, float value) {", |
|
30 " float t = clamp((value - edge0) / (edge1 - edge0), 0.0, 1.0);", |
|
31 " return t * t * (3.0 - 2.0 * t);", |
|
32 "}"].join("\n"), |
|
33 gridRes: 8, |
|
34 tests: [ |
|
35 ["$(output) = vec4(", |
|
36 " $(func)(0.3, 0.7, $(input).x),", |
|
37 " $(func)(0.2, 0.8, $(input).y),", |
|
38 " 0,", |
|
39 " 1);"].join("\n"), |
|
40 ["$(output) = vec4(", |
|
41 " $(func)(0.4, 0.8, $(input).xy),", |
|
42 " 0, 1);"].join("\n"), |
|
43 ["$(output) = vec4(", |
|
44 " $(func)(0.3, 0.7, $(input).xyz),", |
|
45 " 1);"].join("\n"), |
|
46 ["$(output) = ", |
|
47 " $(func)(0.3, 0.9, $(input));"].join("\n") |
|
48 ] |
|
49 }); |
|
50 successfullyParsed = true; |
|
51 </script> |
|
52 </body> |
|
53 </html> |
|
54 |