blob: d5b3c9b3d46b74270e96c9965db315c05e74e220 [file] [log] [blame]
John Kessenichc0275792013-08-09 17:14:49 +00001#version 150 core
2
John Kesseniche7c59c12013-10-16 22:28:35 +00003in fromVertex {
John Kessenich5053a392014-01-07 17:44:41 +00004 in vec3 color;
John Kessenich7c908d22013-12-18 03:06:24 +00005} fromV[];
John Kesseniche7c59c12013-10-16 22:28:35 +00006
7out toFragment {
John Kessenich5053a392014-01-07 17:44:41 +00008 out vec3 color;
John Kesseniche7c59c12013-10-16 22:28:35 +00009} toF;
10
11out fromVertex { // okay to reuse a block name for another block name
12 vec3 color;
13};
14
15out fooB {
16 vec2 color;
17} fromVertex; // ERROR, cannot reuse block name as block instance
18
19int fromVertex; // ERROR, cannot reuse a block name for something else
20
21out fooC {
22 vec2 color;
23} fooC; // ERROR, cannot have same name for block and instance name
24
John Kessenichc0275792013-08-09 17:14:49 +000025void main()
26{
27 EmitVertex();
28 EndPrimitive();
29 EmitStreamVertex(1); // ERROR
30 EndStreamPrimitive(0); // ERROR
John Kesseniche7c59c12013-10-16 22:28:35 +000031
John Kessenich7c908d22013-12-18 03:06:24 +000032 color = fromV[0].color;
John Kesseniche7c59c12013-10-16 22:28:35 +000033 gl_ClipDistance[3] = gl_in[1].gl_ClipDistance[2];
34 gl_Position = gl_in[0].gl_Position;
35 gl_PointSize = gl_in[3].gl_PointSize;
36 gl_PrimitiveID = gl_PrimitiveIDIn;
37 gl_Layer = 2;
John Kessenichc0275792013-08-09 17:14:49 +000038}
John Kessenich94fdd112013-10-23 19:34:05 +000039
40out vec4 ov0; // stream should be 0
41layout(stream = 4) out vec4 ov4;
42out vec4 o1v0; // stream should be 0
43
44layout(stream = 3) uniform; // ERROR
45layout(stream = 3) in; // ERROR
46layout(stream = 3) uniform int ua; // ERROR
47layout(stream = 3) uniform ubb { int ua; } ibb; // ERROR
48
49layout(line_strip, points, triangle_strip, stream = 3, points, triangle_strip) out; // just means "stream = 3, triangle_strip"
50layout(stream = 3, triangle_strip) out;
51out vec4 ov3; // stream should be 3
52
53layout(stream = 6) out ooutb { vec4 a; } ouuaa6;
54
John Kessenicha4351c52013-11-11 04:21:31 +000055layout(stream = 6) out ooutb2 {
John Kessenich94fdd112013-10-23 19:34:05 +000056 layout(stream = 6) vec4 a;
57} ouua6;
58
John Kessenicha4351c52013-11-11 04:21:31 +000059layout(stream = 7) out ooutb3 {
John Kessenich94fdd112013-10-23 19:34:05 +000060 layout(stream = 6) vec4 a; // ERROR
61} ouua7;
62
63out vec4 ov2s3; // stream should be 3
64
John Kessenich8d6ce1c2014-04-29 23:09:26 +000065layout(max_vertices = 200) out;
66layout(max_vertices = 300) out; // ERROR, too big
John Kessenich94fdd112013-10-23 19:34:05 +000067void foo(layout(max_vertices = 4) int a) // ERROR
68{
69 ouuaa6.a = vec4(1.0);
70}
71
72layout(line_strip, points, triangle_strip, stream = 3, points) out; // ERROR, changing output primitive
73layout(line_strip, points, stream = 3) out; // ERROR, changing output primitive
74layout(triangle_strip) in; // ERROR, not an input primitive
75layout(triangle_strip) uniform; // ERROR
76layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
John Kessenich7c908d22013-12-18 03:06:24 +000077layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
John Kessenich8d6ce1c2014-04-29 23:09:26 +000078layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
John Kessenicha4351c52013-11-11 04:21:31 +000079out outbn2 {
John Kessenich8d6ce1c2014-04-29 23:09:26 +000080 layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
John Kessenich94fdd112013-10-23 19:34:05 +000081 layout(max_vertices = 3) int b; // ERROR, not on a block member
82 layout(triangle_strip) int c; // ERROR, not on a block member
83} outbi;
84
85layout(lines) out; // ERROR, not on output
John Kessenichddea6782014-08-10 18:19:36 +000086layout(lines_adjacency) in;
John Kessenich94fdd112013-10-23 19:34:05 +000087layout(triangles) in; // ERROR, can't change it
88layout(triangles_adjacency) in; // ERROR, can't change it
John Kessenich8d6ce1c2014-04-29 23:09:26 +000089layout(invocations = 4) in; // ERROR, not until 4.0
John Kessenich94fdd112013-10-23 19:34:05 +000090
91in inbn {
92 layout(stream = 2) int a; // ERROR, stream on input
John Kessenich7c908d22013-12-18 03:06:24 +000093} inbi[];
John Kessenicha4351c52013-11-11 04:21:31 +000094
95in sameName {
96 int a15;
John Kessenich7c908d22013-12-18 03:06:24 +000097} insn[];
John Kessenicha4351c52013-11-11 04:21:31 +000098
99out sameName {
100 float f15;
101};
102
103uniform sameName {
104 bool b15;
105};
John Kesseniche91cde52014-10-06 15:44:02 +0000106
107float summ = gl_MaxVertexAttribs +
108 gl_MaxVertexUniformComponents +
109 gl_MaxVaryingFloats +
110 gl_MaxVaryingComponents +
111 gl_MaxVertexOutputComponents +
112 gl_MaxGeometryInputComponents +
113 gl_MaxGeometryOutputComponents +
114 gl_MaxFragmentInputComponents +
115 gl_MaxVertexTextureImageUnits +
116 gl_MaxCombinedTextureImageUnits +
117 gl_MaxTextureImageUnits +
118 gl_MaxFragmentUniformComponents +
119 gl_MaxDrawBuffers +
120 gl_MaxClipDistances +
121 gl_MaxGeometryTextureImageUnits +
122 gl_MaxGeometryOutputVertices +
123 gl_MaxGeometryTotalOutputComponents +
124 gl_MaxGeometryUniformComponents +
125 gl_MaxGeometryVaryingComponents;
John Kessenichad54b242014-10-17 20:01:27 +0000126
127void fooe1()
128{
129 gl_ViewportIndex = gl_MaxViewports - 1;
130}
131
132#extension GL_ARB_viewport_array : enable
133
134void fooe2()
135{
136 gl_ViewportIndex = gl_MaxViewports - 1;
137}
138
139out int gl_ViewportIndex;