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  * \file esextcTextureBorderClampTexParameterIErrors.cpp
26  * \brief Texture Border Clamp glTexParameterIivEXT(), glTexParameterIuivEXT() Errors (Test 2)
27  */ /*-------------------------------------------------------------------*/
28 
29 #include "esextcTextureBorderClampTexParameterIErrors.hpp"
30 #include "gluContextInfo.hpp"
31 #include "gluDefs.hpp"
32 #include "gluStrUtil.hpp"
33 #include "glwEnums.hpp"
34 #include "glwFunctions.hpp"
35 #include "tcuTestLog.hpp"
36 
37 namespace glcts
38 {
39 
40 /** Constructor
41  *
42  *  @param context     Test context
43  *  @param name        Test case's name
44  *  @param description Test case's description
45  **/
TextureBorderClampTexParameterIErrorsTest(Context & context,const ExtParameters & extParams,const char * name,const char * description)46 TextureBorderClampTexParameterIErrorsTest::TextureBorderClampTexParameterIErrorsTest(Context&			  context,
47 																					 const ExtParameters& extParams,
48 																					 const char*		  name,
49 																					 const char*		  description)
50 	: TextureBorderClampBase(context, extParams, name, description), m_test_passed(true)
51 {
52 	/* Left blank on purpose */
53 }
54 
55 /** Initializes GLES objects used during the test.
56  *
57  */
initTest(void)58 void TextureBorderClampTexParameterIErrorsTest::initTest(void)
59 {
60 	if (!m_is_texture_border_clamp_supported)
61 	{
62 		throw tcu::NotSupportedError(TEXTURE_BORDER_CLAMP_NOT_SUPPORTED, "", __FILE__, __LINE__);
63 	}
64 
65 	/* Initialize base class */
66 	TextureBorderClampBase::initTest();
67 }
68 
69 /** Executes the test.
70  *
71  *  Sets the test result to QP_TEST_RESULT_FAIL if the test failed, QP_TEST_RESULT_PASS otherwise.
72  *
73  *  Note the function throws exception should an error occur!
74  *
75  *  @return STOP if the test has finished, CONTINUE to indicate iterate should be called once again.
76  **/
iterate(void)77 tcu::TestNode::IterateResult TextureBorderClampTexParameterIErrorsTest::iterate(void)
78 {
79 	initTest();
80 
81 	/* Make sure that the functions report GL_INVALID_ENUM error if cube-map
82 	 *  face or GL_TEXTURE_BUFFER_EXT texture targets (if supported) is issued as
83 	 *  a texture target.*/
84 	if (m_is_texture_buffer_supported)
85 	{
86 		VerifyGLTexParameterIiv(m_glExtTokens.TEXTURE_BUFFER, GL_TEXTURE_BASE_LEVEL, 1, GL_INVALID_ENUM);
87 		VerifyGLTexParameterIuiv(m_glExtTokens.TEXTURE_BUFFER, GL_TEXTURE_BASE_LEVEL, 1, GL_INVALID_ENUM);
88 	}
89 
90 	VerifyGLTexParameterIiv(GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_BASE_LEVEL, 1, GL_INVALID_ENUM);
91 	VerifyGLTexParameterIuiv(GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_BASE_LEVEL, 1, GL_INVALID_ENUM);
92 
93 	/* Make sure that the functions report GL_INVALID_ENUM error if
94 	 * GL_TEXTURE_IMMUTABLE_FORMAT is passed by pname argument.*/
95 	VerifyGLTexParameterIivForAll(GL_TEXTURE_IMMUTABLE_FORMAT, 1, GL_INVALID_ENUM);
96 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_IMMUTABLE_FORMAT, 1, GL_INVALID_ENUM);
97 
98 	/* Make sure that the functions report GL_INVALID_VALUE error if the following
99 	 * pname+value combinations are used: */
100 
101 	/* GL_TEXTURE_BASE_LEVEL  -1 (iv() version only)*/
102 	VerifyGLTexParameterIivTextureBaseLevelForAll(GL_TEXTURE_BASE_LEVEL, -1, GL_INVALID_VALUE);
103 	/* GL_TEXTURE_MAX_LEVEL, -1; (iv() version only) */
104 	VerifyGLTexParameterIivForAll(GL_TEXTURE_MAX_LEVEL, -1, GL_INVALID_VALUE);
105 
106 	/* Make sure that the functions report GL_INVALID_ENUM error if the following
107 	 * pname+value combinations are used: */
108 
109 	/* GL_TEXTURE_COMPARE_MODE, GL_NEAREST */
110 	VerifyGLTexParameterIivForAll(GL_TEXTURE_COMPARE_MODE, GL_NEAREST, GL_INVALID_ENUM);
111 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_COMPARE_MODE, GL_NEAREST, GL_INVALID_ENUM);
112 
113 	/* GL_TEXTURE_COMPARE_FUNC, GL_NEAREST;*/
114 	VerifyGLTexParameterIivForAll(GL_TEXTURE_COMPARE_FUNC, GL_NEAREST, GL_INVALID_ENUM);
115 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_COMPARE_FUNC, GL_NEAREST, GL_INVALID_ENUM);
116 
117 	/* GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST;*/
118 	VerifyGLTexParameterIivForAll(GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST, GL_INVALID_ENUM);
119 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST, GL_INVALID_ENUM);
120 
121 	/* GL_TEXTURE_MIN_FILTER, GL_RED */
122 	VerifyGLTexParameterIivForAll(GL_TEXTURE_MIN_FILTER, GL_RED, GL_INVALID_ENUM);
123 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_MIN_FILTER, GL_RED, GL_INVALID_ENUM);
124 
125 	/* GL_TEXTURE_SWIZZLE_R, GL_NEAREST */
126 	VerifyGLTexParameterIivForAll(GL_TEXTURE_SWIZZLE_R, GL_NEAREST, GL_INVALID_ENUM);
127 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_SWIZZLE_R, GL_NEAREST, GL_INVALID_ENUM);
128 
129 	/* GL_TEXTURE_SWIZZLE_G, GL_NEAREST */
130 	VerifyGLTexParameterIivForAll(GL_TEXTURE_SWIZZLE_G, GL_NEAREST, GL_INVALID_ENUM);
131 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_SWIZZLE_G, GL_NEAREST, GL_INVALID_ENUM);
132 
133 	/* GL_TEXTURE_SWIZZLE_B, GL_NEAREST */
134 	VerifyGLTexParameterIivForAll(GL_TEXTURE_SWIZZLE_B, GL_NEAREST, GL_INVALID_ENUM);
135 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_SWIZZLE_B, GL_NEAREST, GL_INVALID_ENUM);
136 
137 	/* GL_TEXTURE_SWIZZLE_A, GL_NEAREST */
138 	VerifyGLTexParameterIivForAll(GL_TEXTURE_SWIZZLE_A, GL_NEAREST, GL_INVALID_ENUM);
139 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_SWIZZLE_A, GL_NEAREST, GL_INVALID_ENUM);
140 
141 	/* GL_TEXTURE_WRAP_S, GL_RED */
142 	VerifyGLTexParameterIivForAll(GL_TEXTURE_WRAP_S, GL_RED, GL_INVALID_ENUM);
143 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_WRAP_S, GL_RED, GL_INVALID_ENUM);
144 
145 	/* GL_TEXTURE_WRAP_T, GL_RED */
146 	VerifyGLTexParameterIivForAll(GL_TEXTURE_WRAP_T, GL_RED, GL_INVALID_ENUM);
147 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_WRAP_T, GL_RED, GL_INVALID_ENUM);
148 
149 	/* GL_TEXTURE_WRAP_R, GL_RED */
150 	VerifyGLTexParameterIivForAll(GL_TEXTURE_WRAP_R, GL_RED, GL_INVALID_ENUM);
151 	VerifyGLTexParameterIuivForAll(GL_TEXTURE_WRAP_R, GL_RED, GL_INVALID_ENUM);
152 
153 	/* Make sure that the functions report GL_INVALID_ENUM error if the following
154 	 * pname+value pairs are used for GL_TEXTURE_2D_MULTISAMPLE or
155 	 * GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES targets: */
156 	if (m_is_texture_storage_multisample_supported)
157 	{
158 		/* GL_TEXTURE_COMPARE_MODE, GL_NONE */
159 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_MODE, GL_NONE, GL_INVALID_ENUM);
160 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_MODE, GL_NONE, GL_INVALID_ENUM);
161 
162 		/* GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL */
163 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL, GL_INVALID_ENUM);
164 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL, GL_INVALID_ENUM);
165 
166 		/* GL_TEXTURE_MAG_FILTER, GL_LINEAR */
167 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR, GL_INVALID_ENUM);
168 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR, GL_INVALID_ENUM);
169 
170 		/* GL_TEXTURE_MAX_LOD, 1000 */
171 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD, 1000, GL_INVALID_ENUM);
172 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD, 1000, GL_INVALID_ENUM);
173 
174 		/* GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR */
175 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR,
176 								GL_INVALID_ENUM);
177 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR,
178 								 GL_INVALID_ENUM);
179 
180 		/* GL_TEXTURE_MIN_LOD, -1000 */
181 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_LOD, -1000, GL_INVALID_ENUM);
182 
183 		/* GL_TEXTURE_WRAP_S, GL_REPEAT */
184 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, GL_REPEAT, GL_INVALID_ENUM);
185 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, GL_REPEAT, GL_INVALID_ENUM);
186 
187 		/* GL_TEXTURE_WRAP_T, GL_REPEAT */
188 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, GL_REPEAT, GL_INVALID_ENUM);
189 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, GL_REPEAT, GL_INVALID_ENUM);
190 
191 		/* GL_TEXTURE_WRAP_R, GL_REPEAT */
192 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_R, GL_REPEAT, GL_INVALID_ENUM);
193 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_R, GL_REPEAT, GL_INVALID_ENUM);
194 
195 	} /* if (m_is_texture_storage_multisample_supported) */
196 
197 	if (m_is_texture_storage_multisample_2d_array_supported)
198 	{
199 		/* GL_TEXTURE_COMPARE_MODE, GL_NONE */
200 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_COMPARE_MODE, GL_NONE, GL_INVALID_ENUM);
201 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_COMPARE_MODE, GL_NONE,
202 								 GL_INVALID_ENUM);
203 
204 		/* GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL */
205 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL,
206 								GL_INVALID_ENUM);
207 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL,
208 								 GL_INVALID_ENUM);
209 
210 		/* GL_TEXTURE_MAG_FILTER, GL_LINEAR */
211 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR, GL_INVALID_ENUM);
212 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR,
213 								 GL_INVALID_ENUM);
214 
215 		/* GL_TEXTURE_MAX_LOD, 1000 */
216 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_MAX_LOD, 1000, GL_INVALID_ENUM);
217 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_MAX_LOD, 1000, GL_INVALID_ENUM);
218 
219 		/* GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR */
220 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR,
221 								GL_INVALID_ENUM);
222 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR,
223 								 GL_INVALID_ENUM);
224 
225 		/* GL_TEXTURE_MIN_LOD, -1000 */
226 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_MIN_LOD, -1000, GL_INVALID_ENUM);
227 
228 		/* GL_TEXTURE_WRAP_S, GL_REPEAT */
229 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_WRAP_S, GL_REPEAT, GL_INVALID_ENUM);
230 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_WRAP_S, GL_REPEAT, GL_INVALID_ENUM);
231 
232 		/* GL_TEXTURE_WRAP_T, GL_REPEAT */
233 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_WRAP_T, GL_REPEAT, GL_INVALID_ENUM);
234 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_WRAP_T, GL_REPEAT, GL_INVALID_ENUM);
235 
236 		/* GL_TEXTURE_WRAP_R, GL_REPEAT */
237 		VerifyGLTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_WRAP_R, GL_REPEAT, GL_INVALID_ENUM);
238 		VerifyGLTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, GL_TEXTURE_WRAP_R, GL_REPEAT, GL_INVALID_ENUM);
239 
240 	} /* if (m_is_texture_storage_multisample_2d_array_supported) */
241 
242 	if (m_test_passed)
243 	{
244 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
245 	}
246 	else
247 	{
248 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
249 	}
250 
251 	return STOP;
252 }
253 
254 /** Check if glTexParameterIivEXT() reports an user-specified error if called with
255  *  provided arguments.
256  *
257  *  @param target         texture target to use for the call;
258  *  @param pname          value of parameter name to use for the call;
259  *  @param param          parameter value to use for the call;
260  *  @param expected_error expected GL error code.
261  */
VerifyGLTexParameterIiv(glw::GLenum target,glw::GLenum pname,glw::GLint params,glw::GLenum expected_error)262 void TextureBorderClampTexParameterIErrorsTest::VerifyGLTexParameterIiv(glw::GLenum target, glw::GLenum pname,
263 																		glw::GLint params, glw::GLenum expected_error)
264 {
265 	glw::GLenum			  error_code = GL_NO_ERROR;
266 	const glw::Functions& gl		 = m_context.getRenderContext().getFunctions();
267 
268 	gl.texParameterIiv(target, pname, &params);
269 
270 	error_code = gl.getError();
271 	if (expected_error != error_code)
272 	{
273 		m_test_passed = false;
274 
275 		m_testCtx.getLog() << tcu::TestLog::Message << "glTexParameterIivEXT() failed:["
276 						   << "target:" << getTexTargetString(target) << ", pname:" << getPNameString(pname)
277 						   << "] reported error code:[" << glu::getErrorStr(error_code) << "] expected error code:["
278 						   << glu::getErrorStr(expected_error) << "]\n"
279 						   << tcu::TestLog::EndMessage;
280 	}
281 }
282 
283 /** Check if glTexParameterIivEXT() reports one of two user specified errors if called with
284  *  provided arguments.
285  *
286  *  @param target          texture target to use for the call;
287  *  @param pname           value of parameter name to use for the call;
288  *  @param param           parameter value to use for the call;
289  *  @param expected_error1 one of the expected GL error codes.
290  *  @param expected_error2 one of the expected GL error codes.
291  */
VerifyGLTexParameterIivMultipleAcceptedErrors(glw::GLenum target,glw::GLenum pname,glw::GLint params,glw::GLenum expected_error1,glw::GLenum expected_error2)292 void TextureBorderClampTexParameterIErrorsTest::VerifyGLTexParameterIivMultipleAcceptedErrors(
293 	glw::GLenum target, glw::GLenum pname, glw::GLint params, glw::GLenum expected_error1, glw::GLenum expected_error2)
294 {
295 	glw::GLenum			  error_code = GL_NO_ERROR;
296 	const glw::Functions& gl		 = m_context.getRenderContext().getFunctions();
297 
298 	gl.texParameterIiv(target, pname, &params);
299 
300 	error_code = gl.getError();
301 	if (expected_error1 != error_code && expected_error2 != error_code)
302 	{
303 		m_test_passed = false;
304 
305 		m_testCtx.getLog() << tcu::TestLog::Message << "glTexParameterIivEXT() failed:["
306 						   << "target:" << getTexTargetString(target) << ", pname:" << getPNameString(pname)
307 						   << "] reported error code:[" << glu::getErrorStr(error_code) << "] expected error code:["
308 						   << glu::getErrorStr(expected_error1) << "] or error code ["
309 						   << glu::getErrorStr(expected_error2) << "]\n"
310 						   << tcu::TestLog::EndMessage;
311 	}
312 }
313 
314 /** Check if glTexParameterIuivEXT() reports an user-specified error if called with
315  *  provided arguments.
316  *
317  *  @param target         texture target to use for the call;
318  *  @param pname          value of parameter name to use for the call;
319  *  @param param          parameter value to use for the call;
320  *  @param expected_error expected GL error code.
321  */
VerifyGLTexParameterIuiv(glw::GLenum target,glw::GLenum pname,glw::GLuint params,glw::GLenum expected_error)322 void TextureBorderClampTexParameterIErrorsTest::VerifyGLTexParameterIuiv(glw::GLenum target, glw::GLenum pname,
323 																		 glw::GLuint params, glw::GLenum expected_error)
324 {
325 	glw::GLenum			  error_code = GL_NO_ERROR;
326 	const glw::Functions& gl		 = m_context.getRenderContext().getFunctions();
327 
328 	gl.texParameterIuiv(target, pname, &params);
329 
330 	error_code = gl.getError();
331 	if (expected_error != error_code)
332 	{
333 		m_test_passed = false;
334 
335 		m_testCtx.getLog() << tcu::TestLog::Message << "glTexParameterIuivEXT() failed:["
336 						   << "target:" << getTexTargetString(target) << ", pname:" << getPNameString(pname)
337 						   << "] reported error code:[" << glu::getErrorStr(error_code) << "] expected error code:["
338 						   << glu::getErrorStr(expected_error) << "]\n"
339 						   << tcu::TestLog::EndMessage;
340 	}
341 }
342 
343 /** Check if glTexParameterIuivEXT() reports an user-specified error if called with
344  *  provided arguments. Checks all supported texture targets.
345  *
346  *  @param pname          value of parameter name to use for the call;
347  *  @param params         parameter value to use for the call;
348  *  @param expected_error expected GL error code.
349  */
VerifyGLTexParameterIivForAll(glw::GLenum pname,glw::GLint params,glw::GLenum expected_error)350 void TextureBorderClampTexParameterIErrorsTest::VerifyGLTexParameterIivForAll(glw::GLenum pname, glw::GLint params,
351 																			  glw::GLenum expected_error)
352 {
353 	for (glw::GLuint i = 0; i < m_texture_target_list.size(); ++i)
354 	{
355 		VerifyGLTexParameterIiv(m_texture_target_list[i], /* target texture */
356 								pname, params, expected_error);
357 	}
358 }
359 
360 /** Check if glTexParameterIuivEXT() reports an user-specified error if called with
361  * GL_TEXTURE_BASE_LEVEL as the pname. Checks all supported texture targets. For
362  * multisample targets a param different from 0 should give invalid operation error,
363  * but for any target a negative param should give invalid value error, so for
364  * multisample targets and a negative param, either invalid operation or invalid
365  * value should be accepted.
366  *
367  *  @param pname          value of parameter name to use for the call;
368  *  @param params         parameter value to use for the call;
369  *  @param expected_error expected GL error code.
370  */
VerifyGLTexParameterIivTextureBaseLevelForAll(glw::GLenum pname,glw::GLint params,glw::GLenum expected_error)371 void TextureBorderClampTexParameterIErrorsTest::VerifyGLTexParameterIivTextureBaseLevelForAll(
372 	glw::GLenum pname, glw::GLint params, glw::GLenum expected_error)
373 {
374 	for (glw::GLuint i = 0; i < m_texture_target_list.size(); ++i)
375 	{
376 		if (GL_TEXTURE_2D_MULTISAMPLE == m_texture_target_list[i] ||
377 			GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES == m_texture_target_list[i])
378 		{
379 			/* Negative params can give either invalid operation or invalid value for multisample textures. */
380 			if (0 > params)
381 			{
382 				VerifyGLTexParameterIivMultipleAcceptedErrors(m_texture_target_list[i], /* target texture */
383 															  pname, params, GL_INVALID_OPERATION, GL_INVALID_VALUE);
384 			}
385 			/* Non-zero params give invalid operation for multisample textures. */
386 			else
387 			{
388 				VerifyGLTexParameterIiv(m_texture_target_list[i], /* target texture */
389 										pname, params, GL_INVALID_OPERATION);
390 			}
391 		}
392 		else
393 		{
394 			VerifyGLTexParameterIiv(m_texture_target_list[i], /* target texture */
395 									pname, params, expected_error);
396 		}
397 	}
398 }
399 
400 /** Check if glTexParameterIuivEXT() reports an user-specified error if called with
401  *  provided arguments. Checks all supported texture targets.
402  *
403  *  @param pname          value of parameter name to use for the call;
404  *  @param params         parameter value to use for the call;
405  *  @param expected_error expected GL error code.
406  */
VerifyGLTexParameterIuivForAll(glw::GLenum pname,glw::GLuint params,glw::GLenum expected_error)407 void TextureBorderClampTexParameterIErrorsTest::VerifyGLTexParameterIuivForAll(glw::GLenum pname, glw::GLuint params,
408 																			   glw::GLenum expected_error)
409 {
410 	for (glw::GLuint i = 0; i < m_texture_target_list.size(); ++i)
411 	{
412 		VerifyGLTexParameterIuiv(m_texture_target_list[i] /* target texture */, pname, params, expected_error);
413 	}
414 }
415 
416 } // namespace glcts
417