• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Multisample texture size tests
22  *//*--------------------------------------------------------------------*/
23 
24 #include "es31fShaderTextureSizeTests.hpp"
25 #include "gluRenderContext.hpp"
26 #include "gluShaderProgram.hpp"
27 #include "gluPixelTransfer.hpp"
28 #include "gluContextInfo.hpp"
29 #include "glwEnums.hpp"
30 #include "glwFunctions.hpp"
31 #include "tcuTestLog.hpp"
32 #include "tcuStringTemplate.hpp"
33 #include "tcuSurface.hpp"
34 #include "tcuRenderTarget.hpp"
35 #include "deStringUtil.hpp"
36 
37 using namespace glw;
38 
39 namespace deqp
40 {
41 namespace gles31
42 {
43 namespace Functional
44 {
45 namespace
46 {
47 
48 static const char* const s_positionVertexShaderSource =	"${GLSL_VERSION_DECL}\n"
49 														"in highp vec4 a_position;\n"
50 														"void main (void)\n"
51 														"{\n"
52 														"	gl_Position = a_position;\n"
53 														"}\n";
54 
specializeShader(Context & context,const char * code)55 static std::string specializeShader(Context& context, const char* code)
56 {
57 	glu::GLSLVersion glslVersion = glu::getContextTypeGLSLVersion(context.getRenderContext().getType());
58 	std::map<std::string, std::string> specializationMap;
59 
60 	specializationMap["GLSL_VERSION_DECL"] = glu::getGLSLVersionDeclaration(glslVersion);
61 
62 	return tcu::StringTemplate(code).specialize(specializationMap);
63 }
64 
65 class TextureSizeCase : public TestCase
66 {
67 public:
68 	enum TextureType
69 	{
70 		TEXTURE_FLOAT_2D = 0,
71 		TEXTURE_FLOAT_2D_ARRAY,
72 		TEXTURE_INT_2D,
73 		TEXTURE_INT_2D_ARRAY,
74 		TEXTURE_UINT_2D,
75 		TEXTURE_UINT_2D_ARRAY,
76 
77 		TEXTURE_LAST
78 	};
79 
80 							TextureSizeCase		(Context& context, const char* name, const char* desc, TextureType type, int samples);
81 							~TextureSizeCase	(void);
82 
83 private:
84 	void					init				(void);
85 	void					deinit				(void);
86 	IterateResult			iterate				(void);
87 
88 	std::string				genFragmentSource	(void);
89 	glw::GLenum				getTextureGLTarget	(void);
90 	glw::GLenum				getTextureGLInternalFormat (void);
91 
92 	void					createTexture		(const tcu::IVec3& size);
93 	void					deleteTexture		(void);
94 	void					runShader			(tcu::Surface& dst, const tcu::IVec3& size);
95 	bool					verifyImage			(const tcu::Surface& dst);
96 
97 	const TextureType		m_type;
98 	const int				m_numSamples;
99 	const bool				m_isArrayType;
100 
101 	glw::GLuint				m_texture;
102 	glw::GLuint				m_vbo;
103 	glw::GLuint				m_vao;
104 	glu::ShaderProgram*		m_shader;
105 	std::vector<tcu::IVec3>	m_iterations;
106 	int						m_iteration;
107 
108 	bool					m_allIterationsPassed;
109 	bool					m_allCasesSkipped;
110 };
111 
TextureSizeCase(Context & context,const char * name,const char * desc,TextureType type,int samples)112 TextureSizeCase::TextureSizeCase (Context& context, const char* name, const char* desc, TextureType type, int samples)
113 	: TestCase				(context, name, desc)
114 	, m_type				(type)
115 	, m_numSamples			(samples)
116 	, m_isArrayType			(m_type == TEXTURE_FLOAT_2D_ARRAY || m_type == TEXTURE_INT_2D_ARRAY || m_type == TEXTURE_UINT_2D_ARRAY)
117 	, m_texture				(0)
118 	, m_vbo					(0)
119 	, m_vao					(0)
120 	, m_shader				(DE_NULL)
121 	, m_iteration			(0)
122 	, m_allIterationsPassed	(true)
123 	, m_allCasesSkipped		(true)
124 {
125 	DE_ASSERT(type < TEXTURE_LAST);
126 }
127 
~TextureSizeCase(void)128 TextureSizeCase::~TextureSizeCase (void)
129 {
130 	deinit();
131 }
132 
init(void)133 void TextureSizeCase::init (void)
134 {
135 	static const tcu::IVec2 testSizes2D[] =
136 	{
137 		tcu::IVec2(1,	1),
138 		tcu::IVec2(1,	4),
139 		tcu::IVec2(4,	8),
140 		tcu::IVec2(21,	11),
141 		tcu::IVec2(107,	254),
142 		tcu::IVec2(-1,	3),
143 		tcu::IVec2(3,	-1),
144 	};
145 	static const tcu::IVec3 testSizes3D[] =
146 	{
147 		tcu::IVec3(1,	1,		1),
148 		tcu::IVec3(1,	4,		7),
149 		tcu::IVec3(4,	8,		12),
150 		tcu::IVec3(21,	11,		9),
151 		tcu::IVec3(107,	254,	2),
152 		tcu::IVec3(-1,	3,		3),
153 		tcu::IVec3(3,	-1,		3),
154 		tcu::IVec3(4,	4,		-1),
155 	};
156 	static const tcu::Vec4 fullscreenQuad[] =
157 	{
158 		tcu::Vec4(-1.0f,  1.0f, 0.0f, 1.0f),
159 		tcu::Vec4(-1.0f, -1.0f, 0.0f, 1.0f),
160 		tcu::Vec4( 1.0f,  1.0f, 0.0f, 1.0f),
161 		tcu::Vec4( 1.0f, -1.0f, 0.0f, 1.0f)
162 	};
163 
164 	glu::RenderContext&		rc					= m_context.getRenderContext();
165 	const glw::Functions&	gl					= rc.getFunctions();
166 	const bool				supportsES32orGL45	= glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)) ||
167 												  glu::contextSupports(rc.getType(), glu::ApiType::core(4, 5));
168 
169 	// requirements
170 	if (m_isArrayType && !supportsES32orGL45 && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
171 		TCU_THROW(NotSupportedError, "Test requires OES_texture_storage_multisample_2d_array extension");
172 
173 	if (m_context.getRenderTarget().getWidth() < 1 || m_context.getRenderTarget().getHeight() < 1)
174 		TCU_THROW(NotSupportedError, "rendertarget size must be at least 1x1");
175 
176 	glw::GLint				maxTextureSize		= 0;
177 	glw::GLint				maxTextureLayers	= 0;
178 	glw::GLint				maxSamples			= 0;
179 
180 	gl.getIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
181 	gl.getIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxTextureLayers);
182 	gl.getInternalformativ(getTextureGLTarget(), getTextureGLInternalFormat(), GL_SAMPLES, 1, &maxSamples);
183 
184 	if (m_numSamples > maxSamples)
185 		TCU_THROW(NotSupportedError, "sample count is not supported");
186 
187 	// gen shade
188 
189 	m_shader = new glu::ShaderProgram(m_context.getRenderContext(), glu::ProgramSources() << glu::VertexSource(specializeShader(m_context, s_positionVertexShaderSource)) << glu::FragmentSource(genFragmentSource()));
190 	m_testCtx.getLog() << *m_shader;
191 	if (!m_shader->isOk())
192 		throw tcu::TestError("shader build failed");
193 
194 	// gen buffer
195 
196 	gl.genBuffers(1, &m_vbo);
197 	gl.bindBuffer(GL_ARRAY_BUFFER, m_vbo);
198 	gl.bufferData(GL_ARRAY_BUFFER, sizeof(fullscreenQuad), fullscreenQuad, GL_STATIC_DRAW);
199 
200 	if (!glu::isContextTypeES(m_context.getRenderContext().getType()))
201 		gl.genVertexArrays(1, &m_vao);
202 
203 	// gen iterations
204 
205 	m_testCtx.getLog()
206 		<< tcu::TestLog::Message
207 		<< "GL_MAX_TEXTURE_SIZE = " << maxTextureSize << "\n"
208 		<< "GL_MAX_ARRAY_TEXTURE_LAYERS = " << maxTextureLayers
209 		<< tcu::TestLog::EndMessage;
210 
211 	if (!m_isArrayType)
212 	{
213 		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(testSizes2D); ++ndx)
214 		{
215 			if (testSizes2D[ndx].x() <= maxTextureSize && testSizes2D[ndx].y() <= maxTextureSize)
216 			{
217 				const int w = (testSizes2D[ndx].x() < 0) ? (maxTextureSize) : (testSizes2D[ndx].x());
218 				const int h = (testSizes2D[ndx].y() < 0) ? (maxTextureSize) : (testSizes2D[ndx].y());
219 
220 				m_iterations.push_back(tcu::IVec3(w, h, 0));
221 			}
222 		}
223 	}
224 	else
225 	{
226 		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(testSizes3D); ++ndx)
227 		{
228 			if (testSizes3D[ndx].x() <= maxTextureSize && testSizes3D[ndx].y() <= maxTextureSize && testSizes3D[ndx].z() <= maxTextureLayers)
229 			{
230 				const int w = (testSizes3D[ndx].x() < 0) ? (maxTextureSize)		: (testSizes3D[ndx].x());
231 				const int h = (testSizes3D[ndx].y() < 0) ? (maxTextureSize)		: (testSizes3D[ndx].y());
232 				const int d = (testSizes3D[ndx].z() < 0) ? (maxTextureLayers)	: (testSizes3D[ndx].z());
233 
234 				m_iterations.push_back(tcu::IVec3(w, h, d));
235 			}
236 		}
237 	}
238 }
239 
deinit(void)240 void TextureSizeCase::deinit (void)
241 {
242 	if (m_texture)
243 	{
244 		m_context.getRenderContext().getFunctions().deleteTextures(1, &m_texture);
245 		m_texture = 0;
246 	}
247 
248 	if (m_vbo)
249 	{
250 		m_context.getRenderContext().getFunctions().deleteBuffers(1, &m_vbo);
251 		m_vbo = 0;
252 	}
253 
254 	if (m_vao)
255 	{
256 		m_context.getRenderContext().getFunctions().deleteVertexArrays(1, &m_vao);
257 		m_vao = 0;
258 	}
259 
260 	if (m_shader)
261 	{
262 		delete m_shader;
263 		m_shader = DE_NULL;
264 	}
265 }
266 
iterate(void)267 TextureSizeCase::IterateResult TextureSizeCase::iterate (void)
268 {
269 	tcu::Surface	result		(1, 1);
270 	bool			skipTest	= false;
271 
272 	m_testCtx.getLog() << tcu::TestLog::Message << "\nIteration " << (m_iteration+1) << " / " << (int)m_iterations.size() << tcu::TestLog::EndMessage;
273 
274 	try
275 	{
276 		// set texture size
277 
278 		createTexture(m_iterations[m_iteration]);
279 
280 		// query texture size
281 
282 		runShader(result, m_iterations[m_iteration]);
283 	}
284 	catch (glu::OutOfMemoryError&)
285 	{
286 		m_testCtx.getLog() << tcu::TestLog::Message << "Got GL_OUT_OF_MEMORY, skipping this size" << tcu::TestLog::EndMessage;
287 
288 		skipTest = true;
289 	}
290 
291 	// free resources
292 
293 	deleteTexture();
294 
295 	// queried value was correct?
296 
297 	if (!skipTest)
298 	{
299 		m_allCasesSkipped = false;
300 
301 		if (!verifyImage(result))
302 			m_allIterationsPassed = false;
303 	}
304 
305 	// final result
306 
307 	if (++m_iteration < (int)m_iterations.size())
308 		return CONTINUE;
309 
310 	if (!m_allIterationsPassed)
311 	{
312 		m_testCtx.getLog() << tcu::TestLog::Message << "One or more test sizes failed." << tcu::TestLog::EndMessage;
313 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid texture size");
314 	}
315 	else if (m_allCasesSkipped)
316 	{
317 		m_testCtx.getLog() << tcu::TestLog::Message << "Could not test any texture size, texture creation failed." << tcu::TestLog::EndMessage;
318 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "All test texture creations failed");
319 	}
320 	else
321 	{
322 		m_testCtx.getLog() << tcu::TestLog::Message << "All texture sizes passed." << tcu::TestLog::EndMessage;
323 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
324 	}
325 
326 	return STOP;
327 }
328 
genFragmentSource(void)329 std::string TextureSizeCase::genFragmentSource (void)
330 {
331 	static const char* const templateSource =	"${GLSL_VERSION_DECL}\n"
332 												"${EXTENSION_STATEMENT}"
333 												"layout(location = 0) out highp vec4 fragColor;\n"
334 												"uniform highp ${SAMPLERTYPE} u_sampler;\n"
335 												"uniform highp ${SIZETYPE} u_size;\n"
336 												"void main (void)\n"
337 												"{\n"
338 												"	const highp vec4 okColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
339 												"	const highp vec4 failColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
340 												"	fragColor = (textureSize(u_sampler) == u_size) ? (okColor) : (failColor);\n"
341 												"}\n";
342 
343 	std::map<std::string, std::string> args;
344 
345 	switch (m_type)
346 	{
347 		case TEXTURE_FLOAT_2D:			args["SAMPLERTYPE"] = "sampler2DMS";		break;
348 		case TEXTURE_FLOAT_2D_ARRAY:	args["SAMPLERTYPE"] = "sampler2DMSArray";	break;
349 		case TEXTURE_INT_2D:			args["SAMPLERTYPE"] = "isampler2DMS";		break;
350 		case TEXTURE_INT_2D_ARRAY:		args["SAMPLERTYPE"] = "isampler2DMSArray";	break;
351 		case TEXTURE_UINT_2D:			args["SAMPLERTYPE"] = "usampler2DMS";		break;
352 		case TEXTURE_UINT_2D_ARRAY:		args["SAMPLERTYPE"] = "usampler2DMSArray";	break;
353 		default:
354 			DE_ASSERT(DE_FALSE);
355 	}
356 
357 	if (!m_isArrayType)
358 		args["SIZETYPE"] = "ivec2";
359 	else
360 		args["SIZETYPE"] = "ivec3";
361 
362 	const glu::ContextType	contextType			= m_context.getRenderContext().getType();
363 	const bool				supportsES32orGL45	= glu::contextSupports(contextType, glu::ApiType::es(3, 2)) ||
364 												  glu::contextSupports(contextType, glu::ApiType::core(4, 5));
365 
366 	if (m_isArrayType && !supportsES32orGL45)
367 		args["EXTENSION_STATEMENT"] = "#extension GL_OES_texture_storage_multisample_2d_array : require\n";
368 	else
369 		args["EXTENSION_STATEMENT"] = "";
370 
371 	args["GLSL_VERSION_DECL"] = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(contextType));
372 
373 	return tcu::StringTemplate(templateSource).specialize(args);
374 }
375 
getTextureGLTarget(void)376 glw::GLenum TextureSizeCase::getTextureGLTarget (void)
377 {
378 	switch (m_type)
379 	{
380 		case TEXTURE_FLOAT_2D:			return GL_TEXTURE_2D_MULTISAMPLE;
381 		case TEXTURE_FLOAT_2D_ARRAY:	return GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
382 		case TEXTURE_INT_2D:			return GL_TEXTURE_2D_MULTISAMPLE;
383 		case TEXTURE_INT_2D_ARRAY:		return GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
384 		case TEXTURE_UINT_2D:			return GL_TEXTURE_2D_MULTISAMPLE;
385 		case TEXTURE_UINT_2D_ARRAY:		return GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
386 		default:
387 			DE_ASSERT(DE_FALSE);
388 			return 0;
389 	}
390 }
391 
getTextureGLInternalFormat(void)392 glw::GLenum TextureSizeCase::getTextureGLInternalFormat (void)
393 {
394 	switch (m_type)
395 	{
396 		case TEXTURE_FLOAT_2D:			return GL_RGBA8;
397 		case TEXTURE_FLOAT_2D_ARRAY:	return GL_RGBA8;
398 		case TEXTURE_INT_2D:			return GL_R8I;
399 		case TEXTURE_INT_2D_ARRAY:		return GL_R8I;
400 		case TEXTURE_UINT_2D:			return GL_R8UI;
401 		case TEXTURE_UINT_2D_ARRAY:		return GL_R8UI;
402 		default:
403 			DE_ASSERT(DE_FALSE);
404 			return 0;
405 	}
406 }
407 
createTexture(const tcu::IVec3 & size)408 void TextureSizeCase::createTexture (const tcu::IVec3& size)
409 {
410 	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
411 
412 	if (!m_isArrayType)
413 		m_testCtx.getLog() << tcu::TestLog::Message << "Creating texture with size " << size.x() << "x" << size.y() << tcu::TestLog::EndMessage;
414 	else
415 		m_testCtx.getLog() << tcu::TestLog::Message << "Creating texture with size " << size.x() << "x" << size.y() << "x" << size.z() << tcu::TestLog::EndMessage;
416 
417 	gl.genTextures(1, &m_texture);
418 	gl.bindTexture(getTextureGLTarget(), m_texture);
419 	GLU_EXPECT_NO_ERROR(gl.getError(), "texture gen");
420 
421 	if (!m_isArrayType)
422 		gl.texStorage2DMultisample(getTextureGLTarget(), m_numSamples, getTextureGLInternalFormat(), size.x(), size.y(), GL_FALSE);
423 	else
424 		gl.texStorage3DMultisample(getTextureGLTarget(), m_numSamples, getTextureGLInternalFormat(), size.x(), size.y(), size.z(), GL_FALSE);
425 	GLU_EXPECT_NO_ERROR(gl.getError(), "texStorage");
426 }
427 
deleteTexture(void)428 void TextureSizeCase::deleteTexture (void)
429 {
430 	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
431 
432 	if (m_texture)
433 	{
434 		gl.deleteTextures(1, &m_texture);
435 		m_texture = 0;
436 
437 		GLU_EXPECT_NO_ERROR(gl.getError(), "texture delete");
438 	}
439 }
440 
runShader(tcu::Surface & dst,const tcu::IVec3 & size)441 void TextureSizeCase::runShader (tcu::Surface& dst, const tcu::IVec3& size)
442 {
443 	const glw::Functions&	gl					= m_context.getRenderContext().getFunctions();
444 	const int				positionLoc			= gl.getAttribLocation(m_shader->getProgram(), "a_position");
445 	const int				shaderSamplerLoc	= gl.getUniformLocation(m_shader->getProgram(), "u_sampler");
446 	const int				shaderSizeLoc		= gl.getUniformLocation(m_shader->getProgram(), "u_size");
447 
448 	m_testCtx.getLog() << tcu::TestLog::Message << "Running the verification shader." << tcu::TestLog::EndMessage;
449 
450 	GLU_EXPECT_NO_ERROR(gl.getError(), "preclear");
451 	gl.viewport(0, 0, 1, 1);
452 	gl.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
453 	gl.clear(GL_COLOR_BUFFER_BIT);
454 	GLU_EXPECT_NO_ERROR(gl.getError(), "clear");
455 
456 	if (m_vao)
457 		gl.bindVertexArray(m_vao);
458 
459 	gl.bindBuffer(GL_ARRAY_BUFFER, m_vbo);
460 	gl.vertexAttribPointer(positionLoc, 4, GL_FLOAT, GL_FALSE, 0, DE_NULL);
461 	gl.enableVertexAttribArray(positionLoc);
462 	GLU_EXPECT_NO_ERROR(gl.getError(), "vertexAttrib");
463 
464 	gl.useProgram(m_shader->getProgram());
465 	gl.uniform1i(shaderSamplerLoc, 0);
466 	if (m_isArrayType)
467 		gl.uniform3iv(shaderSizeLoc, 1, size.getPtr());
468 	else
469 		gl.uniform2iv(shaderSizeLoc, 1, size.getPtr());
470 	GLU_EXPECT_NO_ERROR(gl.getError(), "setup program");
471 
472 	gl.bindTexture(getTextureGLTarget(), m_texture);
473 	GLU_EXPECT_NO_ERROR(gl.getError(), "bindtex");
474 
475 	gl.drawArrays(GL_TRIANGLE_STRIP, 0, 4);
476 	GLU_EXPECT_NO_ERROR(gl.getError(), "drawArrays");
477 
478 	gl.disableVertexAttribArray(positionLoc);
479 	gl.useProgram(0);
480 	if (m_vao)
481 		gl.bindVertexArray(0);
482 	GLU_EXPECT_NO_ERROR(gl.getError(), "cleanup");
483 
484 	gl.finish();
485 	glu::readPixels(m_context.getRenderContext(), 0, 0, dst.getAccess());
486 	GLU_EXPECT_NO_ERROR(gl.getError(), "readPixels");
487 }
488 
verifyImage(const tcu::Surface & dst)489 bool TextureSizeCase::verifyImage (const tcu::Surface& dst)
490 {
491 	DE_ASSERT(dst.getWidth() == 1 && dst.getHeight() == 1);
492 
493 	const int		colorThresholdRed	= 1 << (8 - m_context.getRenderTarget().getPixelFormat().redBits);
494 	const int		colorThresholdGreen	= 1 << (8 - m_context.getRenderTarget().getPixelFormat().greenBits);
495 	const int		colorThresholdBlue	= 1 << (8 - m_context.getRenderTarget().getPixelFormat().blueBits);
496 	const tcu::RGBA	color				= dst.getPixel(0,0);
497 
498 	m_testCtx.getLog() << tcu::TestLog::Message << "Verifying image." << tcu::TestLog::EndMessage;
499 
500 	// green
501 	if (color.getRed() < colorThresholdRed && color.getGreen() > 255 - colorThresholdGreen && color.getBlue() < colorThresholdBlue)
502 	{
503 		m_testCtx.getLog() << tcu::TestLog::Message << "Result ok." << tcu::TestLog::EndMessage;
504 		return true;
505 	}
506 	// red
507 	else if (color.getRed() > 255 - colorThresholdRed && color.getGreen() < colorThresholdGreen && color.getBlue() < colorThresholdBlue)
508 	{
509 		m_testCtx.getLog() << tcu::TestLog::Message << "Image size incorrect." << tcu::TestLog::EndMessage;
510 		return false;
511 	}
512 
513 	m_testCtx.getLog() << tcu::TestLog::Message << "Expected either green or red pixel, got " << color << tcu::TestLog::EndMessage;
514 	return false;
515 }
516 
517 } // anonymous
518 
ShaderTextureSizeTests(Context & context)519 ShaderTextureSizeTests::ShaderTextureSizeTests (Context& context)
520 	: TestCaseGroup(context, "texture_size", "Texture size tests")
521 {
522 }
523 
~ShaderTextureSizeTests(void)524 ShaderTextureSizeTests::~ShaderTextureSizeTests (void)
525 {
526 }
527 
init(void)528 void ShaderTextureSizeTests::init (void)
529 {
530 	static const struct SamplerType
531 	{
532 		TextureSizeCase::TextureType	type;
533 		const char*						name;
534 	} samplerTypes[] =
535 	{
536 		{ TextureSizeCase::TEXTURE_FLOAT_2D,		"texture_2d"			},
537 		{ TextureSizeCase::TEXTURE_FLOAT_2D_ARRAY,	"texture_2d_array"		},
538 		{ TextureSizeCase::TEXTURE_INT_2D,			"texture_int_2d"		},
539 		{ TextureSizeCase::TEXTURE_INT_2D_ARRAY,	"texture_int_2d_array"	},
540 		{ TextureSizeCase::TEXTURE_UINT_2D,			"texture_uint_2d"		},
541 		{ TextureSizeCase::TEXTURE_UINT_2D_ARRAY,	"texture_uint_2d_array"	},
542 	};
543 
544 	static const int sampleCounts[] = { 1, 4 };
545 
546 	for (int samplerTypeNdx = 0; samplerTypeNdx < DE_LENGTH_OF_ARRAY(samplerTypes); ++samplerTypeNdx)
547 	{
548 		for (int sampleCountNdx = 0; sampleCountNdx < DE_LENGTH_OF_ARRAY(sampleCounts); ++sampleCountNdx)
549 		{
550 			const std::string name = std::string() + "samples_" + de::toString(sampleCounts[sampleCountNdx]) + "_" + samplerTypes[samplerTypeNdx].name;
551 			const std::string desc = std::string() + "samples count = " + de::toString(sampleCounts[sampleCountNdx]) + ", type = " + samplerTypes[samplerTypeNdx].name;
552 
553 			addChild(new TextureSizeCase(m_context, name.c_str(), desc.c_str(), samplerTypes[samplerTypeNdx].type, sampleCounts[sampleCountNdx]));
554 		}
555 	}
556 }
557 
558 } // Functional
559 } // gles31
560 } // deqp
561