1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 2.0 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 Negative Texture API tests.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "es2fNegativeTextureApiTests.hpp"
25 #include "es2fApiCase.hpp"
26 #include "tcuFormatUtil.hpp"
27 #include "gluContextInfo.hpp"
28 
29 #include <vector>
30 #include <algorithm>
31 
32 #include "glwEnums.hpp"
33 #include "glwDefs.hpp"
34 
35 using namespace glw; // GL types
36 
37 namespace deqp
38 {
39 namespace gles2
40 {
41 namespace Functional
42 {
43 
44 using tcu::TestLog;
45 using std::vector;
46 
cubeFaceToGLFace(tcu::CubeFace face)47 static deUint32 cubeFaceToGLFace (tcu::CubeFace face)
48 {
49 	switch (face)
50 	{
51 		case tcu::CUBEFACE_NEGATIVE_X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
52 		case tcu::CUBEFACE_POSITIVE_X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X;
53 		case tcu::CUBEFACE_NEGATIVE_Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
54 		case tcu::CUBEFACE_POSITIVE_Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
55 		case tcu::CUBEFACE_NEGATIVE_Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
56 		case tcu::CUBEFACE_POSITIVE_Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
57 		default:
58 			DE_ASSERT(DE_FALSE);
59 			return GL_NONE;
60 	}
61 }
62 
63 #define FOR_CUBE_FACES(FACE_GL_VAR, BODY)												\
64 	do																					\
65 	{																					\
66 		for (int faceIterTcu = 0; faceIterTcu < tcu::CUBEFACE_LAST; faceIterTcu++)		\
67 		{																				\
68 			const GLenum FACE_GL_VAR = cubeFaceToGLFace((tcu::CubeFace)faceIterTcu);	\
69 			BODY																		\
70 		}																				\
71 	} while (false)
72 
getCompressedTexSubImage2DFormat(const vector<deInt32> & supported,vector<deInt32> & accepted)73 static void getCompressedTexSubImage2DFormat(const vector<deInt32>& supported, vector<deInt32>& accepted)
74 {
75 	// Find a supported compressed texture format that is accepted by compressedTexSubImage2D()
76 
77 	static const GLuint compressedTexSubImage2DFormats[] =
78 	{
79 		0x83F0,	// GL_COMPRESSED_RGB_S3TC_DXT1_EXT
80 		0x83F1,	// GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
81 		0x8C00,	// GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
82 		0x8C01,	// GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
83 		0x8C02,	// GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
84 		0x8C03	// GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
85 	};
86 
87 	for (int i = 0; i < (int)supported.size(); i++)
88 	{
89 		vector<deInt32>::const_iterator fmt = std::find(supported.begin(), supported.end(), compressedTexSubImage2DFormats[i]);
90 		if (fmt != supported.end())
91 			accepted.push_back(*fmt);
92 	}
93 }
94 
NegativeTextureApiTests(Context & context)95 NegativeTextureApiTests::NegativeTextureApiTests (Context& context)
96 	: TestCaseGroup(context, "texture", "Negative Texture API Cases")
97 {
98 }
99 
~NegativeTextureApiTests(void)100 NegativeTextureApiTests::~NegativeTextureApiTests (void)
101 {
102 }
103 
init(void)104 void NegativeTextureApiTests::init (void)
105 {
106 	// glActiveTexture
107 
108 	ES2F_ADD_API_CASE(activetexture_invalid_texture, "Invalid glActiveTexture() usage",
109 		{
110 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if texture is not one of GL_TEXTUREi, where i ranges from 0 to (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1).");
111 			glActiveTexture(-1);
112 			expectError(GL_INVALID_ENUM);
113 			int numMaxTextureUnits = m_context.getContextInfo().getInt(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
114 			glActiveTexture(GL_TEXTURE0 + numMaxTextureUnits);
115 			expectError(GL_INVALID_ENUM);
116 			m_log << TestLog::EndSection;
117 		});
118 
119 	// glBindTexture
120 
121 	ES2F_ADD_API_CASE(bindtexture_invalid_target, "Invalid glBindTexture() usage",
122 		{
123 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not one of the allowable values.");
124 			glBindTexture(0, 1);
125 			expectError(GL_INVALID_ENUM);
126 			m_log << TestLog::EndSection;
127 		});
128 	ES2F_ADD_API_CASE(bindtexture_type_mismatch, "Invalid glBindTexture() usage",
129 		{
130 			m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if texture was previously created with a target that doesn't match that of target.");
131 			GLuint texture;
132 			glGenTextures(1, &texture);
133 			glBindTexture(GL_TEXTURE_2D, texture);
134 			glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
135 			expectError(GL_INVALID_OPERATION);
136 			glDeleteTextures(1, &texture);
137 			m_log << TestLog::EndSection;
138 		});
139 
140 	// glCompressedTexImage2D
141 
142 	ES2F_ADD_API_CASE(compressedteximage_2d_invalid_target, "Invalid glCompressedTexImage2D() usage",
143 		{
144 			vector<deInt32> compressedFormats;
145 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
146 			if (!compressedFormats.empty())
147 			{
148 				m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
149 				glCompressedTexImage2D(0, 0, compressedFormats[0], 0, 0, 0, 0, 0);
150 				expectError(GL_INVALID_ENUM);
151 				m_log << TestLog::EndSection;
152 			}
153 		});
154 	ES2F_ADD_API_CASE(compressedteximage_2d_invalid_format_tex2d, "Invalid glCompressedTexImage2D() usage",
155 		{
156 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if internalformat is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS.");
157 			glCompressedTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);
158 			expectError(GL_INVALID_ENUM);
159 			m_log << TestLog::EndSection;
160 		});
161 	ES2F_ADD_API_CASE(compressedteximage_2d_invalid_format_cube, "Invalid glCompressedTexImage2D() usage",
162 		{
163 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if internalformat is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS.");
164 			glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0);
165 			expectError(GL_INVALID_ENUM);
166 			glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0);
167 			expectError(GL_INVALID_ENUM);
168 			glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0);
169 			expectError(GL_INVALID_ENUM);
170 			glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0);
171 			expectError(GL_INVALID_ENUM);
172 			glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0);
173 			expectError(GL_INVALID_ENUM);
174 			glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0);
175 			expectError(GL_INVALID_ENUM);
176 			m_log << TestLog::EndSection;
177 		});
178 	ES2F_ADD_API_CASE(compressedteximage2d_neg_level_tex2d, "Invalid glCompressedTexImage2D() usage",
179 		{
180 			vector<deInt32> compressedFormats;
181 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
182 			if (!compressedFormats.empty())
183 			{
184 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
185 				glCompressedTexImage2D(GL_TEXTURE_2D, -1, compressedFormats[0], 0, 0, 0, 0, 0);
186 				expectError(GL_INVALID_VALUE);
187 				m_log << TestLog::EndSection;
188 			}
189 		});
190 	ES2F_ADD_API_CASE(compressedteximage2d_neg_level_cube, "Invalid glCompressedTexImage2D() usage",
191 		{
192 			vector<deInt32> compressedFormats;
193 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
194 			if (!compressedFormats.empty())
195 			{
196 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
197 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, compressedFormats[0], 0, 0, 0, 0, 0);
198 				expectError(GL_INVALID_VALUE);
199 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, compressedFormats[0], 0, 0, 0, 0, 0);
200 				expectError(GL_INVALID_VALUE);
201 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, compressedFormats[0], 0, 0, 0, 0, 0);
202 				expectError(GL_INVALID_VALUE);
203 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, compressedFormats[0], 0, 0, 0, 0, 0);
204 				expectError(GL_INVALID_VALUE);
205 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, compressedFormats[0], 0, 0, 0, 0, 0);
206 				expectError(GL_INVALID_VALUE);
207 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, compressedFormats[0], 0, 0, 0, 0, 0);
208 				expectError(GL_INVALID_VALUE);
209 				m_log << TestLog::EndSection;
210 			}
211 		});
212 	ES2F_ADD_API_CASE(compressedteximage2d_level_max_tex2d, "Invalid glCompressedTexImage2D() usage",
213 		{
214 			vector<deInt32> compressedFormats;
215 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
216 			if (!compressedFormats.empty())
217 			{
218 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
219 				deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
220 				glCompressedTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
221 				expectError(GL_INVALID_VALUE);
222 				m_log << TestLog::EndSection;
223 			}
224 		});
225 	ES2F_ADD_API_CASE(compressedteximage2d_level_max_cube_pos, "Invalid glCompressedTexImage2D() usage",
226 		{
227 			vector<deInt32> compressedFormats;
228 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
229 			if (!compressedFormats.empty())
230 			{
231 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
232 				deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
233 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
234 				expectError(GL_INVALID_VALUE);
235 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
236 				expectError(GL_INVALID_VALUE);
237 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
238 				expectError(GL_INVALID_VALUE);
239 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
240 				expectError(GL_INVALID_VALUE);
241 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
242 				expectError(GL_INVALID_VALUE);
243 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
244 				expectError(GL_INVALID_VALUE);
245 				m_log << TestLog::EndSection;
246 			}
247 		});
248 	ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_tex2d, "Invalid glCompressedTexImage2D() usage",
249 		{
250 			vector<deInt32> compressedFormats;
251 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
252 			if (!compressedFormats.empty())
253 			{
254 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
255 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], -1, 0, 0, 0, 0);
256 				expectError(GL_INVALID_VALUE);
257 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, -1, 0, 0, 0);
258 				expectError(GL_INVALID_VALUE);
259 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], -1, -1, 0, 0, 0);
260 				expectError(GL_INVALID_VALUE);
261 				m_log << TestLog::EndSection;
262 			}
263 		});
264 	ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_pos_x, "Invalid glCompressedTexImage2D() usage",
265 		{
266 			vector<deInt32> compressedFormats;
267 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
268 			if (!compressedFormats.empty())
269 			{
270 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
271 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], -1, 0, 0, 0, 0);
272 				expectError(GL_INVALID_VALUE);
273 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], 0, -1, 0, 0, 0);
274 				expectError(GL_INVALID_VALUE);
275 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], -1, -1, 0, 0, 0);
276 				expectError(GL_INVALID_VALUE);
277 				m_log << TestLog::EndSection;
278 			}
279 		});
280 	ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_pos_y, "Invalid glCompressedTexImage2D() usage",
281 		{
282 			vector<deInt32> compressedFormats;
283 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
284 			if (!compressedFormats.empty())
285 			{
286 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
287 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], -1, 0, 0, 0, 0);
288 				expectError(GL_INVALID_VALUE);
289 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], 0, -1, 0, 0, 0);
290 				expectError(GL_INVALID_VALUE);
291 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], -1, -1, 0, 0, 0);
292 				expectError(GL_INVALID_VALUE);
293 				m_log << TestLog::EndSection;
294 			}
295 		});
296 	ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_pos_z, "Invalid glCompressedTexImage2D() usage",
297 		{
298 			vector<deInt32> compressedFormats;
299 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
300 			if (!compressedFormats.empty())
301 			{
302 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
303 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], -1, 0, 0, 0, 0);
304 				expectError(GL_INVALID_VALUE);
305 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], 0, -1, 0, 0, 0);
306 				expectError(GL_INVALID_VALUE);
307 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], -1, -1, 0, 0, 0);
308 				expectError(GL_INVALID_VALUE);
309 				m_log << TestLog::EndSection;
310 			}
311 		});
312 	ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_neg_x, "Invalid glCompressedTexImage2D() usage",
313 		{
314 			vector<deInt32> compressedFormats;
315 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
316 			if (!compressedFormats.empty())
317 			{
318 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
319 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], -1, 0, 0, 0, 0);
320 				expectError(GL_INVALID_VALUE);
321 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], 0, -1, 0, 0, 0);
322 				expectError(GL_INVALID_VALUE);
323 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], -1, -1, 0, 0, 0);
324 				expectError(GL_INVALID_VALUE);
325 				m_log << TestLog::EndSection;
326 			}
327 		});
328 	ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_neg_y, "Invalid glCompressedTexImage2D() usage",
329 		{
330 			vector<deInt32> compressedFormats;
331 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
332 			if (!compressedFormats.empty())
333 			{
334 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
335 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], -1, 0, 0, 0, 0);
336 				expectError(GL_INVALID_VALUE);
337 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], 0, -1, 0, 0, 0);
338 				expectError(GL_INVALID_VALUE);
339 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], -1, -1, 0, 0, 0);
340 				expectError(GL_INVALID_VALUE);
341 				m_log << TestLog::EndSection;
342 			}
343 		});
344 	ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_neg_z, "Invalid glCompressedTexImage2D() usage",
345 		{
346 			vector<deInt32> compressedFormats;
347 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
348 			if (!compressedFormats.empty())
349 			{
350 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
351 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], -1, 0, 0, 0, 0);
352 				expectError(GL_INVALID_VALUE);
353 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], 0, -1, 0, 0, 0);
354 				expectError(GL_INVALID_VALUE);
355 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], -1, -1, 0, 0, 0);
356 				expectError(GL_INVALID_VALUE);
357 				m_log << TestLog::EndSection;
358 			}
359 		});
360 	ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_tex2d, "Invalid glCompressedTexImage2D() usage",
361 		{
362 			vector<deInt32> compressedFormats;
363 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
364 			if (!compressedFormats.empty())
365 			{
366 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
367 				int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1;
368 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
369 				expectError(GL_INVALID_VALUE);
370 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
371 				expectError(GL_INVALID_VALUE);
372 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
373 				expectError(GL_INVALID_VALUE);
374 				m_log << TestLog::EndSection;
375 			}
376 		});
377 	ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_pos_x, "Invalid glCompressedTexImage2D() usage",
378 		{
379 			vector<deInt32> compressedFormats;
380 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
381 			if (!compressedFormats.empty())
382 			{
383 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
384 				int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
385 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
386 				expectError(GL_INVALID_VALUE);
387 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
388 				expectError(GL_INVALID_VALUE);
389 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
390 				expectError(GL_INVALID_VALUE);
391 				m_log << TestLog::EndSection;
392 			}
393 		});
394 	ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_pos_y, "Invalid glCompressedTexImage2D() usage",
395 		{
396 			vector<deInt32> compressedFormats;
397 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
398 			if (!compressedFormats.empty())
399 			{
400 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
401 				int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
402 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
403 				expectError(GL_INVALID_VALUE);
404 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
405 				expectError(GL_INVALID_VALUE);
406 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
407 				expectError(GL_INVALID_VALUE);
408 				m_log << TestLog::EndSection;
409 			}
410 		});
411 	ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_pos_z, "Invalid glCompressedTexImage2D() usage",
412 		{
413 			vector<deInt32> compressedFormats;
414 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
415 			if (!compressedFormats.empty())
416 			{
417 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
418 				int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
419 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
420 				expectError(GL_INVALID_VALUE);
421 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
422 				expectError(GL_INVALID_VALUE);
423 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
424 				expectError(GL_INVALID_VALUE);
425 				m_log << TestLog::EndSection;
426 			}
427 		});
428 	ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_neg_x, "Invalid glCompressedTexImage2D() usage",
429 		{
430 			vector<deInt32> compressedFormats;
431 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
432 			if (!compressedFormats.empty())
433 			{
434 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
435 				int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
436 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
437 				expectError(GL_INVALID_VALUE);
438 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
439 				expectError(GL_INVALID_VALUE);
440 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
441 				expectError(GL_INVALID_VALUE);
442 				m_log << TestLog::EndSection;
443 			}
444 		});
445 	ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_neg_y, "Invalid glCompressedTexImage2D() usage",
446 		{
447 			vector<deInt32> compressedFormats;
448 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
449 			if (!compressedFormats.empty())
450 			{
451 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
452 				int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
453 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
454 				expectError(GL_INVALID_VALUE);
455 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
456 				expectError(GL_INVALID_VALUE);
457 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
458 				expectError(GL_INVALID_VALUE);
459 				m_log << TestLog::EndSection;
460 			}
461 		});
462 	ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_neg_z, "Invalid glCompressedTexImage2D() usage",
463 		{
464 			vector<deInt32> compressedFormats;
465 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
466 			if (!compressedFormats.empty())
467 			{
468 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
469 				int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
470 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
471 				expectError(GL_INVALID_VALUE);
472 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
473 				expectError(GL_INVALID_VALUE);
474 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
475 				expectError(GL_INVALID_VALUE);
476 				m_log << TestLog::EndSection;
477 			}
478 		});
479 	ES2F_ADD_API_CASE(compressedteximage2d_invalid_border, "Invalid glCompressedTexImage2D() usage",
480 		{
481 			vector<deInt32> compressedFormats;
482 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
483 			if (!compressedFormats.empty())
484 			{
485 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
486 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, 0, 1, 0, 0);
487 				expectError(GL_INVALID_VALUE);
488 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, 0, -1, 0, 0);
489 				expectError(GL_INVALID_VALUE);
490 				m_log << TestLog::EndSection;
491 			}
492 		});
493 
494 	ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_pos_x, "Invalid glCompressedTexImage2D() usage",
495 		{
496 			vector<deInt32> compressedFormats;
497 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
498 			if (!compressedFormats.empty())
499 			{
500 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
501 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], 0, 0, 1, 0, 0);
502 				expectError(GL_INVALID_VALUE);
503 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], 0, 0, -1, 0, 0);
504 				expectError(GL_INVALID_VALUE);
505 				m_log << TestLog::EndSection;
506 			}
507 		});
508 	ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_pos_y, "Invalid glCompressedTexImage2D() usage",
509 		{
510 			vector<deInt32> compressedFormats;
511 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
512 			if (!compressedFormats.empty())
513 			{
514 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
515 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], 0, 0, 1, 0, 0);
516 				expectError(GL_INVALID_VALUE);
517 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], 0, 0, -1, 0, 0);
518 				expectError(GL_INVALID_VALUE);
519 				m_log << TestLog::EndSection;
520 			}
521 		});
522 	ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_pos_z, "Invalid glCompressedTexImage2D() usage",
523 		{
524 			vector<deInt32> compressedFormats;
525 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
526 			if (!compressedFormats.empty())
527 			{
528 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
529 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], 0, 0, 1, 0, 0);
530 				expectError(GL_INVALID_VALUE);
531 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], 0, 0, -1, 0, 0);
532 				expectError(GL_INVALID_VALUE);
533 				m_log << TestLog::EndSection;
534 			}
535 		});
536 	ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_neg_x, "Invalid glCompressedTexImage2D() usage",
537 		{
538 			vector<deInt32> compressedFormats;
539 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
540 			if (!compressedFormats.empty())
541 			{
542 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
543 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], 0, 0, 1, 0, 0);
544 				expectError(GL_INVALID_VALUE);
545 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], 0, 0, -1, 0, 0);
546 				expectError(GL_INVALID_VALUE);
547 				m_log << TestLog::EndSection;
548 			}
549 		});
550 	ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_neg_y, "Invalid glCompressedTexImage2D() usage",
551 		{
552 			vector<deInt32> compressedFormats;
553 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
554 			if (!compressedFormats.empty())
555 			{
556 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
557 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], 0, 0, 1, 0, 0);
558 				expectError(GL_INVALID_VALUE);
559 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], 0, 0, -1, 0, 0);
560 				expectError(GL_INVALID_VALUE);
561 				m_log << TestLog::EndSection;
562 			}
563 		});
564 	ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_neg_z, "Invalid glCompressedTexImage2D() usage",
565 		{
566 			vector<deInt32> compressedFormats;
567 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
568 			if (!compressedFormats.empty())
569 			{
570 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
571 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], 0, 0, 1, 0, 0);
572 				expectError(GL_INVALID_VALUE);
573 				glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], 0, 0, -1, 0, 0);
574 				expectError(GL_INVALID_VALUE);
575 				m_log << TestLog::EndSection;
576 			}
577 		});
578 	ES2F_ADD_API_CASE(compressedteximage2d_invalid_size, "Invalid glCompressedTexImage2D() usage",
579 		{
580 			vector<deInt32> compressedFormats;
581 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
582 			if (!compressedFormats.empty())
583 			{
584 				m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.");
585 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, 0, 0, -1, 0);
586 				expectError(GL_INVALID_VALUE);
587 				m_log << TestLog::EndSection;
588 			}
589 		});
590 
591 	// glCopyTexImage2D
592 
593 	ES2F_ADD_API_CASE(copyteximage2d_invalid_target, "Invalid glCopyTexImage2D() usage",
594 		{
595 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
596 			glCopyTexImage2D(0, 0, GL_RGB, 0, 0, 64, 64, 0);
597 			expectError(GL_INVALID_ENUM);
598 			m_log << TestLog::EndSection;
599 		});
600 	ES2F_ADD_API_CASE(copyteximage2d_invalid_format_tex2d, "Invalid glCopyTexImage2D() usage",
601 		{
602 			m_log << TestLog::Section("", "GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not an accepted format.");
603 			glCopyTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 64, 64, 0);
604 			expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
605 			m_log << TestLog::EndSection;
606 		});
607 	ES2F_ADD_API_CASE(copyteximage2d_invalid_format_cube, "Invalid glCopyTexImage2D() usage",
608 		{
609 			m_log << TestLog::Section("", "GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not an accepted format.");
610 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 16, 16, 0);
611 			expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
612 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 16, 16, 0);
613 			expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
614 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 16, 16, 0);
615 			expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
616 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 16, 16, 0);
617 			expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
618 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 16, 16, 0);
619 			expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
620 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 16, 16, 0);
621 			expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
622 			m_log << TestLog::EndSection;
623 		});
624 	ES2F_ADD_API_CASE(copyteximage2d_inequal_width_height_cube, "Invalid glCopyTexImage2D() usage",
625 		{
626 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if target is one of the six cube map 2D image targets and the width and height parameters are not equal.");
627 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0);
628 			expectError(GL_INVALID_VALUE);
629 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0);
630 			expectError(GL_INVALID_VALUE);
631 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0);
632 			expectError(GL_INVALID_VALUE);
633 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0);
634 			expectError(GL_INVALID_VALUE);
635 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0);
636 			expectError(GL_INVALID_VALUE);
637 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0);
638 			expectError(GL_INVALID_VALUE);
639 			m_log << TestLog::EndSection;
640 		});
641 	ES2F_ADD_API_CASE(copyteximage2d_neg_level_tex2d, "Invalid glCopyTexImage2D() usage",
642 		{
643 			m_log << TestLog::Section("", "");
644 			glCopyTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 0, 0, 64, 64, 0);
645 			expectError(GL_INVALID_VALUE);
646 			m_log << TestLog::EndSection;
647 		});
648 	ES2F_ADD_API_CASE(copyteximage2d_neg_level_cube, "Invalid glCopyTexImage2D() usage",
649 		{
650 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
651 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0);
652 			expectError(GL_INVALID_VALUE);
653 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0);
654 			expectError(GL_INVALID_VALUE);
655 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0);
656 			expectError(GL_INVALID_VALUE);
657 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0);
658 			expectError(GL_INVALID_VALUE);
659 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0);
660 			expectError(GL_INVALID_VALUE);
661 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0);
662 			expectError(GL_INVALID_VALUE);
663 			m_log << TestLog::EndSection;
664 		});
665 	ES2F_ADD_API_CASE(copyteximage2d_level_max_tex2d, "Invalid glCopyTexImage2D() usage",
666 		{
667 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
668 			deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
669 			glCopyTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 0, 0, 64, 64, 0);
670 			expectError(GL_INVALID_VALUE);
671 			m_log << TestLog::EndSection;
672 		});
673 	ES2F_ADD_API_CASE(copyteximage2d_level_max_cube, "Invalid glCopyTexImage2D() usage",
674 		{
675 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
676 			deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
677 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
678 			expectError(GL_INVALID_VALUE);
679 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
680 			expectError(GL_INVALID_VALUE);
681 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
682 			expectError(GL_INVALID_VALUE);
683 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
684 			expectError(GL_INVALID_VALUE);
685 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
686 			expectError(GL_INVALID_VALUE);
687 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
688 			expectError(GL_INVALID_VALUE);
689 			m_log << TestLog::EndSection;
690 		});
691 	ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_tex2d, "Invalid glCopyTexImage2D() usage",
692 		{
693 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
694 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, 1, 0);
695 			expectError(GL_INVALID_VALUE);
696 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, -1, 0);
697 			expectError(GL_INVALID_VALUE);
698 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, -1, 0);
699 			expectError(GL_INVALID_VALUE);
700 			m_log << TestLog::EndSection;
701 		});
702 	ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_pos_x, "Invalid glCopyTexImage2D() usage",
703 		{
704 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
705 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, 1, 0);
706 			expectError(GL_INVALID_VALUE);
707 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, -1, 0);
708 			expectError(GL_INVALID_VALUE);
709 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0);
710 			expectError(GL_INVALID_VALUE);
711 			m_log << TestLog::EndSection;
712 		});
713 	ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_pos_y, "Invalid glCopyTexImage2D() usage",
714 		{
715 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
716 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, 1, 0);
717 			expectError(GL_INVALID_VALUE);
718 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, -1, 0);
719 			expectError(GL_INVALID_VALUE);
720 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0);
721 			expectError(GL_INVALID_VALUE);
722 			m_log << TestLog::EndSection;
723 		});
724 	ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_pos_z, "Invalid glCopyTexImage2D() usage",
725 		{
726 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
727 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, 1, 0);
728 			expectError(GL_INVALID_VALUE);
729 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, -1, 0);
730 			expectError(GL_INVALID_VALUE);
731 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0);
732 			expectError(GL_INVALID_VALUE);
733 			m_log << TestLog::EndSection;
734 		});
735 	ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_neg_x, "Invalid glCopyTexImage2D() usage",
736 		{
737 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
738 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, 1, 0);
739 			expectError(GL_INVALID_VALUE);
740 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, -1, 0);
741 			expectError(GL_INVALID_VALUE);
742 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0);
743 			expectError(GL_INVALID_VALUE);
744 			m_log << TestLog::EndSection;
745 		});
746 	ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_neg_y, "Invalid glCopyTexImage2D() usage",
747 		{
748 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
749 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, 1, 0);
750 			expectError(GL_INVALID_VALUE);
751 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, -1, 0);
752 			expectError(GL_INVALID_VALUE);
753 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0);
754 			expectError(GL_INVALID_VALUE);
755 			m_log << TestLog::EndSection;
756 		});
757 	ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_neg_z, "Invalid glCopyTexImage2D() usage",
758 		{
759 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
760 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, 1, 0);
761 			expectError(GL_INVALID_VALUE);
762 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, -1, 0);
763 			expectError(GL_INVALID_VALUE);
764 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0);
765 			expectError(GL_INVALID_VALUE);
766 			m_log << TestLog::EndSection;
767 		});
768 	ES2F_ADD_API_CASE(copyteximage2d_width_height_max_tex2d, "Invalid glCopyTexImage2D() usage",
769 		{
770 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
771 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1;
772 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
773 			expectError(GL_INVALID_VALUE);
774 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
775 			expectError(GL_INVALID_VALUE);
776 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
777 			expectError(GL_INVALID_VALUE);
778 			m_log << TestLog::EndSection;
779 		});
780 	ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_pos_x, "Invalid glCopyTexImage2D() usage",
781 		{
782 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
783 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
784 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
785 			expectError(GL_INVALID_VALUE);
786 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
787 			expectError(GL_INVALID_VALUE);
788 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
789 			expectError(GL_INVALID_VALUE);
790 			m_log << TestLog::EndSection;
791 		});
792 	ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_pos_y, "Invalid glCopyTexImage2D() usage",
793 		{
794 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
795 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
796 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
797 			expectError(GL_INVALID_VALUE);
798 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
799 			expectError(GL_INVALID_VALUE);
800 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
801 			expectError(GL_INVALID_VALUE);
802 			m_log << TestLog::EndSection;
803 		});
804 	ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_pos_z, "Invalid glCopyTexImage2D() usage",
805 		{
806 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
807 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
808 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
809 			expectError(GL_INVALID_VALUE);
810 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
811 			expectError(GL_INVALID_VALUE);
812 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
813 			expectError(GL_INVALID_VALUE);
814 			m_log << TestLog::EndSection;
815 		});
816 	ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_neg_x, "Invalid glCopyTexImage2D() usage",
817 		{
818 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
819 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
820 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
821 			expectError(GL_INVALID_VALUE);
822 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
823 			expectError(GL_INVALID_VALUE);
824 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
825 			expectError(GL_INVALID_VALUE);
826 			m_log << TestLog::EndSection;
827 		});
828 	ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_neg_y, "Invalid glCopyTexImage2D() usage",
829 		{
830 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
831 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
832 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
833 			expectError(GL_INVALID_VALUE);
834 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
835 			expectError(GL_INVALID_VALUE);
836 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
837 			expectError(GL_INVALID_VALUE);
838 			m_log << TestLog::EndSection;
839 		});
840 	ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_neg_z, "Invalid glCopyTexImage2D() usage",
841 		{
842 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
843 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
844 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
845 			expectError(GL_INVALID_VALUE);
846 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
847 			expectError(GL_INVALID_VALUE);
848 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
849 			expectError(GL_INVALID_VALUE);
850 			m_log << TestLog::EndSection;
851 		});
852 	ES2F_ADD_API_CASE(copyteximage2d_invalid_border_tex2d, "Invalid glCopyTexImage2D() usage",
853 		{
854 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
855 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 64, 64, -1);
856 			expectError(GL_INVALID_VALUE);
857 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 64, 64, 1);
858 			expectError(GL_INVALID_VALUE);
859 			m_log << TestLog::EndSection;
860 		});
861 	ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_pos_x, "Invalid glCopyTexImage2D() usage",
862 		{
863 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
864 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 16, -1);
865 			expectError(GL_INVALID_VALUE);
866 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 16, 1);
867 			expectError(GL_INVALID_VALUE);
868 			m_log << TestLog::EndSection;
869 		});
870 	ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_pos_y, "Invalid glCopyTexImage2D() usage",
871 		{
872 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
873 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 16, -1);
874 			expectError(GL_INVALID_VALUE);
875 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 16, 1);
876 			expectError(GL_INVALID_VALUE);
877 			m_log << TestLog::EndSection;
878 		});
879 	ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_pos_z, "Invalid glCopyTexImage2D() usage",
880 		{
881 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
882 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 16, -1);
883 			expectError(GL_INVALID_VALUE);
884 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 16, 1);
885 			expectError(GL_INVALID_VALUE);
886 			m_log << TestLog::EndSection;
887 		});
888 	ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_neg_x, "Invalid glCopyTexImage2D() usage",
889 		{
890 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
891 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 16, -1);
892 			expectError(GL_INVALID_VALUE);
893 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 16, 1);
894 			expectError(GL_INVALID_VALUE);
895 			m_log << TestLog::EndSection;
896 		});
897 	ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_neg_y, "Invalid glCopyTexImage2D() usage",
898 		{
899 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
900 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 16, -1);
901 			expectError(GL_INVALID_VALUE);
902 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 16, 1);
903 			expectError(GL_INVALID_VALUE);
904 			m_log << TestLog::EndSection;
905 		});
906 	ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_neg_z, "Invalid glCopyTexImage2D() usage",
907 		{
908 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
909 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 16, -1);
910 			expectError(GL_INVALID_VALUE);
911 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 16, 1);
912 			expectError(GL_INVALID_VALUE);
913 			m_log << TestLog::EndSection;
914 		});
915 
916 	ES2F_ADD_API_CASE(copyteximage2d_incomplete_framebuffer, "Invalid glCopyTexImage2D() usage",
917 		{
918 			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
919 			GLuint fbo;
920 			glGenFramebuffers(1, &fbo);
921 			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
922 			glCheckFramebufferStatus(GL_FRAMEBUFFER);
923 
924 			glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 64, 64, 0);
925 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
926 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 16, 0);
927 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
928 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 16, 0);
929 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
930 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 16, 0);
931 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
932 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 16, 0);
933 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
934 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 16, 0);
935 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
936 			glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 16, 0);
937 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
938 
939 			glBindFramebuffer(GL_FRAMEBUFFER, 0);
940 			glDeleteFramebuffers(1, &fbo);
941 			m_log << tcu::TestLog::EndSection;
942 		});
943 
944 	// glCopyTexSubImage2D
945 
946 	ES2F_ADD_API_CASE(copytexsubimage2d_invalid_target, "Invalid glCopyTexSubImage2D() usage",
947 		{
948 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
949 			glCopyTexSubImage2D(0, 0, 0, 0, 0, 0, 0, 0);
950 			expectError(GL_INVALID_ENUM);
951 			m_log << TestLog::EndSection;
952 		});
953 	ES2F_ADD_API_CASE(copytexsubimage2d_neg_level_tex2d, "Invalid glCopyTexSubImage2D() usage",
954 		{
955 			GLuint texture;
956 			glGenTextures(1, &texture);
957 			glBindTexture(GL_TEXTURE_2D, texture);
958 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
959 
960 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
961 			glCopyTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, 0, 0);
962 			expectError(GL_INVALID_VALUE);
963 			m_log << TestLog::EndSection;
964 
965 			glDeleteTextures(1, &texture);
966 		});
967 	ES2F_ADD_API_CASE(copytexsubimage2d_neg_level_cube, "Invalid glCopyTexSubImage2D() usage",
968 		{
969 			GLuint texture;
970 			glGenTextures(1, &texture);
971 			glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
972 			FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL););
973 
974 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
975 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, 0, 0, 0, 0, 0, 0);
976 			expectError(GL_INVALID_VALUE);
977 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, 0, 0, 0, 0, 0, 0);
978 			expectError(GL_INVALID_VALUE);
979 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, 0, 0, 0, 0, 0, 0);
980 			expectError(GL_INVALID_VALUE);
981 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, 0, 0, 0, 0, 0, 0);
982 			expectError(GL_INVALID_VALUE);
983 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, 0, 0, 0, 0, 0, 0);
984 			expectError(GL_INVALID_VALUE);
985 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, 0, 0, 0, 0, 0, 0);
986 			expectError(GL_INVALID_VALUE);
987 			m_log << TestLog::EndSection;
988 
989 			glDeleteTextures(1, &texture);
990 		});
991 	ES2F_ADD_API_CASE(copytexsubimage2d_level_max_tex2d, "Invalid glCopyTexSubImage2D() usage",
992 		{
993 			GLuint texture;
994 			glGenTextures(1, &texture);
995 			glBindTexture(GL_TEXTURE_2D, texture);
996 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
997 
998 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
999 			deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
1000 			glCopyTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1001 			expectError(GL_INVALID_VALUE);
1002 			m_log << TestLog::EndSection;
1003 
1004 			glDeleteTextures(1, &texture);
1005 		});
1006 	ES2F_ADD_API_CASE(copytexsubimage2d_level_max_cube_pos, "Invalid glCopyTexSubImage2D() usage",
1007 		{
1008 			GLuint texture;
1009 			glGenTextures(1, &texture);
1010 			glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
1011 			FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL););
1012 
1013 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_SIZE).");
1014 			deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1015 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1016 			expectError(GL_INVALID_VALUE);
1017 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1018 			expectError(GL_INVALID_VALUE);
1019 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1020 			expectError(GL_INVALID_VALUE);
1021 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1022 			expectError(GL_INVALID_VALUE);
1023 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1024 			expectError(GL_INVALID_VALUE);
1025 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1026 			expectError(GL_INVALID_VALUE);
1027 			m_log << TestLog::EndSection;
1028 
1029 			glDeleteTextures(1, &texture);
1030 		});
1031 	ES2F_ADD_API_CASE(copytexsubimage2d_neg_offset, "Invalid glCopyTexSubImage2D() usage",
1032 		{
1033 			GLuint texture;
1034 			glGenTextures(1, &texture);
1035 			glBindTexture(GL_TEXTURE_2D, texture);
1036 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1037 
1038 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset < 0 or yoffset < 0.");
1039 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, 0, 0);
1040 			expectError(GL_INVALID_VALUE);
1041 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, 0, 0);
1042 			expectError(GL_INVALID_VALUE);
1043 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, 0, 0);
1044 			expectError(GL_INVALID_VALUE);
1045 			m_log << TestLog::EndSection;
1046 
1047 			glDeleteTextures(1, &texture);
1048 		});
1049 	ES2F_ADD_API_CASE(copytexsubimage2d_offset_allowed, "Invalid glCopyTexSubImage2D() usage",
1050 		{
1051 			GLuint texture;
1052 			glGenTextures(1, &texture);
1053 			glBindTexture(GL_TEXTURE_2D, texture);
1054 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1055 
1056 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
1057 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 8, 4, 0, 0, 10, 10);
1058 			expectError(GL_INVALID_VALUE);
1059 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 4, 8, 0, 0, 10, 10);
1060 			expectError(GL_INVALID_VALUE);
1061 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 8, 8, 0, 0, 10, 10);
1062 			expectError(GL_INVALID_VALUE);
1063 			m_log << TestLog::EndSection;
1064 
1065 			glDeleteTextures(1, &texture);
1066 		});
1067 	ES2F_ADD_API_CASE(copytexsubimage2d_neg_wdt_hgt, "Invalid glCopyTexSubImage2D() usage",
1068 		{
1069 			GLuint texture;
1070 			glGenTextures(1, &texture);
1071 			glBindTexture(GL_TEXTURE_2D, texture);
1072 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1073 
1074 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1075 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, 0);
1076 			expectError(GL_INVALID_VALUE);
1077 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, -1);
1078 			expectError(GL_INVALID_VALUE);
1079 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, -1);
1080 			expectError(GL_INVALID_VALUE);
1081 			m_log << TestLog::EndSection;
1082 
1083 			glDeleteTextures(1, &texture);
1084 		});
1085 	ES2F_ADD_API_CASE(copytexsubimage2d_incomplete_framebuffer, "Invalid glCopyTexSubImage2D() usage",
1086 		{
1087 			GLuint texture;
1088 			glGenTextures(1, &texture);
1089 			glBindTexture(GL_TEXTURE_2D, texture);
1090 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1091 
1092 			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1093 			GLuint fbo;
1094 			glGenFramebuffers(1, &fbo);
1095 			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1096 			glCheckFramebufferStatus(GL_FRAMEBUFFER);
1097 
1098 			glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);
1099 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1100 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0);
1101 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1102 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0);
1103 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1104 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0);
1105 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1106 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0);
1107 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1108 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0);
1109 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1110 			glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0);
1111 			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1112 
1113 			glBindFramebuffer(GL_FRAMEBUFFER, 0);
1114 			glDeleteFramebuffers(1, &fbo);
1115 			m_log << tcu::TestLog::EndSection;
1116 
1117 			glDeleteTextures(1, &texture);
1118 		});
1119 
1120 	// glDeleteTextures
1121 
1122 	ES2F_ADD_API_CASE(deletetextures_invalid_number, "Invalid glDeleteTextures() usage",
1123 		{
1124 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
1125 			glDeleteTextures(-1,0);
1126 			expectError(GL_INVALID_VALUE);
1127 			m_log << TestLog::EndSection;
1128 		});
1129 	ES2F_ADD_API_CASE(deletetextures_invalid_number_bind, "Invalid glDeleteTextures() usage",
1130 		{
1131 			GLuint texture;
1132 			glGenTextures(1, &texture);
1133 
1134 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
1135 			glBindTexture(GL_TEXTURE_2D, texture);
1136 			glDeleteTextures(-1,0);
1137 			expectError(GL_INVALID_VALUE);
1138 			m_log << TestLog::EndSection;
1139 
1140 			glDeleteTextures(1, &texture);
1141 		});
1142 
1143 	// glGenerateMipmap
1144 
1145 	ES2F_ADD_API_CASE(generatemipmap_invalid_target, "Invalid glGenerateMipmap() usage",
1146 		{
1147 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.");
1148 			glGenerateMipmap(0);
1149 			expectError(GL_INVALID_ENUM);
1150 			m_log << TestLog::EndSection;
1151 		});
1152 	ES2F_ADD_API_CASE(generatemipmap_npot_wdt_hgt, "Invalid glGenerateMipmap() usage",
1153 		{
1154 			GLuint texture;
1155 
1156 			if (m_context.getContextInfo().isExtensionSupported("GL_OES_texture_npot"))
1157 			{
1158 				m_log	<< tcu::TestLog::Message
1159 						<< "GL_OES_texture_npot extension removes error condition, skipping test"
1160 						<< tcu::TestLog::EndMessage;
1161 				return;
1162 			}
1163 
1164 			glActiveTexture(GL_TEXTURE0);
1165 			glGenTextures(1, &texture);
1166 			glBindTexture(GL_TEXTURE_2D, texture);
1167 
1168 			m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if either the width or height of the zero level array is not a power of two.");
1169 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 257, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1170 			glGenerateMipmap(GL_TEXTURE_2D);
1171 			expectError(GL_INVALID_OPERATION);
1172 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 257, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1173 			glGenerateMipmap(GL_TEXTURE_2D);
1174 			expectError(GL_INVALID_OPERATION);
1175 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 257, 257, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1176 			glGenerateMipmap(GL_TEXTURE_2D);
1177 			expectError(GL_INVALID_OPERATION);
1178 			m_log << TestLog::EndSection;
1179 
1180 			glDeleteTextures(1, &texture);
1181 		});
1182 	ES2F_ADD_API_CASE(generatemipmap_zero_level_array_compressed, "Invalid glGenerateMipmap() usage",
1183 		{
1184 			vector<deInt32> compressedFormats;
1185 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
1186 			if (!compressedFormats.empty())
1187 			{
1188 				m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format.");
1189 				glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, 0, 0, 0, 0);
1190 				glGenerateMipmap(GL_TEXTURE_2D);
1191 				expectError(GL_INVALID_OPERATION);
1192 				m_log << TestLog::EndSection;
1193 			}
1194 		});
1195 	ES2F_ADD_API_CASE(generatemipmap_incomplete_cube, "Invalid glGenerateMipmap() usage",
1196 		{
1197 			GLuint texture;
1198 			glGenTextures(1, &texture);
1199 			glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
1200 
1201 			m_log << TestLog::Section("", "INVALID_OPERATION is generated if the texture bound to target is not cube complete.");
1202 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1203 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1204 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1205 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1206 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1207 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1208 			glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
1209 			expectError(GL_INVALID_OPERATION);
1210 			m_log << TestLog::EndSection;
1211 
1212 			glDeleteTextures(1, &texture);
1213 		});
1214 
1215 	// glGenTextures
1216 
1217 	ES2F_ADD_API_CASE(gentextures_invalid_size, "Invalid glGenTextures() usage",
1218 		{
1219 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
1220 			glGenTextures(-1, 0);
1221 			expectError(GL_INVALID_VALUE);
1222 			m_log << TestLog::EndSection;
1223 		});
1224 
1225 	// glPixelStorei
1226 
1227 	ES2F_ADD_API_CASE(pixelstorei_invalid_pname, "Invalid glPixelStorei() usage",
1228 		{
1229 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if pname is not an accepted value.");
1230 			glPixelStorei(0,1);
1231 			expectError(GL_INVALID_ENUM);
1232 			m_log << TestLog::EndSection;
1233 		});
1234 	ES2F_ADD_API_CASE(pixelstorei_invalid_param, "Invalid glPixelStorei() usage",
1235 		{
1236 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if alignment is specified as other than 1, 2, 4, or 8.");
1237 			glPixelStorei(GL_PACK_ALIGNMENT, 0);
1238 			expectError(GL_INVALID_VALUE);
1239 			glPixelStorei(GL_UNPACK_ALIGNMENT, 0);
1240 			expectError(GL_INVALID_VALUE);
1241 			glPixelStorei(GL_PACK_ALIGNMENT, 16);
1242 			expectError(GL_INVALID_VALUE);
1243 			glPixelStorei(GL_UNPACK_ALIGNMENT, 16);
1244 			expectError(GL_INVALID_VALUE);
1245 			m_log << TestLog::EndSection;
1246 		});
1247 
1248 	// glTexImage2D
1249 
1250 	ES2F_ADD_API_CASE(teximage2d_invalid_target, "Invalid glTexImage2D() usage",
1251 		{
1252 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
1253 			glTexImage2D(0, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1254 			expectError(GL_INVALID_ENUM);
1255 			m_log << TestLog::EndSection;
1256 		});
1257 	ES2F_ADD_API_CASE(teximage2d_invalid_format, "Invalid glTexImage2D() usage",
1258 		{
1259 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format or type is not an accepted value.");
1260 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, 0, GL_UNSIGNED_BYTE, 0);
1261 			expectError(GL_INVALID_ENUM);
1262 			m_log << TestLog::EndSection;
1263 		});
1264 	ES2F_ADD_API_CASE(teximage2d_invalid_type, "Invalid glTexImage2D() usage",
1265 		{
1266 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format or type is not an accepted value.");
1267 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, 0, 0);
1268 			expectError(GL_INVALID_ENUM);
1269 			m_log << TestLog::EndSection;
1270 		});
1271 	ES2F_ADD_API_CASE(teximage2d_inequal_width_height_cube, "Invalid glTexImage2D() usage",
1272 		{
1273 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if target is one of the six cube map 2D image targets and the width and height parameters are not equal.");
1274 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1275 			expectError(GL_INVALID_VALUE);
1276 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1277 			expectError(GL_INVALID_VALUE);
1278 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1279 			expectError(GL_INVALID_VALUE);
1280 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1281 			expectError(GL_INVALID_VALUE);
1282 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1283 			expectError(GL_INVALID_VALUE);
1284 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1285 			expectError(GL_INVALID_VALUE);
1286 			m_log << TestLog::EndSection;
1287 		});
1288 	ES2F_ADD_API_CASE(teximage2d_neg_level_tex2d, "Invalid glTexImage2D() usage",
1289 		{
1290 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1291 			glTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1292 			expectError(GL_INVALID_VALUE);
1293 			m_log << TestLog::EndSection;
1294 		});
1295 	ES2F_ADD_API_CASE(teximage2d_neg_level_cube, "Invalid glTexImage2D() usage",
1296 		{
1297 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1298 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1299 			expectError(GL_INVALID_VALUE);
1300 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1301 			expectError(GL_INVALID_VALUE);
1302 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1303 			expectError(GL_INVALID_VALUE);
1304 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1305 			expectError(GL_INVALID_VALUE);
1306 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1307 			expectError(GL_INVALID_VALUE);
1308 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1309 			expectError(GL_INVALID_VALUE);
1310 			m_log << TestLog::EndSection;
1311 		});
1312 	ES2F_ADD_API_CASE(teximage2d_level_max_tex2d, "Invalid glTexImage2D() usage",
1313 		{
1314 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
1315 			deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
1316 			glTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1317 			expectError(GL_INVALID_VALUE);
1318 			m_log << TestLog::EndSection;
1319 		});
1320 	ES2F_ADD_API_CASE(teximage2d_level_max_cube, "Invalid glTexImage2D() usage",
1321 		{
1322 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
1323 			deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1324 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1325 			expectError(GL_INVALID_VALUE);
1326 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1327 			expectError(GL_INVALID_VALUE);
1328 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1329 			expectError(GL_INVALID_VALUE);
1330 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1331 			expectError(GL_INVALID_VALUE);
1332 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1333 			expectError(GL_INVALID_VALUE);
1334 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1335 			expectError(GL_INVALID_VALUE);
1336 			m_log << TestLog::EndSection;
1337 		});
1338 	ES2F_ADD_API_CASE(teximage2d_invalid_internalformat, "Invalid glTexImage2D() usage",
1339 		{
1340 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if internalformat is not an accepted format.");
1341 			glTexImage2D(GL_TEXTURE_2D, 0, 0, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1342 			expectError(GL_INVALID_VALUE);
1343 			m_log << TestLog::EndSection;
1344 		});
1345 	ES2F_ADD_API_CASE(teximage2d_neg_width_height_tex2d, "Invalid glTexImage2D() usage",
1346 		{
1347 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1348 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1349 			expectError(GL_INVALID_VALUE);
1350 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1351 			expectError(GL_INVALID_VALUE);
1352 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1353 			expectError(GL_INVALID_VALUE);
1354 			m_log << TestLog::EndSection;
1355 		});
1356 	ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_pos_x, "Invalid glTexImage2D() usage",
1357 		{
1358 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1359 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1360 			expectError(GL_INVALID_VALUE);
1361 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1362 			expectError(GL_INVALID_VALUE);
1363 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1364 			expectError(GL_INVALID_VALUE);
1365 			m_log << TestLog::EndSection;
1366 		});
1367 	ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_pos_y, "Invalid glTexImage2D() usage",
1368 		{
1369 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1370 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1371 			expectError(GL_INVALID_VALUE);
1372 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1373 			expectError(GL_INVALID_VALUE);
1374 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1375 			expectError(GL_INVALID_VALUE);
1376 			m_log << TestLog::EndSection;
1377 		});
1378 	ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_pos_z, "Invalid glTexImage2D() usage",
1379 		{
1380 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1381 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1382 			expectError(GL_INVALID_VALUE);
1383 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1384 			expectError(GL_INVALID_VALUE);
1385 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1386 			expectError(GL_INVALID_VALUE);
1387 			m_log << TestLog::EndSection;
1388 		});
1389 	ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_neg_x, "Invalid glTexImage2D() usage",
1390 		{
1391 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1392 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1393 			expectError(GL_INVALID_VALUE);
1394 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1395 			expectError(GL_INVALID_VALUE);
1396 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1397 			expectError(GL_INVALID_VALUE);
1398 			m_log << TestLog::EndSection;
1399 		});
1400 	ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_neg_y, "Invalid glTexImage2D() usage",
1401 		{
1402 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1403 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1404 			expectError(GL_INVALID_VALUE);
1405 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1406 			expectError(GL_INVALID_VALUE);
1407 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1408 			expectError(GL_INVALID_VALUE);
1409 			m_log << TestLog::EndSection;
1410 		});
1411 	ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_neg_z, "Invalid glTexImage2D() usage",
1412 		{
1413 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1414 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1415 			expectError(GL_INVALID_VALUE);
1416 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1417 			expectError(GL_INVALID_VALUE);
1418 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1419 			expectError(GL_INVALID_VALUE);
1420 			m_log << TestLog::EndSection;
1421 		});
1422 	ES2F_ADD_API_CASE(teximage2d_width_height_max_tex2d, "Invalid glTexImage2D() usage",
1423 		{
1424 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
1425 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1;
1426 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1427 			expectError(GL_INVALID_VALUE);
1428 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1429 			expectError(GL_INVALID_VALUE);
1430 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1431 			expectError(GL_INVALID_VALUE);
1432 			m_log << TestLog::EndSection;
1433 		});
1434 	ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_pos_x, "Invalid glTexImage2D() usage",
1435 		{
1436 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1437 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1438 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1439 			expectError(GL_INVALID_VALUE);
1440 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1441 			expectError(GL_INVALID_VALUE);
1442 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1443 			expectError(GL_INVALID_VALUE);
1444 			m_log << TestLog::EndSection;
1445 		});
1446 	ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_pos_y, "Invalid glTexImage2D() usage",
1447 		{
1448 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1449 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1450 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1451 			expectError(GL_INVALID_VALUE);
1452 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1453 			expectError(GL_INVALID_VALUE);
1454 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1455 			expectError(GL_INVALID_VALUE);
1456 			m_log << TestLog::EndSection;
1457 		});
1458 	ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_pos_z, "Invalid glTexImage2D() usage",
1459 		{
1460 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1461 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1462 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1463 			expectError(GL_INVALID_VALUE);
1464 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1465 			expectError(GL_INVALID_VALUE);
1466 			glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1467 			expectError(GL_INVALID_VALUE);
1468 			m_log << TestLog::EndSection;
1469 		});
1470 	ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_neg_x, "Invalid glTexImage2D() usage",
1471 		{
1472 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1473 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1474 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1475 			expectError(GL_INVALID_VALUE);
1476 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1477 			expectError(GL_INVALID_VALUE);
1478 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1479 			expectError(GL_INVALID_VALUE);
1480 			m_log << TestLog::EndSection;
1481 		});
1482 	ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_neg_y, "Invalid glTexImage2D() usage",
1483 		{
1484 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1485 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1486 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1487 			expectError(GL_INVALID_VALUE);
1488 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1489 			expectError(GL_INVALID_VALUE);
1490 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1491 			expectError(GL_INVALID_VALUE);
1492 			m_log << TestLog::EndSection;
1493 		});
1494 	ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_neg_z, "Invalid glTexImage2D() usage",
1495 		{
1496 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1497 			int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1498 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1499 			expectError(GL_INVALID_VALUE);
1500 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1501 			expectError(GL_INVALID_VALUE);
1502 			glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1503 			expectError(GL_INVALID_VALUE);
1504 			m_log << TestLog::EndSection;
1505 		});
1506 	ES2F_ADD_API_CASE(teximage2d_invalid_border, "Invalid glTexImage2D() usage",
1507 		{
1508 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
1509 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1510 			expectError(GL_INVALID_VALUE);
1511 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1512 			expectError(GL_INVALID_VALUE);
1513 			m_log << TestLog::EndSection;
1514 		});
1515 	ES2F_ADD_API_CASE(teximage2d_format_mismatch, "Invalid glTexImage2D() usage",
1516 		{
1517 			m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if format does not match internalformat.");
1518 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1519 			expectError(GL_INVALID_OPERATION);
1520 			m_log << TestLog::EndSection;
1521 		});
1522 	ES2F_ADD_API_CASE(teximage2d_type_format_mismatch, "Invalid glTexImage2D() usage",
1523 		{
1524 			m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if type is GL_UNSIGNED_SHORT_4_4_4_4 or GL_UNSIGNED_SHORT_5_5_5_1 and format is not GL_RGBA.");
1525 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0);
1526 			expectError(GL_INVALID_OPERATION);
1527 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
1528 			expectError(GL_INVALID_OPERATION);
1529 			m_log << TestLog::EndSection;
1530 		});
1531 
1532 	// glTexSubImage2D
1533 
1534 	ES2F_ADD_API_CASE(texsubimage2d_invalid_target, "Invalid glTexSubImage2D() usage",
1535 		{
1536 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
1537 			glTexSubImage2D(0, 0, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1538 			expectError(GL_INVALID_ENUM);
1539 			m_log << TestLog::EndSection;
1540 		});
1541 	ES2F_ADD_API_CASE(texsubimage2d_invalid_format, "Invalid glTexSubImage2D() usage",
1542 		{
1543 			GLuint texture;
1544 			glGenTextures(1, &texture);
1545 			glBindTexture(GL_TEXTURE_2D, texture);
1546 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1547 
1548 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format or type is not an accepted value.");
1549 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, GL_UNSIGNED_BYTE, 0);
1550 			expectError(GL_INVALID_ENUM);
1551 			m_log << TestLog::EndSection;
1552 
1553 			glDeleteTextures(1, &texture);
1554 		});
1555 	ES2F_ADD_API_CASE(texsubimage2d_invalid_type, "Invalid glTexSubImage2D() usage",
1556 		{
1557 			GLuint texture;
1558 			glGenTextures(1, &texture);
1559 			glBindTexture(GL_TEXTURE_2D, texture);
1560 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1561 
1562 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format or type is not an accepted value.");
1563 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGB, 0, 0);
1564 			expectError(GL_INVALID_ENUM);
1565 			m_log << TestLog::EndSection;
1566 
1567 			glDeleteTextures(1, &texture);
1568 		});
1569 	ES2F_ADD_API_CASE(texsubimage2d_neg_level_tex2d, "Invalid glTexSubImage2D() usage",
1570 		{
1571 			GLuint texture;
1572 			glGenTextures(1, &texture);
1573 			glBindTexture(GL_TEXTURE_2D, texture);
1574 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1575 
1576 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1577 			glTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1578 			expectError(GL_INVALID_VALUE);
1579 			m_log << TestLog::EndSection;
1580 
1581 			glDeleteTextures(1, &texture);
1582 		});
1583 	ES2F_ADD_API_CASE(texsubimage2d_neg_level_cube, "Invalid glTexSubImage2D() usage",
1584 		{
1585 			GLuint texture;
1586 			glGenTextures(1, &texture);
1587 			glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
1588 			FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL););
1589 
1590 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1591 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1592 			expectError(GL_INVALID_VALUE);
1593 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1594 			expectError(GL_INVALID_VALUE);
1595 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1596 			expectError(GL_INVALID_VALUE);
1597 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1598 			expectError(GL_INVALID_VALUE);
1599 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1600 			expectError(GL_INVALID_VALUE);
1601 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1602 			expectError(GL_INVALID_VALUE);
1603 			m_log << TestLog::EndSection;
1604 
1605 			glDeleteTextures(1, &texture);
1606 		});
1607 	ES2F_ADD_API_CASE(texsubimage2d_level_max_tex2d, "Invalid glTexSubImage2D() usage",
1608 		{
1609 			GLuint texture;
1610 			glGenTextures(1, &texture);
1611 			glBindTexture(GL_TEXTURE_2D, texture);
1612 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1613 
1614 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
1615 			deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
1616 			glTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1617 			expectError(GL_INVALID_VALUE);
1618 			m_log << TestLog::EndSection;
1619 
1620 			glDeleteTextures(1, &texture);
1621 		});
1622 	ES2F_ADD_API_CASE(texsubimage2d_level_max_cube, "Invalid glTexSubImage2D() usage",
1623 		{
1624 			GLuint texture;
1625 			glGenTextures(1, &texture);
1626 			glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
1627 			FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL););
1628 
1629 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
1630 			deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1631 			glTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1632 			expectError(GL_INVALID_VALUE);
1633 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1634 			expectError(GL_INVALID_VALUE);
1635 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1636 			expectError(GL_INVALID_VALUE);
1637 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1638 			expectError(GL_INVALID_VALUE);
1639 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1640 			expectError(GL_INVALID_VALUE);
1641 			glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1642 			expectError(GL_INVALID_VALUE);
1643 			m_log << TestLog::EndSection;
1644 
1645 			glDeleteTextures(1, &texture);
1646 		});
1647 	ES2F_ADD_API_CASE(texsubimage2d_neg_offset, "Invalid glTexSubImage2D() usage",
1648 		{
1649 			GLuint texture;
1650 			glGenTextures(1, &texture);
1651 			glBindTexture(GL_TEXTURE_2D, texture);
1652 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1653 
1654 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset or yoffset are negative.");
1655 			glTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1656 			expectError(GL_INVALID_VALUE);
1657 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1658 			expectError(GL_INVALID_VALUE);
1659 			glTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1660 			expectError(GL_INVALID_VALUE);
1661 			m_log << TestLog::EndSection;
1662 
1663 			glDeleteTextures(1, &texture);
1664 		});
1665 	ES2F_ADD_API_CASE(texsubimage2d_offset_allowed, "Invalid glTexSubImage2D() usage",
1666 		{
1667 			GLuint texture;
1668 			glGenTextures(1, &texture);
1669 			glBindTexture(GL_TEXTURE_2D, texture);
1670 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1671 
1672 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
1673 			glTexSubImage2D(GL_TEXTURE_2D, 0, 8, 4, 10, 10, GL_RGB, GL_UNSIGNED_BYTE, 0);
1674 			expectError(GL_INVALID_VALUE);
1675 			glTexSubImage2D(GL_TEXTURE_2D, 0, 4, 8, 10, 10, GL_RGB, GL_UNSIGNED_BYTE, 0);
1676 			expectError(GL_INVALID_VALUE);
1677 			glTexSubImage2D(GL_TEXTURE_2D, 0, 8, 8, 10, 10, GL_RGB, GL_UNSIGNED_BYTE, 0);
1678 			expectError(GL_INVALID_VALUE);
1679 			m_log << TestLog::EndSection;
1680 
1681 			glDeleteTextures(1, &texture);
1682 		});
1683 	ES2F_ADD_API_CASE(texsubimage2d_neg_wdt_hgt, "Invalid glTexSubImage2D() usage",
1684 		{
1685 			GLuint texture;
1686 			glGenTextures(1, &texture);
1687 			glBindTexture(GL_TEXTURE_2D, texture);
1688 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1689 
1690 			m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1691 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1692 			expectError(GL_INVALID_VALUE);
1693 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1694 			expectError(GL_INVALID_VALUE);
1695 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, -GL_RGB, GL_UNSIGNED_BYTE, 0);
1696 			expectError(GL_INVALID_VALUE);
1697 			m_log << TestLog::EndSection;
1698 
1699 			glDeleteTextures(1, &texture);
1700 		});
1701 	ES2F_ADD_API_CASE(texsubimage2d_type_format_mismatch, "Invalid glTexSubImage2D() usage",
1702 		{
1703 			GLuint texture;
1704 			glGenTextures(1, &texture);
1705 			glBindTexture(GL_TEXTURE_2D, texture);
1706 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1707 
1708 			m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if type is GL_UNSIGNED_SHORT_5_6_5 and format is not GL_RGB");
1709 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, 0);
1710 			expectError(GL_INVALID_OPERATION);
1711 			m_log << tcu::TestLog::EndSection;
1712 
1713 			m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if type is GL_UNSIGNED_SHORT_4_4_4_4 or GL_UNSIGNED_SHORT_5_5_5_1 and format is not GL_RGBA.");
1714 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0);
1715 			expectError(GL_INVALID_OPERATION);
1716 			glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
1717 			expectError(GL_INVALID_OPERATION);
1718 			m_log << tcu::TestLog::EndSection;
1719 
1720 			glDeleteTextures(1, &texture);
1721 		});
1722 
1723 	// glTexParameteri
1724 
1725 	ES2F_ADD_API_CASE(texparameteri, "Invalid glTexParameteri() usage",
1726 		{
1727 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1728 			glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1729 			expectError(GL_INVALID_ENUM);
1730 			glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR);
1731 			expectError(GL_INVALID_ENUM);
1732 			glTexParameteri(0, 0, GL_LINEAR);
1733 			expectError(GL_INVALID_ENUM);
1734 			m_log << TestLog::EndSection;
1735 
1736 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.");
1737 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0);
1738 			expectError(GL_INVALID_ENUM);
1739 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT);
1740 			expectError(GL_INVALID_ENUM);
1741 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0);
1742 			expectError(GL_INVALID_ENUM);
1743 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
1744 			expectError(GL_INVALID_ENUM);
1745 			m_log << TestLog::EndSection;
1746 		});
1747 	ES2F_ADD_API_CASE(texparameteri_bind, "Invalid glTexParameteri() usage",
1748 		{
1749 			GLuint texture;
1750 			glGenTextures(1, &texture);
1751 			glBindTexture(GL_TEXTURE_2D, texture);
1752 
1753 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1754 			glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1755 			expectError(GL_INVALID_ENUM);
1756 			glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR);
1757 			expectError(GL_INVALID_ENUM);
1758 			glTexParameteri(0, 0, GL_LINEAR);
1759 			expectError(GL_INVALID_ENUM);
1760 			m_log << TestLog::EndSection;
1761 
1762 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.");
1763 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0);
1764 			expectError(GL_INVALID_ENUM);
1765 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT);
1766 			expectError(GL_INVALID_ENUM);
1767 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0);
1768 			expectError(GL_INVALID_ENUM);
1769 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
1770 			expectError(GL_INVALID_ENUM);
1771 			m_log << TestLog::EndSection;
1772 
1773 			glDeleteTextures(1, &texture);
1774 		});
1775 
1776 	// glTexParameterf
1777 
1778 	ES2F_ADD_API_CASE(texparameterf, "Invalid glTexParameterf() usage",
1779 		{
1780 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1781 			glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1782 			expectError(GL_INVALID_ENUM);
1783 			glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR);
1784 			expectError(GL_INVALID_ENUM);
1785 			glTexParameterf(0, 0, GL_LINEAR);
1786 			expectError(GL_INVALID_ENUM);
1787 			m_log << TestLog::EndSection;
1788 
1789 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.");
1790 			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0);
1791 			expectError(GL_INVALID_ENUM);
1792 			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT);
1793 			expectError(GL_INVALID_ENUM);
1794 			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0);
1795 			expectError(GL_INVALID_ENUM);
1796 			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
1797 			expectError(GL_INVALID_ENUM);
1798 			m_log << TestLog::EndSection;
1799 		});
1800 	ES2F_ADD_API_CASE(texparameterf_bind, "Invalid glTexParameterf() usage",
1801 		{
1802 			GLuint texture;
1803 			glGenTextures(1, &texture);
1804 			glBindTexture(GL_TEXTURE_2D, texture);
1805 
1806 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1807 			glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1808 			expectError(GL_INVALID_ENUM);
1809 			glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR);
1810 			expectError(GL_INVALID_ENUM);
1811 			glTexParameterf(0, 0, GL_LINEAR);
1812 			expectError(GL_INVALID_ENUM);
1813 			m_log << TestLog::EndSection;
1814 
1815 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.");
1816 			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0);
1817 			expectError(GL_INVALID_ENUM);
1818 			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT);
1819 			expectError(GL_INVALID_ENUM);
1820 			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0);
1821 			expectError(GL_INVALID_ENUM);
1822 			glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
1823 			expectError(GL_INVALID_ENUM);
1824 			m_log << TestLog::EndSection;
1825 
1826 			glDeleteTextures(1, &texture);
1827 		});
1828 
1829 	// glTexParameteriv
1830 
1831 	ES2F_ADD_API_CASE(texparameteriv, "Invalid glTexParameteriv() usage",
1832 		{
1833 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1834 			GLint params[1] = {GL_LINEAR};
1835 			glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, &params[0]);
1836 			expectError(GL_INVALID_ENUM);
1837 			glTexParameteriv(GL_TEXTURE_2D, 0, &params[0]);
1838 			expectError(GL_INVALID_ENUM);
1839 			glTexParameteriv(0, 0, &params[0]);
1840 			expectError(GL_INVALID_ENUM);
1841 			m_log << TestLog::EndSection;
1842 
1843 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.");
1844 			params[0] = 0;
1845 			glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &params[0]);
1846 			expectError(GL_INVALID_ENUM);
1847 			params[0] = GL_REPEAT;
1848 			glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, &params[0]);
1849 			expectError(GL_INVALID_ENUM);
1850 			params[0] = 0;
1851 			glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &params[0]);
1852 			expectError(GL_INVALID_ENUM);
1853 			params[0] = GL_NEAREST;
1854 			glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, &params[0]);
1855 			expectError(GL_INVALID_ENUM);
1856 			m_log << TestLog::EndSection;
1857 		});
1858 	ES2F_ADD_API_CASE(texparameteriv_bind, "Invalid glTexParameteriv() usage",
1859 		{
1860 			GLuint texture;
1861 			glGenTextures(1, &texture);
1862 			glBindTexture(GL_TEXTURE_2D, texture);
1863 
1864 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1865 			GLint params[1] = {GL_LINEAR};
1866 			glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, &params[0]);
1867 			expectError(GL_INVALID_ENUM);
1868 			glTexParameteriv(GL_TEXTURE_2D, 0, &params[0]);
1869 			expectError(GL_INVALID_ENUM);
1870 			glTexParameteriv(0, 0, &params[0]);
1871 			expectError(GL_INVALID_ENUM);
1872 			m_log << TestLog::EndSection;
1873 
1874 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.");
1875 			params[0] = 0;
1876 			glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &params[0]);
1877 			expectError(GL_INVALID_ENUM);
1878 			params[0] = GL_REPEAT;
1879 			glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, &params[0]);
1880 			expectError(GL_INVALID_ENUM);
1881 			params[0] = 0;
1882 			glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &params[0]);
1883 			expectError(GL_INVALID_ENUM);
1884 			params[0] = GL_NEAREST;
1885 			glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, &params[0]);
1886 			expectError(GL_INVALID_ENUM);
1887 			m_log << TestLog::EndSection;
1888 
1889 			glDeleteTextures(1, &texture);
1890 		});
1891 
1892 	// glTexParameterfv
1893 
1894 	ES2F_ADD_API_CASE(texparameterfv, "Invalid glTexParameterfv() usage",
1895 		{
1896 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1897 			GLfloat params[1] = {GL_LINEAR};
1898 			glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, &params[0]);
1899 			expectError(GL_INVALID_ENUM);
1900 			glTexParameterfv(GL_TEXTURE_2D, 0, &params[0]);
1901 			expectError(GL_INVALID_ENUM);
1902 			glTexParameterfv(0, 0, &params[0]);
1903 			expectError(GL_INVALID_ENUM);
1904 			m_log << TestLog::EndSection;
1905 
1906 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.");
1907 			params[0] = 0.0f;
1908 			glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &params[0]);
1909 			expectError(GL_INVALID_ENUM);
1910 			params[0] = GL_REPEAT;
1911 			glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, &params[0]);
1912 			expectError(GL_INVALID_ENUM);
1913 			params[0] = 0.0f;
1914 			glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &params[0]);
1915 			expectError(GL_INVALID_ENUM);
1916 			params[0] = GL_NEAREST;
1917 			glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, &params[0]);
1918 			expectError(GL_INVALID_ENUM);
1919 			m_log << TestLog::EndSection;
1920 		});
1921 	ES2F_ADD_API_CASE(texparameterfv_bind, "Invalid glTexParameterfv() usage",
1922 		{
1923 			GLuint texture;
1924 			glGenTextures(1, &texture);
1925 			glBindTexture(GL_TEXTURE_2D, texture);
1926 
1927 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1928 			GLfloat params[1] = {GL_LINEAR};
1929 			glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, &params[0]);
1930 			expectError(GL_INVALID_ENUM);
1931 			glTexParameterfv(GL_TEXTURE_2D, 0, &params[0]);
1932 			expectError(GL_INVALID_ENUM);
1933 			glTexParameterfv(0, 0, &params[0]);
1934 			expectError(GL_INVALID_ENUM);
1935 			m_log << TestLog::EndSection;
1936 
1937 			m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.");
1938 			params[0] = 0.0f;
1939 			glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &params[0]);
1940 			expectError(GL_INVALID_ENUM);
1941 			params[0] = GL_REPEAT;
1942 			glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, &params[0]);
1943 			expectError(GL_INVALID_ENUM);
1944 			params[0] = 0.0f;
1945 			glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &params[0]);
1946 			expectError(GL_INVALID_ENUM);
1947 			params[0] = GL_NEAREST;
1948 			glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, &params[0]);
1949 			expectError(GL_INVALID_ENUM);
1950 			m_log << TestLog::EndSection;
1951 
1952 			glDeleteTextures(1, &texture);
1953 		});
1954 
1955 	// glCompressedTexSubImage2D
1956 
1957 	ES2F_ADD_API_CASE(compressedtexsubimage2d_invalid_target, "Invalid glCompressedTexSubImage2D() usage",
1958 		{
1959 			vector<deInt32> supported;
1960 			vector<deInt32> accepted;
1961 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
1962 			getCompressedTexSubImage2DFormat(supported, accepted);
1963 
1964 			if (accepted.empty())
1965 			{
1966 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
1967 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
1968 			}
1969 			else
1970 			{
1971 				for (int i = 0; i < (int)accepted.size(); i++)
1972 				{
1973 					m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
1974 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
1975 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
1976 					glCompressedTexSubImage2D(0, 0, 0, 0, 0, 0, accepted[i], 0, 0);
1977 					expectError(GL_INVALID_ENUM);
1978 					m_log << TestLog::EndSection;
1979 				}
1980 			}
1981 		});
1982 	ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_level_tex2d, "Invalid glCompressedTexSubImage2D() usage",
1983 		{
1984 			vector<deInt32> supported;
1985 			vector<deInt32> accepted;
1986 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
1987 			getCompressedTexSubImage2DFormat(supported, accepted);
1988 
1989 			if (accepted.empty())
1990 			{
1991 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
1992 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
1993 			}
1994 			else
1995 			{
1996 				for (int i = 0; i < (int)accepted.size(); i++)
1997 				{
1998 					m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1999 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2000 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2001 					//expectError(GL_NO_ERROR);
2002 					glCompressedTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2003 					expectError(GL_INVALID_VALUE);
2004 					m_log << TestLog::EndSection;
2005 				}
2006 			}
2007 		});
2008 	ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_level_cube, "Invalid glCompressedTexSubImage2D() usage",
2009 		{
2010 			vector<deInt32> supported;
2011 			vector<deInt32> accepted;
2012 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2013 			getCompressedTexSubImage2DFormat(supported, accepted);
2014 
2015 			if (accepted.empty())
2016 			{
2017 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2018 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2019 			}
2020 			else
2021 			{
2022 				for (int i = 0; i < (int)accepted.size(); i++)
2023 				{
2024 					m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
2025 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2026 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, accepted[i], 0, 0, 0, 0, 0);
2027 					//expectError(GL_NO_ERROR);
2028 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2029 					expectError(GL_INVALID_VALUE);
2030 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, accepted[i], 0, 0, 0, 0, 0);
2031 					//expectError(GL_NO_ERROR);
2032 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2033 					expectError(GL_INVALID_VALUE);
2034 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, accepted[i], 0, 0, 0, 0, 0);
2035 					//expectError(GL_NO_ERROR);
2036 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2037 					expectError(GL_INVALID_VALUE);
2038 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, accepted[i], 0, 0, 0, 0, 0);
2039 					//expectError(GL_NO_ERROR);
2040 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2041 					expectError(GL_INVALID_VALUE);
2042 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, accepted[i], 0, 0, 0, 0, 0);
2043 					//expectError(GL_NO_ERROR);
2044 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2045 					expectError(GL_INVALID_VALUE);
2046 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, accepted[i], 0, 0, 0, 0, 0);
2047 					//expectError(GL_NO_ERROR);
2048 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2049 					expectError(GL_INVALID_VALUE);
2050 					m_log << TestLog::EndSection;
2051 				}
2052 			}
2053 		});
2054 	ES2F_ADD_API_CASE(compressedtexsubimage2d_level_max_tex2d, "Invalid glCompressedTexSubImage2D() usage",
2055 		{
2056 			vector<deInt32> supported;
2057 			vector<deInt32> accepted;
2058 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2059 			getCompressedTexSubImage2DFormat(supported, accepted);
2060 
2061 			if (accepted.empty())
2062 			{
2063 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2064 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2065 			}
2066 			else
2067 			{
2068 				for (int i = 0; i < (int)accepted.size(); i++)
2069 				{
2070 					m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
2071 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2072 					deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
2073 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2074 					//expectError(GL_NO_ERROR);
2075 					glCompressedTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2076 					expectError(GL_INVALID_VALUE);
2077 					m_log << TestLog::EndSection;
2078 				}
2079 			}
2080 		});
2081 	ES2F_ADD_API_CASE(compressedtexsubimage2d_level_max_cube, "Invalid glCompressedTexSubImage2D() usage",
2082 		{
2083 			vector<deInt32> supported;
2084 			vector<deInt32> accepted;
2085 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2086 			getCompressedTexSubImage2DFormat(supported, accepted);
2087 
2088 			if (accepted.empty())
2089 			{
2090 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2091 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2092 			}
2093 			else
2094 			{
2095 				for (int i = 0; i < (int)accepted.size(); i++)
2096 				{
2097 					m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
2098 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2099 					deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
2100 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2101 					//expectError(GL_NO_ERROR);
2102 					glCompressedTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2103 					expectError(GL_INVALID_VALUE);
2104 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, accepted[i], 0, 0, 0, 0, 0);
2105 					//expectError(GL_NO_ERROR);
2106 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2107 					expectError(GL_INVALID_VALUE);
2108 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, accepted[i], 0, 0, 0, 0, 0);
2109 					//expectError(GL_NO_ERROR);
2110 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2111 					expectError(GL_INVALID_VALUE);
2112 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, accepted[i], 0, 0, 0, 0, 0);
2113 					//expectError(GL_NO_ERROR);
2114 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2115 					expectError(GL_INVALID_VALUE);
2116 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, accepted[i], 0, 0, 0, 0, 0);
2117 					//expectError(GL_NO_ERROR);
2118 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2119 					expectError(GL_INVALID_VALUE);
2120 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, accepted[i], 0, 0, 0, 0, 0);
2121 					//expectError(GL_NO_ERROR);
2122 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2123 					expectError(GL_INVALID_VALUE);
2124 					//glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, accepted[i], 0, 0, 0, 0, 0);
2125 					//expectError(GL_NO_ERROR);
2126 					glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2127 					expectError(GL_INVALID_VALUE);
2128 					m_log << TestLog::EndSection;
2129 				}
2130 			}
2131 		});
2132 		ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_offset, "Invalid glCompressedTexSubImage2D() usage",
2133 		{
2134 			vector<deInt32> supported;
2135 			vector<deInt32> accepted;
2136 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2137 			getCompressedTexSubImage2DFormat(supported, accepted);
2138 
2139 			if (accepted.empty())
2140 			{
2141 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2142 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2143 			}
2144 			else
2145 			{
2146 				for (int i = 0; i < (int)accepted.size(); i++)
2147 				{
2148 					m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset or yoffset are negative.");
2149 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2150 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2151 					//expectError(GL_NO_ERROR);
2152 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, accepted[i], 0, 0);
2153 					expectError(GL_INVALID_VALUE);
2154 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2155 					//expectError(GL_NO_ERROR);
2156 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, accepted[i], 0, 0);
2157 					expectError(GL_INVALID_VALUE);
2158 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2159 					//expectError(GL_NO_ERROR);
2160 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, accepted[i], 0, 0);
2161 					expectError(GL_INVALID_VALUE);
2162 					m_log << TestLog::EndSection;
2163 				}
2164 			}
2165 		});
2166 	ES2F_ADD_API_CASE(compressedtexsubimage2d_offset_allowed, "Invalid glCompressedTexSubImage2D() usage",
2167 		{
2168 			vector<deInt32> supported;
2169 			vector<deInt32> accepted;
2170 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2171 			getCompressedTexSubImage2DFormat(supported, accepted);
2172 
2173 			if (accepted.empty())
2174 			{
2175 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2176 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2177 			}
2178 			else
2179 			{
2180 				for (int i = 0; i < (int)accepted.size(); i++)
2181 				{
2182 					deUint32 maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
2183 					m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
2184 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2185 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2186 					//expectError(GL_NO_ERROR);
2187 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, maxTextureSize, 0, 0, 0, accepted[i], 0, 0);
2188 					expectError(GL_INVALID_VALUE);
2189 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2190 					//expectError(GL_NO_ERROR);
2191 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, maxTextureSize, 0, 0, accepted[i], 0, 0);
2192 					expectError(GL_INVALID_VALUE);
2193 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2194 					//expectError(GL_NO_ERROR);
2195 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, maxTextureSize, maxTextureSize, 0, 0, accepted[i], 0, 0);
2196 					expectError(GL_INVALID_VALUE);
2197 					m_log << TestLog::EndSection;
2198 				}
2199 			}
2200 		});
2201 	ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_wdt_hgt, "Invalid glCompressedTexSubImage2D() usage",
2202 		{
2203 			vector<deInt32> supported;
2204 			vector<deInt32> accepted;
2205 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2206 			getCompressedTexSubImage2DFormat(supported, accepted);
2207 
2208 			if (accepted.empty())
2209 			{
2210 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2211 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2212 			}
2213 			else
2214 			{
2215 				for (int i = 0; i < (int)accepted.size(); i++)
2216 				{
2217 					m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
2218 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2219 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2220 					//expectError(GL_NO_ERROR);
2221 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, 0, accepted[i], 0, 0);
2222 					expectError(GL_INVALID_VALUE);
2223 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2224 					//expectError(GL_NO_ERROR);
2225 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -1, accepted[i], 0, 0);
2226 					expectError(GL_INVALID_VALUE);
2227 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2228 					//expectError(GL_NO_ERROR);
2229 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, accepted[i], 0, 0);
2230 					expectError(GL_INVALID_VALUE);
2231 					m_log << TestLog::EndSection;
2232 				}
2233 			}
2234 		});
2235 	ES2F_ADD_API_CASE(compressedtexsubimage2d_invalid_size, "Invalid glCompressedTexImage2D() usage",
2236 		{
2237 			vector<deInt32> supported;
2238 			vector<deInt32> accepted;
2239 			getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2240 			getCompressedTexSubImage2DFormat(supported, accepted);
2241 
2242 			if (accepted.empty())
2243 			{
2244 				m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2245 				m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2246 			}
2247 			else
2248 			{
2249 				for (int i = 0; i < (int)accepted.size(); i++)
2250 				{
2251 					m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.");
2252 					m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2253 					//glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2254 					//expectError(GL_NO_ERROR);
2255 					glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, accepted[i], -1, 0);
2256 					expectError(GL_INVALID_VALUE);
2257 					m_log << TestLog::EndSection;
2258 				}
2259 			}
2260 		});
2261 }
2262 
2263 } // Functional
2264 } // gles2
2265 } // deqp
2266