]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/ternary_operator.glsl
Refactor the mesh exporter to use UVs directly from UV layers
[libs/gl.git] / tests / glsl / ternary_operator.glsl
1 uniform Colors
2 {
3         vec4 color1;
4         vec4 color2;
5 };
6 uniform sampler2D mask;
7 uniform Transform
8 {
9         mat4 mvp;
10 } transform;
11
12 #pragma MSP stage(vertex)
13 layout(location=0) in vec4 position;
14 layout(location=1) in vec2 texcoord;
15 void main()
16 {
17         passthrough;
18         gl_Position = transform.mvp*position;
19 }
20
21 #pragma MSP stage(fragment)
22 layout(location=0) out vec4 frag_color;
23 void main()
24 {
25         frag_color = texture(mask, texcoord).r > 0.5 ? color1 : color2;
26 }
27
28 /* Expected output: vertex
29 uniform Transform
30 {
31   mat4 mvp;
32 } transform;
33 layout(location=0) in vec4 position;
34 layout(location=1) in vec2 texcoord;
35 out vec2 _vs_out_texcoord;
36 void main()
37 {
38   _vs_out_texcoord = texcoord;
39   gl_Position = transform.mvp*position;
40 }
41 */
42
43 /* Expected output: fragment
44 uniform Colors
45 {
46   vec4 color1;
47   vec4 color2;
48 };
49 uniform sampler2D mask;
50 layout(location=0) out vec4 frag_color;
51 in vec2 _vs_out_texcoord;
52 void main()
53 {
54   frag_color = texture(mask, _vs_out_texcoord).r>0.5?color1:color2;
55 }
56 */