• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 150 core
2
3in fromVertex {
4    in vec3 color;
5} fromV[];
6
7out toFragment {
8    out vec3 color;
9} 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
25void main()
26{
27    EmitVertex();
28    EndPrimitive();
29    EmitStreamVertex(1);    // ERROR
30    EndStreamPrimitive(0);  // ERROR
31
32    color = fromV[0].color;
33    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;
38}
39
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
55layout(stream = 6) out ooutb2 {
56    layout(stream = 6) vec4 a;
57} ouua6;
58
59layout(stream = 7) out ooutb3 {
60    layout(stream = 6) vec4 a;  // ERROR
61} ouua7;
62
63out vec4 ov2s3;  // stream should be 3
64
65layout(max_vertices = 200) out;
66layout(max_vertices = 300) out;   // ERROR, too big
67void 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
77layout(triangle_strip) in vec4 bad2v4[];  // ERROR, not on a variable or input
78layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
79out outbn2 {
80    layout(invocations = 3)  int a; // 2 ERRORs, not on a block member, not until 4.0
81    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_adjacency) in;
87layout(triangles) in;             // ERROR, can't change it
88layout(triangles_adjacency) in;   // ERROR, can't change it
89layout(invocations = 4) in;       // ERROR, not until 4.0
90
91in inbn {
92    layout(stream = 2) int a;     // ERROR, stream on input
93} inbi[];
94
95in sameName {
96    int a15;
97} insn[];
98
99out sameName {
100    float f15;
101};
102
103uniform sameName {
104    bool b15;
105};
106
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;
126
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;
140