blob: 2edf95076c74ce6c7a53ffdda966815d07377cc1 [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
86layout(lines_adjancency) in;
87layout(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};