Merge pull request #2976 from jeremy-lunarg/hayes-fix-2975
[platform/upstream/glslang.git] / Test / 140.frag
1 #version 140
2
3 varying vec4 v;
4
5 in vec4 i;
6 out vec4 o;
7
8 in float gl_ClipDistance[5];
9
10 void main()
11 {
12     float clip = gl_ClipDistance[2];
13 }
14 #ifdef GL_ES
15 #error GL_ES is set
16 #else
17 #error GL_ES is not set
18 #endif
19
20
21 in struct S { float f; } s; // ERROR
22
23 float patch = 3.1;
24
25 layout(location=3) in vec4 vl;  // ERROR
26
27 layout(location = 3) out vec4 factorBad;  // ERROR
28
29 #extension GL_ARB_explicit_attrib_location : enable
30
31 layout(location = 5) out vec4 factor;
32
33 #extension GL_ARB_separate_shader_objects : enable
34
35 layout(location=4) in vec4 vl2;
36
37 float fooi();
38
39 void foo()
40 {
41     vec2 r1 = modf(v.xy, v.zw);  // ERROR, v.zw not l-value
42     vec2 r2 = modf(o.xy, o.zw);
43     o.z = fooi();
44 }
45
46 // Test extra-function initializers
47
48 float i1 = gl_FrontFacing ? -2.0 : 2.0;
49 float i2 = 102;
50
51 float fooi()
52 {
53     return i1 + i2;
54 }
55
56 uniform sampler2DMS aaa1; // ERROR
57
58 #extension GL_ARB_texture_multisample : enable
59
60 uniform sampler2DMS aaa2;