1/*-------------------------------------------------------------------------
2 * OpenGL Conformance Test Suite
3 * -----------------------------
4 *
5 * Copyright (c) 2014-2016 The Khronos Group Inc.
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
22 */ /*-------------------------------------------------------------------*/
23
24/**
25 */ /*!
26 * \file  es31cTextureStorageMultisampleGetActiveUniformTests.cpp
27 * \brief Implements conformance tests that check whether glGetActiveUniform()
28 *        works correctly with multisample texture samplers. (ES3.1 only)
29 */ /*-------------------------------------------------------------------*/
30
31#include "es31cTextureStorageMultisampleGetActiveUniformTests.hpp"
32#include "gluContextInfo.hpp"
33#include "gluDefs.hpp"
34#include "glwEnums.hpp"
35#include "glwFunctions.hpp"
36#include "tcuRenderTarget.hpp"
37#include "tcuTestLog.hpp"
38
39#include <string.h>
40#include <string>
41#include <vector>
42
43namespace glcts
44{
45
46/* Constants */
47const char* MultisampleTextureGetActiveUniformSamplersTest::fs_body =
48	"#version 310 es\n"
49	"\n"
50	"precision highp float;\n"
51	"\n"
52	"uniform highp sampler2DMS  fs_sampler_2d_multisample;\n"
53	"uniform highp usampler2DMS fs_sampler_2d_multisample_uint;\n"
54	"uniform highp isampler2DMS fs_sampler_2d_multisample_int;\n"
55	"\n"
56	"out vec4 result;\n"
57	"\n"
58	"void main()\n"
59	"{\n"
60	"    vec4  sampler2DMS_value  = texelFetch(fs_sampler_2d_multisample,      ivec2(0), 0);\n"
61	"    uvec4 usampler2DMS_value = texelFetch(fs_sampler_2d_multisample_uint, ivec2(0), 0);\n"
62	"    ivec4 isampler2DMS_value = texelFetch(fs_sampler_2d_multisample_int,  ivec2(0), 0);\n"
63	"\n"
64	"    result  =       sampler2DMS_value  +\n"
65	"              vec4(usampler2DMS_value) +\n"
66	"              vec4(isampler2DMS_value);\n"
67	"}\n";
68
69const char* MultisampleTextureGetActiveUniformSamplersTest::fs_body_oes =
70	"#version 310 es\n"
71	"\n"
72	"#extension GL_OES_texture_storage_multisample_2d_array : enable\n"
73	"precision highp float;\n"
74	"\n"
75	"uniform highp sampler2DMS       fs_sampler_2d_multisample;\n"
76	"uniform highp sampler2DMSArray  fs_sampler_2d_multisample_array;\n"
77	"uniform highp usampler2DMS      fs_sampler_2d_multisample_uint;\n"
78	"uniform highp usampler2DMSArray fs_sampler_2d_multisample_array_uint;\n"
79	"uniform highp isampler2DMS      fs_sampler_2d_multisample_int;\n"
80	"uniform highp isampler2DMSArray fs_sampler_2d_multisample_array_int;\n"
81	"\n"
82	"out vec4 result;\n"
83	"\n"
84	"void main()\n"
85	"{\n"
86	"    vec4  sampler2DMS_value       = texelFetch(fs_sampler_2d_multisample,            ivec2(0), 0);\n"
87	"    vec4  sampler2DMSArray_value  = texelFetch(fs_sampler_2d_multisample_array,      ivec3(0), 0);\n"
88	"    uvec4 usampler2DMS_value      = texelFetch(fs_sampler_2d_multisample_uint,       ivec2(0), 0);\n"
89	"    uvec4 usampler2DMSArray_value = texelFetch(fs_sampler_2d_multisample_array_uint, ivec3(0), 0);\n"
90	"    ivec4 isampler2DMS_value      = texelFetch(fs_sampler_2d_multisample_int,        ivec2(0), 0);\n"
91	"    ivec4 isampler2DMSArray_value = texelFetch(fs_sampler_2d_multisample_array_int,  ivec3(0), 0);\n"
92	"\n"
93	"    result  =       sampler2DMS_value  +       sampler2DMSArray_value  +\n"
94	"              vec4(usampler2DMS_value) + vec4(usampler2DMSArray_value) +\n"
95	"              vec4(isampler2DMS_value) + vec4(isampler2DMSArray_value);\n"
96	"}\n";
97
98const char* MultisampleTextureGetActiveUniformSamplersTest::vs_body =
99	"#version 310 es\n"
100	"\n"
101	"precision highp float;\n"
102	"\n"
103	"uniform highp sampler2DMS  vs_sampler_2d_multisample;\n"
104	"uniform highp usampler2DMS vs_sampler_2d_multisample_uint;\n"
105	"uniform highp isampler2DMS vs_sampler_2d_multisample_int;\n"
106	"\n"
107	"out vec4 result;\n"
108	"\n"
109	"void main()\n"
110	"{\n"
111	"    vec4  sampler2DMS_value  = texelFetch(vs_sampler_2d_multisample,      ivec2(0), 0);\n"
112	"    uvec4 usampler2DMS_value = texelFetch(vs_sampler_2d_multisample_uint, ivec2(0), 0);\n"
113	"    ivec4 isampler2DMS_value = texelFetch(vs_sampler_2d_multisample_int,  ivec2(0), 0);\n"
114	"\n"
115	"    gl_Position =       sampler2DMS_value  +\n"
116	"                  vec4(usampler2DMS_value) +\n"
117	"                  vec4(isampler2DMS_value);\n"
118	"}\n";
119
120const char* MultisampleTextureGetActiveUniformSamplersTest::vs_body_oes =
121	"#version 310 es\n"
122	"\n"
123	"#extension GL_OES_texture_storage_multisample_2d_array : enable\n"
124	"precision highp float;\n"
125	"\n"
126	"uniform highp sampler2DMS       vs_sampler_2d_multisample;\n"
127	"uniform highp sampler2DMSArray  vs_sampler_2d_multisample_array;\n"
128	"uniform highp usampler2DMS      vs_sampler_2d_multisample_uint;\n"
129	"uniform highp usampler2DMSArray vs_sampler_2d_multisample_array_uint;\n"
130	"uniform highp isampler2DMS      vs_sampler_2d_multisample_int;\n"
131	"uniform highp isampler2DMSArray vs_sampler_2d_multisample_array_int;\n"
132	"\n"
133	"out vec4 result;\n"
134	"\n"
135	"void main()\n"
136	"{\n"
137	"    vec4  sampler2DMS_value       = texelFetch(vs_sampler_2d_multisample,            ivec2(0), 0);\n"
138	"    vec4  sampler2DMSArray_value  = texelFetch(vs_sampler_2d_multisample_array,      ivec3(0), 0);\n"
139	"    uvec4 usampler2DMS_value      = texelFetch(vs_sampler_2d_multisample_uint,       ivec2(0), 0);\n"
140	"    uvec4 usampler2DMSArray_value = texelFetch(vs_sampler_2d_multisample_array_uint, ivec3(0), 0);\n"
141	"    ivec4 isampler2DMS_value      = texelFetch(vs_sampler_2d_multisample_int,        ivec2(0), 0);\n"
142	"    ivec4 isampler2DMSArray_value = texelFetch(vs_sampler_2d_multisample_array_int,  ivec3(0), 0);\n"
143	"\n"
144	"    gl_Position =       sampler2DMS_value  +       sampler2DMSArray_value  +\n"
145	"                  vec4(usampler2DMS_value) + vec4(usampler2DMSArray_value) +\n"
146	"                  vec4(isampler2DMS_value) + vec4(isampler2DMSArray_value);\n"
147	"}\n";
148
149/** Constructor.
150 *
151 *  @param context Rendering context handle.
152 **/
153MultisampleTextureGetActiveUniformSamplersTest::MultisampleTextureGetActiveUniformSamplersTest(Context& context)
154	: TestCase(context, "multisample_texture_samplers", "Verifies multisample texture samplers are reported correctly")
155	, fs_id(0)
156	, gl_oes_texture_storage_multisample_2d_array_supported(GL_FALSE)
157	, po_id(0)
158	, vs_id(0)
159{
160	/* Left blank on purpose */
161}
162
163/** Deinitializes ES objects created during test execution */
164void MultisampleTextureGetActiveUniformSamplersTest::deinit()
165{
166	/* Call base class' deinit() */
167	TestCase::deinit();
168}
169
170/** Initializes test-specific ES objects */
171void MultisampleTextureGetActiveUniformSamplersTest::initInternals()
172{
173	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
174
175	fs_id = gl.createShader(GL_FRAGMENT_SHADER);
176	po_id = gl.createProgram();
177	vs_id = gl.createShader(GL_VERTEX_SHADER);
178
179	GLU_EXPECT_NO_ERROR(gl.getError(), "Shader or program creation failed");
180}
181
182/** Removes test-specific ES objects */
183void MultisampleTextureGetActiveUniformSamplersTest::deinitInternals()
184{
185	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
186
187	gl.deleteShader(fs_id);
188	gl.deleteProgram(po_id);
189	gl.deleteShader(vs_id);
190
191	GLU_EXPECT_NO_ERROR(gl.getError(), "Shader or program delete failed");
192}
193
194/** Executes test iteration.
195 *
196 *  @return Returns STOP when test has finished executing, CONTINUE if more iterations are needed.
197 */
198tcu::TestNode::IterateResult MultisampleTextureGetActiveUniformSamplersTest::iterate()
199{
200	gl_oes_texture_storage_multisample_2d_array_supported =
201		m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array");
202
203	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
204
205	initInternals();
206
207	/* Configure the test program object */
208	gl.attachShader(po_id, fs_id);
209	gl.attachShader(po_id, vs_id);
210
211	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not configure the test program object");
212
213	/* Compile the fragment shader */
214	glw::GLint compile_status = GL_FALSE;
215
216	if (gl_oes_texture_storage_multisample_2d_array_supported)
217	{
218		gl.shaderSource(fs_id, 1,			 /* count */
219						&fs_body_oes, NULL); /* length */
220	}
221	else
222	{
223		gl.shaderSource(fs_id, 1,		 /* count */
224						&fs_body, NULL); /* length */
225	}
226
227	GLU_EXPECT_NO_ERROR(gl.getError(), "glShaderSource() call failed.");
228
229	gl.compileShader(fs_id);
230	GLU_EXPECT_NO_ERROR(gl.getError(), "glCompileShader() call failed.");
231
232	gl.getShaderiv(fs_id, GL_COMPILE_STATUS, &compile_status);
233
234	if (compile_status != GL_TRUE)
235	{
236		TCU_FAIL("Fragment shader compilation failed.");
237	}
238
239	if (gl_oes_texture_storage_multisample_2d_array_supported)
240	{
241		/* Compile the vertex shader */
242		gl.shaderSource(vs_id, 1,			 /* count */
243						&vs_body_oes, NULL); /* length */
244	}
245	else
246	{
247		/* Compile the vertex shader */
248		gl.shaderSource(vs_id, 1,		 /* count */
249						&vs_body, NULL); /* length */
250	}
251
252	GLU_EXPECT_NO_ERROR(gl.getError(), "glShaderSource() call failed.");
253
254	gl.compileShader(vs_id);
255	GLU_EXPECT_NO_ERROR(gl.getError(), "glCompileShader() call failed.");
256
257	gl.getShaderiv(vs_id, GL_COMPILE_STATUS, &compile_status);
258
259	if (compile_status != GL_TRUE)
260	{
261		char temp[1024];
262
263		gl.getShaderInfoLog(vs_id, 1024, 0, temp);
264
265		TCU_FAIL("Vertex shader compilation failed.");
266	}
267
268	/* Link the test program object */
269	glw::GLint link_status = GL_FALSE;
270
271	gl.linkProgram(po_id);
272	GLU_EXPECT_NO_ERROR(gl.getError(), "glLinkProgram() call failed.");
273
274	gl.getProgramiv(po_id, GL_LINK_STATUS, &link_status);
275
276	if (link_status != GL_TRUE)
277	{
278		TCU_FAIL("Program linking failed.");
279	}
280
281	/* Retrieve amount of active uniforms */
282	glw::GLint n_active_uniforms = 0;
283
284	gl.getProgramiv(po_id, GL_ACTIVE_UNIFORMS, &n_active_uniforms);
285	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetProgramiv() call (GL_ACTIVE_UNIFORMS) failed.");
286
287	/* Allocate a buffer that will hold uniform names */
288	glw::GLint max_active_uniform_length = 0;
289	char*	  uniform_name				 = NULL;
290
291	gl.getProgramiv(po_id, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_active_uniform_length);
292	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetProgramiv() call (GL_ACTIVE_UNIFORM_MAX_LENGTH) failed.");
293
294	uniform_name = new char[max_active_uniform_length];
295
296	/* Prepare an array of booleans. Each cell, set to false by default, will tell
297	 * whether a corresponding uniform has already been reported.
298	 */
299	enum
300	{
301		SHADER_UNIFORM_FS_MULTISAMPLE,
302		SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY,
303		SHADER_UNIFORM_FS_MULTISAMPLE_UINT,
304		SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY_UINT,
305		SHADER_UNIFORM_FS_MULTISAMPLE_INT,
306		SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY_INT,
307
308		SHADER_UNIFORM_VS_MULTISAMPLE,
309		SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY,
310		SHADER_UNIFORM_VS_MULTISAMPLE_UINT,
311		SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY_UINT,
312		SHADER_UNIFORM_VS_MULTISAMPLE_INT,
313		SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY_INT,
314
315		SHADER_UNIFORM_COUNT
316	};
317
318	bool shader_uniform_reported_status[SHADER_UNIFORM_COUNT];
319
320	memset(shader_uniform_reported_status, 0, sizeof(shader_uniform_reported_status));
321
322	/* Iterate through all active uniforms. */
323	for (int n_uniform = 0; n_uniform < n_active_uniforms; ++n_uniform)
324	{
325		glw::GLint  uniform_size = 0;
326		glw::GLenum uniform_type = GL_NONE;
327
328		/* Retrieve uniform properties */
329		gl.getActiveUniform(po_id, n_uniform, max_active_uniform_length, NULL, /* length */
330							&uniform_size, &uniform_type, uniform_name);
331		GLU_EXPECT_NO_ERROR(gl.getError(), "glGetActiveUniform() call failed");
332
333		/* Check if the reported name is valid and that the type and size
334		 * retrieved matches the uniform.
335		 * Also verify that the uniform has not been already reported.
336		 */
337		if (strcmp(uniform_name, "fs_sampler_2d_multisample") == 0)
338		{
339			if (shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE])
340			{
341				TCU_FAIL("fs_sampler_2d_multisample uniform is reported more than once");
342			}
343
344			if (uniform_type != GL_SAMPLER_2D_MULTISAMPLE)
345			{
346				TCU_FAIL("Invalid uniform type reported for fs_sampler_2d_multisample uniform");
347			}
348
349			shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE] = true;
350		}
351		else if (strcmp(uniform_name, "fs_sampler_2d_multisample_array") == 0)
352		{
353			if (gl_oes_texture_storage_multisample_2d_array_supported)
354			{
355				if (shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY])
356				{
357					TCU_FAIL("fs_sampler_2d_multisample_array uniform is reported more than once");
358				}
359
360				if (uniform_type != GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES)
361				{
362					TCU_FAIL("Invalid uniform type reported for fs_sampler_2d_multisample_array uniform");
363				}
364
365				shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY] = true;
366			}
367			else
368			{
369				TCU_FAIL("Unsupported active uniform type reported.");
370			}
371		}
372		else if (strcmp(uniform_name, "fs_sampler_2d_multisample_uint") == 0)
373		{
374			if (shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_UINT])
375			{
376				TCU_FAIL("fs_sampler_2d_multisample_uint uniform is reported more than once");
377			}
378
379			if (uniform_type != GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE)
380			{
381				TCU_FAIL("Invalid uniform type reported for fs_sampler_2d_multisample_uint uniform");
382			}
383
384			shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_UINT] = true;
385		}
386		else if (strcmp(uniform_name, "fs_sampler_2d_multisample_array_uint") == 0)
387		{
388			if (gl_oes_texture_storage_multisample_2d_array_supported)
389			{
390				if (shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY_UINT])
391				{
392					TCU_FAIL("fs_sampler_2d_multisample_array_uint uniform is reported more than once");
393				}
394
395				if (uniform_type != GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES)
396				{
397					TCU_FAIL("Invalid uniform type reported for fs_sampler_2d_multisample_array_uint uniform");
398				}
399
400				shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY_UINT] = true;
401			}
402			else
403			{
404				TCU_FAIL("Unsupported active uniform type reported.");
405			}
406		}
407		else if (strcmp(uniform_name, "fs_sampler_2d_multisample_int") == 0)
408		{
409			if (shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_INT])
410			{
411				TCU_FAIL("fs_sampler_2d_multisample_int uniform is reported more than once");
412			}
413
414			if (uniform_type != GL_INT_SAMPLER_2D_MULTISAMPLE)
415			{
416				TCU_FAIL("Invalid uniform type reported for fs_sampler_2d_multisample_int uniform");
417			}
418
419			shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_INT] = true;
420		}
421		else if (strcmp(uniform_name, "fs_sampler_2d_multisample_array_int") == 0)
422		{
423			if (gl_oes_texture_storage_multisample_2d_array_supported)
424			{
425				if (shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY_INT])
426				{
427					TCU_FAIL("fs_sampler_2d_multisample_array_int uniform is reported more than once");
428				}
429
430				if (uniform_type != GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES)
431				{
432					TCU_FAIL("Invalid uniform type reported for fs_sampler_2d_multisample_array_int uniform");
433				}
434
435				shader_uniform_reported_status[SHADER_UNIFORM_FS_MULTISAMPLE_ARRAY_INT] = true;
436			}
437			else
438			{
439				TCU_FAIL("Unsupported active uniform type reported.");
440			}
441		}
442		else if (strcmp(uniform_name, "vs_sampler_2d_multisample") == 0)
443		{
444			if (shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE])
445			{
446				TCU_FAIL("vs_sampler_2d_multisample uniform is reported more than once");
447			}
448
449			if (uniform_type != GL_SAMPLER_2D_MULTISAMPLE)
450			{
451				TCU_FAIL("Invalid uniform type reported for vs_sampler_2d_multisample uniform");
452			}
453
454			shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE] = true;
455		}
456		else if (strcmp(uniform_name, "vs_sampler_2d_multisample_array") == 0)
457		{
458			if (gl_oes_texture_storage_multisample_2d_array_supported)
459			{
460				if (shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY])
461				{
462					TCU_FAIL("vs_sampler_2d_multisample_array uniform is reported more than once");
463				}
464
465				if (uniform_type != GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES)
466				{
467					TCU_FAIL("Invalid uniform type reported for vs_sampler_2d_multisample_array uniform");
468				}
469
470				shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY] = true;
471			}
472			else
473			{
474				TCU_FAIL("Unsupported active uniform type reported.");
475			}
476		}
477		else if (strcmp(uniform_name, "vs_sampler_2d_multisample_uint") == 0)
478		{
479			if (shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_UINT])
480			{
481				TCU_FAIL("vs_sampler_2d_multisample_uint uniform is reported more than once");
482			}
483
484			if (uniform_type != GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE)
485			{
486				TCU_FAIL("Invalid uniform type reported for vs_sampler_2d_multisample_uint uniform");
487			}
488
489			shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_UINT] = true;
490		}
491		else if (strcmp(uniform_name, "vs_sampler_2d_multisample_array_uint") == 0)
492		{
493			if (gl_oes_texture_storage_multisample_2d_array_supported)
494			{
495				if (shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY_UINT])
496				{
497					TCU_FAIL("vs_sampler_2d_multisample_array_uint uniform is reported more than once");
498				}
499
500				if (uniform_type != GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES)
501				{
502					TCU_FAIL("Invalid uniform type reported for vs_sampler_2d_multisample_array_uint uniform");
503				}
504
505				shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY_UINT] = true;
506			}
507			else
508			{
509				TCU_FAIL("Unsupported active uniform type reported.");
510			}
511		}
512		else if (strcmp(uniform_name, "vs_sampler_2d_multisample_int") == 0)
513		{
514			if (shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_INT])
515			{
516				TCU_FAIL("vs_sampler_2d_multisample_int uniform is reported more than once");
517			}
518
519			if (uniform_type != GL_INT_SAMPLER_2D_MULTISAMPLE)
520			{
521				TCU_FAIL("Invalid uniform type reported for vs_sampler_2d_multisample_int uniform");
522			}
523
524			shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_INT] = true;
525		}
526		else if (strcmp(uniform_name, "vs_sampler_2d_multisample_array_int") == 0)
527		{
528			if (gl_oes_texture_storage_multisample_2d_array_supported)
529			{
530				if (shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY_INT])
531				{
532					TCU_FAIL("vs_sampler_2d_multisample_array_int uniform is reported more than once");
533				}
534
535				if (uniform_type != GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES)
536				{
537					TCU_FAIL("Invalid uniform type reported for vs_sampler_2d_multisample_array_int uniform");
538				}
539
540				shader_uniform_reported_status[SHADER_UNIFORM_VS_MULTISAMPLE_ARRAY_INT] = true;
541			}
542			else
543			{
544				TCU_FAIL("Unsupported active uniform type reported.");
545			}
546		}
547		else
548		{
549			m_testCtx.getLog() << tcu::TestLog::Message << "Unrecognized active uniform [" << uniform_name
550							   << "] of type [" << uniform_type << "] was reported." << tcu::TestLog::EndMessage;
551
552			TCU_FAIL("Unrecognized active uniform type reported.");
553		}
554	} /* for (all active uniforms) */
555
556	/* sampler2DMSArray, isampler2DMSArray and usampler2DMSArray are part of the
557	 * OES_texture_storage_multisample_2d_array extension and should only be reported
558	 * if the extension is supported */
559	bool expected_result[SHADER_UNIFORM_COUNT]	 = { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 };
560	bool expected_result_oes[SHADER_UNIFORM_COUNT] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
561
562	/* Make sure all sampler uniforms we were expecting have been reported */
563	for (unsigned int n_sampler_type = 0; n_sampler_type < SHADER_UNIFORM_COUNT; ++n_sampler_type)
564	{
565		if (gl_oes_texture_storage_multisample_2d_array_supported)
566		{
567			if (shader_uniform_reported_status[n_sampler_type] != expected_result_oes[n_sampler_type])
568			{
569				m_testCtx.getLog() << tcu::TestLog::Message << "Sampler type [" << n_sampler_type
570								   << "] has not been reported by glGetActiveUniform()." << tcu::TestLog::EndMessage;
571
572				TCU_FAIL(
573					"At least one expected multisample texture sampler has not been reported by glGetActiveUniform()");
574			}
575		}
576		else
577		{
578			if (shader_uniform_reported_status[n_sampler_type] != expected_result[n_sampler_type])
579			{
580				m_testCtx.getLog() << tcu::TestLog::Message << "Sampler type [" << n_sampler_type
581								   << "] has not been reported by glGetActiveUniform()." << tcu::TestLog::EndMessage;
582
583				TCU_FAIL(
584					"At least one expected multisample texture sampler has not been reported by glGetActiveUniform()");
585			}
586		}
587	} /* for (all shader uniform types) */
588
589	/* Done */
590	deinitInternals();
591	delete[] uniform_name;
592	uniform_name = NULL;
593
594	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
595	return STOP;
596}
597
598} /* glcts namespace */
599