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