1#ifndef _ES31CARRAYOFARRAYSTESTS_HPP
2#define _ES31CARRAYOFARRAYSTESTS_HPP
3/*-------------------------------------------------------------------------
4 * OpenGL Conformance Test Suite
5 * -----------------------------
6 *
7 * Copyright (c) 2014-2016 The Khronos Group Inc.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 */ /*!
22 * \file
23 * \brief
24 */ /*-------------------------------------------------------------------*/
25
26#include <map>
27
28#include "glcTestCase.hpp"
29#include "glwDefs.hpp"
30#include "glwEnums.hpp"
31#include "tcuDefs.hpp"
32#include "tes31TestCase.hpp"
33
34namespace glcts
35{
36typedef enum {
37	VAR_TYPE_BOOL,
38	VAR_TYPE_INT,
39	VAR_TYPE_UINT,
40	VAR_TYPE_FLOAT,
41	VAR_TYPE_VEC2,
42	VAR_TYPE_VEC3,
43	VAR_TYPE_VEC4,
44	VAR_TYPE_BVEC2,
45	VAR_TYPE_BVEC3,
46	VAR_TYPE_BVEC4,
47	VAR_TYPE_IVEC2,
48	VAR_TYPE_IVEC3,
49	VAR_TYPE_IVEC4,
50	VAR_TYPE_UVEC2,
51	VAR_TYPE_UVEC3,
52	VAR_TYPE_UVEC4,
53	VAR_TYPE_MAT2,
54	VAR_TYPE_MAT3,
55	VAR_TYPE_MAT4,
56	VAR_TYPE_MAT2X2,
57	VAR_TYPE_MAT2X3,
58	VAR_TYPE_MAT2X4,
59	VAR_TYPE_MAT3X2,
60	VAR_TYPE_MAT3X3,
61	VAR_TYPE_MAT3X4,
62	VAR_TYPE_MAT4X2,
63	VAR_TYPE_MAT4X3,
64	VAR_TYPE_MAT4X4,
65	/** List of all supported interface resource types. */
66	VAR_TYPE_IMAGEBUFFER,
67	VAR_TYPE_IIMAGEBUFFER,
68	VAR_TYPE_UIMAGEBUFFER,
69	VAR_TYPE_SAMPLERBUFFER,
70	VAR_TYPE_ISAMPLERBUFFER,
71	VAR_TYPE_USAMPLERBUFFER,
72	/** List of all supported opaque types. */
73	//Floating Point Sampler Types (opaque)
74	VAR_TYPE_SAMPLER2D,
75	VAR_TYPE_SAMPLER3D,
76	VAR_TYPE_SAMPLERCUBE,
77	VAR_TYPE_SAMPLERCUBESHADOW,
78	VAR_TYPE_SAMPLER2DSHADOW,
79	VAR_TYPE_SAMPLER2DARRAY,
80	VAR_TYPE_SAMPLER2DARRAYSHADOW,
81	//Signed Integer Sampler Types (opaque)
82	VAR_TYPE_ISAMPLER2D,
83	VAR_TYPE_ISAMPLER3D,
84	VAR_TYPE_ISAMPLERCUBE,
85	VAR_TYPE_ISAMPLER2DARRAY,
86	//Unsigned Integer Sampler Types (opaque)
87	VAR_TYPE_USAMPLER2D,
88	VAR_TYPE_USAMPLER3D,
89	VAR_TYPE_USAMPLERCUBE,
90	VAR_TYPE_USAMPLER2DARRAY,
91	/* Double types */
92	VAR_TYPE_DOUBLE,
93	VAR_TYPE_DMAT2,
94	VAR_TYPE_DMAT3,
95	VAR_TYPE_DMAT4,
96	VAR_TYPE_DMAT2X2,
97	VAR_TYPE_DMAT2X3,
98	VAR_TYPE_DMAT2X4,
99	VAR_TYPE_DMAT3X2,
100	VAR_TYPE_DMAT3X3,
101	VAR_TYPE_DMAT3X4,
102	VAR_TYPE_DMAT4X2,
103	VAR_TYPE_DMAT4X3,
104	VAR_TYPE_DMAT4X4,
105} test_var_type;
106
107struct var_descriptor
108{
109	std::string type;
110	std::string precision;
111	std::string initializer_with_ones;
112	std::string initializer_with_zeroes;
113	std::string iterator_initialization;
114	std::string iterator_type;
115	std::string specific_element;
116	std::string variable_type_initializer1;
117	std::string variable_type_initializer2;
118	std::string coord_param_for_texture_function;
119	std::string type_of_result_of_texture_function;
120};
121
122// This iterator and map are used to simplify the lookup of type names, initialisation
123//  values, etc., associated with each of the types used within the array tests
124typedef std::map<glcts::test_var_type, var_descriptor> _supported_variable_types_map;
125typedef _supported_variable_types_map::const_iterator _supported_variable_types_map_const_iterator;
126
127/* Groups all tests that verify "arrays of arrays" functionality */
128class ArrayOfArraysTestGroup : public glcts::TestCaseGroup
129{
130public:
131	/* Public methods */
132	ArrayOfArraysTestGroup(Context& context);
133
134	virtual void init(void);
135};
136
137/* Groups all tests that verify "arrays of arrays" functionality */
138class ArrayOfArraysTestGroupGL : public glcts::TestCaseGroup
139{
140public:
141	/* Public methods */
142	ArrayOfArraysTestGroupGL(Context& context);
143
144	virtual void init(void);
145};
146
147namespace ArraysOfArrays
148{
149namespace Interface
150{
151/** Represents ES 3.1 core capabilities **/
152struct ES
153{
154	enum
155	{
156		ALLOW_UNSIZED_DECLARATION = 0
157	};
158	enum
159	{
160		ALLOW_A_OF_A_ON_INTERFACE_BLOCKS = 0
161	};
162	enum
163	{
164		ALLOW_IN_OUT_INTERFACE_BLOCKS = 0
165	};
166	enum
167	{
168		USE_ALL_SHADER_STAGES = 0
169	};
170	enum
171	{
172		USE_ATOMIC = 0
173	};
174	enum
175	{
176		USE_DOUBLE = 0
177	};
178	enum
179	{
180		USE_SUBROUTINE = 0
181	};
182	enum
183	{
184		USE_STORAGE_BLOCK = 0
185	};
186
187	static const size_t			MAX_ARRAY_DIMENSIONS;
188	static const test_var_type* var_types;
189	static const size_t			n_var_types;
190
191	static const char* shader_version_gpu5;
192	static const char* shader_version;
193
194	static const char* test_group_name;
195};
196
197/** Represents GL 4.3 core capabilities **/
198struct GL
199{
200	enum
201	{
202		ALLOW_UNSIZED_DECLARATION = 1
203	};
204	enum
205	{
206		ALLOW_A_OF_A_ON_INTERFACE_BLOCKS = 1
207	};
208	enum
209	{
210		ALLOW_IN_OUT_INTERFACE_BLOCKS = 1
211	};
212	enum
213	{
214		USE_ALL_SHADER_STAGES = 1
215	};
216	enum
217	{
218		USE_ATOMIC = 1
219	};
220	enum
221	{
222		USE_DOUBLE = 1
223	};
224	enum
225	{
226		USE_SUBROUTINE = 1
227	};
228	enum
229	{
230		USE_STORAGE_BLOCK = 1
231	};
232
233	static const size_t			MAX_ARRAY_DIMENSIONS;
234	static const test_var_type* var_types;
235	static const size_t			n_var_types;
236
237	static const char* shader_version_gpu5;
238	static const char* shader_version;
239};
240} /* Interface */
241
242/** Base test class for all arrays_of_arrays tests
243 **/
244template <class API>
245class TestCaseBase : public tcu::TestCase
246{
247public:
248	TestCaseBase(Context& context, const char* name, const char* description);
249
250	virtual ~TestCaseBase(void)
251	{
252	}
253
254	virtual void						 deinit(void);
255	virtual void						 delete_objects(void);
256	virtual tcu::TestNode::IterateResult iterate();
257
258protected:
259	/* Protected declarations */
260	enum TestShaderType
261	{
262		FRAGMENT_SHADER_TYPE,
263		VERTEX_SHADER_TYPE,
264		COMPUTE_SHADER_TYPE,
265		GEOMETRY_SHADER_TYPE,
266		TESSELATION_CONTROL_SHADER_TYPE,
267		TESSELATION_EVALUATION_SHADER_TYPE,
268
269		/* */
270		SHADER_TYPE_LAST
271	};
272
273	/* Protected methods */
274	virtual std::string extend_string(std::string base_string, std::string sub_script, size_t number_of_elements);
275
276	virtual glw::GLint compile_shader_and_get_compilation_result(
277		const std::string& tested_snippet, typename TestCaseBase<API>::TestShaderType tested_shader_type,
278		bool require_gpu_shader5 = false);
279
280	virtual tcu::TestNode::IterateResult execute_negative_test(
281		typename TestCaseBase<API>::TestShaderType tested_shader_type, const std::string& shader_source);
282
283	virtual tcu::TestNode::IterateResult execute_positive_test(const std::string& vertex_shader_source,
284															   const std::string& fragment_shader_source,
285															   bool delete_generated_objects, bool require_gpu_shader5);
286
287	virtual tcu::TestNode::IterateResult execute_positive_test(const std::string& vertex_shader_source,
288															   const std::string& tess_ctrl_shader_source,
289															   const std::string& tess_eval_shader_source,
290															   const std::string& geometry_shader_source,
291															   const std::string& fragment_shader_source,
292															   const std::string& compute_shader_source,
293															   bool delete_generated_objects, bool require_gpu_shader5);
294
295	virtual void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type) = 0;
296
297	/* Protected fields */
298	Context&   context_id;
299	glw::GLint program_object_id;
300
301private:
302	/* Private fields */
303	glw::GLint compute_shader_object_id;
304	glw::GLint fragment_shader_object_id;
305	glw::GLint geometry_shader_object_id;
306	glw::GLint tess_ctrl_shader_object_id;
307	glw::GLint tess_eval_shader_object_id;
308	glw::GLint vertex_shader_object_id;
309};
310
311template <class API>
312class SizedDeclarationsPrimitive : public TestCaseBase<API>
313{
314public:
315	/* Public methods */
316	SizedDeclarationsPrimitive(Context& context)
317		: TestCaseBase<API>(context, "SizedDeclarationsPrimitive",
318							" Verify that declarations of variables containing between 2 and 8\n"
319							" sized dimensions of each primitive type are permitted.\n")
320	{
321		/* Left empty on purpose */
322	}
323
324	virtual ~SizedDeclarationsPrimitive()
325	{
326		/* Left empty on purpose */
327	}
328
329protected:
330	/* Protected methods */
331	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
332};
333
334template <class API>
335class SizedDeclarationsStructTypes1 : public TestCaseBase<API>
336{
337public:
338	/* Public methods */
339	SizedDeclarationsStructTypes1(Context& context)
340		: TestCaseBase<API>(context, "SizedDeclarationsStructTypes1",
341							" Declare a structure type containing both ints and floats, and verify\n"
342							" that variables having between 2 and 8 sized dimensions of this type\n"
343							" can be declared.\n")
344	{
345		/* Left empty on purpose */
346	}
347
348	virtual ~SizedDeclarationsStructTypes1()
349	{
350		/* Left empty on purpose */
351	}
352
353protected:
354	/* Protected methods */
355	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
356};
357
358template <class API>
359class SizedDeclarationsStructTypes2 : public TestCaseBase<API>
360{
361public:
362	/* Public methods */
363	SizedDeclarationsStructTypes2(Context& context)
364		: TestCaseBase<API>(context, "SizedDeclarationsStructTypes2",
365							" Verify that a single declaration containing multiple\n"
366							" variables with different numbers of array dimensions is accepted,\n"
367							" e.g.  float [2][2] x2, x3[2], x4[2][2], etc) with each variable\n"
368							" having between two and eight dimensions when there are\n"
369							" declarations within the structure body.\n")
370	{
371		/* Left empty on purpose */
372	}
373
374	virtual ~SizedDeclarationsStructTypes2()
375	{
376		/* Left empty on purpose */
377	}
378
379protected:
380	/* Protected methods */
381	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
382};
383
384template <class API>
385class SizedDeclarationsStructTypes3 : public TestCaseBase<API>
386{
387public:
388	/* Public methods */
389	SizedDeclarationsStructTypes3(Context& context)
390		: TestCaseBase<API>(context, "SizedDeclarationsStructTypes3",
391							" Declare a structure type containing both ints and floats, and verify\n"
392							" that variables having between 2 and 8 sized dimensions of this type\n"
393							" can be declared, with a structure containing an array.\n")
394	{
395		/* Left empty on purpose */
396	}
397
398	virtual ~SizedDeclarationsStructTypes3()
399	{
400		/* Left empty on purpose */
401	}
402
403protected:
404	/* Protected methods */
405	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
406};
407
408template <class API>
409class SizedDeclarationsStructTypes4 : public TestCaseBase<API>
410{
411public:
412	/* Public methods */
413	SizedDeclarationsStructTypes4(Context& context)
414		: TestCaseBase<API>(context, "SizedDeclarationsStructTypes4",
415							" Declare a structure type containing an array, and verify\n"
416							" that variables having between 2 and 8 sized dimensions of this type\n"
417							" can be declared when the structure  definition is included in the \n"
418							" variable definition.\n")
419	{
420		/* Left empty on purpose */
421	}
422
423	virtual ~SizedDeclarationsStructTypes4()
424	{
425		/* Left empty on purpose */
426	}
427
428protected:
429	/* Protected methods */
430	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
431};
432
433template <class API>
434class SizedDeclarationsTypenameStyle1 : public TestCaseBase<API>
435{
436public:
437	/* Public methods */
438	SizedDeclarationsTypenameStyle1(Context& context)
439		: TestCaseBase<API>(context, "SizedDeclarationsTypenameStyle1",
440							" Verify that an 8-dimensional array of floats can be declared with\n"
441							" any placement of the brackets (e.g. float[2]\n"
442							" x[2][2][2][2][2][2][2], float [2][2] x [2][2][2][2][2][2], etc) (9\n"
443							" cases).\n")
444	{
445		/* Left empty on purpose */
446	}
447
448	virtual ~SizedDeclarationsTypenameStyle1()
449	{
450		/* Left empty on purpose */
451	}
452
453protected:
454	/* Protected methods */
455	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
456};
457
458template <class API>
459class SizedDeclarationsTypenameStyle2 : public TestCaseBase<API>
460{
461public:
462	/* Public methods */
463	SizedDeclarationsTypenameStyle2(Context& context)
464		: TestCaseBase<API>(context, "SizedDeclarationsTypenameStyle2",
465							" Verify that a single declaration containing multiple\n"
466							" variables with different numbers of array dimensions is accepted,\n"
467							" e.g.  float [2][2] x2, x3[2], x4[2][2], etc) with each variable\n"
468							" having between two and eight dimensions. Repeat these tests for\n"
469							" declarations within a structure body.\n")
470	{
471		/* Left empty on purpose */
472	}
473
474	virtual ~SizedDeclarationsTypenameStyle2()
475	{
476		/* Left empty on purpose */
477	}
478
479protected:
480	/* Protected methods */
481	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
482};
483
484template <class API>
485class SizedDeclarationsTypenameStyle3 : public TestCaseBase<API>
486{
487public:
488	/* Public methods */
489	SizedDeclarationsTypenameStyle3(Context& context)
490		: TestCaseBase<API>(context, "SizedDeclarationsTypenameStyle3",
491							" Verify that a single declaration, within a structure body,\n"
492							" is accepted when it contains multiple variables with different\n"
493							" numbers of array dimensions, \n"
494							" e.g.  float [2][2] x2, x3[2], x4[2][2], etc), with each variable\n"
495							" having between two and eight dimensions.\n"
496							" The variables should be declared within a structure body.\n")
497	{
498		/* Left empty on purpose */
499	}
500
501	virtual ~SizedDeclarationsTypenameStyle3()
502	{
503		/* Left empty on purpose */
504	}
505
506protected:
507	/* Protected methods */
508	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
509};
510
511template <class API>
512class SizedDeclarationsTypenameStyle4 : public TestCaseBase<API>
513{
514public:
515	/* Public methods */
516	SizedDeclarationsTypenameStyle4(Context& context)
517		: TestCaseBase<API>(context, "SizedDeclarationsTypenameStyle4",
518							" Verify that an 8-dimensional array of floats can be declared with\n"
519							" any placement of the brackets (e.g. float[2]\n"
520							" x[2][2][2][2][2][2][2], float [2][2] x [2][2][2][2][2][2], etc) (9\n"
521							" cases) within a structure body.\n")
522	{
523		/* Left empty on purpose */
524	}
525
526	virtual ~SizedDeclarationsTypenameStyle4()
527	{
528		/* Left empty on purpose */
529	}
530
531protected:
532	/* Protected methods */
533	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
534};
535
536template <class API>
537class SizedDeclarationsTypenameStyle5 : public TestCaseBase<API>
538{
539public:
540	/* Public methods */
541	SizedDeclarationsTypenameStyle5(Context& context)
542		: TestCaseBase<API>(context, "SizedDeclarationsTypenameStyle5",
543							" Verify that a single declaration containing multiple\n"
544							" variables with different numbers of array dimensions is accepted,\n"
545							" within a structure body\n"
546							" e.g.  float [2][2] x2, x3[2], x4[2][2], etc) with each variable\n"
547							" having between two and eight dimensions.\n")
548	{
549		/* Left empty on purpose */
550	}
551
552	virtual ~SizedDeclarationsTypenameStyle5()
553	{
554		/* Left empty on purpose */
555	}
556
557protected:
558	/* Protected methods */
559	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
560};
561
562template <class API>
563class SizedDeclarationsFunctionParams : public TestCaseBase<API>
564{
565public:
566	/* Public methods */
567	SizedDeclarationsFunctionParams(Context& context)
568		: TestCaseBase<API>(context, "SizedDeclarationsFunctionParams",
569							" Declare a function having eight parameters, each a float array\n"
570							" with a different number of dimensions between 1 and 8, and verify\n"
571							" that the compiler accepts this. Declare a variable with matching\n"
572							" shape for each parameter, and verify that the function can be\n"
573							" called with these variables as arguments. Interchange each pair\n"
574							" of arguments and verify that the shader is correctly rejected due\n"
575							" to mismatched arguments (28 total cases).\n")
576	{
577		/* Left empty on purpose */
578	}
579
580	virtual ~SizedDeclarationsFunctionParams()
581	{
582		/* Left empty on purpose */
583	}
584
585protected:
586	/* Protected methods */
587	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
588};
589
590template <class API>
591class sized_declarations_invalid_sizes1 : public TestCaseBase<API>
592{
593public:
594	/* Public methods */
595	sized_declarations_invalid_sizes1(Context& context)
596		: TestCaseBase<API>(context, "sized_declarations_invalid_sizes1",
597							" Correctly reject variable declarations, having 4 dimensions, for\n"
598							" which any combination of dimensions are declared with zero-size\n"
599							" (16 cases).\n")
600	{
601		/* Left empty on purpose */
602	}
603
604	virtual ~sized_declarations_invalid_sizes1()
605	{
606		/* Left empty on purpose */
607	}
608
609protected:
610	/* Protected methods */
611	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
612};
613
614template <class API>
615class sized_declarations_invalid_sizes2 : public TestCaseBase<API>
616{
617public:
618	/* Public methods */
619	sized_declarations_invalid_sizes2(Context& context)
620		: TestCaseBase<API>(context, "sized_declarations_invalid_sizes2",
621							" Correctly reject variable declarations, having 4 dimensions, for\n"
622							" which any combination of dimensions are declared with size -1\n"
623							" (16 cases).\n")
624	{
625		/* Left empty on purpose */
626	}
627
628	virtual ~sized_declarations_invalid_sizes2()
629	{
630		/* Left empty on purpose */
631	}
632
633protected:
634	/* Protected methods */
635	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
636};
637
638template <class API>
639class sized_declarations_invalid_sizes3 : public TestCaseBase<API>
640{
641public:
642	/* Public methods */
643	sized_declarations_invalid_sizes3(Context& context)
644		: TestCaseBase<API>(context, "sized_declarations_invalid_sizes3",
645							" Correctly reject variable declarations, having 4 dimensions, for\n"
646							" which any combination of dimensions are declared with a\n"
647							" non-constant (16 cases).\n")
648	{
649		/* Left empty on purpose */
650	}
651
652	virtual ~sized_declarations_invalid_sizes3()
653	{
654		/* Left empty on purpose */
655	}
656
657protected:
658	/* Protected methods */
659	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
660};
661
662template <class API>
663class sized_declarations_invalid_sizes4 : public TestCaseBase<API>
664{
665public:
666	/* Public methods */
667	sized_declarations_invalid_sizes4(Context& context)
668		: TestCaseBase<API>(context, "sized_declarations_invalid_sizes4",
669							" Correctly reject modifications of a variable declaration of\n"
670							" 4 dimensions (e.g. float x[2][2][2][2]), in which\n"
671							" each adjacent pair '][' is replaced by the sequence operator\n"
672							" (e.g. float x[2,2][2][2]) (6 cases).\n")
673	{
674		/* Left empty on purpose */
675	}
676
677	virtual ~sized_declarations_invalid_sizes4()
678	{
679		/* Left empty on purpose */
680	}
681
682protected:
683	/* Protected methods */
684	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
685};
686
687template <class API>
688class ConstructorsAndUnsizedDeclConstructors1 : public TestCaseBase<API>
689{
690public:
691	/* Public methods */
692	ConstructorsAndUnsizedDeclConstructors1(Context& context)
693		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclConstructors1",
694							" Verifies that constructors for arrays of between 2 and 8 dimensions\n"
695							" are accepted as isolated expressions for each non-opaque primitive\n"
696							" type (7 cases per primitive type).\n")
697	{
698		/* Left empty on purpose */
699	}
700
701	virtual ~ConstructorsAndUnsizedDeclConstructors1()
702	{
703		/* Left empty on purpose */
704	}
705
706protected:
707	/* Protected methods */
708	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
709	std::string recursively_initialise(std::string var_type, size_t dimension_index, std::string init_string);
710};
711
712template <class API>
713class ConstructorsAndUnsizedDeclConstructors2 : public TestCaseBase<API>
714{
715public:
716	/* Public methods */
717	ConstructorsAndUnsizedDeclConstructors2(Context& context)
718		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclConstructors2",
719							" Correctly reject any attempt to pass arguments to a\n"
720							" 2 dimensional float array constructor which has matching scalar\n"
721							" count, but different array shape or dimensionality to the array's\n"
722							" indexed type e.g. float[2][2](float[4](1,2,3,4)),\n"
723							" float[2][2](float[1][4](float[4](1,2,3,4))) (2 cases).\n")
724	{
725		/* Left empty on purpose */
726	}
727
728	virtual ~ConstructorsAndUnsizedDeclConstructors2()
729	{
730		/* Left empty on purpose */
731	}
732
733protected:
734	/* Protected methods */
735	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
736};
737
738template <class API>
739class ConstructorsAndUnsizedDeclUnsizedConstructors : public TestCaseBase<API>
740{
741public:
742	/* Public methods */
743	ConstructorsAndUnsizedDeclUnsizedConstructors(Context& context)
744		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclUnsizedConstructors",
745							" Verifies that any of the array dimensions, or any combination of\n"
746							" dimensions, may be omitted for a 4-dimensional float array\n"
747							" constructor (the sizes on its nested constructors may be\n"
748							" consistently omitted or present, and need not be manipulated\n"
749							" between cases) (e.g. float[][][2][](float[][][](float[][] etc))\n"
750							" (16 cases).\n")
751	{
752		/* Left empty on purpose */
753	}
754
755	virtual ~ConstructorsAndUnsizedDeclUnsizedConstructors()
756	{
757		/* Left empty on purpose */
758	}
759
760protected:
761	/* Protected methods */
762	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
763};
764
765template <class API>
766class ConstructorsAndUnsizedDeclConst : public TestCaseBase<API>
767{
768public:
769	/* Public methods */
770	ConstructorsAndUnsizedDeclConst(Context& context)
771		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclConst",
772							" Verifies that multi-dimensional arrays can be declared as const\n"
773							" using nested constructors to initialize inner dimensions\n"
774							" e.g. const float[2][2] x = float[2][2](float[2](1,2),float[2](3,4)).\n")
775	{
776		/* Left empty on purpose */
777	}
778
779	virtual ~ConstructorsAndUnsizedDeclConst()
780	{
781		/* Left empty on purpose */
782	}
783
784protected:
785	/* Protected methods */
786	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
787};
788
789template <class API>
790class ConstructorsAndUnsizedDeclInvalidConstructors1 : public TestCaseBase<API>
791{
792public:
793	/* Public methods */
794	ConstructorsAndUnsizedDeclInvalidConstructors1(Context& context)
795		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclInvalidConstructors1",
796							" Correctly reject any attempt to call array constructors for\n"
797							" 2-dimensional arrays of any opaque type.\n")
798	{
799		/* Left empty on purpose */
800	}
801
802	virtual ~ConstructorsAndUnsizedDeclInvalidConstructors1()
803	{
804		/* Left empty on purpose */
805	}
806
807protected:
808	/* Protected methods */
809	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
810};
811
812template <class API>
813class ConstructorsAndUnsizedDeclInvalidConstructors2 : public TestCaseBase<API>
814{
815public:
816	/* Public methods */
817	ConstructorsAndUnsizedDeclInvalidConstructors2(Context& context)
818		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclInvalidConstructors2",
819							" Correctly reject 3-dimensional int array constructor calls\n"
820							" for which any dimension or combination of dimensions is\n"
821							" given as zero (see sec(i) - 8 cases).\n")
822	{
823		/* Left empty on purpose */
824	}
825
826	virtual ~ConstructorsAndUnsizedDeclInvalidConstructors2()
827	{
828		/* Left empty on purpose */
829	}
830
831protected:
832	/* Protected methods */
833	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
834};
835
836template <class API>
837class ConstructorsAndUnsizedDeclInvalidConstructors3 : public TestCaseBase<API>
838{
839public:
840	/* Public methods */
841	ConstructorsAndUnsizedDeclInvalidConstructors3(Context& context)
842		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclInvalidConstructors3",
843							" Correctly reject 3-dimensional int array constructor calls\n"
844							" for which any dimension or combination of dimensions is\n"
845							" given as -1 (see sec(i) - 8 cases).\n")
846	{
847		/* Left empty on purpose */
848	}
849
850	virtual ~ConstructorsAndUnsizedDeclInvalidConstructors3()
851	{
852		/* Left empty on purpose */
853	}
854
855protected:
856	/* Protected methods */
857	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
858};
859
860template <class API>
861class ConstructorsAndUnsizedDeclInvalidConstructors4 : public TestCaseBase<API>
862{
863public:
864	/* Public methods */
865	ConstructorsAndUnsizedDeclInvalidConstructors4(Context& context)
866		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclInvalidConstructors4",
867							" Correctly reject 3-dimensional int array constructor calls\n"
868							" for which any dimension or combination of dimensions is\n"
869							" given by a non-constant variable (8 cases).\n")
870	{
871		/* Left empty on purpose */
872	}
873
874	virtual ~ConstructorsAndUnsizedDeclInvalidConstructors4()
875	{
876		/* Left empty on purpose */
877	}
878
879protected:
880	/* Protected methods */
881	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
882};
883
884template <class API>
885class ConstructorsAndUnsizedDeclConstructorSizing1 : public TestCaseBase<API>
886{
887public:
888	/* Public methods */
889	ConstructorsAndUnsizedDeclConstructorSizing1(Context& context)
890		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclConstructorSizing1",
891							" Verifies that arrays of 4 dimensions can be declared with any\n"
892							" combination of dimension sizes omitted, provided a valid\n"
893							" constructor is used as an initializer (15 cases per non-opaque\n"
894							" primitive type).\n")
895	{
896		/* Left empty on purpose */
897	}
898
899	virtual ~ConstructorsAndUnsizedDeclConstructorSizing1()
900	{
901		/* Left empty on purpose */
902	}
903
904protected:
905	/* Protected methods */
906	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
907};
908
909template <class API>
910class ConstructorsAndUnsizedDeclConstructorSizing2 : public TestCaseBase<API>
911{
912public:
913	/* Public methods */
914	ConstructorsAndUnsizedDeclConstructorSizing2(Context& context)
915		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclConstructorSizing2",
916							" Verifies that a sequence of arrays from 2 to 8 dimensions can\n"
917							" be declared in a single statement\n"
918							" (e.g. float[] x=float[](4,5), y[]=float[][](float[](4)), z[][]...).\n"
919							" The size of the dimensions should vary between the cases\n"
920							" of this test (e.g. in the previous case, we have\n"
921							" float x[2] and float y[1][1]).\n")
922	{
923		/* Left empty on purpose */
924	}
925
926	virtual ~ConstructorsAndUnsizedDeclConstructorSizing2()
927	{
928		/* Left empty on purpose */
929	}
930
931protected:
932	/* Protected methods */
933	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
934};
935
936template <class API>
937class ConstructorsAndUnsizedDeclStructConstructors : public TestCaseBase<API>
938{
939public:
940	/* Public methods */
941	ConstructorsAndUnsizedDeclStructConstructors(Context& context)
942		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclStructConstructors",
943							" Declare a user type (struct) and verify that arrays of between 2\n"
944							" and 8 dimensions can be declared without explicit sizes, and\n"
945							" initialized from constructors (7 cases).\n")
946	{
947		/* Left empty on purpose */
948	}
949
950	virtual ~ConstructorsAndUnsizedDeclStructConstructors()
951	{
952		/* Left empty on purpose */
953	}
954
955protected:
956	/* Protected methods */
957	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
958	std::string recursively_initialise(std::string var_type, size_t dimension_index, std::string init_string);
959};
960
961template <class API>
962class ConstructorsAndUnsizedDeclUnsizedArrays1 : public TestCaseBase<API>
963{
964public:
965	/* Public methods */
966	ConstructorsAndUnsizedDeclUnsizedArrays1(Context& context)
967		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclUnsizedArrays1",
968							" Correctly reject unsized declarations of variables between 2 and 8\n"
969							" dimensions for which an initializer is not present.\n")
970	{
971		/* Left empty on purpose */
972	}
973
974	virtual ~ConstructorsAndUnsizedDeclUnsizedArrays1()
975	{
976		/* Left empty on purpose */
977	}
978
979protected:
980	/* Protected methods */
981	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
982};
983
984template <class API>
985class ConstructorsAndUnsizedDeclUnsizedArrays2 : public TestCaseBase<API>
986{
987public:
988	/* Public methods */
989	ConstructorsAndUnsizedDeclUnsizedArrays2(Context& context)
990		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclUnsizedArrays2",
991							" Correctly reject unsized declarations where some elements are\n"
992							" lacking initializers (e.g. float[] x=float[](1), y).\n")
993	{
994		/* Left empty on purpose */
995	}
996
997	virtual ~ConstructorsAndUnsizedDeclUnsizedArrays2()
998	{
999		/* Left empty on purpose */
1000	}
1001
1002protected:
1003	/* Protected methods */
1004	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1005};
1006
1007template <class API>
1008class ConstructorsAndUnsizedDeclUnsizedArrays3 : public TestCaseBase<API>
1009{
1010public:
1011	/* Public methods */
1012	ConstructorsAndUnsizedDeclUnsizedArrays3(Context& context)
1013		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclUnsizedArrays3",
1014							" Correctly reject a declaration which initializes a\n"
1015							" multi-dimensional array from a matrix type,\n"
1016							" e.g. (float[][] x = mat4(0)).\n")
1017	{
1018		/* Left empty on purpose */
1019	}
1020
1021	virtual ~ConstructorsAndUnsizedDeclUnsizedArrays3()
1022	{
1023		/* Left empty on purpose */
1024	}
1025
1026protected:
1027	/* Protected methods */
1028	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1029};
1030
1031template <class API>
1032class ConstructorsAndUnsizedDeclUnsizedArrays4 : public TestCaseBase<API>
1033{
1034public:
1035	/* Public methods */
1036	ConstructorsAndUnsizedDeclUnsizedArrays4(Context& context)
1037		: TestCaseBase<API>(context, "ConstructorsAndUnsizedDeclUnsizedArrays4",
1038							" Declare a user type containing an unsized array\n"
1039							" (e.g. struct foo { float[][] x; }) and verify that the shader is\n"
1040							" correctly rejected.\n")
1041	{
1042		/* Left empty on purpose */
1043	}
1044
1045	virtual ~ConstructorsAndUnsizedDeclUnsizedArrays4()
1046	{
1047		/* Left empty on purpose */
1048	}
1049
1050protected:
1051	/* Protected methods */
1052	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1053};
1054
1055template <class API>
1056class ExpressionsAssignment1 : public TestCaseBase<API>
1057{
1058public:
1059	/* Public methods */
1060	ExpressionsAssignment1(Context& context)
1061		: TestCaseBase<API>(context, "ExpressionsAssignment1",
1062							" Declare two variables of matching array size, having between 2 and\n"
1063							" 8 dimensions, and verify that the value of one can be assigned to\n"
1064							" the other without error (7 cases).\n")
1065	{
1066		/* Left empty on purpose */
1067	}
1068
1069	virtual ~ExpressionsAssignment1()
1070	{
1071		/* Left empty on purpose */
1072	}
1073
1074protected:
1075	/* Protected methods */
1076	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1077	std::string recursively_initialise(std::string var_type, size_t dimension_index, std::string init_string);
1078};
1079
1080template <class API>
1081class ExpressionsAssignment2 : public TestCaseBase<API>
1082{
1083public:
1084	/* Public methods */
1085	ExpressionsAssignment2(Context& context)
1086		: TestCaseBase<API>(context, "ExpressionsAssignment2",
1087							" Correctly reject assignment of variables of differing numbers of array\n"
1088							" dimensions (between 1 and 4) to one another (6 cases).\n")
1089	{
1090		/* Left empty on purpose */
1091	}
1092
1093	virtual ~ExpressionsAssignment2()
1094	{
1095		/* Left empty on purpose */
1096	}
1097
1098protected:
1099	/* Protected methods */
1100	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1101};
1102
1103template <class API>
1104class ExpressionsAssignment3 : public TestCaseBase<API>
1105{
1106public:
1107	/* Public methods */
1108	ExpressionsAssignment3(Context& context)
1109		: TestCaseBase<API>(context, "ExpressionsAssignment3",
1110							" Correctly reject assignment of variables of 4 dimensions and differing\n"
1111							" array size to one another, where all combinations of each dimension\n"
1112							" matching or not matching are tested (15 cases).\n")
1113	{
1114		/* Left empty on purpose */
1115	}
1116
1117	virtual ~ExpressionsAssignment3()
1118	{
1119		/* Left empty on purpose */
1120	}
1121
1122protected:
1123	/* Protected methods */
1124	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1125};
1126
1127template <class API>
1128class ExpressionsTypeRestrictions1 : public TestCaseBase<API>
1129{
1130public:
1131	/* Public methods */
1132	ExpressionsTypeRestrictions1(Context& context)
1133		: TestCaseBase<API>(context, "ExpressionsTypeRestrictions1",
1134							" Declare two 2-dimensional arrays of a sampler type and verify that\n"
1135							" one cannot be assigned to the other.\n"
1136							" Repeat the test for each opaque type.\n")
1137	{
1138		/* Left empty on purpose */
1139	}
1140
1141	virtual ~ExpressionsTypeRestrictions1()
1142	{
1143		/* Left empty on purpose */
1144	}
1145
1146protected:
1147	/* Protected methods */
1148	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1149};
1150
1151template <class API>
1152class ExpressionsTypeRestrictions2 : public TestCaseBase<API>
1153{
1154public:
1155	/* Public methods */
1156	ExpressionsTypeRestrictions2(Context& context)
1157		: TestCaseBase<API>(context, "ExpressionsTypeRestrictions2",
1158							" For each opaque type, verify that structures containing \n"
1159							" two 2-dimensional arrays of that sampler type\n"
1160							" cannot be assigned to each other.\n")
1161	{
1162		/* Left empty on purpose */
1163	}
1164
1165	virtual ~ExpressionsTypeRestrictions2()
1166	{
1167		/* Left empty on purpose */
1168	}
1169
1170protected:
1171	/* Protected methods */
1172	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1173};
1174
1175template <class API>
1176class ExpressionsIndexingScalar1 : public TestCaseBase<API>
1177{
1178public:
1179	/* Public methods */
1180	ExpressionsIndexingScalar1(Context& context)
1181		: TestCaseBase<API>(context, "ExpressionsIndexingScalar1",
1182							" Assign to each scalar element of a 4 dimensional array\n"
1183							" float x[1][2][3][4] (24 cases).\n")
1184	{
1185		/* Left empty on purpose */
1186	}
1187
1188	virtual ~ExpressionsIndexingScalar1()
1189	{
1190		/* Left empty on purpose */
1191	}
1192
1193protected:
1194	/* Protected methods */
1195	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1196};
1197
1198template <class API>
1199class ExpressionsIndexingScalar2 : public TestCaseBase<API>
1200{
1201public:
1202	/* Public methods */
1203	ExpressionsIndexingScalar2(Context& context)
1204		: TestCaseBase<API>(context, "ExpressionsIndexingScalar2",
1205							" Correctly reject indexing the array with any combination\n"
1206							" of indices given as -1 (15 cases).\n")
1207	{
1208		/* Left empty on purpose */
1209	}
1210
1211	virtual ~ExpressionsIndexingScalar2()
1212	{
1213		/* Left empty on purpose */
1214	}
1215
1216protected:
1217	/* Protected methods */
1218	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1219};
1220
1221template <class API>
1222class ExpressionsIndexingScalar3 : public TestCaseBase<API>
1223{
1224public:
1225	/* Public methods */
1226	ExpressionsIndexingScalar3(Context& context)
1227		: TestCaseBase<API>(context, "ExpressionsIndexingScalar3",
1228							" Correctly reject indexing the array with any combination\n"
1229							" of indices given as 4 (15 cases).\n")
1230	{
1231		/* Left empty on purpose */
1232	}
1233
1234	virtual ~ExpressionsIndexingScalar3()
1235	{
1236		/* Left empty on purpose */
1237	}
1238
1239protected:
1240	/* Protected methods */
1241	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1242};
1243
1244template <class API>
1245class ExpressionsIndexingScalar4 : public TestCaseBase<API>
1246{
1247public:
1248	/* Public methods */
1249	ExpressionsIndexingScalar4(Context& context)
1250		: TestCaseBase<API>(context, "ExpressionsIndexingScalar4",
1251							" Correctly reject any attempt to index a 4-dimensional array with\n"
1252							" any combination of missing array index expressions\n"
1253							" (e.g. x[][0][0][]) - (15 cases).\n")
1254	{
1255		/* Left empty on purpose */
1256	}
1257
1258	virtual ~ExpressionsIndexingScalar4()
1259	{
1260		/* Left empty on purpose */
1261	}
1262
1263protected:
1264	/* Protected methods */
1265	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1266};
1267
1268template <class API>
1269class ExpressionsIndexingArray1 : public TestCaseBase<API>
1270{
1271public:
1272	/* Public methods */
1273	ExpressionsIndexingArray1(Context& context)
1274		: TestCaseBase<API>(context, "ExpressionsIndexingArray1",
1275							" Assign to each dimension of an 8 dimensional, single-element array\n"
1276							" with an appropriate constructor (e.g. float\n"
1277							" x[1][1][1][1][1][1][1][1];\n"
1278							" x[0] = float[1][1][1][1][1][1][1](1);\n"
1279							" x[0][0] = etc) - (8 cases).\n")
1280	{
1281		/* Left empty on purpose */
1282	}
1283
1284	virtual ~ExpressionsIndexingArray1()
1285	{
1286		/* Left empty on purpose */
1287	}
1288
1289protected:
1290	/* Protected methods */
1291	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1292};
1293
1294template <class API>
1295class ExpressionsIndexingArray2 : public TestCaseBase<API>
1296{
1297public:
1298	/* Public methods */
1299	ExpressionsIndexingArray2(Context& context)
1300		: TestCaseBase<API>(context, "ExpressionsIndexingArray2",
1301							" Declare two 8 dimensional, single-element arrays, and assign to\n"
1302							" each dimension of one from the matching sub_scripting of the other\n"
1303							" (e.g. x[0] = y[0]; x[0][0] = y[0][0]; etc.) (8 cases).\n")
1304	{
1305		/* Left empty on purpose */
1306	}
1307
1308	virtual ~ExpressionsIndexingArray2()
1309	{
1310		/* Left empty on purpose */
1311	}
1312
1313protected:
1314	/* Protected methods */
1315	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1316	std::string recursively_initialise(std::string var_type, size_t dimension_index, std::string init_string);
1317};
1318
1319template <class API>
1320class ExpressionsIndexingArray3 : public TestCaseBase<API>
1321{
1322public:
1323	/* Public methods */
1324	ExpressionsIndexingArray3(Context& context)
1325		: TestCaseBase<API>(context, "ExpressionsIndexingArray3",
1326							" Correctly reject use of ivecn to index an n-dimensional array -\n"
1327							" e.g. float x[2][2][2][2]; x[ivec4(0)] = 1; (3 cases).\n")
1328	{
1329		/* Left empty on purpose */
1330	}
1331
1332	virtual ~ExpressionsIndexingArray3()
1333	{
1334		/* Left empty on purpose */
1335	}
1336
1337protected:
1338	/* Protected methods */
1339	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1340};
1341
1342template <class API>
1343class ExpressionsDynamicIndexing1 : public TestCaseBase<API>
1344{
1345public:
1346	/* Public methods */
1347	ExpressionsDynamicIndexing1(Context& context)
1348		: TestCaseBase<API>(context, "ExpressionsDynamicIndexing1",
1349							" Verifies that any mixture of constant, uniform and dynamic expressions\n"
1350							" can be used as the array index expression, in any combination, for\n"
1351							" each dimension of a 2 dimensional array (16 cases).\n")
1352	{
1353		/* Left empty on purpose */
1354	}
1355
1356	virtual ~ExpressionsDynamicIndexing1()
1357	{
1358		/* Left empty on purpose */
1359	}
1360
1361protected:
1362	/* Protected methods */
1363	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1364};
1365
1366template <class API>
1367class ExpressionsDynamicIndexing2 : public TestCaseBase<API>
1368{
1369public:
1370	/* Public methods */
1371	ExpressionsDynamicIndexing2(Context& context)
1372		: TestCaseBase<API>(context, "ExpressionsDynamicIndexing2",
1373							" Correctly reject any attempt to index 4-dimensional arrays of opaque\n"
1374							" types with any combination of non-constant expressions\n"
1375							" (e.g. x[0][y][0][y] etc for non-const y) - (15 cases per type).\n")
1376	{
1377		/* Left empty on purpose */
1378	}
1379
1380	virtual ~ExpressionsDynamicIndexing2()
1381	{
1382		/* Left empty on purpose */
1383	}
1384
1385protected:
1386	/* Protected methods */
1387	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1388};
1389
1390template <class API>
1391class ExpressionsEquality1 : public TestCaseBase<API>
1392{
1393public:
1394	/* Public methods */
1395	ExpressionsEquality1(Context& context)
1396		: TestCaseBase<API>(context, "ExpressionsEquality1",
1397							" Verifies that two 4-dimensional arrays of matching primitive\n"
1398							" type can be correctly compared for equality and inequality, when\n"
1399							" they differ independently in each component or combination of\n"
1400							" components (e.g. x = float[][](float[](1,1), float[](1,1)); y =\n"
1401							" float[][](float[](2,1), float[](1,1)); return x == y;) - (16\n"
1402							" cases per primitive type).\n")
1403	{
1404		/* Left empty on purpose */
1405	}
1406
1407	virtual ~ExpressionsEquality1()
1408	{
1409		/* Left empty on purpose */
1410	}
1411
1412protected:
1413	/* Protected methods */
1414	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1415};
1416
1417template <class API>
1418class ExpressionsEquality2 : public TestCaseBase<API>
1419{
1420public:
1421	/* Public methods */
1422	ExpressionsEquality2(Context& context)
1423		: TestCaseBase<API>(context, "ExpressionsEquality2",
1424							" Verifies that two 4-dimensional arrays of matching user (struct)\n"
1425							" types can be correctly compared for equality and inequality, when\n"
1426							" they differ independently in each component or combination of\n"
1427							" components - (16 cases per primitive type).\n")
1428	{
1429		/* Left empty on purpose */
1430	}
1431
1432	virtual ~ExpressionsEquality2()
1433	{
1434		/* Left empty on purpose */
1435	}
1436
1437protected:
1438	/* Protected methods */
1439	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1440};
1441
1442template <class API>
1443class ExpressionsLength1 : public TestCaseBase<API>
1444{
1445public:
1446	/* Public methods */
1447	ExpressionsLength1(Context& context, const glw::GLchar* name, const glw::GLchar* description)
1448		: TestCaseBase<API>(context, name, description)
1449	{
1450		/* Left empty on purpose */
1451	}
1452
1453	ExpressionsLength1(Context& context)
1454		: TestCaseBase<API>(context, "ExpressionsLength1",
1455							" For a 4-dimensional array declared as int x[4][3][2][1], verify that\n"
1456							" x.length returns the integer 4, x[0].length the integer 3, and so\n"
1457							" forth (4 cases).\n")
1458	{
1459		/* Left empty on purpose */
1460	}
1461
1462	virtual ~ExpressionsLength1()
1463	{
1464		/* Left empty on purpose */
1465	}
1466
1467protected:
1468	/* Protected methods */
1469	void execute_dispatch_test(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1470							   const std::string& tested_declaration, const std::string& tested_snippet);
1471
1472	void execute_draw_test(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1473						   const std::string& tested_declaration, const std::string& tested_snippet);
1474
1475	std::string prepare_compute_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1476									   const std::string& tested_declaration, const std::string& tested_snippet);
1477
1478	std::string prepare_fragment_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1479										const std::string& tested_declaration, const std::string& tested_snippet);
1480
1481	std::string prepare_geometry_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1482										const std::string& tested_declaration, const std::string& tested_snippet);
1483
1484	std::string prepare_tess_ctrl_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1485										 const std::string& tested_declaration, const std::string& tested_snippet);
1486
1487	std::string prepare_tess_eval_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1488										 const std::string& tested_declaration, const std::string& tested_snippet);
1489
1490	std::string prepare_vertex_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1491									  const std::string& tested_declaration, const std::string& tested_snippet);
1492
1493	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1494};
1495
1496template <class API>
1497class ExpressionsLength2 : public ExpressionsLength1<API>
1498{
1499public:
1500	/* Public methods */
1501	ExpressionsLength2(Context& context)
1502		: ExpressionsLength1<API>(context, "ExpressionsLength2",
1503								  " For a 4-dimensional array declared as int x[1][2][3][4], verify that\n"
1504								  " x.length returns the integer 1, x[0].length the integer 2, and so\n"
1505								  " forth (4 cases).\n")
1506	{
1507		/* Left empty on purpose */
1508	}
1509
1510	virtual ~ExpressionsLength2()
1511	{
1512		/* Left empty on purpose */
1513	}
1514
1515protected:
1516	/* Protected methods */
1517	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1518};
1519
1520template <class API>
1521class ExpressionsLength3 : public ExpressionsLength1<API>
1522{
1523public:
1524	/* Public methods */
1525	ExpressionsLength3(Context& context)
1526		: ExpressionsLength1<API>(context, "ExpressionsLength3",
1527								  " Correctly reject any use of the length method on elements of a\n"
1528								  " 4-dimensional array x[1][1][1][1] for which the index\n"
1529								  " expression is omitted, e.g. x[].length, x[][].length etc (3 cases).\n")
1530	{
1531		/* Left empty on purpose */
1532	}
1533
1534	virtual ~ExpressionsLength3()
1535	{
1536		/* Left empty on purpose */
1537	}
1538
1539protected:
1540	/* Protected methods */
1541	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1542};
1543
1544template <class API>
1545class ExpressionsInvalid1 : public TestCaseBase<API>
1546{
1547public:
1548	/* Public methods */
1549	ExpressionsInvalid1(Context& context)
1550		: TestCaseBase<API>(context, "ExpressionsInvalid1", " Correctly reject an assignment of a 2 dimensional\n"
1551															" array x[2][2] to a variable y of type mat2.\n")
1552	{
1553		/* Left empty on purpose */
1554	}
1555
1556	virtual ~ExpressionsInvalid1()
1557	{
1558		/* Left empty on purpose */
1559	}
1560
1561protected:
1562	/* Protected methods */
1563	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1564};
1565
1566template <class API>
1567class ExpressionsInvalid2 : public TestCaseBase<API>
1568{
1569public:
1570	/* Public methods */
1571	ExpressionsInvalid2(Context& context)
1572		: TestCaseBase<API>(context, "ExpressionsInvalid2",
1573							" For 8-dimensional arrays x,y, correctly reject any attempt\n"
1574							" to apply the relational operators other than equality and\n"
1575							" inequality (4 cases per non-opaque primitive type).\n")
1576	{
1577		/* Left empty on purpose */
1578	}
1579
1580	virtual ~ExpressionsInvalid2()
1581	{
1582		/* Left empty on purpose */
1583	}
1584
1585protected:
1586	/* Protected methods */
1587	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1588};
1589
1590template <class API>
1591class InteractionFunctionCalls1 : public TestCaseBase<API>
1592{
1593public:
1594	/* Public methods */
1595	InteractionFunctionCalls1(Context& context, const glw::GLchar* name, const glw::GLchar* description)
1596		: TestCaseBase<API>(context, name, description)
1597	{
1598		/* Left empty on purpose */
1599	}
1600
1601	InteractionFunctionCalls1(Context& context)
1602		: TestCaseBase<API>(context, "InteractionFunctionCalls1",
1603							" Declare a function returning an 8-dimensional 64-element array as\n"
1604							" an out parameter, which places a unique integer in each\n"
1605							" element.\n"
1606							" Verifies that the values are returned as expected when this function\n"
1607							" is called.\n"
1608							" Repeat for the following primitive types: int, float,\n"
1609							" ivec2, ivec3, ivec4, vec2, vec3, vec4, mat2, mat3, mat4.\n")
1610	{
1611		/* Left empty on purpose */
1612	}
1613
1614	virtual ~InteractionFunctionCalls1()
1615	{
1616		/* Left empty on purpose */
1617	}
1618
1619protected:
1620	/* Protected methods */
1621	void execute_dispatch_test(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1622							   const std::string& function_definition, const std::string& function_use,
1623							   const std::string& verification);
1624
1625	void execute_draw_test(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1626						   const std::string& function_definition, const std::string& function_use,
1627						   const std::string& verification);
1628
1629	std::string prepare_compute_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1630									   const std::string& function_definition, const std::string& function_use,
1631									   const std::string& verification);
1632
1633	std::string prepare_fragment_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1634										const std::string& function_definition, const std::string& function_use,
1635										const std::string& verification);
1636
1637	std::string prepare_geometry_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1638										const std::string& function_definition, const std::string& function_use,
1639										const std::string& verification);
1640
1641	std::string prepare_tess_ctrl_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1642										 const std::string& function_definition, const std::string& function_use,
1643										 const std::string& verification);
1644
1645	std::string prepare_tess_eval_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1646										 const std::string& function_definition, const std::string& function_use,
1647										 const std::string& verification);
1648
1649	std::string prepare_vertex_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1650									  const std::string& function_definition, const std::string& function_use,
1651									  const std::string& verification);
1652
1653	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1654};
1655
1656template <class API>
1657class InteractionFunctionCalls2 : public InteractionFunctionCalls1<API>
1658{
1659public:
1660	/* Public methods */
1661	InteractionFunctionCalls2(Context& context)
1662		: InteractionFunctionCalls1<API>(context, "InteractionFunctionCalls2",
1663										 " Declare a function taking an inout parameter,\n"
1664										 " which multiplies each element by a different prime.\n"
1665										 " Verifies that the results after returning are again as expected.\n"
1666										 " Repeat for the following primitive types: int, float,\n"
1667										 " ivec2, ivec3, ivec4, vec2, vec3, vec4, mat2, mat3, mat4.\n")
1668	{
1669		/* Left empty on purpose */
1670	}
1671
1672	virtual ~InteractionFunctionCalls2()
1673	{
1674		/* Left empty on purpose */
1675	}
1676
1677protected:
1678	/* Protected methods */
1679	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1680};
1681
1682template <class API>
1683class InteractionArgumentAliasing1 : public InteractionFunctionCalls1<API>
1684{
1685public:
1686	/* Public methods */
1687	InteractionArgumentAliasing1(Context& context)
1688		: InteractionFunctionCalls1<API>(context, "InteractionArgumentAliasing1",
1689										 " Declare a function taking two 8-dimensional, 64-element parameters\n"
1690										 " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
1691										 " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
1692										 " and overwriting x with a constant value, the original values of z\n"
1693										 " are accessible through y.\n"
1694										 " Repeat for float and mat4 types.\n")
1695	{
1696		/* Left empty on purpose */
1697	}
1698
1699	virtual ~InteractionArgumentAliasing1()
1700	{
1701		/* Left empty on purpose */
1702	}
1703
1704protected:
1705	/* Protected methods */
1706	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1707};
1708
1709template <class API>
1710class InteractionArgumentAliasing2 : public InteractionFunctionCalls1<API>
1711{
1712public:
1713	/* Public methods */
1714	InteractionArgumentAliasing2(Context& context)
1715		: InteractionFunctionCalls1<API>(context, "InteractionArgumentAliasing2",
1716										 " Declare a function taking two 8-dimensional, 64-element parameters\n"
1717										 " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
1718										 " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
1719										 " and overwriting y with a constant value, the original values of z\n"
1720										 " are accessible through x.\n"
1721										 " Repeat for float and mat4 types.\n")
1722	{
1723		/* Left empty on purpose */
1724	}
1725
1726	virtual ~InteractionArgumentAliasing2()
1727	{
1728		/* Left empty on purpose */
1729	}
1730
1731protected:
1732	/* Protected methods */
1733	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1734};
1735
1736template <class API>
1737class InteractionArgumentAliasing3 : public InteractionFunctionCalls1<API>
1738{
1739public:
1740	/* Public methods */
1741	InteractionArgumentAliasing3(Context& context)
1742		: InteractionFunctionCalls1<API>(context, "InteractionArgumentAliasing3",
1743										 " Declare a function taking two 8-dimensional, 64-element parameters\n"
1744										 " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
1745										 " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
1746										 " and overwriting y with a constant value, the original values of z\n"
1747										 " are accessible through x, where x is an out parameter.\n"
1748										 " Repeat for float and mat4 types.\n")
1749	{
1750		/* Left empty on purpose */
1751	}
1752
1753	virtual ~InteractionArgumentAliasing3()
1754	{
1755		/* Left empty on purpose */
1756	}
1757
1758protected:
1759	/* Protected methods */
1760	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1761};
1762
1763template <class API>
1764class InteractionArgumentAliasing4 : public InteractionFunctionCalls1<API>
1765{
1766public:
1767	/* Public methods */
1768	InteractionArgumentAliasing4(Context& context)
1769		: InteractionFunctionCalls1<API>(context, "InteractionArgumentAliasing4",
1770										 " Declare a function taking two 8-dimensional, 64-element parameters\n"
1771										 " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
1772										 " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
1773										 " and overwriting x with a constant value, the original values of z\n"
1774										 " are accessible through y, where y is an out parameter.\n"
1775										 " Repeat for float and mat4 types.\n")
1776	{
1777		/* Left empty on purpose */
1778	}
1779
1780	virtual ~InteractionArgumentAliasing4()
1781	{
1782		/* Left empty on purpose */
1783	}
1784
1785protected:
1786	/* Protected methods */
1787	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1788};
1789
1790template <class API>
1791class InteractionArgumentAliasing5 : public InteractionFunctionCalls1<API>
1792{
1793public:
1794	/* Public methods */
1795	InteractionArgumentAliasing5(Context& context)
1796		: InteractionFunctionCalls1<API>(context, "InteractionArgumentAliasing5",
1797										 " Declare a function taking two 8-dimensional, 64-element parameters\n"
1798										 " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
1799										 " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
1800										 " and overwriting y with a constant value, the original values of z\n"
1801										 " are accessible through x, where x is an inout parameter.\n"
1802										 " Repeat for float and mat4 types.\n")
1803	{
1804		/* Left empty on purpose */
1805	}
1806
1807	virtual ~InteractionArgumentAliasing5()
1808	{
1809		/* Left empty on purpose */
1810	}
1811
1812protected:
1813	/* Protected methods */
1814	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1815};
1816
1817template <class API>
1818class InteractionArgumentAliasing6 : public InteractionFunctionCalls1<API>
1819{
1820public:
1821	/* Public methods */
1822	InteractionArgumentAliasing6(Context& context)
1823		: InteractionFunctionCalls1<API>(context, "InteractionArgumentAliasing6",
1824										 " Declare a function taking two 8-dimensional, 64-element parameters\n"
1825										 " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
1826										 " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
1827										 " and overwriting x with a constant value, the original values of z\n"
1828										 " are accessible through y, where y is an inout parameter.\n"
1829										 " Repeat for float and mat4 types.\n")
1830	{
1831		/* Left empty on purpose */
1832	}
1833
1834	virtual ~InteractionArgumentAliasing6()
1835	{
1836		/* Left empty on purpose */
1837	}
1838
1839public:
1840	//AL protected:
1841	/* Protected methods */
1842	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1843};
1844
1845template <class API>
1846class InteractionUniforms1 : public TestCaseBase<API>
1847{
1848public:
1849	/* Public methods */
1850	InteractionUniforms1(Context& context, const glw::GLchar* name, const glw::GLchar* description)
1851		: TestCaseBase<API>(context, name, description)
1852	{
1853		/* Left empty on purpose */
1854	}
1855
1856	InteractionUniforms1(Context& context)
1857		: TestCaseBase<API>(context, "InteractionUniforms1",
1858							" Declare a 4-dimensional uniform array and verify that it can be\n"
1859							" initialized with user data correctly using the API.\n")
1860	{
1861		/* Left empty on purpose */
1862	}
1863
1864	virtual ~InteractionUniforms1()
1865	{
1866		/* Left empty on purpose */
1867	}
1868
1869protected:
1870	/* Protected methods */
1871	std::string prepare_compute_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1872									   const std::string& uniform_definition, const std::string& uniform_use);
1873
1874	std::string prepare_fragment_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1875										const std::string& uniform_definition, const std::string& uniform_use);
1876
1877	std::string prepare_geometry_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1878										const std::string& uniform_definition, const std::string& uniform_use);
1879
1880	std::string prepare_tess_ctrl_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1881										 const std::string& uniform_definition, const std::string& uniform_use);
1882
1883	std::string prepare_tess_eval_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1884										 const std::string& uniform_definition, const std::string& uniform_use);
1885
1886	std::string prepare_vertex_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
1887									  const std::string& uniform_definition, const std::string& uniform_use);
1888
1889	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1890};
1891
1892template <class API>
1893class InteractionUniforms2 : public TestCaseBase<API>
1894{
1895public:
1896	/* Public methods */
1897	InteractionUniforms2(Context& context)
1898		: TestCaseBase<API>(context, "InteractionUniforms2",
1899							" Correctly reject 4-dimensional uniform arrays with any unsized\n"
1900							" dimension, with or without an initializer (30 cases).\n")
1901	{
1902		/* Left empty on purpose */
1903	}
1904
1905	virtual ~InteractionUniforms2()
1906	{
1907		/* Left empty on purpose */
1908	}
1909
1910protected:
1911	/* Protected methods */
1912	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1913};
1914
1915template <class API>
1916class InteractionUniformBuffers1 : public TestCaseBase<API>
1917{
1918public:
1919	/* Public methods */
1920	InteractionUniformBuffers1(Context& context)
1921		: TestCaseBase<API>(context, "InteractionUniformBuffers1",
1922							" Declare a uniform block containing a 6-dimensional array and verify\n"
1923							" that the resulting shader compiles.\n"
1924							" Repeat for ints and uints.\n")
1925	{
1926		/* Left empty on purpose */
1927	}
1928
1929	virtual ~InteractionUniformBuffers1()
1930	{
1931		/* Left empty on purpose */
1932	}
1933
1934protected:
1935	/* Protected methods */
1936	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1937};
1938
1939template <class API>
1940class InteractionUniformBuffers2 : public InteractionUniforms1<API>
1941{
1942public:
1943	/* Public methods */
1944	InteractionUniformBuffers2(Context& context)
1945		: InteractionUniforms1<API>(context, "InteractionUniformBuffers2",
1946									" Declare a 4-dimensional uniform float array x[2][2][2][2] within a\n"
1947									" uniform block, and verify that it can be initialized correctly with user\n"
1948									" data via the API.\n"
1949									" Repeat for ints and uints.\n")
1950	{
1951		/* Left empty on purpose */
1952	}
1953
1954	virtual ~InteractionUniformBuffers2()
1955	{
1956		/* Left empty on purpose */
1957	}
1958
1959protected:
1960	/* Protected methods */
1961	void execute_dispatch_test();
1962
1963	void execute_draw_test(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1964
1965	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1966};
1967
1968template <class API>
1969class InteractionUniformBuffers3 : public TestCaseBase<API>
1970{
1971public:
1972	/* Public methods */
1973	InteractionUniformBuffers3(Context& context)
1974		: TestCaseBase<API>(context, "InteractionUniformBuffers3",
1975							" Correctly reject 4-dimensional uniform arrays with a uniform block\n"
1976							" with any dimension unsized, with or without an initializer (30 cases).\n"
1977							" Repeat for ints and uints.\n")
1978	{
1979		/* Left empty on purpose */
1980	}
1981
1982	virtual ~InteractionUniformBuffers3()
1983	{
1984		/* Left empty on purpose */
1985	}
1986
1987protected:
1988	/* Protected methods */
1989	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
1990};
1991
1992template <class API>
1993class InteractionStorageBuffers1 : public TestCaseBase<API>
1994{
1995public:
1996	/* Public methods */
1997	InteractionStorageBuffers1(Context& context)
1998		: TestCaseBase<API>(context, "InteractionStorageBuffers1",
1999							" Declare a storage block containing a 6-dimensional array and verify\n"
2000							" that the resulting shader compiles.\n"
2001							" Repeat for ints and uints.\n")
2002	{
2003		/* Left empty on purpose */
2004	}
2005
2006	virtual ~InteractionStorageBuffers1()
2007	{
2008		/* Left empty on purpose */
2009	}
2010
2011protected:
2012	/* Protected methods */
2013	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2014};
2015
2016template <class API>
2017class InteractionStorageBuffers2 : public InteractionUniforms1<API>
2018{
2019public:
2020	/* Public methods */
2021	InteractionStorageBuffers2(Context& context)
2022		: InteractionUniforms1<API>(context, "InteractionStorageBuffers2",
2023									" Declare a 4-dimensional float array x[2][2][2][2] within a\n"
2024									" storage block, and verify that it can be initialized correctly with user\n"
2025									" data via the API.\n"
2026									" Repeat for ints and uints.\n")
2027	{
2028		/* Left empty on purpose */
2029	}
2030
2031	virtual ~InteractionStorageBuffers2()
2032	{
2033		/* Left empty on purpose */
2034	}
2035
2036protected:
2037	/* Protected methods */
2038	void execute_dispatch_test();
2039
2040	void execute_draw_test(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2041
2042	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2043};
2044
2045template <class API>
2046class InteractionStorageBuffers3 : public TestCaseBase<API>
2047{
2048public:
2049	/* Public methods */
2050	InteractionStorageBuffers3(Context& context)
2051		: TestCaseBase<API>(context, "InteractionStorageBuffers3",
2052							" Correctly reject 4-dimensional uniform arrays with a uniform block\n"
2053							" with any dimension unsized, with or without an initializer (30 cases).\n"
2054							" Repeat for ints and uints.\n")
2055	{
2056		/* Left empty on purpose */
2057	}
2058
2059	virtual ~InteractionStorageBuffers3()
2060	{
2061		/* Left empty on purpose */
2062	}
2063
2064protected:
2065	/* Protected methods */
2066	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2067};
2068
2069template <class API>
2070class InteractionInterfaceArrays1 : public TestCaseBase<API>
2071{
2072public:
2073	/* Public methods */
2074	InteractionInterfaceArrays1(Context& context)
2075		: TestCaseBase<API>(context, "InteractionInterfaceArrays1", " Verifies that 2-dimensional arrays of shader\n"
2076																	" storage buffer objects are correctly rejected.\n")
2077	{
2078		/* Left empty on purpose */
2079	}
2080
2081	virtual ~InteractionInterfaceArrays1()
2082	{
2083		/* Left empty on purpose */
2084	}
2085
2086protected:
2087	/* Protected methods */
2088	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2089};
2090
2091template <class API>
2092class InteractionInterfaceArrays2 : public TestCaseBase<API>
2093{
2094public:
2095	/* Public methods */
2096	InteractionInterfaceArrays2(Context& context, const glw::GLchar* name, const glw::GLchar* description)
2097		: TestCaseBase<API>(context, name, description)
2098	{
2099		/* Left empty on purpose */
2100	}
2101
2102	InteractionInterfaceArrays2(Context& context)
2103		: TestCaseBase<API>(context, "InteractionInterfaceArrays2",
2104							" Verifies that 2-dimensional arrays of input and output variables\n"
2105							" are correctly rejected.\n")
2106	{
2107		/* Left empty on purpose */
2108	}
2109
2110	virtual ~InteractionInterfaceArrays2()
2111	{
2112		/* Left empty on purpose */
2113	}
2114
2115protected:
2116	/* Protected methods */
2117	const typename TestCaseBase<API>::TestShaderType get_output_shader_type(
2118		const typename TestCaseBase<API>::TestShaderType& input_shader_type);
2119	const std::string prepare_fragment_shader(const typename TestCaseBase<API>::TestShaderType& input_shader_type,
2120											  const std::string& input_source, const std::string& output_source);
2121	const std::string prepare_geometry_shader(const typename TestCaseBase<API>::TestShaderType& input_shader_type,
2122											  const std::string& input_source, const std::string& output_source);
2123	const std::string prepare_tess_ctrl_shader_source(
2124		const typename TestCaseBase<API>::TestShaderType& input_shader_type, const std::string& input_source,
2125		const std::string& output_source);
2126	const std::string prepare_tess_eval_shader_source(
2127		const typename TestCaseBase<API>::TestShaderType& input_shader_type, const std::string& input_source,
2128		const std::string& output_source);
2129	const std::string prepare_vertex_shader(const typename TestCaseBase<API>::TestShaderType& input_shader_type,
2130											const std::string& input_source, const std::string& output_source);
2131	void prepare_sources(const typename TestCaseBase<API>::TestShaderType& input_shader_type,
2132						 const typename TestCaseBase<API>::TestShaderType& output_shader_type,
2133						 const std::string* input_shader_source, const std::string* output_shader_source,
2134						 std::string& input_source, std::string& output_source);
2135	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType input_shader_type);
2136};
2137
2138template <class API>
2139class InteractionInterfaceArrays3 : public TestCaseBase<API>
2140{
2141public:
2142	/* Public methods */
2143	InteractionInterfaceArrays3(Context& context)
2144		: TestCaseBase<API>(context, "InteractionInterfaceArrays3",
2145							" Verifies that 2-dimensional arrays of uniform interface blocks\n"
2146							" are correctly rejected.\n")
2147	{
2148		/* Left empty on purpose */
2149	}
2150
2151	virtual ~InteractionInterfaceArrays3()
2152	{
2153		/* Left empty on purpose */
2154	}
2155
2156protected:
2157	/* Protected methods */
2158	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2159};
2160
2161template <class API>
2162class InteractionInterfaceArrays4 : public InteractionInterfaceArrays2<API>
2163{
2164public:
2165	/* Public methods */
2166	InteractionInterfaceArrays4(Context& context)
2167		: InteractionInterfaceArrays2<API>(context, "InteractionInterfaceArrays4",
2168										   " Verifies that 2-dimensional arrays of input and output interface blocks\n"
2169										   " are correctly rejected.\n")
2170	{
2171		/* Left empty on purpose */
2172	}
2173
2174	virtual ~InteractionInterfaceArrays4()
2175	{
2176		/* Left empty on purpose */
2177	}
2178
2179protected:
2180	/* Protected methods */
2181	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType input_shader_type);
2182};
2183
2184/** Implements test AtomicDeclaration, desription follows:
2185 *
2186 * Prepare a shader that declares "bar", a multidimensional array of atomic
2187 * counters. Shader should increment all entries of "bar". It is expected that
2188 * building of program will:
2189 * - pass when number of entries in "bar" is equal to a value of the
2190 * corresponding MAX_*_ATOMIC_COUNTERS constant,
2191 * - fail when number of entries in "bar" exceeds limit.
2192 * Test all supported shader stages separately.
2193 **/
2194template <class API>
2195class AtomicDeclarationTest : public TestCaseBase<API>
2196{
2197public:
2198	/* Public methods */
2199	AtomicDeclarationTest(Context& context)
2200		: TestCaseBase<API>(context, "AtomicDeclaration",
2201							" Verifies that atomic counters can be grouped in multidimensional arrays\n")
2202	{
2203		/* Left empty on purpose */
2204	}
2205
2206	virtual ~AtomicDeclarationTest()
2207	{
2208		/* Left empty on purpose */
2209	}
2210
2211protected:
2212	/* Protected methods */
2213	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2214};
2215
2216/** Implements test AtomicUsage, desription follows:
2217 *
2218 * Prepare a program like in "valid" case of AtomicDeclaration test, but use
2219 * layout qualifier with last binding and specific offset. Bind a buffer so all
2220 * entries in "bar" have unique values assigned. Select offset and size of
2221 * "bar" as follows:
2222 * - offset is 0, "bar" fills entire allowed space;
2223 * - offset is not 0, "bar" does not exceed any limit.
2224 * Test pass if buffer contents are correctly modified by execution of the
2225 * program.
2226 * Test all supported shader stages separately.
2227 **/
2228template <class API>
2229class AtomicUsageTest : public TestCaseBase<API>
2230{
2231public:
2232	/* Public methods */
2233	AtomicUsageTest(Context& context)
2234		: TestCaseBase<API>(context, "AtomicUsage",
2235							" Verifies that atomic counters grouped in multidimensional arrays can be used\n")
2236	{
2237		/* Left empty on purpose */
2238	}
2239
2240	virtual ~AtomicUsageTest()
2241	{
2242		/* Left empty on purpose */
2243	}
2244
2245protected:
2246	/* Protected methods */
2247	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2248
2249private:
2250	void execute(typename TestCaseBase<API>::TestShaderType tested_shader_type, glw::GLuint binding, glw::GLuint offset,
2251				 glw::GLuint n_entries);
2252};
2253
2254/** Implements "out" case of SubRoutineCalls test, description follows:
2255 *
2256 * Modify "function-calls" test in the following aspects:
2257 * - provide two subroutines instead of each function;
2258 * - "new" "out" subroutine should use different pattern of values;
2259 * - "new" "inout" subroutine should use division instead of multiplication;
2260 * - it is expected that "original" set will pass, while "new" set will fail.
2261 **/
2262template <class API>
2263class SubroutineFunctionCalls1 : public TestCaseBase<API>
2264{
2265public:
2266	/* Public methods */
2267	SubroutineFunctionCalls1(Context& context, const glw::GLchar* name, const glw::GLchar* description)
2268		: TestCaseBase<API>(context, name, description)
2269	{
2270		/* Left empty on purpose */
2271	}
2272
2273	SubroutineFunctionCalls1(Context& context)
2274		: TestCaseBase<API>(context, "SubroutineFunctionCalls1",
2275							" Declare two subroutines returning an 8-dimensional 64-element array as\n"
2276							" an out parameter, filled with unique values.\n"
2277							" Verifies that the values are returned as expected when this function\n"
2278							" is called.\n"
2279							" Repeat for the following primitive types: int, float,\n"
2280							" ivec2, ivec3, ivec4, vec2, vec3, vec4, mat2, mat3, mat4.\n")
2281	{
2282		/* Left empty on purpose */
2283	}
2284
2285	virtual ~SubroutineFunctionCalls1()
2286	{
2287		/* Left empty on purpose */
2288	}
2289
2290protected:
2291	/* Protected methods */
2292	void execute_dispatch_test(typename TestCaseBase<API>::TestShaderType tested_shader_type,
2293							   const std::string& function_definition, const std::string& function_use,
2294							   const std::string& verification, bool use_original, bool expect_invalid_result);
2295
2296	void execute_draw_test(typename TestCaseBase<API>::TestShaderType tested_shader_type,
2297						   const std::string& function_definition, const std::string& function_use,
2298						   const std::string& verification, bool use_original, bool expect_invalid_result);
2299
2300	std::string prepare_compute_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
2301									   const std::string& function_definition, const std::string& function_use,
2302									   const std::string& verification);
2303
2304	std::string prepare_fragment_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
2305										const std::string& function_definition, const std::string& function_use,
2306										const std::string& verification);
2307
2308	std::string prepare_geometry_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
2309										const std::string& function_definition, const std::string& function_use,
2310										const std::string& verification);
2311
2312	std::string prepare_tess_ctrl_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
2313										 const std::string& function_definition, const std::string& function_use,
2314										 const std::string& verification);
2315
2316	std::string prepare_tess_eval_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
2317										 const std::string& function_definition, const std::string& function_use,
2318										 const std::string& verification);
2319
2320	std::string prepare_vertex_shader(typename TestCaseBase<API>::TestShaderType tested_shader_type,
2321									  const std::string& function_definition, const std::string& function_use,
2322									  const std::string& verification);
2323
2324	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2325};
2326
2327/** Implements "inout" case of SubRoutineCalls test, description follows:
2328 *
2329 * Modify "function-calls" test in the following aspects:
2330 * - provide two subroutines instead of each function;
2331 * - "new" "out" subroutine should use different pattern of values;
2332 * - "new" "inout" subroutine should use division instead of multiplication;
2333 * - it is expected that "original" set will pass, while "new" set will fail.
2334 **/
2335template <class API>
2336class SubroutineFunctionCalls2 : public SubroutineFunctionCalls1<API>
2337{
2338public:
2339	/* Public methods */
2340	SubroutineFunctionCalls2(Context& context)
2341		: SubroutineFunctionCalls1<API>(context, "SubroutineFunctionCalls2",
2342										" Declare two subroutines taking an inout parameter,\n"
2343										" which modifies each element in a unique way.\n"
2344										" Verifies that the results after returning are as expected.\n"
2345										" Repeat for the following primitive types: int, float,\n"
2346										" ivec2, ivec3, ivec4, vec2, vec3, vec4, mat2, mat3, mat4.\n")
2347	{
2348		/* Left empty on purpose */
2349	}
2350
2351	virtual ~SubroutineFunctionCalls2()
2352	{
2353		/* Left empty on purpose */
2354	}
2355
2356protected:
2357	/* Protected methods */
2358	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2359};
2360
2361template <class API>
2362class SubroutineArgumentAliasing1 : public SubroutineFunctionCalls1<API>
2363{
2364public:
2365	/* Public methods */
2366	SubroutineArgumentAliasing1(Context& context)
2367		: SubroutineFunctionCalls1<API>(
2368			  context, "SubroutineArgumentAliasing1",
2369			  " Declare a function taking two 8-dimensional, 64-element parameters\n"
2370			  " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
2371			  " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
2372			  " and overwriting one parameter with a constant value, the original values of z\n"
2373			  " are accessible through the second parameter.\n"
2374			  " Repeat for float and mat4 types.\n")
2375	{
2376		/* Left empty on purpose */
2377	}
2378
2379	virtual ~SubroutineArgumentAliasing1()
2380	{
2381		/* Left empty on purpose */
2382	}
2383
2384protected:
2385	/* Protected methods */
2386	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2387};
2388
2389template <class API>
2390class SubroutineArgumentAliasing2 : public SubroutineFunctionCalls1<API>
2391{
2392public:
2393	/* Public methods */
2394	SubroutineArgumentAliasing2(Context& context)
2395		: SubroutineFunctionCalls1<API>(
2396			  context, "SubroutineArgumentAliasing2",
2397			  " Declare two subroutines taking two 8-dimensional, 64-element parameters\n"
2398			  " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
2399			  " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
2400			  " and overwriting one parameter with a constant value, the original values of z\n"
2401			  " are accessible through the second inout parameter.\n"
2402			  " Repeat for float and mat4 types.\n")
2403	{
2404		/* Left empty on purpose */
2405	}
2406
2407	virtual ~SubroutineArgumentAliasing2()
2408	{
2409		/* Left empty on purpose */
2410	}
2411
2412protected:
2413	/* Protected methods */
2414	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2415};
2416
2417template <class API>
2418class SubroutineArgumentAliasing3 : public SubroutineFunctionCalls1<API>
2419{
2420public:
2421	/* Public methods */
2422	SubroutineArgumentAliasing3(Context& context)
2423		: SubroutineFunctionCalls1<API>(
2424			  context, "SubroutineArgumentAliasing3",
2425			  " Declare two subroutines taking two 8-dimensional, 64-element parameters\n"
2426			  " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
2427			  " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
2428			  " and overwriting x, out, parameter with a constant value, the original values of z\n"
2429			  " are accessible through the y parameter.\n"
2430			  " Repeat for float and mat4 types.\n")
2431	{
2432		/* Left empty on purpose */
2433	}
2434
2435	virtual ~SubroutineArgumentAliasing3()
2436	{
2437		/* Left empty on purpose */
2438	}
2439
2440protected:
2441	/* Protected methods */
2442	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2443};
2444
2445template <class API>
2446class SubroutineArgumentAliasing4 : public SubroutineFunctionCalls1<API>
2447{
2448public:
2449	/* Public methods */
2450	SubroutineArgumentAliasing4(Context& context)
2451		: SubroutineFunctionCalls1<API>(
2452			  context, "SubroutineArgumentAliasing4",
2453			  " Declare two subroutines taking two 8-dimensional, 64-element parameters\n"
2454			  " (e.g. void g(int x[2][2][2][2][2][2][2][2], int\n"
2455			  " y[2][2][2][2][2][2][2][2]) and verify that after calling g(z,z),\n"
2456			  " and overwriting y, out, parameter with a constant value, the original values of z\n"
2457			  " are accessible through the x parameter.\n"
2458			  " Repeat for float and mat4 types.\n")
2459	{
2460		/* Left empty on purpose */
2461	}
2462
2463	virtual ~SubroutineArgumentAliasing4()
2464	{
2465		/* Left empty on purpose */
2466	}
2467
2468protected:
2469	/* Protected methods */
2470	void test_shader_compilation(typename TestCaseBase<API>::TestShaderType tested_shader_type);
2471};
2472
2473} /* ArraysOfArrays */
2474} /* glcts */
2475
2476#endif // _ES31CARRAYOFARRAYSTESTS_HPP
2477