1/*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 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 Integer state query tests
22 *//*--------------------------------------------------------------------*/
23
24#include "es31fIntegerStateQueryTests.hpp"
25#include "tcuTestLog.hpp"
26#include "gluRenderContext.hpp"
27#include "gluCallLogWrapper.hpp"
28#include "gluContextInfo.hpp"
29#include "gluObjectWrapper.hpp"
30#include "gluShaderProgram.hpp"
31#include "gluStrUtil.hpp"
32#include "glwFunctions.hpp"
33#include "glwEnums.hpp"
34#include "glsStateQueryUtil.hpp"
35#include "deRandom.hpp"
36#include "deStringUtil.hpp"
37
38namespace deqp
39{
40namespace gles31
41{
42namespace Functional
43{
44namespace
45{
46
47using namespace gls::StateQueryUtil;
48
49const int MAX_FRAG_ATOMIC_COUNTER_BUFFERS_GLES32	= 1;
50const int MAX_FRAG_ATOMIC_COUNTERS_GLES32			= 8;
51const int MAX_FRAG_SHADER_STORAGE_BLOCKS_GLES32		= 4;
52
53static const char* getVerifierSuffix (QueryType type)
54{
55	switch (type)
56	{
57		case QUERY_BOOLEAN:		return "getboolean";
58		case QUERY_INTEGER:		return "getinteger";
59		case QUERY_INTEGER64:	return "getinteger64";
60		case QUERY_FLOAT:		return "getfloat";
61		default:
62			DE_ASSERT(DE_FALSE);
63			return DE_NULL;
64	}
65}
66
67class MaxSamplesCase : public TestCase
68{
69public:
70						MaxSamplesCase	(Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType);
71private:
72	IterateResult		iterate			(void);
73
74	const glw::GLenum	m_target;
75	const int			m_minValue;
76	const QueryType		m_verifierType;
77};
78
79MaxSamplesCase::MaxSamplesCase (Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType)
80	: TestCase			(context, name, desc)
81	, m_target			(target)
82	, m_minValue		(minValue)
83	, m_verifierType	(verifierType)
84{
85}
86
87MaxSamplesCase::IterateResult MaxSamplesCase::iterate (void)
88{
89	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
90	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
91
92	gl.enableLogging(true);
93	verifyStateIntegerMin(result, gl, m_target, m_minValue, m_verifierType);
94
95	result.setTestContextResult(m_testCtx);
96	return STOP;
97}
98
99class TexBindingCase : public TestCase
100{
101public:
102						TexBindingCase	(Context& context, const char* name, const char* desc, glw::GLenum texTarget, glw::GLenum bindTarget, QueryType verifierType);
103private:
104	void				init			(void);
105	IterateResult		iterate			(void);
106
107	const glw::GLenum	m_texTarget;
108	const glw::GLenum	m_bindTarget;
109	const QueryType		m_verifierType;
110};
111
112TexBindingCase::TexBindingCase (Context& context, const char* name, const char* desc, glw::GLenum texTarget, glw::GLenum bindTarget, QueryType verifierType)
113	: TestCase			(context, name, desc)
114	, m_texTarget		(texTarget)
115	, m_bindTarget		(bindTarget)
116	, m_verifierType	(verifierType)
117{
118}
119
120void TexBindingCase::init (void)
121{
122	if (contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)))
123		return;
124
125	if (m_texTarget == GL_TEXTURE_2D_MULTISAMPLE_ARRAY && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
126		throw tcu::NotSupportedError("Test requires OES_texture_storage_multisample_2d_array extension");
127	if (m_texTarget == GL_TEXTURE_CUBE_MAP_ARRAY && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_cube_map_array"))
128		throw tcu::NotSupportedError("Test requires GL_EXT_texture_cube_map_array extension");
129	if (m_texTarget == GL_TEXTURE_BUFFER && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_buffer"))
130		throw tcu::NotSupportedError("Test requires GL_EXT_texture_buffer extension");
131}
132
133TexBindingCase::IterateResult TexBindingCase::iterate (void)
134{
135	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
136	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
137
138	gl.enableLogging(true);
139
140	// initial
141	{
142		const tcu::ScopedLogSection section(m_testCtx.getLog(), "initial", "Initial value");
143
144		verifyStateInteger(result, gl, m_bindTarget, 0, m_verifierType);
145	}
146
147	// bind
148	{
149		const tcu::ScopedLogSection section(m_testCtx.getLog(), "bind", "After bind");
150
151		glw::GLuint texture;
152
153		gl.glGenTextures(1, &texture);
154		gl.glBindTexture(m_texTarget, texture);
155		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind texture");
156
157		verifyStateInteger(result, gl, m_bindTarget, texture, m_verifierType);
158
159		gl.glDeleteTextures(1, &texture);
160	}
161
162	// after delete
163	{
164		const tcu::ScopedLogSection section(m_testCtx.getLog(), "bind", "After delete");
165
166		verifyStateInteger(result, gl, m_bindTarget, 0, m_verifierType);
167	}
168
169	result.setTestContextResult(m_testCtx);
170	return STOP;
171}
172
173class MinimumValueCase : public TestCase
174{
175public:
176						MinimumValueCase	(Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType);
177						MinimumValueCase	(Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType, glu::ApiType minVersion);
178private:
179	IterateResult		iterate				(void);
180
181	const glw::GLenum	m_target;
182	const int			m_minValue;
183	const QueryType		m_verifierType;
184	const glu::ApiType	m_minimumVersion;
185};
186
187MinimumValueCase::MinimumValueCase (Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType)
188	: TestCase			(context, name, desc)
189	, m_target			(target)
190	, m_minValue		(minValue)
191	, m_verifierType	(verifierType)
192	, m_minimumVersion	(glu::ApiType::es(3, 1))
193{
194}
195
196MinimumValueCase::MinimumValueCase (Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType, glu::ApiType minVersion)
197	: TestCase			(context, name, desc)
198	, m_target			(target)
199	, m_minValue		(minValue)
200	, m_verifierType	(verifierType)
201	, m_minimumVersion	(minVersion)
202{
203}
204
205MinimumValueCase::IterateResult MinimumValueCase::iterate (void)
206{
207	TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(m_context.getRenderContext().getType(), m_minimumVersion), "Test not supported in this context version.");
208
209	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
210	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
211
212	// \note: In GL ES 3.2, the following targets have different limits as in 3.1
213	const int				value	= contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2))
214									? (m_target == GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS	? MAX_FRAG_ATOMIC_COUNTER_BUFFERS_GLES32	// 1
215									: m_target == GL_MAX_FRAGMENT_ATOMIC_COUNTERS			? MAX_FRAG_ATOMIC_COUNTERS_GLES32			// 8
216									: m_target == GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS		? MAX_FRAG_SHADER_STORAGE_BLOCKS_GLES32		// 4
217									: m_minValue)
218									: m_minValue;
219
220	gl.enableLogging(true);
221	verifyStateIntegerMin(result, gl, m_target, value, m_verifierType);
222
223	result.setTestContextResult(m_testCtx);
224	return STOP;
225}
226
227class AlignmentCase : public TestCase
228{
229public:
230						AlignmentCase	(Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType);
231						AlignmentCase	(Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType, glu::ApiType minVersion);
232private:
233	IterateResult		iterate			(void);
234
235	const glw::GLenum	m_target;
236	const int			m_minValue;
237	const QueryType		m_verifierType;
238	const glu::ApiType	m_minimumVersion;
239};
240
241AlignmentCase::AlignmentCase (Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType)
242	: TestCase			(context, name, desc)
243	, m_target			(target)
244	, m_minValue		(minValue)
245	, m_verifierType	(verifierType)
246	, m_minimumVersion	(glu::ApiType::es(3, 1))
247{
248}
249
250AlignmentCase::AlignmentCase (Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, QueryType verifierType, glu::ApiType minVersion)
251	: TestCase			(context, name, desc)
252	, m_target			(target)
253	, m_minValue		(minValue)
254	, m_verifierType	(verifierType)
255	, m_minimumVersion	(minVersion)
256{
257}
258
259AlignmentCase::IterateResult AlignmentCase::iterate (void)
260{
261	TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(m_context.getRenderContext().getType(), m_minimumVersion), "Test not supported in this context.");
262
263	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
264	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
265
266	gl.enableLogging(true);
267	verifyStateIntegerMax(result, gl, m_target, m_minValue, m_verifierType);
268
269	result.setTestContextResult(m_testCtx);
270	return STOP;
271}
272
273class BufferBindingCase : public TestCase
274{
275public:
276						BufferBindingCase	(Context& context, const char* name, const char* desc, glw::GLenum queryTarget, glw::GLenum bindingPoint, QueryType verifierType);
277private:
278	IterateResult		iterate				(void);
279
280	const glw::GLenum	m_queryTarget;
281	const glw::GLenum	m_bindingPoint;
282	const QueryType		m_verifierType;
283};
284
285BufferBindingCase::BufferBindingCase (Context& context, const char* name, const char* desc, glw::GLenum queryTarget, glw::GLenum bindingPoint, QueryType verifierType)
286	: TestCase			(context, name, desc)
287	, m_queryTarget		(queryTarget)
288	, m_bindingPoint	(bindingPoint)
289	, m_verifierType	(verifierType)
290{
291}
292
293BufferBindingCase::IterateResult BufferBindingCase::iterate (void)
294{
295	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
296	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
297
298	gl.enableLogging(true);
299
300	{
301		const tcu::ScopedLogSection	section(m_testCtx.getLog(), "Initial", "Initial value");
302
303		verifyStateInteger(result, gl, m_queryTarget, 0, m_verifierType);
304	}
305
306	{
307		const tcu::ScopedLogSection	section	(m_testCtx.getLog(), "AfterBinding", "After binding");
308		glu::Buffer					buf		(m_context.getRenderContext());
309
310		gl.glBindBuffer(m_bindingPoint, *buf);
311		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "setup");
312
313		verifyStateInteger(result, gl, m_queryTarget, *buf, m_verifierType);
314	}
315
316	{
317		const tcu::ScopedLogSection	section	(m_testCtx.getLog(), "AfterDelete", "After deleting");
318		glw::GLuint					buf		= 0;
319
320		gl.glGenBuffers(1, &buf);
321		gl.glBindBuffer(m_bindingPoint, buf);
322		gl.glDeleteBuffers(1, &buf);
323		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "setup");
324
325		verifyStateInteger(result, gl, m_queryTarget, 0, m_verifierType);
326	}
327
328	result.setTestContextResult(m_testCtx);
329	return STOP;
330}
331
332class ProgramPipelineBindingCase : public TestCase
333{
334public:
335						ProgramPipelineBindingCase	(Context& context, const char* name, const char* desc, QueryType verifierType);
336private:
337	IterateResult		iterate						(void);
338
339	const QueryType		m_verifierType;
340};
341
342ProgramPipelineBindingCase::ProgramPipelineBindingCase (Context& context, const char* name, const char* desc, QueryType verifierType)
343	: TestCase			(context, name, desc)
344	, m_verifierType	(verifierType)
345{
346}
347
348ProgramPipelineBindingCase::IterateResult ProgramPipelineBindingCase::iterate (void)
349{
350	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
351	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
352
353	gl.enableLogging(true);
354
355	{
356		const tcu::ScopedLogSection	section(m_testCtx.getLog(), "Initial", "Initial value");
357
358		verifyStateInteger(result, gl, GL_PROGRAM_PIPELINE_BINDING, 0, m_verifierType);
359	}
360
361	{
362		const tcu::ScopedLogSection	section		(m_testCtx.getLog(), "AfterBinding", "After binding");
363		glu::ProgramPipeline		pipeline	(m_context.getRenderContext());
364
365		gl.glBindProgramPipeline(pipeline.getPipeline());
366		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "setup");
367
368		verifyStateInteger(result, gl, GL_PROGRAM_PIPELINE_BINDING, pipeline.getPipeline(), m_verifierType);
369	}
370
371	{
372		const tcu::ScopedLogSection	section		(m_testCtx.getLog(), "AfterDelete", "After deleting");
373		glw::GLuint					pipeline	= 0;
374
375		gl.glGenProgramPipelines(1, &pipeline);
376		gl.glBindProgramPipeline(pipeline);
377		gl.glDeleteProgramPipelines(1, &pipeline);
378		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "setup");
379
380		verifyStateInteger(result, gl, GL_PROGRAM_PIPELINE_BINDING, 0, m_verifierType);
381	}
382
383	result.setTestContextResult(m_testCtx);
384	return STOP;
385}
386
387class FramebufferMinimumValueCase : public TestCase
388{
389public:
390						FramebufferMinimumValueCase	(Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, glw::GLenum tiedTo, QueryType verifierType);
391private:
392	IterateResult		iterate						(void);
393
394	const glw::GLenum	m_target;
395	const glw::GLenum	m_tiedTo;
396	const int			m_minValue;
397	const QueryType		m_verifierType;
398};
399
400FramebufferMinimumValueCase::FramebufferMinimumValueCase (Context& context, const char* name, const char* desc, glw::GLenum target, int minValue, glw::GLenum tiedTo, QueryType verifierType)
401	: TestCase			(context, name, desc)
402	, m_target			(target)
403	, m_tiedTo			(tiedTo)
404	, m_minValue		(minValue)
405	, m_verifierType	(verifierType)
406{
407}
408
409FramebufferMinimumValueCase::IterateResult FramebufferMinimumValueCase::iterate (void)
410{
411	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
412	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
413
414	gl.enableLogging(true);
415
416	{
417		const tcu::ScopedLogSection	section(m_testCtx.getLog(), "Minimum", "Specified minimum is " + de::toString(m_minValue));
418
419		verifyStateIntegerMin(result, gl, m_target, m_minValue, m_verifierType);
420	}
421	{
422		const tcu::ScopedLogSection				section		(m_testCtx.getLog(), "Ties", "The limit is tied to the value of " + de::toString(glu::getGettableStateStr(m_tiedTo)));
423		StateQueryMemoryWriteGuard<glw::GLint>	tiedToValue;
424
425		gl.glGetIntegerv(m_tiedTo, &tiedToValue);
426		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGetIntegerv");
427
428		if (tiedToValue.verifyValidity(result))
429			verifyStateIntegerMin(result, gl, m_target, tiedToValue, m_verifierType);
430	}
431
432	result.setTestContextResult(m_testCtx);
433	return STOP;
434}
435
436class LegacyVectorLimitCase : public TestCase
437{
438public:
439						LegacyVectorLimitCase	(Context& context, const char* name, const char* desc, glw::GLenum legacyTarget, glw::GLenum componentTarget, QueryType verifierType);
440private:
441	IterateResult		iterate					(void);
442
443	const glw::GLenum	m_legacyTarget;
444	const glw::GLenum	m_componentTarget;
445	const QueryType		m_verifierType;
446};
447
448LegacyVectorLimitCase::LegacyVectorLimitCase (Context& context, const char* name, const char* desc, glw::GLenum legacyTarget, glw::GLenum componentTarget, QueryType verifierType)
449	: TestCase			(context, name, desc)
450	, m_legacyTarget	(legacyTarget)
451	, m_componentTarget	(componentTarget)
452	, m_verifierType	(verifierType)
453{
454}
455
456LegacyVectorLimitCase::IterateResult LegacyVectorLimitCase::iterate (void)
457{
458	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
459	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
460
461	gl.enableLogging(true);
462
463	{
464		const tcu::ScopedLogSection	section(m_testCtx.getLog(), "TiedTo", de::toString(glu::getGettableStateStr(m_legacyTarget)) +
465																			" is " +
466																			de::toString(glu::getGettableStateStr(m_componentTarget)) +
467																			" divided by four");
468
469		StateQueryMemoryWriteGuard<glw::GLint> value;
470		gl.glGetIntegerv(m_componentTarget, &value);
471		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGetIntegerv");
472
473		if (value.verifyValidity(result))
474			verifyStateInteger(result, gl, m_legacyTarget, ((int)value) / 4, m_verifierType);
475	}
476
477	result.setTestContextResult(m_testCtx);
478	return STOP;
479}
480
481class CombinedUniformComponentsCase : public TestCase
482{
483public:
484						CombinedUniformComponentsCase	(Context& context, const char* name, const char* desc, glw::GLenum target, QueryType verifierType);
485						CombinedUniformComponentsCase	(Context& context, const char* name, const char* desc, glw::GLenum target, QueryType verifierType, glu::ApiType minVersion);
486private:
487	IterateResult		iterate									(void);
488	const glw::GLenum	m_target;
489	const QueryType		m_verifierType;
490	const glu::ApiType	m_minimumVersion;
491};
492
493CombinedUniformComponentsCase::CombinedUniformComponentsCase (Context& context, const char* name, const char* desc, glw::GLenum target, QueryType verifierType)
494	: TestCase			(context, name, desc)
495	, m_target			(target)
496	, m_verifierType	(verifierType)
497	, m_minimumVersion	(glu::ApiType::es(3, 1))
498{
499}
500
501CombinedUniformComponentsCase::CombinedUniformComponentsCase (Context& context, const char* name, const char* desc, glw::GLenum target, QueryType verifierType, glu::ApiType minVersion)
502	: TestCase			(context, name, desc)
503	, m_target			(target)
504	, m_verifierType	(verifierType)
505	, m_minimumVersion	(minVersion)
506{
507}
508
509CombinedUniformComponentsCase::IterateResult CombinedUniformComponentsCase::iterate (void)
510{
511	TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(m_context.getRenderContext().getType(), m_minimumVersion), "Test not supported in this context.");
512
513	glu::CallLogWrapper		gl							(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
514	tcu::ResultCollector	result						(m_testCtx.getLog(), " // ERROR: ");
515
516	const glw::GLenum		maxUniformBlocksEnum		= (m_target == GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS) ? GL_MAX_COMPUTE_UNIFORM_BLOCKS
517														: (m_target == GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS) ? GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS
518														: (m_target == GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS) ? GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS
519														: (m_target == GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS) ? GL_MAX_GEOMETRY_UNIFORM_BLOCKS
520														: -1;
521
522	const glw::GLenum		maxUniformComponentsEnum	= (m_target == GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS) ? GL_MAX_COMPUTE_UNIFORM_COMPONENTS
523														: (m_target == GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS) ? GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS
524														: (m_target == GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS) ? GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS
525														: (m_target == GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS) ? GL_MAX_GEOMETRY_UNIFORM_COMPONENTS
526														: -1;
527
528	gl.enableLogging(true);
529
530	m_testCtx.getLog()	<< tcu::TestLog::Message
531						<< "The minimum value of MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS is MAX_COMPUTE_UNIFORM_BLOCKS x MAX_UNIFORM_BLOCK_SIZE / 4 + MAX_COMPUTE_UNIFORM_COMPONENTS"
532						<< tcu::TestLog::EndMessage;
533
534	StateQueryMemoryWriteGuard<glw::GLint> maxUniformBlocks;
535	gl.glGetIntegerv(maxUniformBlocksEnum, &maxUniformBlocks);
536	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGetIntegerv");
537
538	StateQueryMemoryWriteGuard<glw::GLint> maxUniformBlockSize;
539	gl.glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &maxUniformBlockSize);
540	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGetIntegerv");
541
542	StateQueryMemoryWriteGuard<glw::GLint> maxUniformComponents;
543	gl.glGetIntegerv(maxUniformComponentsEnum, &maxUniformComponents);
544	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGetIntegerv");
545
546	if (maxUniformBlocks.verifyValidity(result) && maxUniformBlockSize.verifyValidity(result) && maxUniformComponents.verifyValidity(result))
547		verifyStateIntegerMin(result, gl, m_target, ((int)maxUniformBlocks) * ((int)maxUniformBlockSize) / 4 + (int)maxUniformComponents, m_verifierType);
548
549	result.setTestContextResult(m_testCtx);
550	return STOP;
551}
552
553class TextureGatherLimitCase : public TestCase
554{
555public:
556						TextureGatherLimitCase	(Context& context, const char* name, const char* desc, bool isMaxCase, QueryType verifierType);
557private:
558	IterateResult		iterate					(void);
559
560	const bool			m_isMaxCase;
561	const QueryType		m_verifierType;
562};
563
564TextureGatherLimitCase::TextureGatherLimitCase (Context& context, const char* name, const char* desc, bool isMaxCase, QueryType verifierType)
565	: TestCase			(context, name, desc)
566	, m_isMaxCase		(isMaxCase)
567	, m_verifierType	(verifierType)
568{
569}
570
571TextureGatherLimitCase::IterateResult TextureGatherLimitCase::iterate (void)
572{
573	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
574	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
575
576	gl.enableLogging(true);
577
578	if (m_isMaxCase)
579	{
580		// range [0, inf)
581		verifyStateIntegerMin(result, gl, GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET, 0, m_verifierType);
582	}
583	else
584	{
585		// range (-inf, 0]
586		verifyStateIntegerMax(result, gl, GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET, 0, m_verifierType);
587	}
588
589	result.setTestContextResult(m_testCtx);
590	return STOP;
591}
592
593class MaxUniformBufferBindingsCase : public TestCase
594{
595public:
596						MaxUniformBufferBindingsCase	(Context& context, const char* name, const char* desc, QueryType verifierType);
597private:
598	IterateResult		iterate							(void);
599
600	const QueryType		m_verifierType;
601};
602
603MaxUniformBufferBindingsCase::MaxUniformBufferBindingsCase (Context& context, const char* name, const char* desc, QueryType verifierType)
604	: TestCase			(context, name, desc)
605	, m_verifierType	(verifierType)
606{
607}
608
609MaxUniformBufferBindingsCase::IterateResult MaxUniformBufferBindingsCase::iterate (void)
610{
611	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
612	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
613	int						minMax;
614
615	gl.enableLogging(true);
616
617	if (contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)))
618	{
619		minMax = 72;
620	}
621	else
622	{
623		if (m_context.getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader"))
624		{
625			m_testCtx.getLog()	<< tcu::TestLog::Message
626								<< "GL_EXT_tessellation_shader increases the minimum value of GL_MAX_UNIFORM_BUFFER_BINDINGS to 72"
627								<< tcu::TestLog::EndMessage;
628			minMax = 72;
629		}
630		else if (m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
631		{
632			m_testCtx.getLog()	<< tcu::TestLog::Message
633								<< "GL_EXT_geometry_shader increases the minimum value of GL_MAX_UNIFORM_BUFFER_BINDINGS to 48"
634								<< tcu::TestLog::EndMessage;
635			minMax = 48;
636		}
637		else
638		{
639			minMax = 36;
640		}
641	}
642
643	// range [0, inf)
644	verifyStateIntegerMin(result, gl, GL_MAX_UNIFORM_BUFFER_BINDINGS, minMax, m_verifierType);
645
646	result.setTestContextResult(m_testCtx);
647	return STOP;
648}
649
650class MaxCombinedUniformBlocksCase : public TestCase
651{
652public:
653						MaxCombinedUniformBlocksCase	(Context& context, const char* name, const char* desc, QueryType verifierType);
654private:
655	IterateResult		iterate							(void);
656
657	const QueryType		m_verifierType;
658};
659
660MaxCombinedUniformBlocksCase::MaxCombinedUniformBlocksCase (Context& context, const char* name, const char* desc, QueryType verifierType)
661	: TestCase			(context, name, desc)
662	, m_verifierType	(verifierType)
663{
664}
665
666MaxCombinedUniformBlocksCase::IterateResult MaxCombinedUniformBlocksCase::iterate (void)
667{
668	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
669	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
670	int						minMax;
671
672	gl.enableLogging(true);
673
674	if (contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)))
675	{
676		minMax = 60;
677	}
678	else
679	{
680		if (m_context.getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader"))
681		{
682			m_testCtx.getLog()	<< tcu::TestLog::Message
683								<< "GL_EXT_tessellation_shader increases the minimum value of GL_MAX_COMBINED_UNIFORM_BLOCKS to 60"
684								<< tcu::TestLog::EndMessage;
685			minMax = 60;
686		}
687		else if (m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
688		{
689			m_testCtx.getLog()	<< tcu::TestLog::Message
690								<< "GL_EXT_geometry_shader increases the minimum value of GL_MAX_COMBINED_UNIFORM_BLOCKS to 36"
691								<< tcu::TestLog::EndMessage;
692			minMax = 36;
693		}
694		else
695		{
696			minMax = 24;
697		}
698	}
699
700	// range [0, inf)
701	verifyStateIntegerMin(result, gl, GL_MAX_COMBINED_UNIFORM_BLOCKS, minMax, m_verifierType);
702
703	result.setTestContextResult(m_testCtx);
704	return STOP;
705}
706
707class MaxCombinedTexImageUnitsCase : public TestCase
708{
709public:
710						MaxCombinedTexImageUnitsCase	(Context& context, const char* name, const char* desc, QueryType verifierType);
711private:
712	IterateResult		iterate							(void);
713
714	const QueryType		m_verifierType;
715};
716
717MaxCombinedTexImageUnitsCase::MaxCombinedTexImageUnitsCase (Context& context, const char* name, const char* desc, QueryType verifierType)
718	: TestCase			(context, name, desc)
719	, m_verifierType	(verifierType)
720{
721}
722
723MaxCombinedTexImageUnitsCase::IterateResult MaxCombinedTexImageUnitsCase::iterate (void)
724{
725	glu::CallLogWrapper		gl		(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
726	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
727	int						minMax;
728
729	gl.enableLogging(true);
730	if (contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)))
731	{
732		minMax = 96;
733	}
734	else
735	{
736		if (m_context.getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader"))
737		{
738			m_testCtx.getLog()	<< tcu::TestLog::Message
739								<< "GL_EXT_tessellation_shader increases the minimum value of GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS to 96"
740								<< tcu::TestLog::EndMessage;
741			minMax = 96;
742		}
743		else if (m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
744		{
745			m_testCtx.getLog()	<< tcu::TestLog::Message
746								<< "GL_EXT_geometry_shader increases the minimum value of GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS to 36"
747								<< tcu::TestLog::EndMessage;
748			minMax = 64;
749		}
750		else
751		{
752			minMax = 48;
753		}
754	}
755
756	// range [0, inf)
757	verifyStateIntegerMin(result, gl, GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, minMax, m_verifierType);
758
759	result.setTestContextResult(m_testCtx);
760	return STOP;
761}
762
763} // anonymous
764
765IntegerStateQueryTests::IntegerStateQueryTests (Context& context)
766	: TestCaseGroup(context, "integer", "Integer state query tests")
767{
768}
769
770IntegerStateQueryTests::~IntegerStateQueryTests (void)
771{
772}
773
774void IntegerStateQueryTests::init (void)
775{
776	// Verifiers
777	const QueryType verifiers[]	= { QUERY_BOOLEAN, QUERY_INTEGER, QUERY_INTEGER64, QUERY_FLOAT };
778
779#define FOR_EACH_VERIFIER(X) \
780	for (int verifierNdx = 0; verifierNdx < DE_LENGTH_OF_ARRAY(verifiers); ++verifierNdx)	\
781	{																						\
782		const char* verifierSuffix = getVerifierSuffix(verifiers[verifierNdx]);				\
783		const QueryType verifier = verifiers[verifierNdx];									\
784		this->addChild(X);																	\
785	}
786
787	FOR_EACH_VERIFIER(new MaxSamplesCase(m_context,		(std::string() + "max_color_texture_samples_" + verifierSuffix).c_str(),				"Test GL_MAX_COLOR_TEXTURE_SAMPLES",			GL_MAX_COLOR_TEXTURE_SAMPLES,		1,	verifier))
788	FOR_EACH_VERIFIER(new MaxSamplesCase(m_context,		(std::string() + "max_depth_texture_samples_" + verifierSuffix).c_str(),				"Test GL_MAX_DEPTH_TEXTURE_SAMPLES",			GL_MAX_DEPTH_TEXTURE_SAMPLES,		1,	verifier))
789	FOR_EACH_VERIFIER(new MaxSamplesCase(m_context,		(std::string() + "max_integer_samples_" + verifierSuffix).c_str(),						"Test GL_MAX_INTEGER_SAMPLES",					GL_MAX_INTEGER_SAMPLES,				1,	verifier))
790
791	FOR_EACH_VERIFIER(new TexBindingCase(m_context,		(std::string() + "texture_binding_2d_multisample_" + verifierSuffix).c_str(),			"Test TEXTURE_BINDING_2D_MULTISAMPLE",			GL_TEXTURE_2D_MULTISAMPLE,			GL_TEXTURE_BINDING_2D_MULTISAMPLE,			verifier))
792	FOR_EACH_VERIFIER(new TexBindingCase(m_context,		(std::string() + "texture_binding_2d_multisample_array_" + verifierSuffix).c_str(),		"Test TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY",	GL_TEXTURE_2D_MULTISAMPLE_ARRAY,	GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY,	verifier))
793	FOR_EACH_VERIFIER(new TexBindingCase(m_context,		(std::string() + "texture_binding_cube_map_array_" + verifierSuffix).c_str(),			"Test TEXTURE_BINDING_CUBE_MAP_ARRAY",			GL_TEXTURE_CUBE_MAP_ARRAY,			GL_TEXTURE_BINDING_CUBE_MAP_ARRAY,			verifier))
794	FOR_EACH_VERIFIER(new TexBindingCase(m_context,		(std::string() + "texture_binding_buffer_" + verifierSuffix).c_str(),					"Test TEXTURE_BINDING_BUFFER",					GL_TEXTURE_BUFFER,					GL_TEXTURE_BINDING_BUFFER,					verifier))
795
796	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_vertex_attrib_relative_offset_" + verifierSuffix).c_str(),		"Test MAX_VERTEX_ATTRIB_RELATIVE_OFFSET",		GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET,	2047,	verifier))
797	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_vertex_attrib_bindings_" + verifierSuffix).c_str(),				"Test MAX_VERTEX_ATTRIB_BINDINGS",				GL_MAX_VERTEX_ATTRIB_BINDINGS,			16,		verifier))
798	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_vertex_attrib_stride_" + verifierSuffix).c_str(),					"Test MAX_VERTEX_ATTRIB_STRIDE",				GL_MAX_VERTEX_ATTRIB_STRIDE,			2048,	verifier))
799	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_sample_mask_words_" + verifierSuffix).c_str(),					"Test MAX_SAMPLE_MASK_WORDS",					GL_MAX_SAMPLE_MASK_WORDS,				1,		verifier))
800
801	FOR_EACH_VERIFIER(new AlignmentCase(m_context,		(std::string() + "shader_storage_buffer_offset_alignment_" + verifierSuffix).c_str(),	"Test SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT",	GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT,	256,	verifier))
802
803	FOR_EACH_VERIFIER(new BufferBindingCase(m_context,	(std::string() + "draw_indirect_buffer_binding_" + verifierSuffix).c_str(),				"Test DRAW_INDIRECT_BUFFER_BINDING",			GL_DRAW_INDIRECT_BUFFER_BINDING,		GL_DRAW_INDIRECT_BUFFER,		verifier))
804	FOR_EACH_VERIFIER(new BufferBindingCase(m_context,	(std::string() + "atomic_counter_buffer_binding_" + verifierSuffix).c_str(),			"Test ATOMIC_COUNTER_BUFFER_BINDING",			GL_ATOMIC_COUNTER_BUFFER_BINDING,		GL_ATOMIC_COUNTER_BUFFER,		verifier))
805	FOR_EACH_VERIFIER(new BufferBindingCase(m_context,	(std::string() + "shader_storage_buffer_binding_" + verifierSuffix).c_str(),			"Test SHADER_STORAGE_BUFFER_BINDING",			GL_SHADER_STORAGE_BUFFER_BINDING,		GL_SHADER_STORAGE_BUFFER,		verifier))
806	FOR_EACH_VERIFIER(new BufferBindingCase(m_context,	(std::string() + "dispatch_indirect_buffer_binding_" + verifierSuffix).c_str(),			"Test DISPATCH_INDIRECT_BUFFER_BINDING",		GL_DISPATCH_INDIRECT_BUFFER_BINDING,	GL_DISPATCH_INDIRECT_BUFFER,	verifier))
807
808	FOR_EACH_VERIFIER(new FramebufferMinimumValueCase(m_context,	(std::string() + "max_framebuffer_width_" + verifierSuffix).c_str(),		"Test MAX_FRAMEBUFFER_WIDTH",					GL_MAX_FRAMEBUFFER_WIDTH,				2048,	GL_MAX_TEXTURE_SIZE,	verifier))
809	FOR_EACH_VERIFIER(new FramebufferMinimumValueCase(m_context,	(std::string() + "max_framebuffer_height_" + verifierSuffix).c_str(),		"Test MAX_FRAMEBUFFER_HEIGHT",					GL_MAX_FRAMEBUFFER_HEIGHT,				2048,	GL_MAX_TEXTURE_SIZE,	verifier))
810	FOR_EACH_VERIFIER(new FramebufferMinimumValueCase(m_context,	(std::string() + "max_framebuffer_samples_" + verifierSuffix).c_str(),		"Test MAX_FRAMEBUFFER_SAMPLES",					GL_MAX_FRAMEBUFFER_SAMPLES,				4,		GL_MAX_SAMPLES,			verifier))
811
812	FOR_EACH_VERIFIER(new ProgramPipelineBindingCase(m_context,	(std::string() + "program_pipeline_binding_" + verifierSuffix).c_str(),			"Test PROGRAM_PIPELINE_BINDING",	verifier))
813
814	// vertex
815	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_vertex_atomic_counter_buffers_" + verifierSuffix).c_str(),		"Test MAX_VERTEX_ATOMIC_COUNTER_BUFFERS",		GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS,	0,		verifier))
816	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_vertex_atomic_counters_" + verifierSuffix).c_str(),				"Test MAX_VERTEX_ATOMIC_COUNTERS",				GL_MAX_VERTEX_ATOMIC_COUNTERS,			0,		verifier))
817	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_vertex_image_uniforms_" + verifierSuffix).c_str(),				"Test MAX_VERTEX_IMAGE_UNIFORMS",				GL_MAX_VERTEX_IMAGE_UNIFORMS,			0,		verifier))
818	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_vertex_shader_storage_blocks_" + verifierSuffix).c_str(),			"Test MAX_VERTEX_SHADER_STORAGE_BLOCKS",		GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS,	0,		verifier))
819	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_vertex_uniform_components_" + verifierSuffix).c_str(),			"Test MAX_VERTEX_UNIFORM_COMPONENTS",			GL_MAX_VERTEX_UNIFORM_COMPONENTS,		1024,	verifier))
820
821	// fragment
822	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_fragment_atomic_counter_buffers_" + verifierSuffix).c_str(),		"Test MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS",		GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS,	0,		verifier))
823	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_fragment_atomic_counters_" + verifierSuffix).c_str(),				"Test MAX_FRAGMENT_ATOMIC_COUNTERS",			GL_MAX_FRAGMENT_ATOMIC_COUNTERS,		0,		verifier))
824	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_fragment_image_uniforms_" + verifierSuffix).c_str(),				"Test MAX_FRAGMENT_IMAGE_UNIFORMS",				GL_MAX_FRAGMENT_IMAGE_UNIFORMS,			0,		verifier))
825	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_fragment_shader_storage_blocks_" + verifierSuffix).c_str(),		"Test MAX_FRAGMENT_SHADER_STORAGE_BLOCKS",		GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS,	0,		verifier))
826	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_fragment_uniform_components_" + verifierSuffix).c_str(),			"Test MAX_FRAGMENT_UNIFORM_COMPONENTS",			GL_MAX_FRAGMENT_UNIFORM_COMPONENTS,		1024,	verifier))
827
828	// compute
829	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_work_group_invocations_" + verifierSuffix).c_str(),		"Test MAX_COMPUTE_WORK_GROUP_INVOCATIONS",		GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS,		128,	verifier))
830	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_uniform_blocks_" + verifierSuffix).c_str(),				"Test MAX_COMPUTE_UNIFORM_BLOCKS",				GL_MAX_COMPUTE_UNIFORM_BLOCKS,				12,		verifier))
831	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_texture_image_units_" + verifierSuffix).c_str(),			"Test MAX_COMPUTE_TEXTURE_IMAGE_UNITS",			GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS,			16,		verifier))
832	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_shared_memory_size_" + verifierSuffix).c_str(),			"Test MAX_COMPUTE_SHARED_MEMORY_SIZE",			GL_MAX_COMPUTE_SHARED_MEMORY_SIZE,			16384,	verifier))
833	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_uniform_components_" + verifierSuffix).c_str(),			"Test MAX_COMPUTE_UNIFORM_COMPONENTS",			GL_MAX_COMPUTE_UNIFORM_COMPONENTS,			1024,	verifier))
834	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_atomic_counter_buffers_" + verifierSuffix).c_str(),		"Test MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS",		GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS,		1,		verifier))
835	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_atomic_counters_" + verifierSuffix).c_str(),				"Test MAX_COMPUTE_ATOMIC_COUNTERS",				GL_MAX_COMPUTE_ATOMIC_COUNTERS,				8,		verifier))
836	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_image_uniforms_" + verifierSuffix).c_str(),				"Test MAX_COMPUTE_IMAGE_UNIFORMS",				GL_MAX_COMPUTE_IMAGE_UNIFORMS,				4,		verifier))
837	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_compute_shader_storage_blocks_" + verifierSuffix).c_str(),		"Test MAX_COMPUTE_SHADER_STORAGE_BLOCKS",		GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS,		4,		verifier))
838
839	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_uniform_locations_" + verifierSuffix).c_str(),					"Test MAX_UNIFORM_LOCATIONS",					GL_MAX_UNIFORM_LOCATIONS,					1024,	verifier))
840	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_atomic_counter_buffer_bindings_" + verifierSuffix).c_str(),		"Test MAX_ATOMIC_COUNTER_BUFFER_BINDINGS",		GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS,		1,		verifier))
841	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_atomic_counter_buffer_size_" + verifierSuffix).c_str(),			"Test MAX_ATOMIC_COUNTER_BUFFER_SIZE",			GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE,			32,		verifier))
842	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_combined_atomic_counter_buffers_" + verifierSuffix).c_str(),		"Test MAX_COMBINED_ATOMIC_COUNTER_BUFFERS",		GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS,		1,		verifier))
843	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_combined_atomic_counters_" + verifierSuffix).c_str(),				"Test MAX_COMBINED_ATOMIC_COUNTERS",			GL_MAX_COMBINED_ATOMIC_COUNTERS,			8,		verifier))
844	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_image_units_" + verifierSuffix).c_str(),							"Test MAX_IMAGE_UNITS",							GL_MAX_IMAGE_UNITS,							4,		verifier))
845	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_combined_image_uniforms_" + verifierSuffix).c_str(),				"Test MAX_COMBINED_IMAGE_UNIFORMS",				GL_MAX_COMBINED_IMAGE_UNIFORMS,				4,		verifier))
846	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_shader_storage_buffer_bindings_" + verifierSuffix).c_str(),		"Test MAX_SHADER_STORAGE_BUFFER_BINDINGS",		GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS,		4,		verifier))
847	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_shader_storage_block_size_" + verifierSuffix).c_str(),			"Test MAX_SHADER_STORAGE_BLOCK_SIZE",			GL_MAX_SHADER_STORAGE_BLOCK_SIZE,			1<<27,	verifier))
848	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_combined_shader_storage_blocks_" + verifierSuffix).c_str(),		"Test MAX_COMBINED_SHADER_STORAGE_BLOCKS",		GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS,		4,		verifier))
849	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_combined_shader_output_resources_" + verifierSuffix).c_str(),		"Test MAX_COMBINED_SHADER_OUTPUT_RESOURCES",	GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES,	4,		verifier))
850
851	FOR_EACH_VERIFIER(new MaxUniformBufferBindingsCase	(m_context,	(std::string() + "max_uniform_buffer_bindings_" + verifierSuffix).c_str(),				"Test MAX_UNIFORM_BUFFER_BINDINGS",				verifier))
852	FOR_EACH_VERIFIER(new MaxCombinedUniformBlocksCase	(m_context,	(std::string() + "max_combined_uniform_blocks_" + verifierSuffix).c_str(),				"Test MAX_COMBINED_UNIFORM_BLOCKS",				verifier))
853	FOR_EACH_VERIFIER(new MaxCombinedTexImageUnitsCase	(m_context,	(std::string() + "max_combined_texture_image_units_" + verifierSuffix).c_str(),			"Test MAX_COMBINED_TEXTURE_IMAGE_UNITS",		verifier))
854	FOR_EACH_VERIFIER(new CombinedUniformComponentsCase	(m_context,	(std::string() + "max_combined_compute_uniform_components_" + verifierSuffix).c_str(),	"Test MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS",	GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS, verifier))
855
856	FOR_EACH_VERIFIER(new LegacyVectorLimitCase(m_context,	(std::string() + "max_vertex_uniform_vectors_" + verifierSuffix).c_str(),			"Test MAX_VERTEX_UNIFORM_VECTORS",				GL_MAX_VERTEX_UNIFORM_VECTORS,			GL_MAX_VERTEX_UNIFORM_COMPONENTS,	verifier))
857	FOR_EACH_VERIFIER(new LegacyVectorLimitCase(m_context,	(std::string() + "max_fragment_uniform_vectors_" + verifierSuffix).c_str(),			"Test MAX_FRAGMENT_UNIFORM_VECTORS",			GL_MAX_FRAGMENT_UNIFORM_VECTORS,		GL_MAX_FRAGMENT_UNIFORM_COMPONENTS,	verifier))
858
859	FOR_EACH_VERIFIER(new TextureGatherLimitCase(m_context,	(std::string() + "min_program_texture_gather_offset_" + verifierSuffix).c_str(),	"Test MIN_PROGRAM_TEXTURE_GATHER_OFFSET",		false,		verifier))
860	FOR_EACH_VERIFIER(new TextureGatherLimitCase(m_context,	(std::string() + "max_program_texture_gather_offset_" + verifierSuffix).c_str(),	"Test MAX_PROGRAM_TEXTURE_GATHER_OFFSET",		true,		verifier))
861
862	// GL ES 3.2 tests
863	FOR_EACH_VERIFIER(new MinimumValueCase	(m_context,	(std::string() + "max_framebuffer_layers_" + verifierSuffix).c_str(),						"Test MAX_FRAMEBUFFER_LAYERS",						GL_MAX_FRAMEBUFFER_LAYERS,						256,	verifier,	glu::ApiType::es(3, 2)))
864	FOR_EACH_VERIFIER(new MinimumValueCase	(m_context,	(std::string() + "fragment_interpolation_offset_bits_" + verifierSuffix).c_str(),			"Test FRAGMENT_INTERPOLATION_OFFSET_BITS",			GL_FRAGMENT_INTERPOLATION_OFFSET_BITS,			4,		verifier,	glu::ApiType::es(3, 2)))
865	FOR_EACH_VERIFIER(new MinimumValueCase	(m_context,	(std::string() + "max_texture_buffer_size_" + verifierSuffix).c_str(),						"Test MAX_TEXTURE_BUFFER_SIZE",						GL_MAX_TEXTURE_BUFFER_SIZE,						65536,	verifier,	glu::ApiType::es(3, 2)))
866	FOR_EACH_VERIFIER(new AlignmentCase		(m_context,	(std::string() + "texture_buffer_offset_alignment_" + verifierSuffix).c_str(),				"Test TEXTURE_BUFFER_OFFSET_ALIGNMENT",				GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT,				256,	verifier,	glu::ApiType::es(3, 2)))
867
868	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_gen_level_" + verifierSuffix).c_str(),							"Test MAX_TESS_GEN_LEVEL",							GL_MAX_TESS_GEN_LEVEL,							64,		verifier,	glu::ApiType::es(3, 2)))
869	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_patch_vertices_" + verifierSuffix).c_str(),							"Test MAX_PATCH_VERTICES",							GL_MAX_PATCH_VERTICES,							32,		verifier,	glu::ApiType::es(3, 2)))
870	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_patch_components_" + verifierSuffix).c_str(),					"Test MAX_TESS_PATCH_COMPONENTS",					GL_MAX_TESS_PATCH_COMPONENTS,					120,	verifier,	glu::ApiType::es(3, 2)))
871
872	// tess control
873	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_uniform_components_" + verifierSuffix).c_str(),			"Test MAX_TESS_CONTROL_UNIFORM_COMPONENTS",			GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS,			1024,	verifier,	glu::ApiType::es(3, 2)))
874	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_texture_image_units_" + verifierSuffix).c_str(),			"Test MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS",		GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS,		16,		verifier,	glu::ApiType::es(3, 2)))
875	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_output_components_" + verifierSuffix).c_str(),			"Test MAX_TESS_CONTROL_OUTPUT_COMPONENTS",			GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS,			64,		verifier,	glu::ApiType::es(3, 2)))
876	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_total_output_components_" + verifierSuffix).c_str(),		"Test MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS",	GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS,	2048,	verifier,	glu::ApiType::es(3, 2)))
877	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_input_components_" + verifierSuffix).c_str(),			"Test MAX_TESS_CONTROL_INPUT_COMPONENTS",			GL_MAX_TESS_CONTROL_INPUT_COMPONENTS,			64,		verifier,	glu::ApiType::es(3, 2)))
878	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_uniform_blocks_" + verifierSuffix).c_str(),				"Test MAX_TESS_CONTROL_UNIFORM_BLOCKS",				GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS,				12,		verifier,	glu::ApiType::es(3, 2)))
879	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_atomic_counter_buffers_" + verifierSuffix).c_str(),		"Test MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS",		GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS,		0,		verifier,	glu::ApiType::es(3, 2)))
880	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_atomic_counters_" + verifierSuffix).c_str(),				"Test MAX_TESS_CONTROL_ATOMIC_COUNTERS",			GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS,			0,		verifier,	glu::ApiType::es(3, 2)))
881	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_shader_storage_blocks_" + verifierSuffix).c_str(),		"Test MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS",		GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS,		0,		verifier,	glu::ApiType::es(3, 2)))
882
883	// tess evaluation
884	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_uniform_components_" + verifierSuffix).c_str(),		"Test MAX_TESS_EVALUATION_UNIFORM_COMPONENTS",		GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS,		1024,	verifier,	glu::ApiType::es(3, 2)))
885	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_texture_image_units_" + verifierSuffix).c_str(),		"Test MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS",		GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS,		16,		verifier,	glu::ApiType::es(3, 2)))
886	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_output_components_" + verifierSuffix).c_str(),		"Test MAX_TESS_EVALUATION_OUTPUT_COMPONENTS",		GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS,		64,		verifier,	glu::ApiType::es(3, 2)))
887	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_input_components_" + verifierSuffix).c_str(),			"Test MAX_TESS_EVALUATION_INPUT_COMPONENTS",		GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS,		64,		verifier,	glu::ApiType::es(3, 2)))
888	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_uniform_blocks_" + verifierSuffix).c_str(),			"Test MAX_TESS_EVALUATION_UNIFORM_BLOCKS",			GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS,			12,		verifier,	glu::ApiType::es(3, 2)))
889	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_atomic_counter_buffers_" + verifierSuffix).c_str(),	"Test MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS",	GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS,	0,		verifier,	glu::ApiType::es(3, 2)))
890	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_atomic_counters_" + verifierSuffix).c_str(),			"Test MAX_TESS_EVALUATION_ATOMIC_COUNTERS",			GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS,			0,		verifier,	glu::ApiType::es(3, 2)))
891	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_shader_storage_blocks_" + verifierSuffix).c_str(),	"Test MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS",	GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS,	0,		verifier,	glu::ApiType::es(3, 2)))
892
893	// geometry
894	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_uniform_components_" + verifierSuffix).c_str(),				"Test MAX_GEOMETRY_UNIFORM_COMPONENTS",				GL_MAX_GEOMETRY_UNIFORM_COMPONENTS,				1024,	verifier,	glu::ApiType::es(3, 2)))
895	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_uniform_blocks_" + verifierSuffix).c_str(),					"Test MAX_GEOMETRY_UNIFORM_BLOCKS",					GL_MAX_GEOMETRY_UNIFORM_BLOCKS,					12,		verifier,	glu::ApiType::es(3, 2)))
896	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_input_components_" + verifierSuffix).c_str(),				"Test MAX_GEOMETRY_INPUT_COMPONENTS",				GL_MAX_GEOMETRY_INPUT_COMPONENTS,				64,		verifier,	glu::ApiType::es(3, 2)))
897	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_output_components_" + verifierSuffix).c_str(),				"Test MAX_GEOMETRY_OUTPUT_COMPONENTS",				GL_MAX_GEOMETRY_OUTPUT_COMPONENTS,				64,		verifier,	glu::ApiType::es(3, 2)))
898	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_output_vertices_" + verifierSuffix).c_str(),					"Test MAX_GEOMETRY_OUTPUT_VERTICES",				GL_MAX_GEOMETRY_OUTPUT_VERTICES,				256,	verifier,	glu::ApiType::es(3, 2)))
899	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_total_output_components_" + verifierSuffix).c_str(),			"Test MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS",		GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS,		1024,	verifier,	glu::ApiType::es(3, 2)))
900	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_texture_image_units_" + verifierSuffix).c_str(),				"Test MAX_GEOMETRY_TEXTURE_IMAGE_UNITS",			GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS,			16,		verifier,	glu::ApiType::es(3, 2)))
901	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_shader_invocations_" + verifierSuffix).c_str(),				"Test MAX_GEOMETRY_SHADER_INVOCATIONS",				GL_MAX_GEOMETRY_SHADER_INVOCATIONS,				32,		verifier,	glu::ApiType::es(3, 2)))
902	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_atomic_counter_buffers_" + verifierSuffix).c_str(),			"Test MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS",			GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS,			0,		verifier,	glu::ApiType::es(3, 2)))
903	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_atomic_counters_" + verifierSuffix).c_str(),					"Test MAX_GEOMETRY_ATOMIC_COUNTERS",				GL_MAX_GEOMETRY_ATOMIC_COUNTERS,				0,		verifier,	glu::ApiType::es(3, 2)))
904	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_shader_storage_blocks_" + verifierSuffix).c_str(),			"Test MAX_GEOMETRY_SHADER_STORAGE_BLOCKS",			GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS,			0,		verifier,	glu::ApiType::es(3, 2)))
905
906	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_control_image_uniforms_" + verifierSuffix).c_str(),				"Test MAX_TESS_CONTROL_IMAGE_UNIFORMS",				GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS,				0,		verifier,	glu::ApiType::es(3, 2)))
907	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_tess_evaluation_image_uniforms_" + verifierSuffix).c_str(),			"Test MAX_TESS_EVALUATION_IMAGE_UNIFORMS",			GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS,			0,		verifier,	glu::ApiType::es(3, 2)))
908	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_geometry_image_uniforms_" + verifierSuffix).c_str(),					"Test MAX_GEOMETRY_IMAGE_UNIFORMS",					GL_MAX_GEOMETRY_IMAGE_UNIFORMS,					0,		verifier,	glu::ApiType::es(3, 2)))
909
910	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "debug_logged_messages_" + verifierSuffix).c_str(),						"Test DEBUG_LOGGED_MESSAGES",						GL_DEBUG_LOGGED_MESSAGES,						0,		verifier,	glu::ApiType::es(3, 2)))
911	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "debug_next_logged_message_length_" + verifierSuffix).c_str(),				"Test DEBUG_NEXT_LOGGED_MESSAGE_LENGTH",			GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH,			0,		verifier,	glu::ApiType::es(3, 2)))
912	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "debug_group_stack_depth_" + verifierSuffix).c_str(),						"Test DEBUG_GROUP_STACK_DEPTH",						GL_DEBUG_GROUP_STACK_DEPTH,						0,		verifier,	glu::ApiType::es(3, 2)))
913	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_debug_message_length_" + verifierSuffix).c_str(),						"Test MAX_DEBUG_MESSAGE_LENGTH",					GL_MAX_DEBUG_MESSAGE_LENGTH,					1,		verifier,	glu::ApiType::es(3, 2)))
914	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_debug_logged_messages_" + verifierSuffix).c_str(),					"Test MAX_DEBUG_LOGGED_MESSAGES",					GL_MAX_DEBUG_LOGGED_MESSAGES,					1,		verifier,	glu::ApiType::es(3, 2)))
915	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_debug_group_stack_depth_" + verifierSuffix).c_str(),					"Test MAX_DEBUG_GROUP_STACK_DEPTH",					GL_MAX_DEBUG_GROUP_STACK_DEPTH,					64,		verifier,	glu::ApiType::es(3, 2)))
916	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "max_label_length_" + verifierSuffix).c_str(),								"Test MAX_LABEL_LENGTH",							GL_MAX_LABEL_LENGTH,							256,	verifier,	glu::ApiType::es(3, 2)))
917
918	FOR_EACH_VERIFIER(new MinimumValueCase(m_context,	(std::string() + "texture_buffer_binding_" + verifierSuffix).c_str(),						"Test TEXTURE_BUFFER_BINDING",						GL_TEXTURE_BUFFER_BINDING,						0,		verifier,	glu::ApiType::es(3, 2)))
919
920	FOR_EACH_VERIFIER(new CombinedUniformComponentsCase	(m_context,	(std::string() + "max_combined_tess_control_uniform_components_" + verifierSuffix).c_str(),		"Test MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS",	GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS,	verifier,	glu::ApiType::es(3, 2)))
921	FOR_EACH_VERIFIER(new CombinedUniformComponentsCase	(m_context,	(std::string() + "max_combined_tess_evaluation_uniform_components_" + verifierSuffix).c_str(),	"Test MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS",	GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS, verifier,	glu::ApiType::es(3, 2)))
922	FOR_EACH_VERIFIER(new CombinedUniformComponentsCase	(m_context,	(std::string() + "max_combined_geometry_uniform_components_" + verifierSuffix).c_str(),			"Test MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS",		GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS,		verifier,	glu::ApiType::es(3, 2)))
923
924#undef FOR_EACH_VERIFIER
925}
926
927} // Functional
928} // gles31
929} // deqp
930