]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/nested_ternary.glsl
Generate correct OpPhi instructions for nested ternary expressions
[libs/gl.git] / tests / glsl / nested_ternary.glsl
1 uniform Colors
2 {
3         vec4 top_left;
4         vec4 top_right;
5         vec4 bottom_left;
6         vec4 bottom_right;
7 };
8
9 #pragma MSP stage(vertex)
10 layout(location=0) in vec4 position;
11 void main()
12 {
13         gl_Position = position;
14         passthrough;
15 }
16
17 #pragma MSP stage(fragment)
18 layout(location=0) out vec4 frag_color;
19 void main()
20 {
21         frag_color = (position.x>0 ? position.y>0 ? top_right : bottom_right :
22                 position.y>0 ? top_left : bottom_left);
23 }
24
25 /* Expected output: vertex
26 layout(location=0) in vec4 position;
27 layout(location=0) out vec4 _vs_out_position;
28 void main()
29 {
30         gl_Position = position;
31         _vs_out_position = position;
32 }
33 */
34
35 /* Expected output: fragment
36 layout(binding=23) uniform Colors
37 {
38         vec4 top_left;
39         vec4 top_right;
40         vec4 bottom_left;
41         vec4 bottom_right;
42 };
43 layout(location=0) out vec4 frag_color;
44 layout(location=0) in vec4 _vs_out_position;
45 void main()
46 {
47         frag_color = _vs_out_position.x>0.0?(_vs_out_position.y>0.0?top_right:bottom_right):_vs_out_position.y>0.0?top_left:bottom_left;
48 }
49 */