1/*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Choose config tests.
22 *//*--------------------------------------------------------------------*/
23
24#include "teglChooseConfigTests.hpp"
25#include "teglChooseConfigReference.hpp"
26#include "tcuTestLog.hpp"
27#include "egluStrUtil.hpp"
28#include "deRandom.hpp"
29#include "deStringUtil.hpp"
30
31#include <vector>
32#include <algorithm>
33#include <string>
34#include <set>
35#include <map>
36
37using std::set;
38using std::vector;
39using std::pair;
40using std::string;
41using tcu::TestLog;
42
43namespace deqp
44{
45namespace egl
46{
47
48using eglu::ConfigInfo;
49
50namespace
51{
52
53string configListToString (const tcu::egl::Display& display, const vector<EGLConfig>& configs)
54{
55	string str = "";
56	for (vector<EGLConfig>::const_iterator cfgIter = configs.begin(); cfgIter != configs.end(); cfgIter++)
57	{
58		EGLConfig	config		= *cfgIter;
59		EGLint		configId	= display.getConfigAttrib(config, EGL_CONFIG_ID);
60
61		if (str.length() != 0)
62			str += " ";
63
64		str += de::toString(configId);
65	}
66	return str;
67}
68
69void logConfigAttrib (TestLog& log, EGLenum attrib, EGLint value)
70{
71	const std::string	attribStr	= eglu::getConfigAttribName(attrib);
72
73	if (value == EGL_DONT_CARE)
74	{
75		log << TestLog::Message << "  " << attribStr << ": EGL_DONT_CARE" << TestLog::EndMessage;
76		return;
77	}
78
79	log << TestLog::Message << "  " << attribStr << ": " << eglu::getConfigAttribValueStr(attrib, value) << TestLog::EndMessage;
80}
81
82} // anonymous
83
84class ChooseConfigCase : public TestCase
85{
86public:
87	ChooseConfigCase (EglTestContext& eglTestCtx, const char* name, const char* description, bool checkOrder, const EGLint* attributes)
88		: TestCase		(eglTestCtx, name, description)
89		, m_checkOrder	(checkOrder)
90	{
91		// Parse attributes
92		while (attributes[0] != EGL_NONE)
93		{
94			m_attributes.push_back(std::make_pair((EGLenum)attributes[0], (EGLint)attributes[1]));
95			attributes += 2;
96		}
97	}
98
99	ChooseConfigCase (EglTestContext& eglTestCtx, const char* name, const char* description, bool checkOrder, const std::vector<std::pair<EGLenum, EGLint> >& attributes)
100		: TestCase		(eglTestCtx, name, description)
101		, m_checkOrder	(checkOrder)
102		, m_attributes	(attributes)
103	{
104	}
105
106	IterateResult iterate (void)
107	{
108		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
109
110		executeTest(m_attributes, m_checkOrder);
111		return STOP;
112	}
113protected:
114	ChooseConfigCase (EglTestContext& eglTestCtx, const char* name, const char* description, bool checkOrder)
115		: TestCase		(eglTestCtx, name, description)
116		, m_checkOrder	(checkOrder)
117	{
118	}
119
120	void executeTest (const std::vector<std::pair<EGLenum, EGLint> >& attributes, bool checkOrder)
121	{
122		TestLog&					log		= m_testCtx.getLog();
123		const tcu::egl::Display&	display	= m_eglTestCtx.getDisplay();
124
125		// Build attributes for EGL
126		vector<EGLint> attribList;
127		for (vector<pair<EGLenum, EGLint> >::const_iterator i = attributes.begin(); i != attributes.end(); i++)
128		{
129			attribList.push_back(i->first);
130			attribList.push_back(i->second);
131		}
132		attribList.push_back(EGL_NONE);
133
134		// Print attribList to log
135		log << TestLog::Message << "Attributes:" << TestLog::EndMessage;
136		for (vector<pair<EGLenum, EGLint> >::const_iterator i = attributes.begin(); i != attributes.end(); i++)
137			logConfigAttrib(log, i->first, i->second);
138
139		std::vector<EGLConfig>	resultConfigs;
140		std::vector<EGLConfig>	referenceConfigs;
141
142		// Query from EGL implementation
143		{
144			EGLint numConfigs = 0;
145			TCU_CHECK_EGL_CALL(eglChooseConfig(display.getEGLDisplay(), &attribList[0], DE_NULL, 0, &numConfigs));
146			resultConfigs.resize(numConfigs);
147
148			if (numConfigs > 0)
149				TCU_CHECK_EGL_CALL(eglChooseConfig(display.getEGLDisplay(), &attribList[0], &resultConfigs[0], (EGLint)resultConfigs.size(), &numConfigs));
150		}
151
152		// Build reference
153		chooseConfigReference(display, referenceConfigs, attributes);
154
155		log << TestLog::Message << "Expected:\n  " << configListToString(display, referenceConfigs) << TestLog::EndMessage;
156		log << TestLog::Message << "Got:\n  " << configListToString(display, resultConfigs) << TestLog::EndMessage;
157
158		bool isSetMatch		= (set<EGLConfig>(resultConfigs.begin(), resultConfigs.end()) == set<EGLConfig>(referenceConfigs.begin(), referenceConfigs.end()));
159		bool isExactMatch	= (resultConfigs == referenceConfigs);
160		bool isMatch		= isSetMatch && (checkOrder ? isExactMatch : true);
161
162		if (isMatch)
163			log << TestLog::Message << "Pass" << TestLog::EndMessage;
164		else if (!isSetMatch)
165			log << TestLog::Message << "Fail, configs don't match" << TestLog::EndMessage;
166		else if (!isExactMatch)
167			log << TestLog::Message << "Fail, got correct configs but in invalid order" << TestLog::EndMessage;
168
169		if (!isMatch)
170			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
171	}
172
173	void fillDontCare (std::vector<std::pair<EGLenum, EGLint> >& attributes)
174	{
175		static const EGLenum dontCareAttributes[] =
176		{
177			EGL_TRANSPARENT_TYPE,
178			EGL_COLOR_BUFFER_TYPE,
179			EGL_RENDERABLE_TYPE,
180			EGL_SURFACE_TYPE
181		};
182
183		// Fill appropriate unused attributes with EGL_DONT_CARE
184		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(dontCareAttributes); ndx++)
185		{
186			bool found = false;
187			for (size_t findNdx = 0; findNdx < attributes.size(); findNdx++)
188				if (attributes[findNdx].first == dontCareAttributes[ndx]) found = true;
189
190			if (!found) attributes.push_back(std::make_pair(dontCareAttributes[ndx], EGL_DONT_CARE));
191		}
192	}
193
194	bool							m_checkOrder;
195	vector<pair<EGLenum, EGLint> >	m_attributes;
196};
197
198class ChooseConfigSimpleCase : public ChooseConfigCase
199{
200protected:
201	EGLint getValue (EGLenum name)
202	{
203		static const struct
204		{
205			EGLenum		name;
206			EGLint		value;
207		} attributes[] = {
208			{ EGL_BUFFER_SIZE,				0					},
209			{ EGL_RED_SIZE,					0					},
210			{ EGL_GREEN_SIZE,				0					},
211			{ EGL_BLUE_SIZE,				0					},
212			{ EGL_LUMINANCE_SIZE,			0					},
213			{ EGL_ALPHA_SIZE,				0					},
214			{ EGL_ALPHA_MASK_SIZE,			0					},
215			{ EGL_BIND_TO_TEXTURE_RGB,		EGL_DONT_CARE		},
216			{ EGL_BIND_TO_TEXTURE_RGBA,		EGL_DONT_CARE		},
217			{ EGL_COLOR_BUFFER_TYPE,		EGL_DONT_CARE		},
218			{ EGL_CONFIG_CAVEAT,			EGL_DONT_CARE		},
219			//{ EGL_CONFIG_ID,				EGL_DONT_CARE		},
220			{ EGL_DEPTH_SIZE,				0					},
221			{ EGL_LEVEL,					0					},
222			{ EGL_MAX_SWAP_INTERVAL,		EGL_DONT_CARE		},
223			{ EGL_MIN_SWAP_INTERVAL,		EGL_DONT_CARE		},
224			{ EGL_NATIVE_RENDERABLE,		EGL_DONT_CARE		},
225			{ EGL_NATIVE_VISUAL_TYPE,		EGL_DONT_CARE		},
226			{ EGL_SAMPLE_BUFFERS,			0					},
227			{ EGL_SAMPLES,					0					},
228			{ EGL_STENCIL_SIZE,				0					},
229			{ EGL_TRANSPARENT_TYPE,			EGL_TRANSPARENT_RGB	},
230			{ EGL_TRANSPARENT_RED_VALUE,	0					},
231			{ EGL_TRANSPARENT_GREEN_VALUE,	0					},
232			{ EGL_TRANSPARENT_BLUE_VALUE,	0					},
233			{ EGL_CONFORMANT,				EGL_OPENGL_ES_BIT	},
234			{ EGL_RENDERABLE_TYPE,			EGL_OPENGL_ES_BIT	},
235			{ EGL_SURFACE_TYPE,				EGL_WINDOW_BIT		}
236			//{ EGL_CONFORMANT,				EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT | EGL_OPENVG_BIT	},
237			//{ EGL_RENDERABLE_TYPE,			EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT | EGL_OPENVG_BIT	},
238			//{ EGL_SURFACE_TYPE,				EGL_WINDOW_BIT
239			//								| EGL_PIXMAP_BIT
240			//								| EGL_PBUFFER_BIT
241			//								| EGL_MULTISAMPLE_RESOLVE_BOX_BIT
242			//								| EGL_VG_ALPHA_FORMAT_PRE_BIT
243			//								| EGL_SWAP_BEHAVIOR_PRESERVED_BIT
244			//								| EGL_VG_COLORSPACE_LINEAR_BIT
245			//								}
246		};
247
248		if (name == EGL_CONFIG_ID)
249		{
250			de::Random rnd(0);
251			return m_eglTestCtx.getConfigs()[rnd.getInt(0, (int)(m_eglTestCtx.getConfigs().size()-1))].configId;
252		}
253		else
254		{
255			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(attributes); ndx++)
256			{
257				if (attributes[ndx].name == name) return attributes[ndx].value;
258			}
259		}
260
261		DE_ASSERT(DE_FALSE);
262		return EGL_NONE;
263	}
264public:
265	ChooseConfigSimpleCase (EglTestContext& eglTestCtx, const char* name, const char* description, EGLenum attribute, bool checkOrder)
266		: ChooseConfigCase(eglTestCtx, name, description, checkOrder)
267		, m_attribute(attribute)
268	{
269	}
270
271	void init (void)
272	{
273	}
274
275	TestCase::IterateResult iterate (void)
276	{
277		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
278
279		std::vector<std::pair<EGLenum, EGLint> > attributes;
280		attributes.push_back(std::pair<EGLenum, EGLint>(m_attribute, getValue(m_attribute)));
281
282		fillDontCare(attributes);
283		executeTest(attributes, m_checkOrder);
284
285		return STOP;
286	}
287private:
288	EGLenum	m_attribute;
289};
290
291class ChooseConfigRandomCase : public ChooseConfigCase
292{
293public:
294	ChooseConfigRandomCase (EglTestContext& eglTestCtx, const char* name, const char* description, const set<EGLenum>& attribSet)
295		: ChooseConfigCase	(eglTestCtx, name, description, true)
296		, m_attribSet		(attribSet)
297		, m_numIters		(10)
298		, m_iterNdx			(0)
299	{
300	}
301
302	void init (void)
303	{
304		m_iterNdx = 0;
305		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
306	}
307
308	TestCase::IterateResult iterate (void)
309	{
310		m_testCtx.getLog() << TestLog::Message << "Iteration :" << m_iterNdx << TestLog::EndMessage;
311		m_iterNdx += 1;
312
313		// Build random list of attributes
314		de::Random									rnd(m_iterNdx);
315		const int									numAttribs	= rnd.getInt(0, (int)m_attribSet.size()*2);
316
317		std::vector<std::pair<EGLenum, EGLint> >	attributes	= genRandomAttributes(m_attribSet, numAttribs, rnd);
318
319		fillDontCare(attributes);
320		executeTest(attributes, m_checkOrder);
321
322		return m_iterNdx < m_numIters ? CONTINUE : STOP;
323	}
324
325	template <int MinVal, int MaxVal> static EGLint getInt (de::Random& rnd)
326	{
327		return rnd.getInt(MinVal, MaxVal);
328	}
329
330	static EGLint getBool (de::Random& rnd)
331	{
332		return rnd.getBool() ? EGL_TRUE : EGL_FALSE;
333	}
334
335	static EGLint getBufferType (de::Random& rnd)
336	{
337		static const EGLint types[] = { EGL_RGB_BUFFER, EGL_LUMINANCE_BUFFER };
338		return rnd.choose<EGLint>(types, types+DE_LENGTH_OF_ARRAY(types));
339	}
340
341	static EGLint getConfigCaveat (de::Random& rnd)
342	{
343		static const EGLint caveats[] = { EGL_SLOW_CONFIG, EGL_NON_CONFORMANT_CONFIG };
344		return rnd.choose<EGLint>(caveats, caveats+DE_LENGTH_OF_ARRAY(caveats));
345	}
346
347	static EGLint getApiBits (de::Random& rnd)
348	{
349		EGLint api = 0;
350		api |= rnd.getBool() ? EGL_OPENGL_BIT		: 0;
351		api |= rnd.getBool() ? EGL_OPENGL_ES_BIT	: 0;
352		api |= rnd.getBool() ? EGL_OPENGL_ES2_BIT	: 0;
353		api |= rnd.getBool() ? EGL_OPENVG_BIT		: 0;
354		return api;
355	}
356
357	static EGLint getSurfaceType (de::Random& rnd)
358	{
359		EGLint bits = 0;
360		bits |= rnd.getBool() ? EGL_WINDOW_BIT	: 0;
361		bits |= rnd.getBool() ? EGL_PIXMAP_BIT	: 0;
362		bits |= rnd.getBool() ? EGL_PBUFFER_BIT	: 0;
363		return bits;
364	}
365
366	struct AttribSpec
367	{
368		EGLenum			attribute;
369		EGLint			(*getValue)(de::Random& rnd);
370	};
371
372	std::vector<std::pair<EGLenum, EGLint> > genRandomAttributes (const std::set<EGLenum>& attribSet, int numAttribs, de::Random& rnd)
373	{
374		static const struct AttribSpec attributes[] =
375		{
376			{ EGL_BUFFER_SIZE,				ChooseConfigRandomCase::getInt<0, 32>,		},
377			{ EGL_RED_SIZE,					ChooseConfigRandomCase::getInt<0, 8>,		},
378			{ EGL_GREEN_SIZE,				ChooseConfigRandomCase::getInt<0, 8>,		},
379			{ EGL_BLUE_SIZE,				ChooseConfigRandomCase::getInt<0, 8>,		},
380			{ EGL_LUMINANCE_SIZE,			ChooseConfigRandomCase::getInt<0, 1>,		},
381			{ EGL_ALPHA_SIZE,				ChooseConfigRandomCase::getInt<0, 8>,		},
382			{ EGL_ALPHA_MASK_SIZE,			ChooseConfigRandomCase::getInt<0, 1>,		},
383			{ EGL_BIND_TO_TEXTURE_RGB,		ChooseConfigRandomCase::getBool,			},
384			{ EGL_BIND_TO_TEXTURE_RGBA,		ChooseConfigRandomCase::getBool,			},
385			{ EGL_COLOR_BUFFER_TYPE,		ChooseConfigRandomCase::getBufferType,		},
386			{ EGL_CONFIG_CAVEAT,			ChooseConfigRandomCase::getConfigCaveat,	},
387//			{ EGL_CONFIG_ID,				0/*special*/,		},
388			{ EGL_CONFORMANT,				ChooseConfigRandomCase::getApiBits,			},
389			{ EGL_DEPTH_SIZE,				ChooseConfigRandomCase::getInt<0, 32>,		},
390			{ EGL_LEVEL,					ChooseConfigRandomCase::getInt<0, 1>,		},
391//			{ EGL_MATCH_NATIVE_PIXMAP,		EGL_NONE,			},
392			{ EGL_MAX_SWAP_INTERVAL,		ChooseConfigRandomCase::getInt<0, 2>,		},
393			{ EGL_MIN_SWAP_INTERVAL,		ChooseConfigRandomCase::getInt<0, 1>,		},
394			{ EGL_NATIVE_RENDERABLE,		ChooseConfigRandomCase::getBool,			},
395//			{ EGL_NATIVE_VISUAL_TYPE,		EGL_DONT_CARE,		},
396			{ EGL_RENDERABLE_TYPE,			ChooseConfigRandomCase::getApiBits,			},
397			{ EGL_SAMPLE_BUFFERS,			ChooseConfigRandomCase::getInt<0, 1>,		},
398			{ EGL_SAMPLES,					ChooseConfigRandomCase::getInt<0, 1>,		},
399			{ EGL_STENCIL_SIZE,				ChooseConfigRandomCase::getInt<0, 1>,		},
400			{ EGL_SURFACE_TYPE,				ChooseConfigRandomCase::getSurfaceType,		},
401//			{ EGL_TRANSPARENT_TYPE,			EGL_TRANSPARENT_RGB,},
402//			{ EGL_TRANSPARENT_RED_VALUE,	ChooseConfigRandomCase::getInt<0, 255>,		},
403//			{ EGL_TRANSPARENT_GREEN_VALUE,	ChooseConfigRandomCase::getInt<0, 255>,		},
404//			{ EGL_TRANSPARENT_BLUE_VALUE,	ChooseConfigRandomCase::getInt<0, 255>,		}
405		};
406
407		std::vector<std::pair<EGLenum, EGLint> > out;
408
409		// Build list to select from
410		std::vector<AttribSpec> candidates;
411		for (int ndx = 0; ndx < (int)DE_LENGTH_OF_ARRAY(attributes); ndx++)
412		{
413			if (attribSet.find(attributes[ndx].attribute) != attribSet.end())
414				candidates.push_back(attributes[ndx]);
415		}
416
417		for (int attribNdx = 0; attribNdx < numAttribs; attribNdx++)
418		{
419			AttribSpec spec = rnd.choose<AttribSpec>(candidates.begin(), candidates.end());
420			out.push_back(std::make_pair(spec.attribute, spec.getValue(rnd)));
421		}
422
423		return out;
424	}
425private:
426	std::set<EGLenum>	m_attribSet;
427	int					m_numIters;
428	int					m_iterNdx;
429};
430
431ChooseConfigTests::ChooseConfigTests (EglTestContext& eglTestCtx)
432	: TestCaseGroup(eglTestCtx, "choose_config", "eglChooseConfig() tests")
433{
434}
435
436ChooseConfigTests::~ChooseConfigTests (void)
437{
438}
439
440namespace
441{
442
443template <typename T, size_t N>
444std::set<T> toSet (const T (&arr)[N])
445{
446	std::set<T> set;
447	for (size_t i = 0; i < N; i++)
448		set.insert(arr[i]);
449	return set;
450}
451
452} // anonymous
453
454void ChooseConfigTests::init (void)
455{
456	// Single attributes
457	{
458		static const struct
459		{
460			EGLenum			attribute;
461			const char*		testName;
462		} attributes[] =
463		{
464			{ EGL_BUFFER_SIZE,				"buffer_size"				},
465			{ EGL_RED_SIZE,					"red_size"					},
466			{ EGL_GREEN_SIZE,				"green_size"				},
467			{ EGL_BLUE_SIZE,				"blue_size"					},
468			{ EGL_LUMINANCE_SIZE,			"luminance_size"			},
469			{ EGL_ALPHA_SIZE,				"alpha_size"				},
470			{ EGL_ALPHA_MASK_SIZE,			"alpha_mask_size"			},
471			{ EGL_BIND_TO_TEXTURE_RGB,		"bind_to_texture_rgb"		},
472			{ EGL_BIND_TO_TEXTURE_RGBA,		"bind_to_texture_rgba"		},
473			{ EGL_COLOR_BUFFER_TYPE,		"color_buffer_type"			},
474			{ EGL_CONFIG_CAVEAT,			"config_caveat"				},
475			{ EGL_CONFIG_ID,				"config_id"					},
476			{ EGL_CONFORMANT,				"conformant"				},
477			{ EGL_DEPTH_SIZE,				"depth_size"				},
478			{ EGL_LEVEL,					"level"						},
479			{ EGL_MAX_SWAP_INTERVAL,		"max_swap_interval"			},
480			{ EGL_MIN_SWAP_INTERVAL,		"min_swap_interval"			},
481			{ EGL_NATIVE_RENDERABLE,		"native_renderable"			},
482			{ EGL_NATIVE_VISUAL_TYPE,		"native_visual_type"		},
483			{ EGL_RENDERABLE_TYPE,			"renderable_type"			},
484			{ EGL_SAMPLE_BUFFERS,			"sample_buffers"			},
485			{ EGL_SAMPLES,					"samples"					},
486			{ EGL_STENCIL_SIZE,				"stencil_size"				},
487			{ EGL_SURFACE_TYPE,				"surface_type"				},
488			{ EGL_TRANSPARENT_TYPE,			"transparent_type"			},
489			{ EGL_TRANSPARENT_RED_VALUE,	"transparent_red_value"		},
490			{ EGL_TRANSPARENT_GREEN_VALUE,	"transparent_green_value"	},
491			{ EGL_TRANSPARENT_BLUE_VALUE,	"transparent_blue_value"	}
492		};
493
494		tcu::TestCaseGroup* simpleGroup = new tcu::TestCaseGroup(m_testCtx, "simple", "Simple tests");
495		addChild(simpleGroup);
496
497		tcu::TestCaseGroup* selectionGroup = new tcu::TestCaseGroup(m_testCtx, "selection_only", "Selection tests, order ignored");
498		simpleGroup->addChild(selectionGroup);
499
500		tcu::TestCaseGroup* sortGroup = new tcu::TestCaseGroup(m_testCtx, "selection_and_sort", "Selection and ordering tests");
501		simpleGroup->addChild(sortGroup);
502
503		for (int ndx = 0; ndx < (int)DE_LENGTH_OF_ARRAY(attributes); ndx++)
504		{
505			selectionGroup->addChild(new ChooseConfigSimpleCase(m_eglTestCtx, attributes[ndx].testName, "Simple config selection case", attributes[ndx].attribute, false));
506			sortGroup->addChild(new ChooseConfigSimpleCase(m_eglTestCtx, attributes[ndx].testName, "Simple config selection and sort case", attributes[ndx].attribute, true));
507		}
508	}
509
510	// Random
511	{
512		tcu::TestCaseGroup* randomGroup = new tcu::TestCaseGroup(m_testCtx, "random", "Random eglChooseConfig() usage");
513		addChild(randomGroup);
514
515		static const EGLenum rgbaSizes[] =
516		{
517			EGL_RED_SIZE,
518			EGL_GREEN_SIZE,
519			EGL_BLUE_SIZE,
520			EGL_ALPHA_SIZE
521		};
522		randomGroup->addChild(new ChooseConfigRandomCase(m_eglTestCtx, "color_sizes", "Random color size rules", toSet(rgbaSizes)));
523
524		static const EGLenum colorDepthStencilSizes[] =
525		{
526			EGL_RED_SIZE,
527			EGL_GREEN_SIZE,
528			EGL_BLUE_SIZE,
529			EGL_ALPHA_SIZE,
530			EGL_DEPTH_SIZE,
531			EGL_STENCIL_SIZE
532		};
533		randomGroup->addChild(new ChooseConfigRandomCase(m_eglTestCtx, "color_depth_stencil_sizes", "Random color, depth and stencil size rules", toSet(colorDepthStencilSizes)));
534
535		static const EGLenum bufferSizes[] =
536		{
537			EGL_BUFFER_SIZE,
538			EGL_LUMINANCE_SIZE,
539			EGL_ALPHA_MASK_SIZE,
540			EGL_DEPTH_SIZE,
541			EGL_STENCIL_SIZE
542		};
543		randomGroup->addChild(new ChooseConfigRandomCase(m_eglTestCtx, "buffer_sizes", "Various buffer size rules", toSet(bufferSizes)));
544
545		static const EGLenum surfaceType[] =
546		{
547			EGL_NATIVE_RENDERABLE,
548			EGL_SURFACE_TYPE
549		};
550		randomGroup->addChild(new ChooseConfigRandomCase(m_eglTestCtx, "surface_type", "Surface type rules", toSet(surfaceType)));
551
552		static const EGLenum sampleBuffers[] =
553		{
554			EGL_SAMPLE_BUFFERS,
555			EGL_SAMPLES
556		};
557		randomGroup->addChild(new ChooseConfigRandomCase(m_eglTestCtx, "sample_buffers", "Sample buffer rules", toSet(sampleBuffers)));
558
559		// \note Not every attribute is supported at the moment
560		static const EGLenum allAttribs[] =
561		{
562			EGL_BUFFER_SIZE,
563			EGL_RED_SIZE,
564			EGL_GREEN_SIZE,
565			EGL_BLUE_SIZE,
566			EGL_ALPHA_SIZE,
567			EGL_ALPHA_MASK_SIZE,
568			EGL_BIND_TO_TEXTURE_RGB,
569			EGL_BIND_TO_TEXTURE_RGBA,
570			EGL_COLOR_BUFFER_TYPE,
571			EGL_CONFIG_CAVEAT,
572			EGL_CONFIG_ID,
573			EGL_CONFORMANT,
574			EGL_DEPTH_SIZE,
575			EGL_LEVEL,
576//			EGL_MATCH_NATIVE_PIXMAP,
577			EGL_MAX_SWAP_INTERVAL,
578			EGL_MIN_SWAP_INTERVAL,
579			EGL_NATIVE_RENDERABLE,
580			EGL_NATIVE_VISUAL_TYPE,
581			EGL_RENDERABLE_TYPE,
582			EGL_SAMPLE_BUFFERS,
583			EGL_SAMPLES,
584			EGL_STENCIL_SIZE,
585			EGL_SURFACE_TYPE,
586			EGL_TRANSPARENT_TYPE,
587//			EGL_TRANSPARENT_RED_VALUE,
588//			EGL_TRANSPARENT_GREEN_VALUE,
589//			EGL_TRANSPARENT_BLUE_VALUE
590		};
591		randomGroup->addChild(new ChooseConfigRandomCase(m_eglTestCtx, "all", "All attributes", toSet(allAttribs)));
592	}
593}
594
595} // egl
596} // deqp
597