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