]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/ternary_operand_type_mismatch.glsl
Implement the ternary operator in GLSL
[libs/gl.git] / tests / glsl / ternary_operand_type_mismatch.glsl
1 uniform Colors
2 {
3         vec4 color;
4         float gray;
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 ? color : gray;
26 }
27
28 /* Expected error:
29 <test>:25: Ternary operator has incompatible types 'vec4' and 'float'
30 */