• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1case mismatch_number_of_declarations
2	version 310 es
3	desc "Shader io block mismatch: different number of declarations"
4	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
5	expect link_fail
6	vertex ""
7		#version 310 es
8		${VERTEX_DECLARATIONS}
9		out IOBlockName
10		{
11			mediump float variable1;
12		};
13
14		void main()
15		{
16			variable1 = float(gl_VertexID);
17			${VERTEX_OUTPUT}
18		}
19	""
20	fragment ""
21		#version 310 es
22		precision mediump float;
23		${FRAGMENT_DECLARATIONS}
24		in IOBlockName
25		{
26			mediump float variable1;
27			mediump float variable2;
28		};
29
30		void main()
31		{
32			${FRAG_COLOR} = vec4(variable1 + variable2);
33		}
34	""
35end
36
37case mismatch_order
38	version 310 es
39	desc "Shader io block mismatch: different member declaration order"
40	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
41	expect link_fail
42	vertex ""
43		#version 310 es
44		${VERTEX_DECLARATIONS}
45		out IOBlockName
46		{
47			mediump float variable1;
48			mediump float variable2;
49		};
50
51		void main()
52		{
53			variable1 = float(gl_VertexID);
54			${VERTEX_OUTPUT}
55		}
56	""
57	fragment ""
58		#version 310 es
59		precision mediump float;
60		${FRAGMENT_DECLARATIONS}
61		in IOBlockName
62		{
63			mediump float variable2;
64			mediump float variable1;
65		};
66
67		void main()
68		{
69			${FRAG_COLOR} = vec4(variable1 + variable2);
70		}
71	""
72end
73
74case mismatch_type
75	version 310 es
76	desc "Shader io block mismatch: different member type"
77	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
78	expect link_fail
79	vertex ""
80		#version 310 es
81		${VERTEX_DECLARATIONS}
82		out IOBlockName
83		{
84			mediump vec2 variable;
85		};
86
87		void main()
88		{
89			variable.x = float(gl_VertexID);
90			variable.y = float(gl_InstanceID);
91			${VERTEX_OUTPUT}
92		}
93	""
94	fragment ""
95		#version 310 es
96		precision mediump float;
97		${FRAGMENT_DECLARATIONS}
98		in IOBlockName
99		{
100			mediump float variable;
101		};
102
103		void main()
104		{
105			${FRAG_COLOR} = vec4(variable);
106		}
107	""
108end
109
110case mismatch_member_name
111	version 310 es
112	desc "Shader io block mismatch: different member name"
113	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
114	expect link_fail
115	vertex ""
116		#version 310 es
117		${VERTEX_DECLARATIONS}
118		out IOBlockName
119		{
120			mediump float variable1;
121		};
122
123		void main()
124		{
125			variable1 = float(gl_VertexID);
126			${VERTEX_OUTPUT}
127		}
128	""
129	fragment ""
130		#version 310 es
131		precision mediump float;
132		${FRAGMENT_DECLARATIONS}
133		in IOBlockName
134		{
135			mediump float variable2;
136		};
137
138		void main()
139		{
140			${FRAG_COLOR} = vec4(variable2);
141		}
142	""
143end
144
145case mismatch_member_array_size
146	version 310 es
147	desc "Shader io block mismatch: different member array size"
148	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
149	expect link_fail
150	vertex ""
151		#version 310 es
152		${VERTEX_DECLARATIONS}
153		out IOBlockName
154		{
155			mediump float variable[1];
156		};
157
158		void main()
159		{
160			variable[0] = float(gl_VertexID);
161			${VERTEX_OUTPUT}
162		}
163	""
164	fragment ""
165		#version 310 es
166		precision mediump float;
167		${FRAGMENT_DECLARATIONS}
168		in IOBlockName
169		{
170			mediump float variable[2];
171		};
172
173		void main()
174		{
175			${FRAG_COLOR} = vec4(variable[0] + variable[1]);
176		}
177	""
178end
179
180case with_and_without_instance_name
181	version 310 es
182	desc "Shader io block: with and without instance name"
183	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
184	values
185	{
186		input float in0 = 1.0;
187		output float out0 = 1.0;
188	}
189	vertex ""
190		#version 310 es
191		${VERTEX_DECLARATIONS}
192		out IOBlockName
193		{
194			mediump float variable;
195		} instanceName;
196
197		void main()
198		{
199			instanceName.variable = in0;
200			${VERTEX_OUTPUT}
201		}
202	""
203	fragment ""
204		#version 310 es
205		precision mediump float;
206		${FRAGMENT_DECLARATIONS}
207		in IOBlockName
208		{
209			mediump float variable;
210		};
211
212		void main()
213		{
214			out0 = variable;
215			${FRAGMENT_OUTPUT}
216		}
217	""
218end
219
220case mismatch_block_array_size
221	version 310 es
222	desc "Shader io block mismatch: different array size"
223	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
224	expect link_fail
225	vertex ""
226		#version 310 es
227		${VERTEX_DECLARATIONS}
228		out IOBlockName
229		{
230			mediump float variable;
231		} instanceName[1];
232
233		void main()
234		{
235			instanceName[0].variable = float(gl_VertexID);
236			${VERTEX_OUTPUT}
237		}
238	""
239	fragment ""
240		#version 310 es
241		precision mediump float;
242		${FRAGMENT_DECLARATIONS}
243		in IOBlockName
244		{
245			mediump float variable;
246		} instanceName[2];
247
248		void main()
249		{
250			${FRAG_COLOR} = vec4(instanceName[0].variable + instanceName[1].variable);
251		}
252	""
253end
254
255case missing_output_block
256	version 310 es
257	desc "Shader io block mismatch: missing output block"
258	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
259	expect link_fail
260	vertex ""
261		#version 310 es
262		${VERTEX_DECLARATIONS}
263		void main()
264		{
265			${VERTEX_OUTPUT}
266		}
267	""
268	fragment ""
269		#version 310 es
270		precision mediump float;
271		${FRAGMENT_DECLARATIONS}
272		in IOBlockName
273		{
274			mediump float variable;
275		};
276
277		void main()
278		{
279			${FRAG_COLOR} = vec4(variable);
280		}
281	""
282end
283
284case ambiguous_variable_name_1
285	version 310 es
286	desc "Unnamed io block variable and global variable with identical names"
287	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
288	expect compile_or_link_fail
289	vertex ""
290		#version 310 es
291		${VERTEX_DECLARATIONS}
292		float variable;
293		out IOBlockName
294		{
295			mediump float variable;
296		};
297
298		void main()
299		{
300			variable = float(gl_VertexID);
301			${VERTEX_OUTPUT}
302		}
303	""
304	fragment ""
305		#version 310 es
306		precision mediump float;
307		${FRAGMENT_DECLARATIONS}
308		in IOBlockName
309		{
310			mediump float variable;
311		};
312
313		void main()
314		{
315			${FRAG_COLOR} = vec4(variable);
316		}
317	""
318end
319
320case ambiguous_variable_name_2
321	version 310 es
322	desc "Two unnamed io blocks with variables with identical names"
323	require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment }
324	expect compile_or_link_fail
325	vertex ""
326		#version 310 es
327		${VERTEX_DECLARATIONS}
328		out IOBlockNameA
329		{
330			mediump float variable;
331		};
332		out IOBlockNameB
333		{
334			mediump float variable;
335		};
336
337		void main()
338		{
339			variable = float(gl_VertexID);
340			${VERTEX_OUTPUT}
341		}
342	""
343	fragment ""
344		#version 310 es
345		precision mediump float;
346		${FRAGMENT_DECLARATIONS}
347		in IOBlockNameA
348		{
349			mediump float variable;
350		};
351		in IOBlockNameB
352		{
353			mediump float variable;
354		};
355
356		void main()
357		{
358			${FRAG_COLOR} = vec4(variable);
359		}
360	""
361end
362