1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 2.0 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief Negative Texture API tests.
22 *//*--------------------------------------------------------------------*/
24 #include "es2fNegativeTextureApiTests.hpp"
25 #include "es2fApiCase.hpp"
26 #include "tcuFormatUtil.hpp"
27 #include "tcuCompressedTexture.hpp"
28 #include "gluTextureUtil.hpp"
29 #include "gluContextInfo.hpp"
34 #include "glwEnums.hpp"
35 #include "glwDefs.hpp"
37 using namespace glw; // GL types
49 static deUint32 cubeFaceToGLFace (tcu::CubeFace face)
53 case tcu::CUBEFACE_NEGATIVE_X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
54 case tcu::CUBEFACE_POSITIVE_X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X;
55 case tcu::CUBEFACE_NEGATIVE_Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
56 case tcu::CUBEFACE_POSITIVE_Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
57 case tcu::CUBEFACE_NEGATIVE_Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
58 case tcu::CUBEFACE_POSITIVE_Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
65 #define FOR_CUBE_FACES(FACE_GL_VAR, BODY) \
68 for (int faceIterTcu = 0; faceIterTcu < tcu::CUBEFACE_LAST; faceIterTcu++) \
70 const GLenum FACE_GL_VAR = cubeFaceToGLFace((tcu::CubeFace)faceIterTcu); \
75 static void getCompressedTexSubImage2DFormat(const vector<deInt32>& supported, vector<deInt32>& accepted)
77 // Find a supported compressed texture format that is accepted by compressedTexSubImage2D()
79 static const GLuint compressedTexSubImage2DFormats[] =
81 0x83F0, // GL_COMPRESSED_RGB_S3TC_DXT1_EXT
82 0x83F1, // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
83 0x8C00, // GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
84 0x8C01, // GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
85 0x8C02, // GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
86 0x8C03 // GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
89 for (int i = 0; i < (int)supported.size(); i++)
91 vector<deInt32>::const_iterator fmt = std::find(supported.begin(), supported.end(), compressedTexSubImage2DFormats[i]);
92 if (fmt != supported.end())
93 accepted.push_back(*fmt);
97 NegativeTextureApiTests::NegativeTextureApiTests (Context& context)
98 : TestCaseGroup(context, "texture", "Negative Texture API Cases")
102 NegativeTextureApiTests::~NegativeTextureApiTests (void)
106 void NegativeTextureApiTests::init (void)
110 ES2F_ADD_API_CASE(activetexture_invalid_texture, "Invalid glActiveTexture() usage",
112 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).");
114 expectError(GL_INVALID_ENUM);
115 int numMaxTextureUnits = m_context.getContextInfo().getInt(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
116 glActiveTexture(GL_TEXTURE0 + numMaxTextureUnits);
117 expectError(GL_INVALID_ENUM);
118 m_log << TestLog::EndSection;
123 ES2F_ADD_API_CASE(bindtexture_invalid_target, "Invalid glBindTexture() usage",
125 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not one of the allowable values.");
127 expectError(GL_INVALID_ENUM);
128 m_log << TestLog::EndSection;
130 ES2F_ADD_API_CASE(bindtexture_type_mismatch, "Invalid glBindTexture() usage",
132 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if texture was previously created with a target that doesn't match that of target.");
134 glGenTextures(1, &texture);
135 glBindTexture(GL_TEXTURE_2D, texture);
136 glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
137 expectError(GL_INVALID_OPERATION);
138 glDeleteTextures(1, &texture);
139 m_log << TestLog::EndSection;
142 // glCompressedTexImage2D
144 ES2F_ADD_API_CASE(compressedteximage_2d_invalid_target, "Invalid glCompressedTexImage2D() usage",
146 vector<deInt32> compressedFormats;
147 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
148 if (!compressedFormats.empty())
150 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
151 glCompressedTexImage2D(0, 0, compressedFormats[0], 0, 0, 0, 0, 0);
152 expectError(GL_INVALID_ENUM);
153 m_log << TestLog::EndSection;
156 ES2F_ADD_API_CASE(compressedteximage_2d_invalid_format_tex2d, "Invalid glCompressedTexImage2D() usage",
158 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if internalformat is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS.");
159 glCompressedTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);
160 expectError(GL_INVALID_ENUM);
161 m_log << TestLog::EndSection;
163 ES2F_ADD_API_CASE(compressedteximage_2d_invalid_format_cube, "Invalid glCompressedTexImage2D() usage",
165 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if internalformat is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS.");
166 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0);
167 expectError(GL_INVALID_ENUM);
168 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0);
169 expectError(GL_INVALID_ENUM);
170 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0);
171 expectError(GL_INVALID_ENUM);
172 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0);
173 expectError(GL_INVALID_ENUM);
174 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0);
175 expectError(GL_INVALID_ENUM);
176 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0);
177 expectError(GL_INVALID_ENUM);
178 m_log << TestLog::EndSection;
180 ES2F_ADD_API_CASE(compressedteximage2d_neg_level_tex2d, "Invalid glCompressedTexImage2D() usage",
182 vector<deInt32> compressedFormats;
183 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
184 if (!compressedFormats.empty())
186 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
187 glCompressedTexImage2D(GL_TEXTURE_2D, -1, compressedFormats[0], 0, 0, 0, 0, 0);
188 expectError(GL_INVALID_VALUE);
189 m_log << TestLog::EndSection;
192 ES2F_ADD_API_CASE(compressedteximage2d_neg_level_cube, "Invalid glCompressedTexImage2D() usage",
194 vector<deInt32> compressedFormats;
195 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
196 if (!compressedFormats.empty())
198 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
199 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, compressedFormats[0], 0, 0, 0, 0, 0);
200 expectError(GL_INVALID_VALUE);
201 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, compressedFormats[0], 0, 0, 0, 0, 0);
202 expectError(GL_INVALID_VALUE);
203 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, compressedFormats[0], 0, 0, 0, 0, 0);
204 expectError(GL_INVALID_VALUE);
205 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, compressedFormats[0], 0, 0, 0, 0, 0);
206 expectError(GL_INVALID_VALUE);
207 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, compressedFormats[0], 0, 0, 0, 0, 0);
208 expectError(GL_INVALID_VALUE);
209 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, compressedFormats[0], 0, 0, 0, 0, 0);
210 expectError(GL_INVALID_VALUE);
211 m_log << TestLog::EndSection;
214 ES2F_ADD_API_CASE(compressedteximage2d_level_max_tex2d, "Invalid glCompressedTexImage2D() usage",
216 vector<deInt32> compressedFormats;
217 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
218 if (!compressedFormats.empty())
220 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
221 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
222 glCompressedTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
223 expectError(GL_INVALID_VALUE);
224 m_log << TestLog::EndSection;
227 ES2F_ADD_API_CASE(compressedteximage2d_level_max_cube_pos, "Invalid glCompressedTexImage2D() usage",
229 vector<deInt32> compressedFormats;
230 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
231 if (!compressedFormats.empty())
233 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
234 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
235 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
236 expectError(GL_INVALID_VALUE);
237 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
238 expectError(GL_INVALID_VALUE);
239 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
240 expectError(GL_INVALID_VALUE);
241 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
242 expectError(GL_INVALID_VALUE);
243 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
244 expectError(GL_INVALID_VALUE);
245 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, compressedFormats[0], 0, 0, 0, 0, 0);
246 expectError(GL_INVALID_VALUE);
247 m_log << TestLog::EndSection;
250 ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_tex2d, "Invalid glCompressedTexImage2D() usage",
252 vector<deInt32> compressedFormats;
253 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
254 if (!compressedFormats.empty())
256 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
257 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], -1, 0, 0, 0, 0);
258 expectError(GL_INVALID_VALUE);
259 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, -1, 0, 0, 0);
260 expectError(GL_INVALID_VALUE);
261 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], -1, -1, 0, 0, 0);
262 expectError(GL_INVALID_VALUE);
263 m_log << TestLog::EndSection;
266 ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_pos_x, "Invalid glCompressedTexImage2D() usage",
268 vector<deInt32> compressedFormats;
269 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
270 if (!compressedFormats.empty())
272 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
273 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], -1, 0, 0, 0, 0);
274 expectError(GL_INVALID_VALUE);
275 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], 0, -1, 0, 0, 0);
276 expectError(GL_INVALID_VALUE);
277 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], -1, -1, 0, 0, 0);
278 expectError(GL_INVALID_VALUE);
279 m_log << TestLog::EndSection;
282 ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_pos_y, "Invalid glCompressedTexImage2D() usage",
284 vector<deInt32> compressedFormats;
285 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
286 if (!compressedFormats.empty())
288 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
289 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], -1, 0, 0, 0, 0);
290 expectError(GL_INVALID_VALUE);
291 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], 0, -1, 0, 0, 0);
292 expectError(GL_INVALID_VALUE);
293 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], -1, -1, 0, 0, 0);
294 expectError(GL_INVALID_VALUE);
295 m_log << TestLog::EndSection;
298 ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_pos_z, "Invalid glCompressedTexImage2D() usage",
300 vector<deInt32> compressedFormats;
301 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
302 if (!compressedFormats.empty())
304 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
305 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], -1, 0, 0, 0, 0);
306 expectError(GL_INVALID_VALUE);
307 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], 0, -1, 0, 0, 0);
308 expectError(GL_INVALID_VALUE);
309 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], -1, -1, 0, 0, 0);
310 expectError(GL_INVALID_VALUE);
311 m_log << TestLog::EndSection;
314 ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_neg_x, "Invalid glCompressedTexImage2D() usage",
316 vector<deInt32> compressedFormats;
317 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
318 if (!compressedFormats.empty())
320 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
321 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], -1, 0, 0, 0, 0);
322 expectError(GL_INVALID_VALUE);
323 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], 0, -1, 0, 0, 0);
324 expectError(GL_INVALID_VALUE);
325 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], -1, -1, 0, 0, 0);
326 expectError(GL_INVALID_VALUE);
327 m_log << TestLog::EndSection;
330 ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_neg_y, "Invalid glCompressedTexImage2D() usage",
332 vector<deInt32> compressedFormats;
333 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
334 if (!compressedFormats.empty())
336 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
337 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], -1, 0, 0, 0, 0);
338 expectError(GL_INVALID_VALUE);
339 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], 0, -1, 0, 0, 0);
340 expectError(GL_INVALID_VALUE);
341 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], -1, -1, 0, 0, 0);
342 expectError(GL_INVALID_VALUE);
343 m_log << TestLog::EndSection;
346 ES2F_ADD_API_CASE(compressedteximage2d_neg_width_height_cube_neg_z, "Invalid glCompressedTexImage2D() usage",
348 vector<deInt32> compressedFormats;
349 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
350 if (!compressedFormats.empty())
352 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
353 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], -1, 0, 0, 0, 0);
354 expectError(GL_INVALID_VALUE);
355 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], 0, -1, 0, 0, 0);
356 expectError(GL_INVALID_VALUE);
357 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], -1, -1, 0, 0, 0);
358 expectError(GL_INVALID_VALUE);
359 m_log << TestLog::EndSection;
362 ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_tex2d, "Invalid glCompressedTexImage2D() usage",
364 vector<deInt32> compressedFormats;
365 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
366 if (!compressedFormats.empty())
368 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
369 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1;
370 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
371 expectError(GL_INVALID_VALUE);
372 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
373 expectError(GL_INVALID_VALUE);
374 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
375 expectError(GL_INVALID_VALUE);
376 m_log << TestLog::EndSection;
379 ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_pos_x, "Invalid glCompressedTexImage2D() usage",
381 vector<deInt32> compressedFormats;
382 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
383 if (!compressedFormats.empty())
385 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
386 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
387 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
388 expectError(GL_INVALID_VALUE);
389 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
390 expectError(GL_INVALID_VALUE);
391 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
392 expectError(GL_INVALID_VALUE);
393 m_log << TestLog::EndSection;
396 ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_pos_y, "Invalid glCompressedTexImage2D() usage",
398 vector<deInt32> compressedFormats;
399 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
400 if (!compressedFormats.empty())
402 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
403 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
404 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
405 expectError(GL_INVALID_VALUE);
406 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
407 expectError(GL_INVALID_VALUE);
408 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
409 expectError(GL_INVALID_VALUE);
410 m_log << TestLog::EndSection;
413 ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_pos_z, "Invalid glCompressedTexImage2D() usage",
415 vector<deInt32> compressedFormats;
416 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
417 if (!compressedFormats.empty())
419 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
420 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
421 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
422 expectError(GL_INVALID_VALUE);
423 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
424 expectError(GL_INVALID_VALUE);
425 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
426 expectError(GL_INVALID_VALUE);
427 m_log << TestLog::EndSection;
430 ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_neg_x, "Invalid glCompressedTexImage2D() usage",
432 vector<deInt32> compressedFormats;
433 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
434 if (!compressedFormats.empty())
436 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
437 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
438 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
439 expectError(GL_INVALID_VALUE);
440 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
441 expectError(GL_INVALID_VALUE);
442 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
443 expectError(GL_INVALID_VALUE);
444 m_log << TestLog::EndSection;
447 ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_neg_y, "Invalid glCompressedTexImage2D() usage",
449 vector<deInt32> compressedFormats;
450 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
451 if (!compressedFormats.empty())
453 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
454 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
455 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
456 expectError(GL_INVALID_VALUE);
457 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
458 expectError(GL_INVALID_VALUE);
459 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
460 expectError(GL_INVALID_VALUE);
461 m_log << TestLog::EndSection;
464 ES2F_ADD_API_CASE(compressedteximage2d_width_height_max_cube_neg_z, "Invalid glCompressedTexImage2D() usage",
466 vector<deInt32> compressedFormats;
467 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
468 if (!compressedFormats.empty())
470 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
471 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
472 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], maxTextureSize, 0, 0, 0, 0);
473 expectError(GL_INVALID_VALUE);
474 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], 0, maxTextureSize, 0, 0, 0);
475 expectError(GL_INVALID_VALUE);
476 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], maxTextureSize, maxTextureSize, 0, 0, 0);
477 expectError(GL_INVALID_VALUE);
478 m_log << TestLog::EndSection;
481 ES2F_ADD_API_CASE(compressedteximage2d_invalid_border, "Invalid glCompressedTexImage2D() usage",
483 vector<deInt32> compressedFormats;
484 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
485 if (!compressedFormats.empty())
487 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
488 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, 0, 1, 0, 0);
489 expectError(GL_INVALID_VALUE);
490 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, 0, -1, 0, 0);
491 expectError(GL_INVALID_VALUE);
492 m_log << TestLog::EndSection;
496 ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_pos_x, "Invalid glCompressedTexImage2D() usage",
498 vector<deInt32> compressedFormats;
499 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
500 if (!compressedFormats.empty())
502 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
503 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], 0, 0, 1, 0, 0);
504 expectError(GL_INVALID_VALUE);
505 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, compressedFormats[0], 0, 0, -1, 0, 0);
506 expectError(GL_INVALID_VALUE);
507 m_log << TestLog::EndSection;
510 ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_pos_y, "Invalid glCompressedTexImage2D() usage",
512 vector<deInt32> compressedFormats;
513 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
514 if (!compressedFormats.empty())
516 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
517 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], 0, 0, 1, 0, 0);
518 expectError(GL_INVALID_VALUE);
519 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, compressedFormats[0], 0, 0, -1, 0, 0);
520 expectError(GL_INVALID_VALUE);
521 m_log << TestLog::EndSection;
524 ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_pos_z, "Invalid glCompressedTexImage2D() usage",
526 vector<deInt32> compressedFormats;
527 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
528 if (!compressedFormats.empty())
530 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
531 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], 0, 0, 1, 0, 0);
532 expectError(GL_INVALID_VALUE);
533 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, compressedFormats[0], 0, 0, -1, 0, 0);
534 expectError(GL_INVALID_VALUE);
535 m_log << TestLog::EndSection;
538 ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_neg_x, "Invalid glCompressedTexImage2D() usage",
540 vector<deInt32> compressedFormats;
541 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
542 if (!compressedFormats.empty())
544 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
545 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], 0, 0, 1, 0, 0);
546 expectError(GL_INVALID_VALUE);
547 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, compressedFormats[0], 0, 0, -1, 0, 0);
548 expectError(GL_INVALID_VALUE);
549 m_log << TestLog::EndSection;
552 ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_neg_y, "Invalid glCompressedTexImage2D() usage",
554 vector<deInt32> compressedFormats;
555 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
556 if (!compressedFormats.empty())
558 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
559 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], 0, 0, 1, 0, 0);
560 expectError(GL_INVALID_VALUE);
561 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, compressedFormats[0], 0, 0, -1, 0, 0);
562 expectError(GL_INVALID_VALUE);
563 m_log << TestLog::EndSection;
566 ES2F_ADD_API_CASE(compressedteximage2d_invalid_border_cube_neg_z, "Invalid glCompressedTexImage2D() usage",
568 vector<deInt32> compressedFormats;
569 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
570 if (!compressedFormats.empty())
572 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
573 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], 0, 0, 1, 0, 0);
574 expectError(GL_INVALID_VALUE);
575 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, compressedFormats[0], 0, 0, -1, 0, 0);
576 expectError(GL_INVALID_VALUE);
577 m_log << TestLog::EndSection;
580 ES2F_ADD_API_CASE(compressedteximage2d_invalid_size, "Invalid glCompressedTexImage2D() usage",
582 vector<deInt32> compressedFormats;
583 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
584 if (!compressedFormats.empty())
586 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.");
587 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, 0, 0, -1, 0);
588 expectError(GL_INVALID_VALUE);
589 m_log << TestLog::EndSection;
595 ES2F_ADD_API_CASE(copyteximage2d_invalid_target, "Invalid glCopyTexImage2D() usage",
597 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
598 glCopyTexImage2D(0, 0, GL_RGB, 0, 0, 64, 64, 0);
599 expectError(GL_INVALID_ENUM);
600 m_log << TestLog::EndSection;
602 ES2F_ADD_API_CASE(copyteximage2d_invalid_format_tex2d, "Invalid glCopyTexImage2D() usage",
604 m_log << TestLog::Section("", "GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not an accepted format.");
605 glCopyTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 64, 64, 0);
606 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
607 m_log << TestLog::EndSection;
609 ES2F_ADD_API_CASE(copyteximage2d_invalid_format_cube, "Invalid glCopyTexImage2D() usage",
611 m_log << TestLog::Section("", "GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not an accepted format.");
612 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 16, 16, 0);
613 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
614 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 16, 16, 0);
615 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
616 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 16, 16, 0);
617 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
618 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 16, 16, 0);
619 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
620 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 16, 16, 0);
621 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
622 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 16, 16, 0);
623 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
624 m_log << TestLog::EndSection;
626 ES2F_ADD_API_CASE(copyteximage2d_inequal_width_height_cube, "Invalid glCopyTexImage2D() usage",
628 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.");
629 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0);
630 expectError(GL_INVALID_VALUE);
631 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0);
632 expectError(GL_INVALID_VALUE);
633 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0);
634 expectError(GL_INVALID_VALUE);
635 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0);
636 expectError(GL_INVALID_VALUE);
637 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0);
638 expectError(GL_INVALID_VALUE);
639 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0);
640 expectError(GL_INVALID_VALUE);
641 m_log << TestLog::EndSection;
643 ES2F_ADD_API_CASE(copyteximage2d_neg_level_tex2d, "Invalid glCopyTexImage2D() usage",
645 m_log << TestLog::Section("", "");
646 glCopyTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 0, 0, 64, 64, 0);
647 expectError(GL_INVALID_VALUE);
648 m_log << TestLog::EndSection;
650 ES2F_ADD_API_CASE(copyteximage2d_neg_level_cube, "Invalid glCopyTexImage2D() usage",
652 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
653 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0);
654 expectError(GL_INVALID_VALUE);
655 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0);
656 expectError(GL_INVALID_VALUE);
657 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0);
658 expectError(GL_INVALID_VALUE);
659 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0);
660 expectError(GL_INVALID_VALUE);
661 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0);
662 expectError(GL_INVALID_VALUE);
663 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0);
664 expectError(GL_INVALID_VALUE);
665 m_log << TestLog::EndSection;
667 ES2F_ADD_API_CASE(copyteximage2d_level_max_tex2d, "Invalid glCopyTexImage2D() usage",
669 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
670 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
671 glCopyTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 0, 0, 64, 64, 0);
672 expectError(GL_INVALID_VALUE);
673 m_log << TestLog::EndSection;
675 ES2F_ADD_API_CASE(copyteximage2d_level_max_cube, "Invalid glCopyTexImage2D() usage",
677 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
678 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
679 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
680 expectError(GL_INVALID_VALUE);
681 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
682 expectError(GL_INVALID_VALUE);
683 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
684 expectError(GL_INVALID_VALUE);
685 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
686 expectError(GL_INVALID_VALUE);
687 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
688 expectError(GL_INVALID_VALUE);
689 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, GL_RGB, 0, 0, 16, 16, 0);
690 expectError(GL_INVALID_VALUE);
691 m_log << TestLog::EndSection;
693 ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_tex2d, "Invalid glCopyTexImage2D() usage",
695 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, -1, 0);
701 expectError(GL_INVALID_VALUE);
702 m_log << TestLog::EndSection;
704 ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_pos_x, "Invalid glCopyTexImage2D() usage",
706 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0);
712 expectError(GL_INVALID_VALUE);
713 m_log << TestLog::EndSection;
715 ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_pos_y, "Invalid glCopyTexImage2D() usage",
717 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0);
723 expectError(GL_INVALID_VALUE);
724 m_log << TestLog::EndSection;
726 ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_pos_z, "Invalid glCopyTexImage2D() usage",
728 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0);
734 expectError(GL_INVALID_VALUE);
735 m_log << TestLog::EndSection;
737 ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_neg_x, "Invalid glCopyTexImage2D() usage",
739 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0);
745 expectError(GL_INVALID_VALUE);
746 m_log << TestLog::EndSection;
748 ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_neg_y, "Invalid glCopyTexImage2D() usage",
750 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0);
756 expectError(GL_INVALID_VALUE);
757 m_log << TestLog::EndSection;
759 ES2F_ADD_API_CASE(copyteximage2d_invalid_width_height_cube_neg_z, "Invalid glCopyTexImage2D() usage",
761 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0);
767 expectError(GL_INVALID_VALUE);
768 m_log << TestLog::EndSection;
770 ES2F_ADD_API_CASE(copyteximage2d_width_height_max_tex2d, "Invalid glCopyTexImage2D() usage",
772 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
773 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1;
774 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
775 expectError(GL_INVALID_VALUE);
776 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
777 expectError(GL_INVALID_VALUE);
778 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
779 expectError(GL_INVALID_VALUE);
780 m_log << TestLog::EndSection;
782 ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_pos_x, "Invalid glCopyTexImage2D() usage",
784 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
785 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
786 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
787 expectError(GL_INVALID_VALUE);
788 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
789 expectError(GL_INVALID_VALUE);
790 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
791 expectError(GL_INVALID_VALUE);
792 m_log << TestLog::EndSection;
794 ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_pos_y, "Invalid glCopyTexImage2D() usage",
796 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
797 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
798 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
799 expectError(GL_INVALID_VALUE);
800 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
801 expectError(GL_INVALID_VALUE);
802 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
803 expectError(GL_INVALID_VALUE);
804 m_log << TestLog::EndSection;
806 ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_pos_z, "Invalid glCopyTexImage2D() usage",
808 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
809 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
810 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
811 expectError(GL_INVALID_VALUE);
812 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
813 expectError(GL_INVALID_VALUE);
814 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
815 expectError(GL_INVALID_VALUE);
816 m_log << TestLog::EndSection;
818 ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_neg_x, "Invalid glCopyTexImage2D() usage",
820 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
821 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
822 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
823 expectError(GL_INVALID_VALUE);
824 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
825 expectError(GL_INVALID_VALUE);
826 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
827 expectError(GL_INVALID_VALUE);
828 m_log << TestLog::EndSection;
830 ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_neg_y, "Invalid glCopyTexImage2D() usage",
832 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
833 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
834 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
835 expectError(GL_INVALID_VALUE);
836 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
837 expectError(GL_INVALID_VALUE);
838 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
839 expectError(GL_INVALID_VALUE);
840 m_log << TestLog::EndSection;
842 ES2F_ADD_API_CASE(copyteximage2d_width_height_max_cube_neg_z, "Invalid glCopyTexImage2D() usage",
844 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
845 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
846 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
847 expectError(GL_INVALID_VALUE);
848 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
849 expectError(GL_INVALID_VALUE);
850 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
851 expectError(GL_INVALID_VALUE);
852 m_log << TestLog::EndSection;
854 ES2F_ADD_API_CASE(copyteximage2d_invalid_border_tex2d, "Invalid glCopyTexImage2D() usage",
856 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
857 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 64, 64, -1);
858 expectError(GL_INVALID_VALUE);
859 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 64, 64, 1);
860 expectError(GL_INVALID_VALUE);
861 m_log << TestLog::EndSection;
863 ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_pos_x, "Invalid glCopyTexImage2D() usage",
865 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
866 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 16, -1);
867 expectError(GL_INVALID_VALUE);
868 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 16, 1);
869 expectError(GL_INVALID_VALUE);
870 m_log << TestLog::EndSection;
872 ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_pos_y, "Invalid glCopyTexImage2D() usage",
874 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
875 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 16, -1);
876 expectError(GL_INVALID_VALUE);
877 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 16, 1);
878 expectError(GL_INVALID_VALUE);
879 m_log << TestLog::EndSection;
881 ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_pos_z, "Invalid glCopyTexImage2D() usage",
883 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
884 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 16, -1);
885 expectError(GL_INVALID_VALUE);
886 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 16, 1);
887 expectError(GL_INVALID_VALUE);
888 m_log << TestLog::EndSection;
890 ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_neg_x, "Invalid glCopyTexImage2D() usage",
892 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
893 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 16, -1);
894 expectError(GL_INVALID_VALUE);
895 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 16, 1);
896 expectError(GL_INVALID_VALUE);
897 m_log << TestLog::EndSection;
899 ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_neg_y, "Invalid glCopyTexImage2D() usage",
901 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
902 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 16, -1);
903 expectError(GL_INVALID_VALUE);
904 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 16, 1);
905 expectError(GL_INVALID_VALUE);
906 m_log << TestLog::EndSection;
908 ES2F_ADD_API_CASE(copyteximage2d_invalid_border_cube_neg_z, "Invalid glCopyTexImage2D() usage",
910 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
911 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 16, -1);
912 expectError(GL_INVALID_VALUE);
913 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 16, 1);
914 expectError(GL_INVALID_VALUE);
915 m_log << TestLog::EndSection;
918 ES2F_ADD_API_CASE(copyteximage2d_incomplete_framebuffer, "Invalid glCopyTexImage2D() usage",
920 m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
922 glGenFramebuffers(1, &fbo);
923 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
924 glCheckFramebufferStatus(GL_FRAMEBUFFER);
926 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 64, 64, 0);
927 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
928 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 16, 0);
929 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
930 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 16, 0);
931 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
932 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 16, 0);
933 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
934 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 16, 0);
935 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
936 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 16, 0);
937 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
938 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 16, 0);
939 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
941 glBindFramebuffer(GL_FRAMEBUFFER, 0);
942 glDeleteFramebuffers(1, &fbo);
943 m_log << tcu::TestLog::EndSection;
946 // glCopyTexSubImage2D
948 ES2F_ADD_API_CASE(copytexsubimage2d_invalid_target, "Invalid glCopyTexSubImage2D() usage",
950 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
951 glCopyTexSubImage2D(0, 0, 0, 0, 0, 0, 0, 0);
952 expectError(GL_INVALID_ENUM);
953 m_log << TestLog::EndSection;
955 ES2F_ADD_API_CASE(copytexsubimage2d_neg_level_tex2d, "Invalid glCopyTexSubImage2D() usage",
958 glGenTextures(1, &texture);
959 glBindTexture(GL_TEXTURE_2D, texture);
960 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
962 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
963 glCopyTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, 0, 0);
964 expectError(GL_INVALID_VALUE);
965 m_log << TestLog::EndSection;
967 glDeleteTextures(1, &texture);
969 ES2F_ADD_API_CASE(copytexsubimage2d_neg_level_cube, "Invalid glCopyTexSubImage2D() usage",
972 glGenTextures(1, &texture);
973 glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
974 FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL););
976 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
977 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, 0, 0, 0, 0, 0, 0);
978 expectError(GL_INVALID_VALUE);
979 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, 0, 0, 0, 0, 0, 0);
980 expectError(GL_INVALID_VALUE);
981 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, 0, 0, 0, 0, 0, 0);
982 expectError(GL_INVALID_VALUE);
983 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, 0, 0, 0, 0, 0, 0);
984 expectError(GL_INVALID_VALUE);
985 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, 0, 0, 0, 0, 0, 0);
986 expectError(GL_INVALID_VALUE);
987 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, 0, 0, 0, 0, 0, 0);
988 expectError(GL_INVALID_VALUE);
989 m_log << TestLog::EndSection;
991 glDeleteTextures(1, &texture);
993 ES2F_ADD_API_CASE(copytexsubimage2d_level_max_tex2d, "Invalid glCopyTexSubImage2D() usage",
996 glGenTextures(1, &texture);
997 glBindTexture(GL_TEXTURE_2D, texture);
998 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1000 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
1001 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
1002 glCopyTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1003 expectError(GL_INVALID_VALUE);
1004 m_log << TestLog::EndSection;
1006 glDeleteTextures(1, &texture);
1008 ES2F_ADD_API_CASE(copytexsubimage2d_level_max_cube_pos, "Invalid glCopyTexSubImage2D() usage",
1011 glGenTextures(1, &texture);
1012 glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
1013 FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL););
1015 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_SIZE).");
1016 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1017 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1018 expectError(GL_INVALID_VALUE);
1019 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1020 expectError(GL_INVALID_VALUE);
1021 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1022 expectError(GL_INVALID_VALUE);
1023 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1024 expectError(GL_INVALID_VALUE);
1025 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1026 expectError(GL_INVALID_VALUE);
1027 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, 0, 0);
1028 expectError(GL_INVALID_VALUE);
1029 m_log << TestLog::EndSection;
1031 glDeleteTextures(1, &texture);
1033 ES2F_ADD_API_CASE(copytexsubimage2d_neg_offset, "Invalid glCopyTexSubImage2D() usage",
1036 glGenTextures(1, &texture);
1037 glBindTexture(GL_TEXTURE_2D, texture);
1038 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1040 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset < 0 or yoffset < 0.");
1041 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, 0, 0);
1042 expectError(GL_INVALID_VALUE);
1043 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, 0, 0);
1044 expectError(GL_INVALID_VALUE);
1045 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, 0, 0);
1046 expectError(GL_INVALID_VALUE);
1047 m_log << TestLog::EndSection;
1049 glDeleteTextures(1, &texture);
1051 ES2F_ADD_API_CASE(copytexsubimage2d_offset_allowed, "Invalid glCopyTexSubImage2D() usage",
1054 glGenTextures(1, &texture);
1055 glBindTexture(GL_TEXTURE_2D, texture);
1056 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1058 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
1059 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 8, 4, 0, 0, 10, 10);
1060 expectError(GL_INVALID_VALUE);
1061 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 4, 8, 0, 0, 10, 10);
1062 expectError(GL_INVALID_VALUE);
1063 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 8, 8, 0, 0, 10, 10);
1064 expectError(GL_INVALID_VALUE);
1065 m_log << TestLog::EndSection;
1067 glDeleteTextures(1, &texture);
1069 ES2F_ADD_API_CASE(copytexsubimage2d_neg_wdt_hgt, "Invalid glCopyTexSubImage2D() usage",
1072 glGenTextures(1, &texture);
1073 glBindTexture(GL_TEXTURE_2D, texture);
1074 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1076 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1077 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, 0);
1078 expectError(GL_INVALID_VALUE);
1079 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, -1);
1080 expectError(GL_INVALID_VALUE);
1081 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, -1);
1082 expectError(GL_INVALID_VALUE);
1083 m_log << TestLog::EndSection;
1085 glDeleteTextures(1, &texture);
1087 ES2F_ADD_API_CASE(copytexsubimage2d_incomplete_framebuffer, "Invalid glCopyTexSubImage2D() usage",
1090 glGenTextures(1, &texture);
1091 glBindTexture(GL_TEXTURE_2D, texture);
1092 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1094 m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1096 glGenFramebuffers(1, &fbo);
1097 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1098 glCheckFramebufferStatus(GL_FRAMEBUFFER);
1100 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);
1101 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1102 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0);
1103 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1104 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0);
1105 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1106 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0);
1107 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1108 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0);
1109 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1110 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0);
1111 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1112 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0);
1113 expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1115 glBindFramebuffer(GL_FRAMEBUFFER, 0);
1116 glDeleteFramebuffers(1, &fbo);
1117 m_log << tcu::TestLog::EndSection;
1119 glDeleteTextures(1, &texture);
1124 ES2F_ADD_API_CASE(deletetextures_invalid_number, "Invalid glDeleteTextures() usage",
1126 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
1127 glDeleteTextures(-1,0);
1128 expectError(GL_INVALID_VALUE);
1129 m_log << TestLog::EndSection;
1131 ES2F_ADD_API_CASE(deletetextures_invalid_number_bind, "Invalid glDeleteTextures() usage",
1134 glGenTextures(1, &texture);
1136 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
1137 glBindTexture(GL_TEXTURE_2D, texture);
1138 glDeleteTextures(-1,0);
1139 expectError(GL_INVALID_VALUE);
1140 m_log << TestLog::EndSection;
1142 glDeleteTextures(1, &texture);
1147 ES2F_ADD_API_CASE(generatemipmap_invalid_target, "Invalid glGenerateMipmap() usage",
1149 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.");
1150 glGenerateMipmap(0);
1151 expectError(GL_INVALID_ENUM);
1152 m_log << TestLog::EndSection;
1154 ES2F_ADD_API_CASE(generatemipmap_npot_wdt_hgt, "Invalid glGenerateMipmap() usage",
1158 if (m_context.getContextInfo().isExtensionSupported("GL_OES_texture_npot"))
1160 m_log << tcu::TestLog::Message
1161 << "GL_OES_texture_npot extension removes error condition, skipping test"
1162 << tcu::TestLog::EndMessage;
1166 glActiveTexture(GL_TEXTURE0);
1167 glGenTextures(1, &texture);
1168 glBindTexture(GL_TEXTURE_2D, texture);
1170 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.");
1171 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 257, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1172 glGenerateMipmap(GL_TEXTURE_2D);
1173 expectError(GL_INVALID_OPERATION);
1174 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 257, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1175 glGenerateMipmap(GL_TEXTURE_2D);
1176 expectError(GL_INVALID_OPERATION);
1177 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 257, 257, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1178 glGenerateMipmap(GL_TEXTURE_2D);
1179 expectError(GL_INVALID_OPERATION);
1180 m_log << TestLog::EndSection;
1182 glDeleteTextures(1, &texture);
1184 ES2F_ADD_API_CASE(generatemipmap_zero_level_array_compressed, "Invalid glGenerateMipmap() usage",
1186 vector<deInt32> compressedFormats;
1187 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
1188 if (!compressedFormats.empty())
1190 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format.");
1191 glCompressedTexImage2D(GL_TEXTURE_2D, 0, compressedFormats[0], 0, 0, 0, 0, 0);
1192 glGenerateMipmap(GL_TEXTURE_2D);
1193 expectError(GL_INVALID_OPERATION);
1194 m_log << TestLog::EndSection;
1197 ES2F_ADD_API_CASE(generatemipmap_incomplete_cube, "Invalid glGenerateMipmap() usage",
1200 glGenTextures(1, &texture);
1201 glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
1203 m_log << TestLog::Section("", "INVALID_OPERATION is generated if the texture bound to target is not cube complete.");
1204 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1205 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1206 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1207 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1208 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1209 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1210 glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
1211 expectError(GL_INVALID_OPERATION);
1212 m_log << TestLog::EndSection;
1214 glDeleteTextures(1, &texture);
1219 ES2F_ADD_API_CASE(gentextures_invalid_size, "Invalid glGenTextures() usage",
1221 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
1222 glGenTextures(-1, 0);
1223 expectError(GL_INVALID_VALUE);
1224 m_log << TestLog::EndSection;
1229 ES2F_ADD_API_CASE(pixelstorei_invalid_pname, "Invalid glPixelStorei() usage",
1231 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if pname is not an accepted value.");
1233 expectError(GL_INVALID_ENUM);
1234 m_log << TestLog::EndSection;
1236 ES2F_ADD_API_CASE(pixelstorei_invalid_param, "Invalid glPixelStorei() usage",
1238 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if alignment is specified as other than 1, 2, 4, or 8.");
1239 glPixelStorei(GL_PACK_ALIGNMENT, 0);
1240 expectError(GL_INVALID_VALUE);
1241 glPixelStorei(GL_UNPACK_ALIGNMENT, 0);
1242 expectError(GL_INVALID_VALUE);
1243 glPixelStorei(GL_PACK_ALIGNMENT, 16);
1244 expectError(GL_INVALID_VALUE);
1245 glPixelStorei(GL_UNPACK_ALIGNMENT, 16);
1246 expectError(GL_INVALID_VALUE);
1247 m_log << TestLog::EndSection;
1252 ES2F_ADD_API_CASE(teximage2d_invalid_target, "Invalid glTexImage2D() usage",
1254 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
1255 glTexImage2D(0, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1256 expectError(GL_INVALID_ENUM);
1257 m_log << TestLog::EndSection;
1259 ES2F_ADD_API_CASE(teximage2d_invalid_format, "Invalid glTexImage2D() usage",
1261 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format or type is not an accepted value.");
1262 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, 0, GL_UNSIGNED_BYTE, 0);
1263 expectError(GL_INVALID_ENUM);
1264 m_log << TestLog::EndSection;
1266 ES2F_ADD_API_CASE(teximage2d_invalid_type, "Invalid glTexImage2D() usage",
1268 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format or type is not an accepted value.");
1269 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, 0, 0);
1270 expectError(GL_INVALID_ENUM);
1271 m_log << TestLog::EndSection;
1273 ES2F_ADD_API_CASE(teximage2d_inequal_width_height_cube, "Invalid glTexImage2D() usage",
1275 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.");
1276 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1277 expectError(GL_INVALID_VALUE);
1278 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1279 expectError(GL_INVALID_VALUE);
1280 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1281 expectError(GL_INVALID_VALUE);
1282 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1283 expectError(GL_INVALID_VALUE);
1284 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1285 expectError(GL_INVALID_VALUE);
1286 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1287 expectError(GL_INVALID_VALUE);
1288 m_log << TestLog::EndSection;
1290 ES2F_ADD_API_CASE(teximage2d_neg_level_tex2d, "Invalid glTexImage2D() usage",
1292 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1293 glTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1294 expectError(GL_INVALID_VALUE);
1295 m_log << TestLog::EndSection;
1297 ES2F_ADD_API_CASE(teximage2d_neg_level_cube, "Invalid glTexImage2D() usage",
1299 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1300 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1301 expectError(GL_INVALID_VALUE);
1302 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1303 expectError(GL_INVALID_VALUE);
1304 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1305 expectError(GL_INVALID_VALUE);
1306 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1307 expectError(GL_INVALID_VALUE);
1308 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1309 expectError(GL_INVALID_VALUE);
1310 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1311 expectError(GL_INVALID_VALUE);
1312 m_log << TestLog::EndSection;
1314 ES2F_ADD_API_CASE(teximage2d_level_max_tex2d, "Invalid glTexImage2D() usage",
1316 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
1317 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
1318 glTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1319 expectError(GL_INVALID_VALUE);
1320 m_log << TestLog::EndSection;
1322 ES2F_ADD_API_CASE(teximage2d_level_max_cube, "Invalid glTexImage2D() usage",
1324 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
1325 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1326 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1327 expectError(GL_INVALID_VALUE);
1328 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1329 expectError(GL_INVALID_VALUE);
1330 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1331 expectError(GL_INVALID_VALUE);
1332 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1333 expectError(GL_INVALID_VALUE);
1334 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1335 expectError(GL_INVALID_VALUE);
1336 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1337 expectError(GL_INVALID_VALUE);
1338 m_log << TestLog::EndSection;
1340 ES2F_ADD_API_CASE(teximage2d_invalid_internalformat, "Invalid glTexImage2D() usage",
1342 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if internalformat is not an accepted format.");
1343 glTexImage2D(GL_TEXTURE_2D, 0, 0, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1344 expectError(GL_INVALID_VALUE);
1345 m_log << TestLog::EndSection;
1347 ES2F_ADD_API_CASE(teximage2d_neg_width_height_tex2d, "Invalid glTexImage2D() usage",
1349 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1355 expectError(GL_INVALID_VALUE);
1356 m_log << TestLog::EndSection;
1358 ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_pos_x, "Invalid glTexImage2D() usage",
1360 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1366 expectError(GL_INVALID_VALUE);
1367 m_log << TestLog::EndSection;
1369 ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_pos_y, "Invalid glTexImage2D() usage",
1371 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1377 expectError(GL_INVALID_VALUE);
1378 m_log << TestLog::EndSection;
1380 ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_pos_z, "Invalid glTexImage2D() usage",
1382 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1388 expectError(GL_INVALID_VALUE);
1389 m_log << TestLog::EndSection;
1391 ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_neg_x, "Invalid glTexImage2D() usage",
1393 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1399 expectError(GL_INVALID_VALUE);
1400 m_log << TestLog::EndSection;
1402 ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_neg_y, "Invalid glTexImage2D() usage",
1404 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1410 expectError(GL_INVALID_VALUE);
1411 m_log << TestLog::EndSection;
1413 ES2F_ADD_API_CASE(teximage2d_neg_width_height_cube_neg_z, "Invalid glTexImage2D() usage",
1415 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
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 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1421 expectError(GL_INVALID_VALUE);
1422 m_log << TestLog::EndSection;
1424 ES2F_ADD_API_CASE(teximage2d_width_height_max_tex2d, "Invalid glTexImage2D() usage",
1426 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
1427 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1;
1428 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1429 expectError(GL_INVALID_VALUE);
1430 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1431 expectError(GL_INVALID_VALUE);
1432 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1433 expectError(GL_INVALID_VALUE);
1434 m_log << TestLog::EndSection;
1436 ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_pos_x, "Invalid glTexImage2D() usage",
1438 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1439 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1440 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1441 expectError(GL_INVALID_VALUE);
1442 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1443 expectError(GL_INVALID_VALUE);
1444 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1445 expectError(GL_INVALID_VALUE);
1446 m_log << TestLog::EndSection;
1448 ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_pos_y, "Invalid glTexImage2D() usage",
1450 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1451 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1452 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1453 expectError(GL_INVALID_VALUE);
1454 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1455 expectError(GL_INVALID_VALUE);
1456 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1457 expectError(GL_INVALID_VALUE);
1458 m_log << TestLog::EndSection;
1460 ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_pos_z, "Invalid glTexImage2D() usage",
1462 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1463 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1464 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1465 expectError(GL_INVALID_VALUE);
1466 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1467 expectError(GL_INVALID_VALUE);
1468 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1469 expectError(GL_INVALID_VALUE);
1470 m_log << TestLog::EndSection;
1472 ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_neg_x, "Invalid glTexImage2D() usage",
1474 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1475 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1476 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1477 expectError(GL_INVALID_VALUE);
1478 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1479 expectError(GL_INVALID_VALUE);
1480 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1481 expectError(GL_INVALID_VALUE);
1482 m_log << TestLog::EndSection;
1484 ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_neg_y, "Invalid glTexImage2D() usage",
1486 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1487 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1488 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1489 expectError(GL_INVALID_VALUE);
1490 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1491 expectError(GL_INVALID_VALUE);
1492 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1493 expectError(GL_INVALID_VALUE);
1494 m_log << TestLog::EndSection;
1496 ES2F_ADD_API_CASE(teximage2d_width_height_max_cube_neg_z, "Invalid glTexImage2D() usage",
1498 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1499 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1500 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1501 expectError(GL_INVALID_VALUE);
1502 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1503 expectError(GL_INVALID_VALUE);
1504 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1505 expectError(GL_INVALID_VALUE);
1506 m_log << TestLog::EndSection;
1508 ES2F_ADD_API_CASE(teximage2d_invalid_border, "Invalid glTexImage2D() usage",
1510 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0.");
1511 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1512 expectError(GL_INVALID_VALUE);
1513 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1514 expectError(GL_INVALID_VALUE);
1515 m_log << TestLog::EndSection;
1517 ES2F_ADD_API_CASE(teximage2d_format_mismatch, "Invalid glTexImage2D() usage",
1519 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if format does not match internalformat.");
1520 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1521 expectError(GL_INVALID_OPERATION);
1522 m_log << TestLog::EndSection;
1524 ES2F_ADD_API_CASE(teximage2d_type_format_mismatch, "Invalid glTexImage2D() usage",
1526 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.");
1527 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0);
1528 expectError(GL_INVALID_OPERATION);
1529 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
1530 expectError(GL_INVALID_OPERATION);
1531 m_log << TestLog::EndSection;
1536 ES2F_ADD_API_CASE(texsubimage2d_invalid_target, "Invalid glTexSubImage2D() usage",
1538 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
1539 glTexSubImage2D(0, 0, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1540 expectError(GL_INVALID_ENUM);
1541 m_log << TestLog::EndSection;
1543 ES2F_ADD_API_CASE(texsubimage2d_invalid_format, "Invalid glTexSubImage2D() usage",
1546 glGenTextures(1, &texture);
1547 glBindTexture(GL_TEXTURE_2D, texture);
1548 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1550 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format or type is not an accepted value.");
1551 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, GL_UNSIGNED_BYTE, 0);
1552 expectError(GL_INVALID_ENUM);
1553 m_log << TestLog::EndSection;
1555 glDeleteTextures(1, &texture);
1557 ES2F_ADD_API_CASE(texsubimage2d_invalid_type, "Invalid glTexSubImage2D() usage",
1560 glGenTextures(1, &texture);
1561 glBindTexture(GL_TEXTURE_2D, texture);
1562 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1564 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format or type is not an accepted value.");
1565 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGB, 0, 0);
1566 expectError(GL_INVALID_ENUM);
1567 m_log << TestLog::EndSection;
1569 glDeleteTextures(1, &texture);
1571 ES2F_ADD_API_CASE(texsubimage2d_neg_level_tex2d, "Invalid glTexSubImage2D() usage",
1574 glGenTextures(1, &texture);
1575 glBindTexture(GL_TEXTURE_2D, texture);
1576 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1578 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1579 glTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1580 expectError(GL_INVALID_VALUE);
1581 m_log << TestLog::EndSection;
1583 glDeleteTextures(1, &texture);
1585 ES2F_ADD_API_CASE(texsubimage2d_neg_level_cube, "Invalid glTexSubImage2D() usage",
1588 glGenTextures(1, &texture);
1589 glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
1590 FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL););
1592 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
1593 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1594 expectError(GL_INVALID_VALUE);
1595 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1596 expectError(GL_INVALID_VALUE);
1597 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1598 expectError(GL_INVALID_VALUE);
1599 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1600 expectError(GL_INVALID_VALUE);
1601 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1602 expectError(GL_INVALID_VALUE);
1603 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1604 expectError(GL_INVALID_VALUE);
1605 m_log << TestLog::EndSection;
1607 glDeleteTextures(1, &texture);
1609 ES2F_ADD_API_CASE(texsubimage2d_level_max_tex2d, "Invalid glTexSubImage2D() usage",
1612 glGenTextures(1, &texture);
1613 glBindTexture(GL_TEXTURE_2D, texture);
1614 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1616 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
1617 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
1618 glTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1619 expectError(GL_INVALID_VALUE);
1620 m_log << TestLog::EndSection;
1622 glDeleteTextures(1, &texture);
1624 ES2F_ADD_API_CASE(texsubimage2d_level_max_cube, "Invalid glTexSubImage2D() usage",
1627 glGenTextures(1, &texture);
1628 glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
1629 FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL););
1631 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
1632 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1633 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1634 expectError(GL_INVALID_VALUE);
1635 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1636 expectError(GL_INVALID_VALUE);
1637 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1638 expectError(GL_INVALID_VALUE);
1639 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1640 expectError(GL_INVALID_VALUE);
1641 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1642 expectError(GL_INVALID_VALUE);
1643 glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1644 expectError(GL_INVALID_VALUE);
1645 m_log << TestLog::EndSection;
1647 glDeleteTextures(1, &texture);
1649 ES2F_ADD_API_CASE(texsubimage2d_neg_offset, "Invalid glTexSubImage2D() usage",
1652 glGenTextures(1, &texture);
1653 glBindTexture(GL_TEXTURE_2D, texture);
1654 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1656 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset or yoffset are negative.");
1657 glTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1658 expectError(GL_INVALID_VALUE);
1659 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1660 expectError(GL_INVALID_VALUE);
1661 glTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1662 expectError(GL_INVALID_VALUE);
1663 m_log << TestLog::EndSection;
1665 glDeleteTextures(1, &texture);
1667 ES2F_ADD_API_CASE(texsubimage2d_offset_allowed, "Invalid glTexSubImage2D() usage",
1670 glGenTextures(1, &texture);
1671 glBindTexture(GL_TEXTURE_2D, texture);
1672 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1674 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
1675 glTexSubImage2D(GL_TEXTURE_2D, 0, 8, 4, 10, 10, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1676 expectError(GL_INVALID_VALUE);
1677 glTexSubImage2D(GL_TEXTURE_2D, 0, 4, 8, 10, 10, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1678 expectError(GL_INVALID_VALUE);
1679 glTexSubImage2D(GL_TEXTURE_2D, 0, 8, 8, 10, 10, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1680 expectError(GL_INVALID_VALUE);
1681 m_log << TestLog::EndSection;
1683 glDeleteTextures(1, &texture);
1685 ES2F_ADD_API_CASE(texsubimage2d_neg_wdt_hgt, "Invalid glTexSubImage2D() usage",
1688 glGenTextures(1, &texture);
1689 glBindTexture(GL_TEXTURE_2D, texture);
1690 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1692 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
1693 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1694 expectError(GL_INVALID_VALUE);
1695 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1696 expectError(GL_INVALID_VALUE);
1697 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, -GL_RGBA, GL_UNSIGNED_BYTE, 0);
1698 expectError(GL_INVALID_VALUE);
1699 m_log << TestLog::EndSection;
1701 glDeleteTextures(1, &texture);
1703 ES2F_ADD_API_CASE(texsubimage2d_type_format_mismatch, "Invalid glTexSubImage2D() usage",
1706 glGenTextures(1, &texture);
1707 glBindTexture(GL_TEXTURE_2D, texture);
1708 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1710 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");
1711 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, 0);
1712 expectError(GL_INVALID_OPERATION);
1713 m_log << tcu::TestLog::EndSection;
1715 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.");
1716 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0);
1717 expectError(GL_INVALID_OPERATION);
1718 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
1719 expectError(GL_INVALID_OPERATION);
1720 m_log << tcu::TestLog::EndSection;
1722 glDeleteTextures(1, &texture);
1727 ES2F_ADD_API_CASE(texparameteri, "Invalid glTexParameteri() usage",
1729 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1730 glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1731 expectError(GL_INVALID_ENUM);
1732 glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR);
1733 expectError(GL_INVALID_ENUM);
1734 glTexParameteri(0, 0, GL_LINEAR);
1735 expectError(GL_INVALID_ENUM);
1736 m_log << TestLog::EndSection;
1738 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.");
1739 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0);
1740 expectError(GL_INVALID_ENUM);
1741 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT);
1742 expectError(GL_INVALID_ENUM);
1743 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0);
1744 expectError(GL_INVALID_ENUM);
1745 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
1746 expectError(GL_INVALID_ENUM);
1747 m_log << TestLog::EndSection;
1749 ES2F_ADD_API_CASE(texparameteri_bind, "Invalid glTexParameteri() usage",
1752 glGenTextures(1, &texture);
1753 glBindTexture(GL_TEXTURE_2D, texture);
1755 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1756 glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1757 expectError(GL_INVALID_ENUM);
1758 glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR);
1759 expectError(GL_INVALID_ENUM);
1760 glTexParameteri(0, 0, GL_LINEAR);
1761 expectError(GL_INVALID_ENUM);
1762 m_log << TestLog::EndSection;
1764 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.");
1765 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0);
1766 expectError(GL_INVALID_ENUM);
1767 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT);
1768 expectError(GL_INVALID_ENUM);
1769 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0);
1770 expectError(GL_INVALID_ENUM);
1771 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
1772 expectError(GL_INVALID_ENUM);
1773 m_log << TestLog::EndSection;
1775 glDeleteTextures(1, &texture);
1780 ES2F_ADD_API_CASE(texparameterf, "Invalid glTexParameterf() usage",
1782 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1783 glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1784 expectError(GL_INVALID_ENUM);
1785 glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR);
1786 expectError(GL_INVALID_ENUM);
1787 glTexParameterf(0, 0, GL_LINEAR);
1788 expectError(GL_INVALID_ENUM);
1789 m_log << TestLog::EndSection;
1791 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.");
1792 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0);
1793 expectError(GL_INVALID_ENUM);
1794 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT);
1795 expectError(GL_INVALID_ENUM);
1796 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0);
1797 expectError(GL_INVALID_ENUM);
1798 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
1799 expectError(GL_INVALID_ENUM);
1800 m_log << TestLog::EndSection;
1802 ES2F_ADD_API_CASE(texparameterf_bind, "Invalid glTexParameterf() usage",
1805 glGenTextures(1, &texture);
1806 glBindTexture(GL_TEXTURE_2D, texture);
1808 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1809 glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1810 expectError(GL_INVALID_ENUM);
1811 glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR);
1812 expectError(GL_INVALID_ENUM);
1813 glTexParameterf(0, 0, GL_LINEAR);
1814 expectError(GL_INVALID_ENUM);
1815 m_log << TestLog::EndSection;
1817 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.");
1818 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0);
1819 expectError(GL_INVALID_ENUM);
1820 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT);
1821 expectError(GL_INVALID_ENUM);
1822 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0);
1823 expectError(GL_INVALID_ENUM);
1824 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST);
1825 expectError(GL_INVALID_ENUM);
1826 m_log << TestLog::EndSection;
1828 glDeleteTextures(1, &texture);
1833 ES2F_ADD_API_CASE(texparameteriv, "Invalid glTexParameteriv() usage",
1835 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1836 GLint params[1] = {GL_LINEAR};
1837 glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
1838 expectError(GL_INVALID_ENUM);
1839 glTexParameteriv(GL_TEXTURE_2D, 0, ¶ms[0]);
1840 expectError(GL_INVALID_ENUM);
1841 glTexParameteriv(0, 0, ¶ms[0]);
1842 expectError(GL_INVALID_ENUM);
1843 m_log << TestLog::EndSection;
1845 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.");
1847 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
1848 expectError(GL_INVALID_ENUM);
1849 params[0] = GL_REPEAT;
1850 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
1851 expectError(GL_INVALID_ENUM);
1853 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]);
1854 expectError(GL_INVALID_ENUM);
1855 params[0] = GL_NEAREST;
1856 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]);
1857 expectError(GL_INVALID_ENUM);
1858 m_log << TestLog::EndSection;
1860 ES2F_ADD_API_CASE(texparameteriv_bind, "Invalid glTexParameteriv() usage",
1863 glGenTextures(1, &texture);
1864 glBindTexture(GL_TEXTURE_2D, texture);
1866 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1867 GLint params[1] = {GL_LINEAR};
1868 glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
1869 expectError(GL_INVALID_ENUM);
1870 glTexParameteriv(GL_TEXTURE_2D, 0, ¶ms[0]);
1871 expectError(GL_INVALID_ENUM);
1872 glTexParameteriv(0, 0, ¶ms[0]);
1873 expectError(GL_INVALID_ENUM);
1874 m_log << TestLog::EndSection;
1876 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.");
1878 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
1879 expectError(GL_INVALID_ENUM);
1880 params[0] = GL_REPEAT;
1881 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
1882 expectError(GL_INVALID_ENUM);
1884 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]);
1885 expectError(GL_INVALID_ENUM);
1886 params[0] = GL_NEAREST;
1887 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]);
1888 expectError(GL_INVALID_ENUM);
1889 m_log << TestLog::EndSection;
1891 glDeleteTextures(1, &texture);
1896 ES2F_ADD_API_CASE(texparameterfv, "Invalid glTexParameterfv() usage",
1898 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1899 GLfloat params[1] = {GL_LINEAR};
1900 glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
1901 expectError(GL_INVALID_ENUM);
1902 glTexParameterfv(GL_TEXTURE_2D, 0, ¶ms[0]);
1903 expectError(GL_INVALID_ENUM);
1904 glTexParameterfv(0, 0, ¶ms[0]);
1905 expectError(GL_INVALID_ENUM);
1906 m_log << TestLog::EndSection;
1908 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.");
1910 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
1911 expectError(GL_INVALID_ENUM);
1912 params[0] = GL_REPEAT;
1913 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
1914 expectError(GL_INVALID_ENUM);
1916 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]);
1917 expectError(GL_INVALID_ENUM);
1918 params[0] = GL_NEAREST;
1919 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]);
1920 expectError(GL_INVALID_ENUM);
1921 m_log << TestLog::EndSection;
1923 ES2F_ADD_API_CASE(texparameterfv_bind, "Invalid glTexParameterfv() usage",
1926 glGenTextures(1, &texture);
1927 glBindTexture(GL_TEXTURE_2D, texture);
1929 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1930 GLfloat params[1] = {GL_LINEAR};
1931 glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
1932 expectError(GL_INVALID_ENUM);
1933 glTexParameterfv(GL_TEXTURE_2D, 0, ¶ms[0]);
1934 expectError(GL_INVALID_ENUM);
1935 glTexParameterfv(0, 0, ¶ms[0]);
1936 expectError(GL_INVALID_ENUM);
1937 m_log << TestLog::EndSection;
1939 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.");
1941 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
1942 expectError(GL_INVALID_ENUM);
1943 params[0] = GL_REPEAT;
1944 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
1945 expectError(GL_INVALID_ENUM);
1947 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]);
1948 expectError(GL_INVALID_ENUM);
1949 params[0] = GL_NEAREST;
1950 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]);
1951 expectError(GL_INVALID_ENUM);
1952 m_log << TestLog::EndSection;
1954 glDeleteTextures(1, &texture);
1957 // glCompressedTexSubImage2D
1959 ES2F_ADD_API_CASE(compressedtexsubimage2d_invalid_target, "Invalid glCompressedTexSubImage2D() usage",
1961 vector<deInt32> supported;
1962 vector<deInt32> accepted;
1963 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
1964 getCompressedTexSubImage2DFormat(supported, accepted);
1966 if (accepted.empty())
1968 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
1969 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
1973 for (int i = 0; i < (int)accepted.size(); i++)
1975 const deInt32 glFormat = accepted[i];
1979 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
1980 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
1981 const int blockSize = tcu::getBlockSize(format);
1982 const std::vector<deUint8> data (blockSize, 0);
1985 glGenTextures(1, &texture);
1986 glBindTexture(GL_TEXTURE_2D, texture);
1987 expectError(GL_NO_ERROR);
1989 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
1990 expectError(GL_NO_ERROR);
1992 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid.");
1993 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
1994 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
1995 glCompressedTexSubImage2D(0, 0, 0, 0, 0, 0, accepted[i], 0, 0);
1996 expectError(GL_INVALID_ENUM);
1997 m_log << TestLog::EndSection;
1999 glDeleteTextures(1, &texture);
2000 expectError(GL_NO_ERROR);
2002 catch (const tcu::InternalError&)
2004 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;
2009 ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_level_tex2d, "Invalid glCompressedTexSubImage2D() usage",
2011 vector<deInt32> supported;
2012 vector<deInt32> accepted;
2013 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2014 getCompressedTexSubImage2DFormat(supported, accepted);
2016 if (accepted.empty())
2018 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2019 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2023 for (int i = 0; i < (int)accepted.size(); i++)
2025 const deInt32 glFormat = accepted[i];
2029 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
2030 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
2031 const int blockSize = tcu::getBlockSize(format);
2032 const std::vector<deUint8> data (blockSize, 0);
2035 glGenTextures(1, &texture);
2036 glBindTexture(GL_TEXTURE_2D, texture);
2037 expectError(GL_NO_ERROR);
2039 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
2040 expectError(GL_NO_ERROR);
2042 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
2043 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2044 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2045 //expectError(GL_NO_ERROR);
2046 glCompressedTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2047 expectError(GL_INVALID_VALUE);
2048 m_log << TestLog::EndSection;
2050 glDeleteTextures(1, &texture);
2051 expectError(GL_NO_ERROR);
2053 catch (const tcu::InternalError&)
2055 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;
2060 ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_level_cube, "Invalid glCompressedTexSubImage2D() usage",
2062 vector<deInt32> supported;
2063 vector<deInt32> accepted;
2064 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2065 getCompressedTexSubImage2DFormat(supported, accepted);
2067 if (accepted.empty())
2069 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2070 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2074 for (int i = 0; i < (int)accepted.size(); i++)
2076 const deInt32 glFormat = accepted[i];
2080 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
2081 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
2082 const int blockSize = tcu::getBlockSize(format);
2083 const std::vector<deUint8> data (blockSize, 0);
2086 glGenTextures(1, &texture);
2087 glBindTexture(GL_TEXTURE_2D, texture);
2088 expectError(GL_NO_ERROR);
2090 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
2091 expectError(GL_NO_ERROR);
2093 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0.");
2094 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2095 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, accepted[i], 0, 0, 0, 0, 0);
2096 //expectError(GL_NO_ERROR);
2097 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2098 expectError(GL_INVALID_VALUE);
2099 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, accepted[i], 0, 0, 0, 0, 0);
2100 //expectError(GL_NO_ERROR);
2101 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2102 expectError(GL_INVALID_VALUE);
2103 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, accepted[i], 0, 0, 0, 0, 0);
2104 //expectError(GL_NO_ERROR);
2105 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2106 expectError(GL_INVALID_VALUE);
2107 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, accepted[i], 0, 0, 0, 0, 0);
2108 //expectError(GL_NO_ERROR);
2109 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2110 expectError(GL_INVALID_VALUE);
2111 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, accepted[i], 0, 0, 0, 0, 0);
2112 //expectError(GL_NO_ERROR);
2113 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2114 expectError(GL_INVALID_VALUE);
2115 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, accepted[i], 0, 0, 0, 0, 0);
2116 //expectError(GL_NO_ERROR);
2117 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, 0, 0, 0, 0, accepted[i], 0, 0);
2118 expectError(GL_INVALID_VALUE);
2119 m_log << TestLog::EndSection;
2121 glDeleteTextures(1, &texture);
2122 expectError(GL_NO_ERROR);
2124 catch (const tcu::InternalError&)
2126 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;
2131 ES2F_ADD_API_CASE(compressedtexsubimage2d_level_max_tex2d, "Invalid glCompressedTexSubImage2D() usage",
2133 vector<deInt32> supported;
2134 vector<deInt32> accepted;
2135 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2136 getCompressedTexSubImage2DFormat(supported, accepted);
2138 if (accepted.empty())
2140 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2141 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2145 for (int i = 0; i < (int)accepted.size(); i++)
2147 const deInt32 glFormat = accepted[i];
2151 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
2152 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
2153 const int blockSize = tcu::getBlockSize(format);
2154 const std::vector<deUint8> data (blockSize, 0);
2157 glGenTextures(1, &texture);
2158 glBindTexture(GL_TEXTURE_2D, texture);
2159 expectError(GL_NO_ERROR);
2161 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
2162 expectError(GL_NO_ERROR);
2164 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
2165 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2166 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1;
2167 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2168 //expectError(GL_NO_ERROR);
2169 glCompressedTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2170 expectError(GL_INVALID_VALUE);
2171 m_log << TestLog::EndSection;
2173 glDeleteTextures(1, &texture);
2174 expectError(GL_NO_ERROR);
2176 catch (const tcu::InternalError&)
2178 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;
2183 ES2F_ADD_API_CASE(compressedtexsubimage2d_level_max_cube, "Invalid glCompressedTexSubImage2D() usage",
2185 vector<deInt32> supported;
2186 vector<deInt32> accepted;
2187 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2188 getCompressedTexSubImage2DFormat(supported, accepted);
2190 if (accepted.empty())
2192 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2193 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2197 for (int i = 0; i < (int)accepted.size(); i++)
2199 const deInt32 glFormat = accepted[i];
2203 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
2204 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
2205 const int blockSize = tcu::getBlockSize(format);
2206 const std::vector<deUint8> data (blockSize, 0);
2209 glGenTextures(1, &texture);
2210 glBindTexture(GL_TEXTURE_2D, texture);
2211 expectError(GL_NO_ERROR);
2213 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
2214 expectError(GL_NO_ERROR);
2216 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
2217 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2218 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
2219 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2220 //expectError(GL_NO_ERROR);
2221 glCompressedTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2222 expectError(GL_INVALID_VALUE);
2223 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, accepted[i], 0, 0, 0, 0, 0);
2224 //expectError(GL_NO_ERROR);
2225 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2226 expectError(GL_INVALID_VALUE);
2227 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, accepted[i], 0, 0, 0, 0, 0);
2228 //expectError(GL_NO_ERROR);
2229 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2230 expectError(GL_INVALID_VALUE);
2231 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, accepted[i], 0, 0, 0, 0, 0);
2232 //expectError(GL_NO_ERROR);
2233 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2234 expectError(GL_INVALID_VALUE);
2235 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, accepted[i], 0, 0, 0, 0, 0);
2236 //expectError(GL_NO_ERROR);
2237 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2238 expectError(GL_INVALID_VALUE);
2239 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, accepted[i], 0, 0, 0, 0, 0);
2240 //expectError(GL_NO_ERROR);
2241 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2242 expectError(GL_INVALID_VALUE);
2243 //glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, accepted[i], 0, 0, 0, 0, 0);
2244 //expectError(GL_NO_ERROR);
2245 glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxTextureSize, 0, 0, 0, 0, accepted[i], 0, 0);
2246 expectError(GL_INVALID_VALUE);
2247 m_log << TestLog::EndSection;
2249 glDeleteTextures(1, &texture);
2250 expectError(GL_NO_ERROR);
2252 catch (const tcu::InternalError&)
2254 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;
2259 ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_offset, "Invalid glCompressedTexSubImage2D() usage",
2261 vector<deInt32> supported;
2262 vector<deInt32> accepted;
2263 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2264 getCompressedTexSubImage2DFormat(supported, accepted);
2266 if (accepted.empty())
2268 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2269 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2273 for (int i = 0; i < (int)accepted.size(); i++)
2275 const deInt32 glFormat = accepted[i];
2279 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
2280 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
2281 const int blockSize = tcu::getBlockSize(format);
2282 const std::vector<deUint8> data (blockSize, 0);
2285 glGenTextures(1, &texture);
2286 glBindTexture(GL_TEXTURE_2D, texture);
2287 expectError(GL_NO_ERROR);
2289 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
2290 expectError(GL_NO_ERROR);
2292 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset or yoffset are negative.");
2293 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2294 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2295 //expectError(GL_NO_ERROR);
2296 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, accepted[i], 0, 0);
2297 expectError(GL_INVALID_VALUE);
2298 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2299 //expectError(GL_NO_ERROR);
2300 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, accepted[i], 0, 0);
2301 expectError(GL_INVALID_VALUE);
2302 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2303 //expectError(GL_NO_ERROR);
2304 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, accepted[i], 0, 0);
2305 expectError(GL_INVALID_VALUE);
2306 m_log << TestLog::EndSection;
2308 glDeleteTextures(1, &texture);
2309 expectError(GL_NO_ERROR);
2311 catch (const tcu::InternalError&)
2313 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;
2318 ES2F_ADD_API_CASE(compressedtexsubimage2d_offset_allowed, "Invalid glCompressedTexSubImage2D() usage",
2320 vector<deInt32> supported;
2321 vector<deInt32> accepted;
2322 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2323 getCompressedTexSubImage2DFormat(supported, accepted);
2325 if (accepted.empty())
2327 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2328 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2332 for (int i = 0; i < (int)accepted.size(); i++)
2334 const deInt32 glFormat = accepted[i];
2338 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
2339 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
2340 const int blockSize = tcu::getBlockSize(format);
2341 const std::vector<deUint8> data (blockSize, 0);
2344 glGenTextures(1, &texture);
2345 glBindTexture(GL_TEXTURE_2D, texture);
2346 expectError(GL_NO_ERROR);
2348 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
2349 expectError(GL_NO_ERROR);
2351 deUint32 maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
2352 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
2353 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2354 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2355 //expectError(GL_NO_ERROR);
2356 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, maxTextureSize, 0, 0, 0, accepted[i], 0, 0);
2357 expectError(GL_INVALID_VALUE);
2358 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2359 //expectError(GL_NO_ERROR);
2360 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, maxTextureSize, 0, 0, accepted[i], 0, 0);
2361 expectError(GL_INVALID_VALUE);
2362 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2363 //expectError(GL_NO_ERROR);
2364 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, maxTextureSize, maxTextureSize, 0, 0, accepted[i], 0, 0);
2365 expectError(GL_INVALID_VALUE);
2366 m_log << TestLog::EndSection;
2368 glDeleteTextures(1, &texture);
2369 expectError(GL_NO_ERROR);
2371 catch (const tcu::InternalError&)
2373 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;
2378 ES2F_ADD_API_CASE(compressedtexsubimage2d_neg_wdt_hgt, "Invalid glCompressedTexSubImage2D() usage",
2380 vector<deInt32> supported;
2381 vector<deInt32> accepted;
2382 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2383 getCompressedTexSubImage2DFormat(supported, accepted);
2385 if (accepted.empty())
2387 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2388 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2392 for (int i = 0; i < (int)accepted.size(); i++)
2394 const deInt32 glFormat = accepted[i];
2398 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
2399 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
2400 const int blockSize = tcu::getBlockSize(format);
2401 const std::vector<deUint8> data (blockSize, 0);
2404 glGenTextures(1, &texture);
2405 glBindTexture(GL_TEXTURE_2D, texture);
2406 expectError(GL_NO_ERROR);
2408 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
2409 expectError(GL_NO_ERROR);
2411 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0.");
2412 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(accepted[i]) << TestLog::EndMessage;
2413 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2414 //expectError(GL_NO_ERROR);
2415 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, 0, accepted[i], 0, 0);
2416 expectError(GL_INVALID_VALUE);
2417 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2418 //expectError(GL_NO_ERROR);
2419 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -1, accepted[i], 0, 0);
2420 expectError(GL_INVALID_VALUE);
2421 //glCompressedTexImage2D(GL_TEXTURE_2D, 0, accepted[i], 0, 0, 0, 0, 0);
2422 //expectError(GL_NO_ERROR);
2423 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, accepted[i], 0, 0);
2424 expectError(GL_INVALID_VALUE);
2425 m_log << TestLog::EndSection;
2427 glDeleteTextures(1, &texture);
2428 expectError(GL_NO_ERROR);
2430 catch (const tcu::InternalError&)
2432 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;
2437 ES2F_ADD_API_CASE(compressedtexsubimage2d_invalid_size, "Invalid glCompressedTexImage2D() usage",
2439 vector<deInt32> supported;
2440 vector<deInt32> accepted;
2441 getSupportedExtensions(GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_COMPRESSED_TEXTURE_FORMATS, supported);
2442 getCompressedTexSubImage2DFormat(supported, accepted);
2444 if (accepted.empty())
2446 m_log << TestLog::Message << "// No suitable compressed formats found, cannot evaluate test." << TestLog::EndMessage;
2447 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No suitable compressed formats found");
2451 for (int i = 0; i < (int)accepted.size(); i++)
2453 const deInt32 glFormat = accepted[i];
2457 const tcu::CompressedTexFormat format = glu::mapGLCompressedTexFormat(glFormat);
2458 const tcu::IVec3 blockPixelSize = tcu::getBlockPixelSize(format);
2459 const int blockSize = tcu::getBlockSize(format);
2460 const std::vector<deUint8> data (blockSize, 0);
2463 glGenTextures(1, &texture);
2464 glBindTexture(GL_TEXTURE_2D, texture);
2465 expectError(GL_NO_ERROR);
2467 glCompressedTexImage2D(GL_TEXTURE_2D, 0, glFormat, blockPixelSize.x(), blockPixelSize.y(), 0, blockSize, DE_NULL);
2468 expectError(GL_NO_ERROR);
2470 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.");
2471 m_log << TestLog::Message << "// Using texture format " << tcu::toHex(glFormat) << TestLog::EndMessage;
2472 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, blockPixelSize.x(), blockPixelSize.y(), glFormat, -1, &data[0]);
2473 expectError(GL_INVALID_VALUE);
2475 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, blockPixelSize.x(), blockPixelSize.y(), glFormat, blockSize / 2, &data[0]);
2476 expectError(GL_INVALID_VALUE);
2478 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, blockPixelSize.x(), blockPixelSize.y(), glFormat, blockSize * 2, &data[0]);
2479 expectError(GL_INVALID_VALUE);
2481 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, blockPixelSize.x(), blockPixelSize.y() * 2, glFormat, blockSize, &data[0]);
2482 expectError(GL_INVALID_VALUE);
2484 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, blockPixelSize.x() * 2, blockPixelSize.y(), glFormat, blockSize, &data[0]);
2485 expectError(GL_INVALID_VALUE);
2487 m_log << TestLog::EndSection;
2489 glDeleteTextures(1, &texture);
2490 expectError(GL_NO_ERROR);
2492 catch (const tcu::InternalError&)
2494 m_log << TestLog::Message << "Skipping unknown format: " << glFormat << TestLog::EndMessage;