1/*------------------------------------------------------------------------- 2 * drawElements Quality Program OpenGL ES 3.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 "es3fNegativeTextureApiTests.hpp" 25#include "es3fApiCase.hpp" 26#include "gluContextInfo.hpp" 27#include "tcuFormatUtil.hpp" 28 29#include <vector> 30#include <algorithm> 31 32#include "glwDefs.hpp" 33#include "glwEnums.hpp" 34 35using namespace glw; // GL types 36 37namespace deqp 38{ 39namespace gles3 40{ 41namespace Functional 42{ 43 44using tcu::TestLog; 45using std::vector; 46 47static inline int divRoundUp (int a, int b) 48{ 49 return a/b + (a%b != 0 ? 1 : 0); 50} 51 52static inline int etc2DataSize (int width, int height) 53{ 54 return (int)(divRoundUp(width, 4) * divRoundUp(height, 4) * sizeof(deUint64)); 55} 56 57static inline int etc2EacDataSize (int width, int height) 58{ 59 return 2 * etc2DataSize(width, height); 60} 61 62static deUint32 cubeFaceToGLFace (tcu::CubeFace face) 63{ 64 switch (face) 65 { 66 case tcu::CUBEFACE_NEGATIVE_X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X; 67 case tcu::CUBEFACE_POSITIVE_X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X; 68 case tcu::CUBEFACE_NEGATIVE_Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; 69 case tcu::CUBEFACE_POSITIVE_Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y; 70 case tcu::CUBEFACE_NEGATIVE_Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; 71 case tcu::CUBEFACE_POSITIVE_Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; 72 default: 73 DE_ASSERT(DE_FALSE); 74 return GL_NONE; 75 } 76} 77 78#define FOR_CUBE_FACES(FACE_GL_VAR, BODY) \ 79 do \ 80 { \ 81 for (int faceIterTcu = 0; faceIterTcu < tcu::CUBEFACE_LAST; faceIterTcu++) \ 82 { \ 83 const GLenum FACE_GL_VAR = cubeFaceToGLFace((tcu::CubeFace)faceIterTcu); \ 84 BODY \ 85 } \ 86 } while (false) 87 88NegativeTextureApiTests::NegativeTextureApiTests (Context& context) 89 : TestCaseGroup(context, "texture", "Negative Texture API Cases") 90{ 91} 92 93NegativeTextureApiTests::~NegativeTextureApiTests (void) 94{ 95} 96 97void NegativeTextureApiTests::init (void) 98{ 99 // glActiveTexture 100 101 ES3F_ADD_API_CASE(activetexture, "Invalid glActiveTexture() usage", 102 { 103 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)."); 104 glActiveTexture(-1); 105 expectError(GL_INVALID_ENUM); 106 int numMaxTextureUnits = m_context.getContextInfo().getInt(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS); 107 glActiveTexture(GL_TEXTURE0 + numMaxTextureUnits); 108 expectError(GL_INVALID_ENUM); 109 m_log << TestLog::EndSection; 110 }); 111 112 // glBindTexture 113 114 ES3F_ADD_API_CASE(bindtexture, "Invalid glBindTexture() usage", 115 { 116 GLuint texture[2]; 117 glGenTextures(2, texture); 118 119 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not one of the allowable values."); 120 glBindTexture(0, 1); 121 expectError(GL_INVALID_ENUM); 122 glBindTexture(GL_FRAMEBUFFER, 1); 123 expectError(GL_INVALID_ENUM); 124 m_log << TestLog::EndSection; 125 126 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if texture was previously created with a target that doesn't match that of target."); 127 glBindTexture(GL_TEXTURE_2D, texture[0]); 128 expectError(GL_NO_ERROR); 129 glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]); 130 expectError(GL_INVALID_OPERATION); 131 glBindTexture(GL_TEXTURE_3D, texture[0]); 132 expectError(GL_INVALID_OPERATION); 133 glBindTexture(GL_TEXTURE_2D_ARRAY, texture[0]); 134 expectError(GL_INVALID_OPERATION); 135 136 glBindTexture(GL_TEXTURE_CUBE_MAP, texture[1]); 137 expectError(GL_NO_ERROR); 138 glBindTexture(GL_TEXTURE_2D, texture[1]); 139 expectError(GL_INVALID_OPERATION); 140 glBindTexture(GL_TEXTURE_3D, texture[1]); 141 expectError(GL_INVALID_OPERATION); 142 glBindTexture(GL_TEXTURE_2D_ARRAY, texture[1]); 143 expectError(GL_INVALID_OPERATION); 144 m_log << TestLog::EndSection; 145 146 glDeleteTextures(2, texture); 147 }); 148 149 // glCompressedTexImage2D 150 151 ES3F_ADD_API_CASE(compressedteximage2d_invalid_target, "Invalid glCompressedTexImage2D() usage", 152 { 153 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 154 glCompressedTexImage2D(0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 155 expectError(GL_INVALID_ENUM); 156 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 157 expectError(GL_INVALID_ENUM); 158 m_log << TestLog::EndSection; 159 }); 160 ES3F_ADD_API_CASE(compressedteximage2d_invalid_format, "Invalid glCompressedTexImage2D() usage", 161 { 162 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if internalformat is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS."); 163 glCompressedTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0); 164 expectError(GL_INVALID_ENUM); 165 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 0, 0, 0); 166 expectError(GL_INVALID_ENUM); 167 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 0, 0, 0, 0, 0); 168 expectError(GL_INVALID_ENUM); 169 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0); 170 expectError(GL_INVALID_ENUM); 171 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0); 172 expectError(GL_INVALID_ENUM); 173 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0); 174 expectError(GL_INVALID_ENUM); 175 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0); 176 expectError(GL_INVALID_ENUM); 177 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0); 178 expectError(GL_INVALID_ENUM); 179 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0); 180 expectError(GL_INVALID_ENUM); 181 m_log << TestLog::EndSection; 182 }); 183 ES3F_ADD_API_CASE(compressedteximage2d_neg_level, "Invalid glCompressedTexImage2D() usage", 184 { 185 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 186 glCompressedTexImage2D(GL_TEXTURE_2D, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 187 expectError(GL_INVALID_VALUE); 188 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 189 expectError(GL_INVALID_VALUE); 190 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 191 expectError(GL_INVALID_VALUE); 192 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 193 expectError(GL_INVALID_VALUE); 194 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 195 expectError(GL_INVALID_VALUE); 196 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 197 expectError(GL_INVALID_VALUE); 198 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 199 expectError(GL_INVALID_VALUE); 200 m_log << TestLog::EndSection; 201 }); 202 ES3F_ADD_API_CASE(compressedteximage2d_max_level, "Invalid glCompressedTexImage2D() usage", 203 { 204 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE) for a 2d texture target."); 205 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 206 glCompressedTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_COMPRESSED_RGB8_ETC2, 16, 16, 0, etc2DataSize(16, 16), 0); 207 expectError(GL_INVALID_VALUE); 208 m_log << TestLog::EndSection; 209 210 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE) for a cubemap target."); 211 deUint32 log2MaxCubemapSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 212 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 213 expectError(GL_INVALID_VALUE); 214 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 215 expectError(GL_INVALID_VALUE); 216 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 217 expectError(GL_INVALID_VALUE); 218 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 219 expectError(GL_INVALID_VALUE); 220 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 221 expectError(GL_INVALID_VALUE); 222 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 223 expectError(GL_INVALID_VALUE); 224 m_log << TestLog::EndSection; 225 }); 226 ES3F_ADD_API_CASE(compressedteximage2d_neg_width_height, "Invalid glCompressedTexImage2D() usage", 227 { 228 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0."); 229 230 m_log << TestLog::Section("", "GL_TEXTURE_2D target"); 231 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 232 expectError(GL_INVALID_VALUE); 233 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 234 expectError(GL_INVALID_VALUE); 235 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 236 expectError(GL_INVALID_VALUE); 237 m_log << TestLog::EndSection; 238 239 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 240 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 241 expectError(GL_INVALID_VALUE); 242 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 243 expectError(GL_INVALID_VALUE); 244 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 245 expectError(GL_INVALID_VALUE); 246 m_log << TestLog::EndSection; 247 248 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 249 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 250 expectError(GL_INVALID_VALUE); 251 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 252 expectError(GL_INVALID_VALUE); 253 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 254 expectError(GL_INVALID_VALUE); 255 m_log << TestLog::EndSection; 256 257 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 258 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 259 expectError(GL_INVALID_VALUE); 260 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 261 expectError(GL_INVALID_VALUE); 262 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 263 expectError(GL_INVALID_VALUE); 264 m_log << TestLog::EndSection; 265 266 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 267 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 268 expectError(GL_INVALID_VALUE); 269 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 270 expectError(GL_INVALID_VALUE); 271 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 272 expectError(GL_INVALID_VALUE); 273 m_log << TestLog::EndSection; 274 275 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 276 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 277 expectError(GL_INVALID_VALUE); 278 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 279 expectError(GL_INVALID_VALUE); 280 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 281 expectError(GL_INVALID_VALUE); 282 m_log << TestLog::EndSection; 283 284 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 285 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 286 expectError(GL_INVALID_VALUE); 287 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 288 expectError(GL_INVALID_VALUE); 289 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 290 expectError(GL_INVALID_VALUE); 291 m_log << TestLog::EndSection; 292 293 m_log << TestLog::EndSection; 294 }); 295 ES3F_ADD_API_CASE(compressedteximage2d_max_width_height, "Invalid glCompressedTexImage2D() usage", 296 { 297 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1; 298 int maxCubemapSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1; 299 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE."); 300 301 m_log << TestLog::Section("", "GL_TEXTURE_2D target"); 302 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 1, 0, etc2EacDataSize(maxTextureSize, 1), 0); 303 expectError(GL_INVALID_VALUE); 304 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxTextureSize, 0, etc2EacDataSize(1, maxTextureSize), 0); 305 expectError(GL_INVALID_VALUE); 306 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, 0, etc2EacDataSize(maxTextureSize, maxTextureSize), 0); 307 expectError(GL_INVALID_VALUE); 308 m_log << TestLog::EndSection; 309 310 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 311 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 312 expectError(GL_INVALID_VALUE); 313 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 314 expectError(GL_INVALID_VALUE); 315 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 316 expectError(GL_INVALID_VALUE); 317 m_log << TestLog::EndSection; 318 319 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 320 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 321 expectError(GL_INVALID_VALUE); 322 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 323 expectError(GL_INVALID_VALUE); 324 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 325 expectError(GL_INVALID_VALUE); 326 m_log << TestLog::EndSection; 327 328 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 329 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 330 expectError(GL_INVALID_VALUE); 331 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 332 expectError(GL_INVALID_VALUE); 333 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 334 expectError(GL_INVALID_VALUE); 335 m_log << TestLog::EndSection; 336 337 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 338 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 339 expectError(GL_INVALID_VALUE); 340 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 341 expectError(GL_INVALID_VALUE); 342 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 343 expectError(GL_INVALID_VALUE); 344 m_log << TestLog::EndSection; 345 346 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 347 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 348 expectError(GL_INVALID_VALUE); 349 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 350 expectError(GL_INVALID_VALUE); 351 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 352 expectError(GL_INVALID_VALUE); 353 m_log << TestLog::EndSection; 354 355 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 356 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 357 expectError(GL_INVALID_VALUE); 358 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 359 expectError(GL_INVALID_VALUE); 360 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 361 expectError(GL_INVALID_VALUE); 362 m_log << TestLog::EndSection; 363 364 m_log << TestLog::EndSection; 365 }); 366 ES3F_ADD_API_CASE(compressedteximage2d_invalid_border, "Invalid glCompressedTexImage2D() usage", 367 { 368 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0."); 369 370 m_log << TestLog::Section("", "GL_TEXTURE_2D target"); 371 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 372 expectError(GL_INVALID_VALUE); 373 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 374 expectError(GL_INVALID_VALUE); 375 m_log << TestLog::EndSection; 376 377 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 378 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 379 expectError(GL_INVALID_VALUE); 380 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 381 expectError(GL_INVALID_VALUE); 382 m_log << TestLog::EndSection; 383 384 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 385 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 386 expectError(GL_INVALID_VALUE); 387 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 388 expectError(GL_INVALID_VALUE); 389 m_log << TestLog::EndSection; 390 391 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 392 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 393 expectError(GL_INVALID_VALUE); 394 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 395 expectError(GL_INVALID_VALUE); 396 m_log << TestLog::EndSection; 397 398 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 399 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 400 expectError(GL_INVALID_VALUE); 401 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 402 expectError(GL_INVALID_VALUE); 403 m_log << TestLog::EndSection; 404 405 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 406 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 407 expectError(GL_INVALID_VALUE); 408 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 409 expectError(GL_INVALID_VALUE); 410 m_log << TestLog::EndSection; 411 412 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 413 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 414 expectError(GL_INVALID_VALUE); 415 glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 416 expectError(GL_INVALID_VALUE); 417 m_log << TestLog::EndSection; 418 419 m_log << TestLog::EndSection; 420 }); 421 ES3F_ADD_API_CASE(compressedteximage2d_invalid_size, "Invalid glCompressedTexImage2D() usage", 422 { 423 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."); 424 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, -1, 0); 425 expectError(GL_INVALID_VALUE); 426 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, 4*4*8, 0); 427 expectError(GL_INVALID_VALUE); 428 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 0, 4*4*16, 0); 429 expectError(GL_INVALID_VALUE); 430 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SIGNED_R11_EAC, 16, 16, 0, 4*4*16, 0); 431 expectError(GL_INVALID_VALUE); 432 m_log << TestLog::EndSection; 433 }); 434 ES3F_ADD_API_CASE(compressedteximage2d_invalid_buffer_target, "Invalid glCompressedTexImage2D() usage", 435 { 436 deUint32 buf; 437 std::vector<GLubyte> data(64); 438 439 glGenBuffers (1, &buf); 440 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 441 glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY); 442 expectError (GL_NO_ERROR); 443 444 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and the buffer object's data store is currently mapped."); 445 glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT); 446 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 4, 4, 0, etc2DataSize(4, 4), 0); 447 expectError (GL_INVALID_OPERATION); 448 glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 449 m_log << TestLog::EndSection; 450 451 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 452 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 0, etc2DataSize(16, 16), 0); 453 expectError (GL_INVALID_OPERATION); 454 m_log << TestLog::EndSection; 455 456 glDeleteBuffers (1, &buf); 457 }); 458 459 // glCopyTexImage2D 460 461 ES3F_ADD_API_CASE(copyteximage2d_invalid_target, "Invalid glCopyTexImage2D() usage", 462 { 463 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 464 glCopyTexImage2D(0, 0, GL_RGB, 0, 0, 64, 64, 0); 465 expectError(GL_INVALID_ENUM); 466 m_log << TestLog::EndSection; 467 }); 468 ES3F_ADD_API_CASE(copyteximage2d_invalid_format, "Invalid glCopyTexImage2D() usage", 469 { 470 m_log << TestLog::Section("", "GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not an accepted format."); 471 glCopyTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 64, 64, 0); 472 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 473 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 16, 16, 0); 474 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 475 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 16, 16, 0); 476 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 477 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 16, 16, 0); 478 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 479 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 16, 16, 0); 480 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 481 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 16, 16, 0); 482 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 483 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 16, 16, 0); 484 expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 485 m_log << TestLog::EndSection; 486 }); 487 ES3F_ADD_API_CASE(copyteximage2d_inequal_width_height_cube, "Invalid glCopyTexImage2D() usage", 488 { 489 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."); 490 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0); 491 expectError(GL_INVALID_VALUE); 492 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0); 493 expectError(GL_INVALID_VALUE); 494 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0); 495 expectError(GL_INVALID_VALUE); 496 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0); 497 expectError(GL_INVALID_VALUE); 498 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0); 499 expectError(GL_INVALID_VALUE); 500 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0); 501 expectError(GL_INVALID_VALUE); 502 m_log << TestLog::EndSection; 503 }); 504 ES3F_ADD_API_CASE(copyteximage2d_neg_level, "Invalid glCopyTexImage2D() usage", 505 { 506 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 507 glCopyTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 0, 0, 64, 64, 0); 508 expectError(GL_INVALID_VALUE); 509 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0); 510 expectError(GL_INVALID_VALUE); 511 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0); 512 expectError(GL_INVALID_VALUE); 513 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0); 514 expectError(GL_INVALID_VALUE); 515 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0); 516 expectError(GL_INVALID_VALUE); 517 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0); 518 expectError(GL_INVALID_VALUE); 519 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0); 520 expectError(GL_INVALID_VALUE); 521 m_log << TestLog::EndSection; 522 }); 523 ES3F_ADD_API_CASE(copyteximage2d_max_level, "Invalid glCopyTexImage2D() usage", 524 { 525 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 526 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 527 glCopyTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 0, 0, 64, 64, 0); 528 expectError(GL_INVALID_VALUE); 529 m_log << TestLog::EndSection; 530 531 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE)."); 532 deUint32 log2MaxCubemapSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 533 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 534 expectError(GL_INVALID_VALUE); 535 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 536 expectError(GL_INVALID_VALUE); 537 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 538 expectError(GL_INVALID_VALUE); 539 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 540 expectError(GL_INVALID_VALUE); 541 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 542 expectError(GL_INVALID_VALUE); 543 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 544 expectError(GL_INVALID_VALUE); 545 m_log << TestLog::EndSection; 546 }); 547 ES3F_ADD_API_CASE(copyteximage2d_neg_width_height, "Invalid glCopyTexImage2D() usage", 548 { 549 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0."); 550 551 m_log << TestLog::Section("", "GL_TEXTURE_2D target"); 552 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, 1, 0); 553 expectError(GL_INVALID_VALUE); 554 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, -1, 0); 555 expectError(GL_INVALID_VALUE); 556 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, -1, 0); 557 expectError(GL_INVALID_VALUE); 558 m_log << TestLog::EndSection; 559 560 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 561 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, 1, 0); 562 expectError(GL_INVALID_VALUE); 563 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, -1, 0); 564 expectError(GL_INVALID_VALUE); 565 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0); 566 expectError(GL_INVALID_VALUE); 567 m_log << TestLog::EndSection; 568 569 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 570 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, 1, 0); 571 expectError(GL_INVALID_VALUE); 572 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, -1, 0); 573 expectError(GL_INVALID_VALUE); 574 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0); 575 expectError(GL_INVALID_VALUE); 576 m_log << TestLog::EndSection; 577 578 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 579 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, 1, 0); 580 expectError(GL_INVALID_VALUE); 581 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, -1, 0); 582 expectError(GL_INVALID_VALUE); 583 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0); 584 expectError(GL_INVALID_VALUE); 585 m_log << TestLog::EndSection; 586 587 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 588 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, 1, 0); 589 expectError(GL_INVALID_VALUE); 590 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, -1, 0); 591 expectError(GL_INVALID_VALUE); 592 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0); 593 expectError(GL_INVALID_VALUE); 594 m_log << TestLog::EndSection; 595 596 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 597 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, 1, 0); 598 expectError(GL_INVALID_VALUE); 599 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, -1, 0); 600 expectError(GL_INVALID_VALUE); 601 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0); 602 expectError(GL_INVALID_VALUE); 603 m_log << TestLog::EndSection; 604 605 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 606 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, 1, 0); 607 expectError(GL_INVALID_VALUE); 608 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, -1, 0); 609 expectError(GL_INVALID_VALUE); 610 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0); 611 expectError(GL_INVALID_VALUE); 612 m_log << TestLog::EndSection; 613 614 m_log << TestLog::EndSection; 615 }); 616 ES3F_ADD_API_CASE(copyteximage2d_max_width_height, "Invalid glCopyTexImage2D() usage", 617 { 618 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1; 619 int maxCubemapSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1; 620 621 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE."); 622 623 m_log << TestLog::Section("", "GL_TEXTURE_2D target"); 624 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0); 625 expectError(GL_INVALID_VALUE); 626 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0); 627 expectError(GL_INVALID_VALUE); 628 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0); 629 expectError(GL_INVALID_VALUE); 630 m_log << TestLog::EndSection; 631 632 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 633 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 634 expectError(GL_INVALID_VALUE); 635 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 636 expectError(GL_INVALID_VALUE); 637 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 638 expectError(GL_INVALID_VALUE); 639 m_log << TestLog::EndSection; 640 641 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 642 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 643 expectError(GL_INVALID_VALUE); 644 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 645 expectError(GL_INVALID_VALUE); 646 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 647 expectError(GL_INVALID_VALUE); 648 m_log << TestLog::EndSection; 649 650 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 651 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 652 expectError(GL_INVALID_VALUE); 653 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 654 expectError(GL_INVALID_VALUE); 655 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 656 expectError(GL_INVALID_VALUE); 657 m_log << TestLog::EndSection; 658 659 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 660 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 661 expectError(GL_INVALID_VALUE); 662 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 663 expectError(GL_INVALID_VALUE); 664 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 665 expectError(GL_INVALID_VALUE); 666 m_log << TestLog::EndSection; 667 668 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 669 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 670 expectError(GL_INVALID_VALUE); 671 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 672 expectError(GL_INVALID_VALUE); 673 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 674 expectError(GL_INVALID_VALUE); 675 m_log << TestLog::EndSection; 676 677 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 678 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 679 expectError(GL_INVALID_VALUE); 680 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 681 expectError(GL_INVALID_VALUE); 682 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 683 expectError(GL_INVALID_VALUE); 684 m_log << TestLog::EndSection; 685 686 m_log << TestLog::EndSection; 687 }); 688 ES3F_ADD_API_CASE(copyteximage2d_invalid_border, "Invalid glCopyTexImage2D() usage", 689 { 690 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0."); 691 692 m_log << TestLog::Section("", "GL_TEXTURE_2D target"); 693 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 0, 0, -1); 694 expectError(GL_INVALID_VALUE); 695 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 0, 0, 1); 696 expectError(GL_INVALID_VALUE); 697 m_log << TestLog::EndSection; 698 699 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 700 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, 0, -1); 701 expectError(GL_INVALID_VALUE); 702 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, 0, 1); 703 expectError(GL_INVALID_VALUE); 704 m_log << TestLog::EndSection; 705 706 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 707 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 0, 0, -1); 708 expectError(GL_INVALID_VALUE); 709 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 0, 0, 1); 710 expectError(GL_INVALID_VALUE); 711 m_log << TestLog::EndSection; 712 713 m_log << TestLog::Section("", "GL_TEXTURE_2D target"); 714 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 0, 0, -1); 715 expectError(GL_INVALID_VALUE); 716 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 0, 0, 1); 717 expectError(GL_INVALID_VALUE); 718 m_log << TestLog::EndSection; 719 720 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 721 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 0, 0, -1); 722 expectError(GL_INVALID_VALUE); 723 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 0, 0, 1); 724 expectError(GL_INVALID_VALUE); 725 m_log << TestLog::EndSection; 726 727 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 728 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 0, 0, -1); 729 expectError(GL_INVALID_VALUE); 730 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 0, 0, 1); 731 expectError(GL_INVALID_VALUE); 732 m_log << TestLog::EndSection; 733 734 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 735 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 0, 0, -1); 736 expectError(GL_INVALID_VALUE); 737 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 0, 0, 1); 738 expectError(GL_INVALID_VALUE); 739 m_log << TestLog::EndSection; 740 741 m_log << TestLog::EndSection; 742 }); 743 ES3F_ADD_API_CASE(copyteximage2d_incomplete_framebuffer, "Invalid glCopyTexImage2D() usage", 744 { 745 GLuint fbo; 746 glGenFramebuffers (1, &fbo); 747 glBindFramebuffer (GL_FRAMEBUFFER, fbo); 748 glCheckFramebufferStatus(GL_FRAMEBUFFER); 749 750 m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete."); 751 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, 0, 0, 0); 752 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 753 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA8, 0, 0, 0, 0, 0); 754 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 755 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA8, 0, 0, 0, 0, 0); 756 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 757 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA8, 0, 0, 0, 0, 0); 758 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 759 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA8, 0, 0, 0, 0, 0); 760 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 761 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA8, 0, 0, 0, 0, 0); 762 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 763 glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA8, 0, 0, 0, 0, 0); 764 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 765 m_log << tcu::TestLog::EndSection; 766 767 glBindFramebuffer (GL_FRAMEBUFFER, 0); 768 glDeleteFramebuffers(1, &fbo); 769 }); 770 771 // glCopyTexSubImage2D 772 773 ES3F_ADD_API_CASE(copytexsubimage2d_invalid_target, "Invalid glCopyTexSubImage2D() usage", 774 { 775 GLuint texture; 776 glGenTextures (1, &texture); 777 glBindTexture (GL_TEXTURE_2D, texture); 778 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 779 780 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 781 glCopyTexSubImage2D(0, 0, 0, 0, 0, 0, 4, 4); 782 expectError(GL_INVALID_ENUM); 783 m_log << TestLog::EndSection; 784 785 glDeleteTextures(1, &texture); 786 }); 787 ES3F_ADD_API_CASE(copytexsubimage2d_neg_level, "Invalid glCopyTexSubImage2D() usage", 788 { 789 GLuint textures[2]; 790 glGenTextures (2, &textures[0]); 791 glBindTexture (GL_TEXTURE_2D, textures[0]); 792 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 793 glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 794 FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);); 795 796 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 797 glCopyTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, 4, 4); 798 expectError(GL_INVALID_VALUE); 799 FOR_CUBE_FACES(faceGL, 800 { 801 glCopyTexSubImage2D(faceGL, -1, 0, 0, 0, 0, 4, 4); 802 expectError(GL_INVALID_VALUE); 803 }); 804 m_log << TestLog::EndSection; 805 806 glDeleteTextures(2, &textures[0]); 807 }); 808 ES3F_ADD_API_CASE(copytexsubimage2d_max_level, "Invalid glCopyTexSubImage2D() usage", 809 { 810 GLuint textures[2]; 811 glGenTextures (2, &textures[0]); 812 glBindTexture (GL_TEXTURE_2D, textures[0]); 813 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 814 glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 815 FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);); 816 817 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE) for 2D texture targets."); 818 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 819 glCopyTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, 4, 4); 820 expectError(GL_INVALID_VALUE); 821 m_log << TestLog::EndSection; 822 823 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_SIZE) for cubemap targets."); 824 deUint32 log2MaxCubemapSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 825 FOR_CUBE_FACES(faceGL, 826 { 827 glCopyTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, 4, 4); 828 expectError(GL_INVALID_VALUE); 829 }); 830 m_log << TestLog::EndSection; 831 832 glDeleteTextures(2, &textures[0]); 833 }); 834 ES3F_ADD_API_CASE(copytexsubimage2d_neg_offset, "Invalid glCopyTexSubImage2D() usage", 835 { 836 GLuint texture; 837 glGenTextures (1, &texture); 838 glBindTexture (GL_TEXTURE_2D, texture); 839 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 840 841 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset < 0 or yoffset < 0."); 842 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, 4, 4); 843 expectError(GL_INVALID_VALUE); 844 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, 4, 4); 845 expectError(GL_INVALID_VALUE); 846 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, 4, 4); 847 expectError(GL_INVALID_VALUE); 848 m_log << TestLog::EndSection; 849 850 glDeleteTextures(1, &texture); 851 }); 852 ES3F_ADD_API_CASE(copytexsubimage2d_invalid_offset, "Invalid glCopyTexSubImage2D() usage", 853 { 854 GLuint texture; 855 glGenTextures (1, &texture); 856 glBindTexture (GL_TEXTURE_2D, texture); 857 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 858 859 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height."); 860 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 14, 0, 0, 0, 4, 4); 861 expectError(GL_INVALID_VALUE); 862 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 14, 0, 0, 4, 4); 863 expectError(GL_INVALID_VALUE); 864 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 14, 14, 0, 0, 4, 4); 865 expectError(GL_INVALID_VALUE); 866 m_log << TestLog::EndSection; 867 868 glDeleteTextures(1, &texture); 869 }); 870 ES3F_ADD_API_CASE(copytexsubimage2d_neg_width_height, "Invalid glCopyTexSubImage2D() usage", 871 { 872 GLuint texture; 873 glGenTextures (1, &texture); 874 glBindTexture (GL_TEXTURE_2D, texture); 875 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 876 877 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0."); 878 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, 0); 879 expectError(GL_INVALID_VALUE); 880 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, -1); 881 expectError(GL_INVALID_VALUE); 882 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, -1); 883 expectError(GL_INVALID_VALUE); 884 m_log << TestLog::EndSection; 885 886 glDeleteTextures(1, &texture); 887 }); 888 ES3F_ADD_API_CASE(copytexsubimage2d_incomplete_framebuffer, "Invalid glCopyTexSubImage2D() usage", 889 { 890 m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete."); 891 892 GLuint texture[2]; 893 GLuint fbo; 894 895 glGenTextures (2, texture); 896 glBindTexture (GL_TEXTURE_2D, texture[0]); 897 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 898 glBindTexture (GL_TEXTURE_CUBE_MAP, texture[1]); 899 glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 900 glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 901 glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 902 glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 903 glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 904 glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 905 expectError(GL_NO_ERROR); 906 907 glGenFramebuffers(1, &fbo); 908 glBindFramebuffer(GL_FRAMEBUFFER, fbo); 909 glCheckFramebufferStatus(GL_FRAMEBUFFER); 910 expectError(GL_NO_ERROR); 911 912 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0); 913 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 914 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0); 915 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 916 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0); 917 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 918 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0); 919 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 920 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0); 921 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 922 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0); 923 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 924 glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0); 925 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 926 927 glBindFramebuffer(GL_FRAMEBUFFER, 0); 928 glDeleteFramebuffers(1, &fbo); 929 glDeleteTextures(2, texture); 930 931 m_log << tcu::TestLog::EndSection; 932 }); 933 934 // glDeleteTextures 935 936 ES3F_ADD_API_CASE(deletetextures, "Invalid glDeleteTextures() usage", 937 { 938 GLuint texture; 939 glGenTextures(1, &texture); 940 941 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative."); 942 glDeleteTextures(-1, 0); 943 expectError(GL_INVALID_VALUE); 944 945 glBindTexture(GL_TEXTURE_2D, texture); 946 glDeleteTextures(-1, 0); 947 expectError(GL_INVALID_VALUE); 948 m_log << TestLog::EndSection; 949 950 glDeleteTextures(1, &texture); 951 }); 952 953 // glGenerateMipmap 954 955 ES3F_ADD_API_CASE(generatemipmap, "Invalid glGenerateMipmap() usage", 956 { 957 GLuint texture[2]; 958 glGenTextures(2, texture); 959 960 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP."); 961 glGenerateMipmap(0); 962 expectError(GL_INVALID_ENUM); 963 m_log << TestLog::EndSection; 964 965 m_log << TestLog::Section("", "INVALID_OPERATION is generated if the texture bound to target is not cube complete."); 966 glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]); 967 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_REPEAT); 968 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 969 glGenerateMipmap(GL_TEXTURE_CUBE_MAP); 970 expectError(GL_INVALID_OPERATION); 971 972 glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]); 973 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 974 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 975 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 976 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 977 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 978 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 979 glGenerateMipmap(GL_TEXTURE_CUBE_MAP); 980 expectError(GL_INVALID_OPERATION); 981 m_log << TestLog::EndSection; 982 983 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format."); 984 glBindTexture(GL_TEXTURE_2D, texture[1]); 985 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 986 glGenerateMipmap(GL_TEXTURE_2D); 987 expectError(GL_INVALID_OPERATION); 988 m_log << TestLog::EndSection; 989 990 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the level base array was not specified with an unsized internal format or a sized internal format that is both color-renderable and texture-filterable."); 991 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8_SNORM, 0, 0, 0, GL_RGB, GL_BYTE, 0); 992 glGenerateMipmap(GL_TEXTURE_2D); 993 expectError(GL_INVALID_OPERATION); 994 glTexImage2D(GL_TEXTURE_2D, 0, GL_R8I, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, 0); 995 glGenerateMipmap(GL_TEXTURE_2D); 996 expectError(GL_INVALID_OPERATION); 997 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 0, 0, 0, GL_RGBA, GL_FLOAT, 0); 998 glGenerateMipmap(GL_TEXTURE_2D); 999 expectError(GL_INVALID_OPERATION); 1000 m_log << TestLog::EndSection; 1001 1002 glDeleteTextures(2, texture); 1003 }); 1004 1005 // glGenTextures 1006 1007 ES3F_ADD_API_CASE(gentextures, "Invalid glGenTextures() usage", 1008 { 1009 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative."); 1010 glGenTextures(-1, 0); 1011 expectError(GL_INVALID_VALUE); 1012 m_log << TestLog::EndSection; 1013 }); 1014 1015 // glPixelStorei 1016 1017 ES3F_ADD_API_CASE(pixelstorei, "Invalid glPixelStorei() usage", 1018 { 1019 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if pname is not an accepted value."); 1020 glPixelStorei(0,1); 1021 expectError(GL_INVALID_ENUM); 1022 m_log << TestLog::EndSection; 1023 1024 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if a negative row length, pixel skip, or row skip value is specified, or if alignment is specified as other than 1, 2, 4, or 8."); 1025 glPixelStorei(GL_PACK_ROW_LENGTH, -1); 1026 expectError(GL_INVALID_VALUE); 1027 glPixelStorei(GL_PACK_SKIP_ROWS, -1); 1028 expectError(GL_INVALID_VALUE); 1029 glPixelStorei(GL_PACK_SKIP_PIXELS, -1); 1030 expectError(GL_INVALID_VALUE); 1031 glPixelStorei(GL_UNPACK_ROW_LENGTH, -1); 1032 expectError(GL_INVALID_VALUE); 1033 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, -1); 1034 expectError(GL_INVALID_VALUE); 1035 glPixelStorei(GL_UNPACK_SKIP_ROWS, -1); 1036 expectError(GL_INVALID_VALUE); 1037 glPixelStorei(GL_UNPACK_SKIP_PIXELS, -1); 1038 expectError(GL_INVALID_VALUE); 1039 glPixelStorei(GL_UNPACK_SKIP_IMAGES, -1); 1040 expectError(GL_INVALID_VALUE); 1041 glPixelStorei(GL_PACK_ALIGNMENT, 0); 1042 expectError(GL_INVALID_VALUE); 1043 glPixelStorei(GL_UNPACK_ALIGNMENT, 0); 1044 expectError(GL_INVALID_VALUE); 1045 glPixelStorei(GL_PACK_ALIGNMENT, 16); 1046 expectError(GL_INVALID_VALUE); 1047 glPixelStorei(GL_UNPACK_ALIGNMENT, 16); 1048 expectError(GL_INVALID_VALUE); 1049 m_log << TestLog::EndSection; 1050 }); 1051 1052 // glTexImage2D 1053 1054 ES3F_ADD_API_CASE(teximage2d, "Invalid glTexImage2D() usage", 1055 { 1056 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 1057 glTexImage2D(0, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1058 expectError(GL_INVALID_ENUM); 1059 m_log << TestLog::EndSection; 1060 1061 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if type is not a type constant."); 1062 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, 0, 0); 1063 expectError(GL_INVALID_ENUM); 1064 m_log << TestLog::EndSection; 1065 1066 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid."); 1067 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1068 expectError(GL_INVALID_OPERATION); 1069 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); 1070 expectError(GL_INVALID_OPERATION); 1071 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5_A1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 1072 expectError(GL_INVALID_OPERATION); 1073 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB10_A2, 1, 1, 0, GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV, 0); 1074 expectError(GL_INVALID_OPERATION); 1075 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0); 1076 expectError(GL_INVALID_OPERATION); 1077 m_log << TestLog::EndSection; 1078 }); 1079 ES3F_ADD_API_CASE(teximage2d_inequal_width_height_cube, "Invalid glTexImage2D() usage", 1080 { 1081 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."); 1082 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1083 expectError(GL_INVALID_VALUE); 1084 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1085 expectError(GL_INVALID_VALUE); 1086 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1087 expectError(GL_INVALID_VALUE); 1088 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1089 expectError(GL_INVALID_VALUE); 1090 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1091 expectError(GL_INVALID_VALUE); 1092 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1093 expectError(GL_INVALID_VALUE); 1094 m_log << TestLog::EndSection; 1095 }); 1096 ES3F_ADD_API_CASE(teximage2d_neg_level, "Invalid glTexImage2D() usage", 1097 { 1098 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 1099 glTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1100 expectError(GL_INVALID_VALUE); 1101 m_log << TestLog::EndSection; 1102 1103 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 1104 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1105 expectError(GL_INVALID_VALUE); 1106 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1107 expectError(GL_INVALID_VALUE); 1108 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1109 expectError(GL_INVALID_VALUE); 1110 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1111 expectError(GL_INVALID_VALUE); 1112 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1113 expectError(GL_INVALID_VALUE); 1114 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1115 expectError(GL_INVALID_VALUE); 1116 m_log << TestLog::EndSection; 1117 }); 1118 ES3F_ADD_API_CASE(teximage2d_max_level, "Invalid glTexImage2D() usage", 1119 { 1120 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 1121 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 1122 glTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1123 expectError(GL_INVALID_VALUE); 1124 m_log << TestLog::EndSection; 1125 1126 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE)."); 1127 deUint32 log2MaxCubemapSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 1128 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1129 expectError(GL_INVALID_VALUE); 1130 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1131 expectError(GL_INVALID_VALUE); 1132 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1133 expectError(GL_INVALID_VALUE); 1134 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1135 expectError(GL_INVALID_VALUE); 1136 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1137 expectError(GL_INVALID_VALUE); 1138 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1139 expectError(GL_INVALID_VALUE); 1140 m_log << TestLog::EndSection; 1141 }); 1142 ES3F_ADD_API_CASE(teximage2d_neg_width_height, "Invalid glTexImage2D() usage", 1143 { 1144 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0."); 1145 1146 m_log << TestLog::Section("", "GL_TEXTURE_2D target"); 1147 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1148 expectError(GL_INVALID_VALUE); 1149 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1150 expectError(GL_INVALID_VALUE); 1151 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1152 expectError(GL_INVALID_VALUE); 1153 m_log << TestLog::EndSection; 1154 1155 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 1156 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1157 expectError(GL_INVALID_VALUE); 1158 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1159 expectError(GL_INVALID_VALUE); 1160 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1161 expectError(GL_INVALID_VALUE); 1162 m_log << TestLog::EndSection; 1163 1164 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 1165 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1166 expectError(GL_INVALID_VALUE); 1167 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1168 expectError(GL_INVALID_VALUE); 1169 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1170 expectError(GL_INVALID_VALUE); 1171 m_log << TestLog::EndSection; 1172 1173 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 1174 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1175 expectError(GL_INVALID_VALUE); 1176 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1177 expectError(GL_INVALID_VALUE); 1178 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1179 expectError(GL_INVALID_VALUE); 1180 m_log << TestLog::EndSection; 1181 1182 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 1183 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1184 expectError(GL_INVALID_VALUE); 1185 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1186 expectError(GL_INVALID_VALUE); 1187 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1188 expectError(GL_INVALID_VALUE); 1189 m_log << TestLog::EndSection; 1190 1191 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 1192 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1193 expectError(GL_INVALID_VALUE); 1194 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1195 expectError(GL_INVALID_VALUE); 1196 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1197 expectError(GL_INVALID_VALUE); 1198 m_log << TestLog::EndSection; 1199 1200 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 1201 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1202 expectError(GL_INVALID_VALUE); 1203 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1204 expectError(GL_INVALID_VALUE); 1205 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1206 expectError(GL_INVALID_VALUE); 1207 m_log << TestLog::EndSection; 1208 1209 m_log << TestLog::EndSection; 1210 }); 1211 ES3F_ADD_API_CASE(teximage2d_max_width_height, "Invalid glTexImage2D() usage", 1212 { 1213 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1; 1214 int maxCubemapSize = m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1; 1215 1216 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE."); 1217 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1218 expectError(GL_INVALID_VALUE); 1219 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1220 expectError(GL_INVALID_VALUE); 1221 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1222 expectError(GL_INVALID_VALUE); 1223 m_log << TestLog::EndSection; 1224 1225 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE."); 1226 1227 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 1228 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1229 expectError(GL_INVALID_VALUE); 1230 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1231 expectError(GL_INVALID_VALUE); 1232 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1233 expectError(GL_INVALID_VALUE); 1234 m_log << TestLog::EndSection; 1235 1236 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 1237 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1238 expectError(GL_INVALID_VALUE); 1239 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1240 expectError(GL_INVALID_VALUE); 1241 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1242 expectError(GL_INVALID_VALUE); 1243 m_log << TestLog::EndSection; 1244 1245 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 1246 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1247 expectError(GL_INVALID_VALUE); 1248 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1249 expectError(GL_INVALID_VALUE); 1250 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1251 expectError(GL_INVALID_VALUE); 1252 m_log << TestLog::EndSection; 1253 1254 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 1255 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1256 expectError(GL_INVALID_VALUE); 1257 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1258 expectError(GL_INVALID_VALUE); 1259 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1260 expectError(GL_INVALID_VALUE); 1261 m_log << TestLog::EndSection; 1262 1263 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 1264 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1265 expectError(GL_INVALID_VALUE); 1266 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1267 expectError(GL_INVALID_VALUE); 1268 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1269 expectError(GL_INVALID_VALUE); 1270 m_log << TestLog::EndSection; 1271 1272 m_log << TestLog::Section("", "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 1273 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1274 expectError(GL_INVALID_VALUE); 1275 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1276 expectError(GL_INVALID_VALUE); 1277 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1278 expectError(GL_INVALID_VALUE); 1279 m_log << TestLog::EndSection; 1280 1281 m_log << TestLog::EndSection; 1282 }); 1283 ES3F_ADD_API_CASE(teximage2d_invalid_border, "Invalid glTexImage2D() usage", 1284 { 1285 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0."); 1286 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 1287 expectError(GL_INVALID_VALUE); 1288 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0); 1289 expectError(GL_INVALID_VALUE); 1290 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 1291 expectError(GL_INVALID_VALUE); 1292 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 1293 expectError(GL_INVALID_VALUE); 1294 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 1295 expectError(GL_INVALID_VALUE); 1296 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 1297 expectError(GL_INVALID_VALUE); 1298 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 1299 expectError(GL_INVALID_VALUE); 1300 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 1301 expectError(GL_INVALID_VALUE); 1302 m_log << TestLog::EndSection; 1303 }); 1304 ES3F_ADD_API_CASE(teximage2d_invalid_buffer_target, "Invalid glTexImage2D() usage", 1305 { 1306 deUint32 buf; 1307 deUint32 texture; 1308 std::vector<GLubyte> data(64); 1309 1310 glGenBuffers (1, &buf); 1311 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 1312 glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY); 1313 glGenTextures (1, &texture); 1314 glBindTexture (GL_TEXTURE_2D, texture); 1315 expectError (GL_NO_ERROR); 1316 1317 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 1318 m_log << TestLog::Section("", "...the buffer object's data store is currently mapped."); 1319 glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT); 1320 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1321 expectError (GL_INVALID_OPERATION); 1322 glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 1323 m_log << TestLog::EndSection; 1324 1325 m_log << TestLog::Section("", "...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 1326 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1327 expectError (GL_INVALID_OPERATION); 1328 m_log << TestLog::EndSection; 1329 1330 m_log << TestLog::Section("", "...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type."); 1331 m_log << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage; 1332 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB5_A1, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (const GLvoid*)3); 1333 expectError (GL_INVALID_OPERATION); 1334 m_log << TestLog::EndSection; 1335 m_log << TestLog::EndSection; 1336 1337 glDeleteBuffers (1, &buf); 1338 glDeleteTextures (1, &texture); 1339 }); 1340 1341 // glTexSubImage2D 1342 1343 ES3F_ADD_API_CASE(texsubimage2d, "Invalid glTexSubImage2D() usage", 1344 { 1345 deUint32 texture; 1346 glGenTextures (1, &texture); 1347 glBindTexture (GL_TEXTURE_2D, texture); 1348 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1349 expectError (GL_NO_ERROR); 1350 1351 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 1352 glTexSubImage2D(0, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1353 expectError(GL_INVALID_ENUM); 1354 m_log << TestLog::EndSection; 1355 1356 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format is not an accepted format constant."); 1357 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 4, 4, GL_UNSIGNED_BYTE, 0); 1358 expectError(GL_INVALID_ENUM); 1359 m_log << TestLog::EndSection; 1360 1361 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if type is not a type constant."); 1362 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, 0, 0); 1363 expectError(GL_INVALID_ENUM); 1364 m_log << TestLog::EndSection; 1365 1366 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid."); 1367 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, 0); 1368 expectError(GL_INVALID_OPERATION); 1369 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); 1370 expectError(GL_INVALID_OPERATION); 1371 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 1372 expectError(GL_INVALID_OPERATION); 1373 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 1374 expectError(GL_INVALID_OPERATION); 1375 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0); 1376 expectError(GL_INVALID_OPERATION); 1377 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_FLOAT, 0); 1378 expectError(GL_INVALID_OPERATION); 1379 m_log << tcu::TestLog::EndSection; 1380 1381 glDeleteTextures (1, &texture); 1382 }); 1383 ES3F_ADD_API_CASE(texsubimage2d_neg_level, "Invalid glTexSubImage2D() usage", 1384 { 1385 deUint32 textures[2]; 1386 glGenTextures (2, &textures[0]); 1387 glBindTexture (GL_TEXTURE_2D, textures[0]); 1388 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1389 glBindTexture (GL_TEXTURE_2D, textures[1]); 1390 FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);); 1391 expectError (GL_NO_ERROR); 1392 1393 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 1394 glTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1395 expectError(GL_INVALID_VALUE); 1396 m_log << TestLog::EndSection; 1397 1398 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 1399 FOR_CUBE_FACES(faceGL, 1400 { 1401 glTexSubImage2D(faceGL, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1402 expectError(GL_INVALID_VALUE); 1403 }); 1404 m_log << TestLog::EndSection; 1405 1406 glDeleteTextures(2, &textures[0]); 1407 }); 1408 ES3F_ADD_API_CASE(texsubimage2d_max_level, "Invalid glTexSubImage2D() usage", 1409 { 1410 deUint32 textures[2]; 1411 glGenTextures (2, &textures[0]); 1412 glBindTexture (GL_TEXTURE_2D, textures[0]); 1413 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1414 glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 1415 FOR_CUBE_FACES(faceGL, glTexImage2D(faceGL, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);); 1416 expectError (GL_NO_ERROR); 1417 1418 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 1419 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 1420 glTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1421 expectError(GL_INVALID_VALUE); 1422 m_log << TestLog::EndSection; 1423 1424 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE)."); 1425 deUint32 log2MaxCubemapSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 1426 FOR_CUBE_FACES(faceGL, 1427 { 1428 glTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1429 expectError(GL_INVALID_VALUE); 1430 }); 1431 m_log << TestLog::EndSection; 1432 1433 glDeleteTextures(2, &textures[0]); 1434 }); 1435 ES3F_ADD_API_CASE(texsubimage2d_neg_offset, "Invalid glTexSubImage2D() usage", 1436 { 1437 deUint32 texture; 1438 glGenTextures(1, &texture); 1439 glBindTexture(GL_TEXTURE_2D, texture); 1440 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1441 expectError(GL_NO_ERROR); 1442 1443 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset or yoffset are negative."); 1444 glTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1445 expectError(GL_INVALID_VALUE); 1446 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1447 expectError(GL_INVALID_VALUE); 1448 glTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 1449 expectError(GL_INVALID_VALUE); 1450 m_log << TestLog::EndSection; 1451 1452 glDeleteTextures(1, &texture); 1453 }); 1454 ES3F_ADD_API_CASE(texsubimage2d_invalid_offset, "Invalid glTexSubImage2D() usage", 1455 { 1456 deUint32 texture; 1457 glGenTextures (1, &texture); 1458 glBindTexture (GL_TEXTURE_2D, texture); 1459 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1460 expectError (GL_NO_ERROR); 1461 1462 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height."); 1463 glTexSubImage2D(GL_TEXTURE_2D, 0, 30, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1464 expectError(GL_INVALID_VALUE); 1465 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 30, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1466 expectError(GL_INVALID_VALUE); 1467 glTexSubImage2D(GL_TEXTURE_2D, 0, 30, 30, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1468 expectError(GL_INVALID_VALUE); 1469 m_log << TestLog::EndSection; 1470 1471 glDeleteTextures (1, &texture); 1472 }); 1473 ES3F_ADD_API_CASE(texsubimage2d_neg_width_height, "Invalid glTexSubImage2D() usage", 1474 { 1475 deUint32 texture; 1476 glGenTextures (1, &texture); 1477 glBindTexture (GL_TEXTURE_2D, texture); 1478 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1479 expectError (GL_NO_ERROR); 1480 1481 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0."); 1482 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1483 expectError(GL_INVALID_VALUE); 1484 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1485 expectError(GL_INVALID_VALUE); 1486 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1487 expectError(GL_INVALID_VALUE); 1488 m_log << TestLog::EndSection; 1489 1490 glDeleteTextures (1, &texture); 1491 }); 1492 ES3F_ADD_API_CASE(texsubimage2d_invalid_buffer_target, "Invalid glTexSubImage2D() usage", 1493 { 1494 deUint32 buf; 1495 deUint32 texture; 1496 std::vector<GLubyte> data(64); 1497 1498 glGenTextures (1, &texture); 1499 glBindTexture (GL_TEXTURE_2D, texture); 1500 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1501 glGenBuffers (1, &buf); 1502 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 1503 glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY); 1504 expectError (GL_NO_ERROR); 1505 1506 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 1507 m_log << TestLog::Section("", "...the buffer object's data store is currently mapped."); 1508 glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT); 1509 glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1510 expectError (GL_INVALID_OPERATION); 1511 glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 1512 m_log << TestLog::EndSection; 1513 1514 m_log << TestLog::Section("", "...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 1515 glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 32, 32, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1516 expectError (GL_INVALID_OPERATION); 1517 m_log << TestLog::EndSection; 1518 1519 m_log << TestLog::Section("", "...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type."); 1520 m_log << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage; 1521 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0); 1522 glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 0); 1523 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 1524 expectError (GL_NO_ERROR); 1525 glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (const GLvoid*)3); 1526 expectError (GL_INVALID_OPERATION); 1527 m_log << TestLog::EndSection; 1528 m_log << TestLog::EndSection; 1529 1530 glDeleteBuffers (1, &buf); 1531 glDeleteTextures (1, &texture); 1532 }); 1533 1534 // glTexParameteri 1535 1536 ES3F_ADD_API_CASE(texparameteri, "Invalid glTexParameteri() usage", 1537 { 1538 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 1539 glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 1540 expectError(GL_INVALID_ENUM); 1541 glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR); 1542 expectError(GL_INVALID_ENUM); 1543 glTexParameteri(0, 0, GL_LINEAR); 1544 expectError(GL_INVALID_ENUM); 1545 m_log << TestLog::EndSection; 1546 1547 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."); 1548 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0); 1549 expectError(GL_INVALID_ENUM); 1550 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT); 1551 expectError(GL_INVALID_ENUM); 1552 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0); 1553 expectError(GL_INVALID_ENUM); 1554 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST); 1555 expectError(GL_INVALID_ENUM); 1556 m_log << TestLog::EndSection; 1557 1558 GLuint texture; 1559 glGenTextures(1, &texture); 1560 glBindTexture(GL_TEXTURE_2D, texture); 1561 1562 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 1563 glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 1564 expectError(GL_INVALID_ENUM); 1565 glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR); 1566 expectError(GL_INVALID_ENUM); 1567 glTexParameteri(0, 0, GL_LINEAR); 1568 expectError(GL_INVALID_ENUM); 1569 m_log << TestLog::EndSection; 1570 1571 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."); 1572 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0); 1573 expectError(GL_INVALID_ENUM); 1574 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT); 1575 expectError(GL_INVALID_ENUM); 1576 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0); 1577 expectError(GL_INVALID_ENUM); 1578 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST); 1579 expectError(GL_INVALID_ENUM); 1580 m_log << TestLog::EndSection; 1581 1582 glDeleteTextures(1, &texture); 1583 }); 1584 1585 // glTexParameterf 1586 1587 ES3F_ADD_API_CASE(texparameterf, "Invalid glTexParameterf() usage", 1588 { 1589 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 1590 glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 1591 expectError(GL_INVALID_ENUM); 1592 glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR); 1593 expectError(GL_INVALID_ENUM); 1594 glTexParameterf(0, 0, GL_LINEAR); 1595 expectError(GL_INVALID_ENUM); 1596 m_log << TestLog::EndSection; 1597 1598 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."); 1599 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0); 1600 expectError(GL_INVALID_ENUM); 1601 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT); 1602 expectError(GL_INVALID_ENUM); 1603 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0); 1604 expectError(GL_INVALID_ENUM); 1605 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST); 1606 expectError(GL_INVALID_ENUM); 1607 m_log << TestLog::EndSection; 1608 1609 GLuint texture; 1610 glGenTextures(1, &texture); 1611 glBindTexture(GL_TEXTURE_2D, texture); 1612 1613 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 1614 glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 1615 expectError(GL_INVALID_ENUM); 1616 glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR); 1617 expectError(GL_INVALID_ENUM); 1618 glTexParameterf(0, 0, GL_LINEAR); 1619 expectError(GL_INVALID_ENUM); 1620 m_log << TestLog::EndSection; 1621 1622 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."); 1623 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0); 1624 expectError(GL_INVALID_ENUM); 1625 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT); 1626 expectError(GL_INVALID_ENUM); 1627 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0); 1628 expectError(GL_INVALID_ENUM); 1629 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST); 1630 expectError(GL_INVALID_ENUM); 1631 m_log << TestLog::EndSection; 1632 1633 glDeleteTextures(1, &texture); 1634 }); 1635 1636 // glTexParameteriv 1637 1638 ES3F_ADD_API_CASE(texparameteriv, "Invalid glTexParameteriv() usage", 1639 { 1640 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 1641 GLint params[1] = {GL_LINEAR}; 1642 glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 1643 expectError(GL_INVALID_ENUM); 1644 glTexParameteriv(GL_TEXTURE_2D, 0, ¶ms[0]); 1645 expectError(GL_INVALID_ENUM); 1646 glTexParameteriv(0, 0, ¶ms[0]); 1647 expectError(GL_INVALID_ENUM); 1648 m_log << TestLog::EndSection; 1649 1650 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."); 1651 params[0] = 0; 1652 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 1653 expectError(GL_INVALID_ENUM); 1654 params[0] = GL_REPEAT; 1655 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 1656 expectError(GL_INVALID_ENUM); 1657 params[0] = 0; 1658 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]); 1659 expectError(GL_INVALID_ENUM); 1660 params[0] = GL_NEAREST; 1661 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]); 1662 expectError(GL_INVALID_ENUM); 1663 m_log << TestLog::EndSection; 1664 1665 GLuint texture; 1666 glGenTextures(1, &texture); 1667 glBindTexture(GL_TEXTURE_2D, texture); 1668 1669 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 1670 params[0] = GL_LINEAR; 1671 glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 1672 expectError(GL_INVALID_ENUM); 1673 glTexParameteriv(GL_TEXTURE_2D, 0, ¶ms[0]); 1674 expectError(GL_INVALID_ENUM); 1675 glTexParameteriv(0, 0, ¶ms[0]); 1676 expectError(GL_INVALID_ENUM); 1677 m_log << TestLog::EndSection; 1678 1679 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."); 1680 params[0] = 0; 1681 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 1682 expectError(GL_INVALID_ENUM); 1683 params[0] = GL_REPEAT; 1684 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 1685 expectError(GL_INVALID_ENUM); 1686 params[0] = 0; 1687 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]); 1688 expectError(GL_INVALID_ENUM); 1689 params[0] = GL_NEAREST; 1690 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]); 1691 expectError(GL_INVALID_ENUM); 1692 m_log << TestLog::EndSection; 1693 1694 glDeleteTextures(1, &texture); 1695 }); 1696 1697 // glTexParameterfv 1698 1699 ES3F_ADD_API_CASE(texparameterfv, "Invalid glTexParameterfv() usage", 1700 { 1701 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 1702 GLfloat params[1] = {GL_LINEAR}; 1703 glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 1704 expectError(GL_INVALID_ENUM); 1705 glTexParameterfv(GL_TEXTURE_2D, 0, ¶ms[0]); 1706 expectError(GL_INVALID_ENUM); 1707 glTexParameterfv(0, 0, ¶ms[0]); 1708 expectError(GL_INVALID_ENUM); 1709 m_log << TestLog::EndSection; 1710 1711 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."); 1712 params[0] = 0.0f; 1713 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 1714 expectError(GL_INVALID_ENUM); 1715 params[0] = GL_REPEAT; 1716 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 1717 expectError(GL_INVALID_ENUM); 1718 params[0] = 0.0f; 1719 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]); 1720 expectError(GL_INVALID_ENUM); 1721 params[0] = GL_NEAREST; 1722 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]); 1723 expectError(GL_INVALID_ENUM); 1724 m_log << TestLog::EndSection; 1725 1726 GLuint texture; 1727 glGenTextures(1, &texture); 1728 glBindTexture(GL_TEXTURE_2D, texture); 1729 1730 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 1731 params[0] = GL_LINEAR; 1732 glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 1733 expectError(GL_INVALID_ENUM); 1734 glTexParameterfv(GL_TEXTURE_2D, 0, ¶ms[0]); 1735 expectError(GL_INVALID_ENUM); 1736 glTexParameterfv(0, 0, ¶ms[0]); 1737 expectError(GL_INVALID_ENUM); 1738 m_log << TestLog::EndSection; 1739 1740 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."); 1741 params[0] = 0.0f; 1742 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 1743 expectError(GL_INVALID_ENUM); 1744 params[0] = GL_REPEAT; 1745 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 1746 expectError(GL_INVALID_ENUM); 1747 params[0] = 0.0f; 1748 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]); 1749 expectError(GL_INVALID_ENUM); 1750 params[0] = GL_NEAREST; 1751 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]); 1752 expectError(GL_INVALID_ENUM); 1753 m_log << TestLog::EndSection; 1754 1755 glDeleteTextures(1, &texture); 1756 }); 1757 1758 // glCompressedTexSubImage2D 1759 1760 ES3F_ADD_API_CASE(compressedtexsubimage2d, "Invalid glCompressedTexSubImage2D() usage", 1761 { 1762 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 1763 glCompressedTexSubImage2D(0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0); 1764 expectError(GL_INVALID_ENUM); 1765 m_log << TestLog::EndSection; 1766 1767 deUint32 texture; 1768 glGenTextures (1, &texture); 1769 glBindTexture (GL_TEXTURE_2D, texture); 1770 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0); 1771 expectError (GL_NO_ERROR); 1772 1773 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified."); 1774 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0); 1775 expectError(GL_INVALID_OPERATION); 1776 m_log << TestLog::EndSection; 1777 1778 m_log << TestLog::Section("", "For ETC2/EAC images GL_INVALID_OPERATION is generated if width is not a multiple of four, and width + xoffset is not equal to the width of the texture level."); 1779 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 4, 0, 10, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(10, 4), 0); 1780 expectError(GL_INVALID_OPERATION); 1781 m_log << TestLog::EndSection; 1782 1783 m_log << TestLog::Section("", "For ETC2/EAC images GL_INVALID_OPERATION is generated if height is not a multiple of four, and height + yoffset is not equal to the height of the texture level."); 1784 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 4, 4, 10, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 10), 0); 1785 expectError(GL_INVALID_OPERATION); 1786 m_log << TestLog::EndSection; 1787 1788 m_log << TestLog::Section("", "For ETC2/EAC images GL_INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four."); 1789 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 1, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 1790 expectError(GL_INVALID_OPERATION); 1791 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 1, 0, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 1792 expectError(GL_INVALID_OPERATION); 1793 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 1794 expectError(GL_INVALID_OPERATION); 1795 m_log << TestLog::EndSection; 1796 1797 glDeleteTextures (1, &texture); 1798 }); 1799 ES3F_ADD_API_CASE(compressedtexsubimage2d_neg_level, "Invalid glCompressedTexSubImage2D() usage", 1800 { 1801 deUint32 textures[2]; 1802 glGenTextures (2, &textures[0]); 1803 glBindTexture (GL_TEXTURE_2D, textures[0]); 1804 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0); 1805 glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 1806 FOR_CUBE_FACES(faceGL, glCompressedTexImage2D(faceGL, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0);); 1807 expectError (GL_NO_ERROR); 1808 1809 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 1810 glCompressedTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1811 expectError(GL_INVALID_VALUE); 1812 m_log << TestLog::EndSection; 1813 1814 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 1815 FOR_CUBE_FACES(faceGL, 1816 { 1817 glCompressedTexSubImage2D(faceGL, -1, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1818 expectError(GL_INVALID_VALUE); 1819 }); 1820 m_log << TestLog::EndSection; 1821 1822 glDeleteTextures(2, &textures[0]); 1823 }); 1824 ES3F_ADD_API_CASE(compressedtexsubimage2d_max_level, "Invalid glCompressedTexSubImage2D() usage", 1825 { 1826 deUint32 textures[2]; 1827 glGenTextures (2, &textures[0]); 1828 glBindTexture (GL_TEXTURE_2D, textures[0]); 1829 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0); 1830 glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 1831 FOR_CUBE_FACES(faceGL, glCompressedTexImage2D(faceGL, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0);); 1832 expectError (GL_NO_ERROR); 1833 1834 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 1835 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 1836 glCompressedTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1837 expectError(GL_INVALID_VALUE); 1838 m_log << TestLog::EndSection; 1839 1840 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE)."); 1841 deUint32 log2MaxCubemapSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 1842 FOR_CUBE_FACES(faceGL, 1843 { 1844 glCompressedTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1845 expectError(GL_INVALID_VALUE); 1846 }); 1847 m_log << TestLog::EndSection; 1848 1849 glDeleteTextures(2, &textures[0]); 1850 }); 1851 ES3F_ADD_API_CASE(compressedtexsubimage2d_neg_offset, "Invalid glCompressedTexSubImage2D() usage", 1852 { 1853 GLuint texture; 1854 glGenTextures(1, &texture); 1855 glBindTexture(GL_TEXTURE_2D, texture); 1856 glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 8, 8, 0, etc2EacDataSize(8, 8), 0); 1857 1858 // \note Both GL_INVALID_VALUE and GL_INVALID_OPERATION are valid here since implementation may 1859 // first check if offsets are valid for certain format and only after that check that they 1860 // are not negative. 1861 m_log << TestLog::Section("", "GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset or yoffset are negative."); 1862 1863 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1864 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1865 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1866 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1867 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -4, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1868 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1869 1870 m_log << TestLog::EndSection; 1871 1872 glDeleteTextures(1, &texture); 1873 }); 1874 ES3F_ADD_API_CASE(compressedtexsubimage2d_invalid_offset, "Invalid glCompressedTexSubImage2D() usage", 1875 { 1876 deUint32 texture; 1877 glGenTextures (1, &texture); 1878 glBindTexture (GL_TEXTURE_2D, texture); 1879 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 1880 expectError (GL_NO_ERROR); 1881 1882 m_log << TestLog::Section("", "GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height."); 1883 1884 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 12, 0, 8, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 4), 0); 1885 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1886 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 12, 4, 8, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 8), 0); 1887 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1888 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 12, 12, 8, 8, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 8), 0); 1889 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1890 m_log << TestLog::EndSection; 1891 1892 glDeleteTextures (1, &texture); 1893 }); 1894 ES3F_ADD_API_CASE(compressedtexsubimage2d_neg_width_height, "Invalid glCompressedTexSubImage2D() usage", 1895 { 1896 deUint32 texture; 1897 glGenTextures (1, &texture); 1898 glBindTexture (GL_TEXTURE_2D, texture); 1899 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 1900 expectError (GL_NO_ERROR); 1901 1902 m_log << TestLog::Section("", "GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if width or height is less than 0."); 1903 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -4, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1904 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1905 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1906 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1907 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -4, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 1908 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 1909 m_log << TestLog::EndSection; 1910 1911 glDeleteTextures(1, &texture); 1912 }); 1913 ES3F_ADD_API_CASE(compressedtexsubimage2d_invalid_size, "Invalid glCompressedTexImage2D() usage", 1914 { 1915 deUint32 texture; 1916 glGenTextures (1, &texture); 1917 glBindTexture (GL_TEXTURE_2D, texture); 1918 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 1919 expectError (GL_NO_ERROR); 1920 1921 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."); 1922 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0); 1923 expectError(GL_INVALID_VALUE); 1924 1925 glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL_COMPRESSED_RGBA8_ETC2_EAC, 4*4*16-1, 0); 1926 expectError(GL_INVALID_VALUE); 1927 m_log << TestLog::EndSection; 1928 1929 glDeleteTextures (1, &texture); 1930 }); 1931 ES3F_ADD_API_CASE(compressedtexsubimage2d_invalid_buffer_target, "Invalid glCompressedTexSubImage2D() usage", 1932 { 1933 deUint32 buf; 1934 deUint32 texture; 1935 std::vector<GLubyte> data(128); 1936 1937 glGenTextures (1, &texture); 1938 glBindTexture (GL_TEXTURE_2D, texture); 1939 glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 1940 glGenBuffers (1, &buf); 1941 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 1942 glBufferData (GL_PIXEL_UNPACK_BUFFER, 128, &data[0], GL_DYNAMIC_COPY); 1943 expectError (GL_NO_ERROR); 1944 1945 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 1946 m_log << TestLog::Section("", "...the buffer object's data store is currently mapped."); 1947 glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 128, GL_MAP_WRITE_BIT); 1948 glCompressedTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 1949 expectError (GL_INVALID_OPERATION); 1950 glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 1951 m_log << TestLog::EndSection; 1952 1953 m_log << TestLog::Section("", "...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 1954 glCompressedTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(16, 16), 0); 1955 expectError (GL_INVALID_OPERATION); 1956 m_log << TestLog::EndSection; 1957 m_log << TestLog::EndSection; 1958 1959 glDeleteBuffers (1, &buf); 1960 glDeleteTextures (1, &texture); 1961 }); 1962 1963 // glTexImage3D 1964 1965 ES3F_ADD_API_CASE(teximage3d, "Invalid glTexImage3D() usage", 1966 { 1967 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 1968 glTexImage3D(0, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1969 expectError(GL_INVALID_ENUM); 1970 glTexImage3D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1971 expectError(GL_INVALID_ENUM); 1972 m_log << TestLog::EndSection; 1973 1974 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if type is not a type constant."); 1975 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, 0, 0); 1976 expectError(GL_INVALID_ENUM); 1977 m_log << TestLog::EndSection; 1978 1979 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format is not an accepted format constant."); 1980 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, 0, GL_UNSIGNED_BYTE, 0); 1981 expectError(GL_INVALID_ENUM); 1982 m_log << TestLog::EndSection; 1983 1984 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if internalFormat is not one of the accepted resolution and format symbolic constants."); 1985 glTexImage3D(GL_TEXTURE_3D, 0, 0, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1986 expectError(GL_INVALID_VALUE); 1987 m_log << TestLog::EndSection; 1988 1989 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if target is GL_TEXTURE_3D and format is GL_DEPTH_COMPONENT, or GL_DEPTH_STENCIL."); 1990 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_BYTE, 0); 1991 expectError(GL_INVALID_OPERATION); 1992 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0); 1993 expectError(GL_INVALID_OPERATION); 1994 m_log << TestLog::EndSection; 1995 1996 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid."); 1997 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1998 expectError(GL_INVALID_OPERATION); 1999 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); 2000 expectError(GL_INVALID_OPERATION); 2001 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB5_A1, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 2002 expectError(GL_INVALID_OPERATION); 2003 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB10_A2, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV, 0); 2004 expectError(GL_INVALID_OPERATION); 2005 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32UI, 1, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0); 2006 expectError(GL_INVALID_OPERATION); 2007 m_log << TestLog::EndSection; 2008 }); 2009 ES3F_ADD_API_CASE(teximage3d_neg_level, "Invalid glTexImage3D() usage", 2010 { 2011 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 2012 glTexImage3D(GL_TEXTURE_3D, -1, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 2013 expectError(GL_INVALID_VALUE); 2014 glTexImage3D(GL_TEXTURE_2D_ARRAY, -1, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 2015 expectError(GL_INVALID_VALUE); 2016 m_log << TestLog::EndSection; 2017 }); 2018 ES3F_ADD_API_CASE(teximage3d_max_level, "Invalid glTexImage3D() usage", 2019 { 2020 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE)."); 2021 deUint32 log2Max3DTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_3D_TEXTURE_SIZE)) + 1; 2022 glTexImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 2023 expectError(GL_INVALID_VALUE); 2024 m_log << TestLog::EndSection; 2025 2026 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 2027 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 2028 glTexImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 2029 expectError(GL_INVALID_VALUE); 2030 m_log << TestLog::EndSection; 2031 }); 2032 ES3F_ADD_API_CASE(teximage3d_neg_width_height_depth, "Invalid glTexImage3D() usage", 2033 { 2034 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height is less than 0."); 2035 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, -1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2036 expectError(GL_INVALID_VALUE); 2037 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, -1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2038 expectError(GL_INVALID_VALUE); 2039 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2040 expectError(GL_INVALID_VALUE); 2041 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, -1, -1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2042 expectError(GL_INVALID_VALUE); 2043 2044 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, -1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2045 expectError(GL_INVALID_VALUE); 2046 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, -1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2047 expectError(GL_INVALID_VALUE); 2048 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, 1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2049 expectError(GL_INVALID_VALUE); 2050 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, -1, -1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2051 expectError(GL_INVALID_VALUE); 2052 m_log << TestLog::EndSection; 2053 }); 2054 ES3F_ADD_API_CASE(teximage3d_max_width_height_depth, "Invalid glTexImage3D() usage", 2055 { 2056 int max3DTextureSize = m_context.getContextInfo().getInt(GL_MAX_3D_TEXTURE_SIZE) + 1; 2057 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1; 2058 2059 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_3D_TEXTURE_SIZE."); 2060 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, max3DTextureSize, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2061 expectError(GL_INVALID_VALUE); 2062 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, max3DTextureSize, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2063 expectError(GL_INVALID_VALUE); 2064 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, max3DTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2065 expectError(GL_INVALID_VALUE); 2066 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, max3DTextureSize, max3DTextureSize, max3DTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2067 expectError(GL_INVALID_VALUE); 2068 m_log << TestLog::EndSection; 2069 2070 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_TEXTURE_SIZE."); 2071 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, maxTextureSize, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2072 expectError(GL_INVALID_VALUE); 2073 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, maxTextureSize, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2074 expectError(GL_INVALID_VALUE); 2075 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, 1, maxTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2076 expectError(GL_INVALID_VALUE); 2077 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, maxTextureSize, maxTextureSize, maxTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2078 expectError(GL_INVALID_VALUE); 2079 m_log << TestLog::EndSection; 2080 }); 2081 ES3F_ADD_API_CASE(teximage3d_invalid_border, "Invalid glTexImage3D() usage", 2082 { 2083 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0 or 1."); 2084 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0); 2085 expectError(GL_INVALID_VALUE); 2086 glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, 2, GL_RGB, GL_UNSIGNED_BYTE, 0); 2087 expectError(GL_INVALID_VALUE); 2088 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 1, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0); 2089 expectError(GL_INVALID_VALUE); 2090 glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 1, 1, 1, 2, GL_RGB, GL_UNSIGNED_BYTE, 0); 2091 expectError(GL_INVALID_VALUE); 2092 m_log << TestLog::EndSection; 2093 }); 2094 ES3F_ADD_API_CASE(teximage3d_invalid_buffer_target, "Invalid glTexImage3D() usage", 2095 { 2096 deUint32 buf; 2097 deUint32 texture; 2098 std::vector<GLubyte> data(512); 2099 2100 glGenBuffers (1, &buf); 2101 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 2102 glBufferData (GL_PIXEL_UNPACK_BUFFER, 512, &data[0], GL_DYNAMIC_COPY); 2103 glGenTextures (1, &texture); 2104 glBindTexture (GL_TEXTURE_3D, texture); 2105 expectError (GL_NO_ERROR); 2106 2107 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 2108 2109 m_log << TestLog::Section("", "...the buffer object's data store is currently mapped."); 2110 glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 128, GL_MAP_WRITE_BIT); 2111 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2112 expectError (GL_INVALID_OPERATION); 2113 glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 2114 m_log << TestLog::EndSection; 2115 2116 m_log << TestLog::Section("", "...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 2117 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 64, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2118 expectError (GL_INVALID_OPERATION); 2119 m_log << TestLog::EndSection; 2120 2121 m_log << TestLog::Section("", "...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type."); 2122 m_log << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage; 2123 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGB5_A1, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (const GLvoid*)3); 2124 expectError (GL_INVALID_OPERATION); 2125 m_log << TestLog::EndSection; 2126 2127 m_log << TestLog::EndSection; 2128 2129 glDeleteBuffers (1, &buf); 2130 glDeleteTextures (1, &texture); 2131 }); 2132 2133 // glTexSubImage3D 2134 2135 ES3F_ADD_API_CASE(texsubimage3d, "Invalid glTexSubImage3D() usage", 2136 { 2137 deUint32 texture; 2138 glGenTextures (1, &texture); 2139 glBindTexture (GL_TEXTURE_3D, texture); 2140 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2141 expectError (GL_NO_ERROR); 2142 2143 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 2144 glTexSubImage3D(0, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2145 expectError(GL_INVALID_ENUM); 2146 glTexSubImage3D(GL_TEXTURE_2D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2147 expectError(GL_INVALID_ENUM); 2148 m_log << TestLog::EndSection; 2149 2150 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if format is not an accepted format constant."); 2151 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 4, 4, 4, GL_UNSIGNED_BYTE, 0); 2152 expectError(GL_INVALID_ENUM); 2153 m_log << TestLog::EndSection; 2154 2155 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if type is not a type constant."); 2156 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, 0, 0); 2157 expectError(GL_INVALID_ENUM); 2158 m_log << TestLog::EndSection; 2159 2160 m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid."); 2161 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); 2162 expectError(GL_INVALID_OPERATION); 2163 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 2164 expectError(GL_INVALID_OPERATION); 2165 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 2166 expectError(GL_INVALID_OPERATION); 2167 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0); 2168 expectError(GL_INVALID_OPERATION); 2169 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_FLOAT, 0); 2170 expectError(GL_INVALID_OPERATION); 2171 m_log << tcu::TestLog::EndSection; 2172 2173 glDeleteTextures (1, &texture); 2174 }); 2175 ES3F_ADD_API_CASE(texsubimage3d_neg_level, "Invalid glTexSubImage3D() usage", 2176 { 2177 deUint32 textures[2]; 2178 glGenTextures (2, &textures[0]); 2179 glBindTexture (GL_TEXTURE_3D, textures[0]); 2180 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2181 glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 2182 glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2183 expectError (GL_NO_ERROR); 2184 2185 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 2186 glTexSubImage3D(GL_TEXTURE_3D, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2187 expectError(GL_INVALID_VALUE); 2188 glTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2189 expectError(GL_INVALID_VALUE); 2190 m_log << TestLog::EndSection; 2191 2192 glDeleteTextures (2, &textures[0]); 2193 }); 2194 ES3F_ADD_API_CASE(texsubimage3d_max_level, "Invalid glTexSubImage3D() usage", 2195 { 2196 deUint32 textures[2]; 2197 glGenTextures (2, &textures[0]); 2198 glBindTexture (GL_TEXTURE_3D, textures[0]); 2199 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2200 glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 2201 glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2202 expectError (GL_NO_ERROR); 2203 2204 deUint32 log2Max3DTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_3D_TEXTURE_SIZE)) + 1; 2205 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 2206 2207 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE)."); 2208 glTexSubImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2209 expectError(GL_INVALID_VALUE); 2210 m_log << TestLog::EndSection; 2211 2212 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 2213 glTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2214 expectError(GL_INVALID_VALUE); 2215 m_log << TestLog::EndSection; 2216 2217 glDeleteTextures (2, &textures[0]); 2218 }); 2219 ES3F_ADD_API_CASE(texsubimage3d_neg_offset, "Invalid glTexSubImage3D() usage", 2220 { 2221 deUint32 textures[2]; 2222 glGenTextures (2, &textures[0]); 2223 glBindTexture (GL_TEXTURE_3D, textures[0]); 2224 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2225 glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 2226 glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2227 expectError (GL_NO_ERROR); 2228 2229 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset, yoffset or zoffset are negative."); 2230 glTexSubImage3D(GL_TEXTURE_3D, 0, -1, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2231 expectError(GL_INVALID_VALUE); 2232 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2233 expectError(GL_INVALID_VALUE); 2234 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2235 expectError(GL_INVALID_VALUE); 2236 glTexSubImage3D(GL_TEXTURE_3D, 0, -1, -1, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2237 expectError(GL_INVALID_VALUE); 2238 glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -1, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2239 expectError(GL_INVALID_VALUE); 2240 glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2241 expectError(GL_INVALID_VALUE); 2242 glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2243 expectError(GL_INVALID_VALUE); 2244 glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -1, -1, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2245 expectError(GL_INVALID_VALUE); 2246 m_log << TestLog::EndSection; 2247 2248 glDeleteTextures (2, &textures[0]); 2249 }); 2250 ES3F_ADD_API_CASE(texsubimage3d_invalid_offset, "Invalid glTexSubImage3D() usage", 2251 { 2252 deUint32 texture; 2253 glGenTextures (1, &texture); 2254 glBindTexture (GL_TEXTURE_3D, texture); 2255 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2256 expectError (GL_NO_ERROR); 2257 2258 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width."); 2259 glTexSubImage3D(GL_TEXTURE_3D, 0, 2, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2260 expectError(GL_INVALID_VALUE); 2261 m_log << TestLog::EndSection; 2262 2263 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if yoffset + height > texture_height."); 2264 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 2, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2265 expectError(GL_INVALID_VALUE); 2266 m_log << TestLog::EndSection; 2267 2268 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if zoffset + depth > texture_depth."); 2269 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 2, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2270 expectError(GL_INVALID_VALUE); 2271 m_log << TestLog::EndSection; 2272 2273 glDeleteTextures (1, &texture); 2274 }); 2275 ES3F_ADD_API_CASE(texsubimage3d_neg_width_height, "Invalid glTexSubImage3D() usage", 2276 { 2277 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width, height or depth is less than 0."); 2278 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, -1, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2279 expectError(GL_INVALID_VALUE); 2280 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2281 expectError(GL_INVALID_VALUE); 2282 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2283 expectError(GL_INVALID_VALUE); 2284 glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, -1, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2285 expectError(GL_INVALID_VALUE); 2286 m_log << TestLog::EndSection; 2287 }); 2288 ES3F_ADD_API_CASE(texsubimage3d_invalid_buffer_target, "Invalid glTexSubImage3D() usage", 2289 { 2290 deUint32 buf; 2291 deUint32 texture; 2292 std::vector<GLubyte> data(512); 2293 2294 glGenTextures (1, &texture); 2295 glBindTexture (GL_TEXTURE_3D, texture); 2296 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 16, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2297 glGenBuffers (1, &buf); 2298 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 2299 glBufferData (GL_PIXEL_UNPACK_BUFFER, 512, &data[0], GL_DYNAMIC_COPY); 2300 expectError (GL_NO_ERROR); 2301 2302 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 2303 2304 m_log << TestLog::Section("", "...the buffer object's data store is currently mapped."); 2305 glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 512, GL_MAP_WRITE_BIT); 2306 glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2307 expectError (GL_INVALID_OPERATION); 2308 glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 2309 m_log << TestLog::EndSection; 2310 2311 m_log << TestLog::Section("", "...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 2312 glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 16, 16, 16, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2313 expectError (GL_INVALID_OPERATION); 2314 m_log << TestLog::EndSection; 2315 2316 m_log << TestLog::Section("", "...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type."); 2317 m_log << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage; 2318 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0); 2319 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 0); 2320 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 2321 expectError (GL_NO_ERROR); 2322 glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (const GLvoid*)3); 2323 expectError (GL_INVALID_OPERATION); 2324 m_log << TestLog::EndSection; 2325 2326 m_log << TestLog::EndSection; 2327 2328 glDeleteBuffers (1, &buf); 2329 glDeleteTextures (1, &texture); 2330 }); 2331 2332 // glCopyTexSubImage3D 2333 2334 ES3F_ADD_API_CASE(copytexsubimage3d, "Invalid glCopyTexSubImage3D() usage", 2335 { 2336 GLuint texture; 2337 glGenTextures (1, &texture); 2338 glBindTexture (GL_TEXTURE_3D, texture); 2339 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2340 2341 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 2342 glCopyTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 4, 4); 2343 expectError(GL_INVALID_ENUM); 2344 m_log << TestLog::EndSection; 2345 2346 glDeleteTextures(1, &texture); 2347 }); 2348 ES3F_ADD_API_CASE(copytexsubimage3d_neg_level, "Invalid glCopyTexSubImage3D() usage", 2349 { 2350 deUint32 textures[2]; 2351 glGenTextures (2, &textures[0]); 2352 glBindTexture (GL_TEXTURE_3D, textures[0]); 2353 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2354 glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 2355 glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2356 expectError (GL_NO_ERROR); 2357 2358 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 2359 glCopyTexSubImage3D(GL_TEXTURE_3D, -1, 0, 0, 0, 0, 0, 4, 4); 2360 expectError(GL_INVALID_VALUE); 2361 glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 4, 4); 2362 expectError(GL_INVALID_VALUE); 2363 m_log << TestLog::EndSection; 2364 2365 glDeleteTextures(2, &textures[0]); 2366 }); 2367 ES3F_ADD_API_CASE(copytexsubimage3d_max_level, "Invalid glCopyTexSubImage3D() usage", 2368 { 2369 deUint32 log2Max3DTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_3D_TEXTURE_SIZE)) + 1; 2370 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 2371 2372 deUint32 textures[2]; 2373 glGenTextures (2, &textures[0]); 2374 glBindTexture (GL_TEXTURE_3D, textures[0]); 2375 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2376 glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 2377 glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2378 expectError (GL_NO_ERROR); 2379 2380 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE)."); 2381 glCopyTexSubImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 4, 4); 2382 expectError(GL_INVALID_VALUE); 2383 m_log << TestLog::EndSection; 2384 2385 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 2386 glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 4, 4); 2387 expectError(GL_INVALID_VALUE); 2388 m_log << TestLog::EndSection; 2389 2390 glDeleteTextures(2, &textures[0]); 2391 }); 2392 ES3F_ADD_API_CASE(copytexsubimage3d_neg_offset, "Invalid glCopyTexSubImage3D() usage", 2393 { 2394 GLuint texture; 2395 glGenTextures (1, &texture); 2396 glBindTexture (GL_TEXTURE_3D, texture); 2397 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2398 2399 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset, yoffset or zoffset is negative."); 2400 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, -1, 0, 0, 0, 0, 4, 4); 2401 expectError(GL_INVALID_VALUE); 2402 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, -1, 0, 0, 0, 4, 4); 2403 expectError(GL_INVALID_VALUE); 2404 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, -1, 0, 0, 4, 4); 2405 expectError(GL_INVALID_VALUE); 2406 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, -1, -1, -1, 0, 0, 4, 4); 2407 expectError(GL_INVALID_VALUE); 2408 m_log << TestLog::EndSection; 2409 2410 glDeleteTextures(1, &texture); 2411 }); 2412 ES3F_ADD_API_CASE(copytexsubimage3d_invalid_offset, "Invalid glCopyTexSubImage3D() usage", 2413 { 2414 GLuint texture; 2415 glGenTextures (1, &texture); 2416 glBindTexture (GL_TEXTURE_3D, texture); 2417 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2418 2419 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if xoffset + width > texture_width."); 2420 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 1, 0, 0, 0, 0, 4, 4); 2421 expectError(GL_INVALID_VALUE); 2422 m_log << TestLog::EndSection; 2423 2424 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if yoffset + height > texture_height."); 2425 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 1, 0, 0, 0, 4, 4); 2426 expectError(GL_INVALID_VALUE); 2427 m_log << TestLog::EndSection; 2428 2429 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if zoffset + 1 > texture_depth."); 2430 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 4, 0, 0, 4, 4); 2431 expectError(GL_INVALID_VALUE); 2432 m_log << TestLog::EndSection; 2433 2434 glDeleteTextures(1, &texture); 2435 }); 2436 ES3F_ADD_API_CASE(copytexsubimage3d_neg_width_height, "Invalid glCopyTexSubImage3D() usage", 2437 { 2438 GLuint texture; 2439 glGenTextures (1, &texture); 2440 glBindTexture (GL_TEXTURE_3D, texture); 2441 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2442 2443 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width < 0."); 2444 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, -4, 4); 2445 expectError(GL_INVALID_VALUE); 2446 m_log << TestLog::EndSection; 2447 2448 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if height < 0."); 2449 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, -4); 2450 expectError(GL_INVALID_VALUE); 2451 m_log << TestLog::EndSection; 2452 2453 glDeleteTextures(1, &texture); 2454 }); 2455 ES3F_ADD_API_CASE(copytexsubimage3d_incomplete_framebuffer, "Invalid glCopyTexSubImage3D() usage", 2456 { 2457 GLuint fbo; 2458 GLuint texture[2]; 2459 2460 glGenTextures (2, texture); 2461 glBindTexture (GL_TEXTURE_3D, texture[0]); 2462 glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2463 glBindTexture (GL_TEXTURE_2D_ARRAY, texture[1]); 2464 glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 2465 glGenFramebuffers (1, &fbo); 2466 glBindFramebuffer (GL_READ_FRAMEBUFFER, fbo); 2467 glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); 2468 2469 m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete."); 2470 glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, 4); 2471 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 2472 glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 4, 4); 2473 expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 2474 m_log << tcu::TestLog::EndSection; 2475 2476 glBindFramebuffer(GL_FRAMEBUFFER, 0); 2477 glDeleteFramebuffers(1, &fbo); 2478 glDeleteTextures(2, texture); 2479 }); 2480 2481 // glCompressedTexImage3D 2482 2483 ES3F_ADD_API_CASE(compressedteximage3d, "Invalid glCompressedTexImage3D() usage", 2484 { 2485 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 2486 glCompressedTexImage3D(0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0); 2487 expectError(GL_INVALID_ENUM); 2488 glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0); 2489 expectError(GL_INVALID_ENUM); 2490 m_log << TestLog::EndSection; 2491 2492 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if internalformat is not one of the specific compressed internal formats."); 2493 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 0, 0); 2494 expectError(GL_INVALID_ENUM); 2495 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 0, 0, 0, 0, 0, 0); 2496 expectError(GL_INVALID_ENUM); 2497 m_log << TestLog::EndSection; 2498 }); 2499 ES3F_ADD_API_CASE(compressedteximage3d_neg_level, "Invalid glCompressedTexImage3D() usage", 2500 { 2501 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 2502 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0); 2503 expectError(GL_INVALID_VALUE); 2504 m_log << TestLog::EndSection; 2505 }); 2506 ES3F_ADD_API_CASE(compressedteximage3d_max_level, "Invalid glCompressedTexImage3D() usage", 2507 { 2508 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 2509 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 2510 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0); 2511 expectError(GL_INVALID_VALUE); 2512 m_log << TestLog::EndSection; 2513 }); 2514 ES3F_ADD_API_CASE(compressedteximage3d_neg_width_height_depth, "Invalid glCompressedTexImage3D() usage", 2515 { 2516 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width, height or depth is less than 0."); 2517 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0, 0); 2518 expectError(GL_INVALID_VALUE); 2519 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0, 0); 2520 expectError(GL_INVALID_VALUE); 2521 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0, 0); 2522 expectError(GL_INVALID_VALUE); 2523 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, -1, 0, 0, 0); 2524 expectError(GL_INVALID_VALUE); 2525 m_log << TestLog::EndSection; 2526 }); 2527 ES3F_ADD_API_CASE(compressedteximage3d_max_width_height_depth, "Invalid glCompressedTexImage3D() usage", 2528 { 2529 int maxTextureSize = m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE) + 1; 2530 2531 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_TEXTURE_SIZE."); 2532 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 0, 0, 0, 0, 0); 2533 expectError(GL_INVALID_VALUE); 2534 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, maxTextureSize, 0, 0, 0, 0); 2535 expectError(GL_INVALID_VALUE); 2536 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, maxTextureSize, 0, 0, 0); 2537 expectError(GL_INVALID_VALUE); 2538 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, maxTextureSize, 0, 0, 0); 2539 expectError(GL_INVALID_VALUE); 2540 m_log << TestLog::EndSection; 2541 }); 2542 ES3F_ADD_API_CASE(compressedteximage3d_invalid_border, "Invalid glCompressedTexImage3D() usage", 2543 { 2544 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if border is not 0."); 2545 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, -1, 0, 0); 2546 expectError(GL_INVALID_VALUE); 2547 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 1, 0, 0); 2548 expectError(GL_INVALID_VALUE); 2549 m_log << TestLog::EndSection; 2550 }); 2551 ES3F_ADD_API_CASE(compressedteximage3d_invalid_size, "Invalid glCompressedTexImage3D() usage", 2552 { 2553 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."); 2554 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, -1, 0); 2555 expectError(GL_INVALID_VALUE); 2556 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, 4*4*8, 0); 2557 expectError(GL_INVALID_VALUE); 2558 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 1, 0, 4*4*16, 0); 2559 expectError(GL_INVALID_VALUE); 2560 glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_SIGNED_R11_EAC, 16, 16, 1, 0, 4*4*16, 0); 2561 expectError(GL_INVALID_VALUE); 2562 m_log << TestLog::EndSection; 2563 }); 2564 ES3F_ADD_API_CASE(compressedteximage3d_invalid_buffer_target, "Invalid glCompressedTexImage3D() usage", 2565 { 2566 deUint32 buf; 2567 std::vector<GLubyte> data(512); 2568 2569 glGenBuffers (1, &buf); 2570 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 2571 glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY); 2572 expectError (GL_NO_ERROR); 2573 2574 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and the buffer object's data store is currently mapped."); 2575 glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 64, GL_MAP_WRITE_BIT); 2576 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 4, 4, 1, 0, etc2DataSize(4, 4), 0); 2577 expectError (GL_INVALID_OPERATION); 2578 glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 2579 m_log << TestLog::EndSection; 2580 2581 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 2582 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 1, 0, etc2DataSize(16, 16), 0); 2583 expectError (GL_INVALID_OPERATION); 2584 m_log << TestLog::EndSection; 2585 2586 glDeleteBuffers (1, &buf); 2587 }); 2588 2589 // glCompressedTexSubImage3D 2590 2591 ES3F_ADD_API_CASE(compressedtexsubimage3d, "Invalid glCompressedTexSubImage3D() usage", 2592 { 2593 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is invalid."); 2594 glCompressedTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2595 expectError(GL_INVALID_ENUM); 2596 m_log << TestLog::EndSection; 2597 2598 deUint32 texture; 2599 glGenTextures (1, &texture); 2600 glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 2601 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 1, 0, etc2EacDataSize(18, 18), 0); 2602 expectError (GL_NO_ERROR); 2603 2604 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified."); 2605 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0); 2606 expectError(GL_INVALID_OPERATION); 2607 m_log << TestLog::EndSection; 2608 2609 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if internalformat is an ETC2/EAC format and target is not GL_TEXTURE_2D_ARRAY."); 2610 glCompressedTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 18, 18, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(18, 18), 0); 2611 expectError(GL_INVALID_OPERATION); 2612 m_log << TestLog::EndSection; 2613 2614 m_log << TestLog::Section("", "For ETC2/EAC images GL_INVALID_OPERATION is generated if width is not a multiple of four, and width + xoffset is not equal to the width of the texture level."); 2615 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 4, 0, 0, 10, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(10, 4), 0); 2616 expectError(GL_INVALID_OPERATION); 2617 m_log << TestLog::EndSection; 2618 2619 m_log << TestLog::Section("", "For ETC2/EAC images GL_INVALID_OPERATION is generated if height is not a multiple of four, and height + yoffset is not equal to the height of the texture level."); 2620 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 4, 0, 4, 10, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 10), 0); 2621 expectError(GL_INVALID_OPERATION); 2622 m_log << TestLog::EndSection; 2623 2624 m_log << TestLog::Section("", "For ETC2/EAC images GL_INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four."); 2625 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 1, 0, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 2626 expectError(GL_INVALID_OPERATION); 2627 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 1, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 2628 expectError(GL_INVALID_OPERATION); 2629 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 1, 1, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 2630 expectError(GL_INVALID_OPERATION); 2631 m_log << TestLog::EndSection; 2632 2633 glDeleteTextures (1, &texture); 2634 }); 2635 ES3F_ADD_API_CASE(compressedtexsubimage3d_neg_level, "Invalid glCompressedTexSubImage3D() usage", 2636 { 2637 deUint32 texture; 2638 glGenTextures (1, &texture); 2639 glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 2640 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 2641 expectError (GL_NO_ERROR); 2642 2643 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is less than 0."); 2644 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2645 expectError(GL_INVALID_VALUE); 2646 m_log << TestLog::EndSection; 2647 2648 glDeleteTextures (1, &texture); 2649 }); 2650 ES3F_ADD_API_CASE(compressedtexsubimage3d_max_level, "Invalid glCompressedTexSubImage3D() usage", 2651 { 2652 deUint32 texture; 2653 glGenTextures (1, &texture); 2654 glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 2655 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 2656 expectError (GL_NO_ERROR); 2657 2658 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 2659 deUint32 log2MaxTextureSize = deLog2Floor32(m_context.getContextInfo().getInt(GL_MAX_TEXTURE_SIZE)) + 1; 2660 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2661 expectError(GL_INVALID_VALUE); 2662 m_log << TestLog::EndSection; 2663 2664 glDeleteTextures (1, &texture); 2665 }); 2666 ES3F_ADD_API_CASE(compressedtexsubimage3d_neg_offset, "Invalid glCompressedTexSubImage3D() usage", 2667 { 2668 deUint32 texture; 2669 glGenTextures (1, &texture); 2670 glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 2671 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 2672 expectError (GL_NO_ERROR); 2673 2674 m_log << TestLog::Section("", "GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset, yoffset or zoffset are negative."); 2675 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -4, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2676 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2677 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, -4, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2678 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2679 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2680 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2681 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -4, -4, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2682 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2683 m_log << TestLog::EndSection; 2684 2685 glDeleteTextures (1, &texture); 2686 }); 2687 ES3F_ADD_API_CASE(compressedtexsubimage3d_invalid_offset, "Invalid glCompressedTexSubImage3D() usage", 2688 { 2689 deUint32 texture; 2690 glGenTextures (1, &texture); 2691 glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 2692 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 1, 0, etc2EacDataSize(4, 4), 0); 2693 expectError (GL_NO_ERROR); 2694 2695 m_log << TestLog::Section("", "GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height."); 2696 2697 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 12, 0, 0, 8, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 4), 0); 2698 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2699 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 12, 0, 4, 8, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 8), 0); 2700 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2701 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 12, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 2702 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2703 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 12, 12, 12, 8, 8, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 8), 0); 2704 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2705 m_log << TestLog::EndSection; 2706 2707 glDeleteTextures (1, &texture); 2708 }); 2709 ES3F_ADD_API_CASE(compressedtexsubimage3d_neg_width_height_depth, "Invalid glCompressedTexSubImage3D() usage", 2710 { 2711 deUint32 texture; 2712 glGenTextures (1, &texture); 2713 glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 2714 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 2715 expectError (GL_NO_ERROR); 2716 2717 m_log << TestLog::Section("", "GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if width, height or depth are negative."); 2718 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2719 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2720 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, -4, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2721 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2722 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2723 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2724 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, -4, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 2725 expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 2726 m_log << TestLog::EndSection; 2727 2728 glDeleteTextures (1, &texture); 2729 }); 2730 ES3F_ADD_API_CASE(compressedtexsubimage3d_invalid_size, "Invalid glCompressedTexSubImage3D() usage", 2731 { 2732 deUint32 texture; 2733 glGenTextures (1, &texture); 2734 glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 2735 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, 4*4*16, 0); 2736 expectError (GL_NO_ERROR); 2737 2738 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."); 2739 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0); 2740 expectError(GL_INVALID_VALUE); 2741 2742 glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, 4*4*16-1, 0); 2743 expectError(GL_INVALID_VALUE); 2744 m_log << TestLog::EndSection; 2745 2746 glDeleteTextures (1, &texture); 2747 }); 2748 ES3F_ADD_API_CASE(compressedtexsubimage3d_invalid_buffer_target, "Invalid glCompressedTexSubImage3D() usage", 2749 { 2750 deUint32 buf; 2751 deUint32 texture; 2752 std::vector<GLubyte> data(512); 2753 2754 glGenTextures (1, &texture); 2755 glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 2756 glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 2757 glGenBuffers (1, &buf); 2758 glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 2759 glBufferData (GL_PIXEL_UNPACK_BUFFER, 512, &data[0], GL_DYNAMIC_COPY); 2760 expectError (GL_NO_ERROR); 2761 2762 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 2763 m_log << TestLog::Section("", "...the buffer object's data store is currently mapped."); 2764 glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 512, GL_MAP_WRITE_BIT); 2765 glCompressedTexSubImage3D (GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 2766 expectError (GL_INVALID_OPERATION); 2767 glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 2768 m_log << TestLog::EndSection; 2769 2770 m_log << TestLog::Section("", "...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 2771 glCompressedTexSubImage3D (GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 32, 32, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(32, 32), 0); 2772 expectError (GL_INVALID_OPERATION); 2773 m_log << TestLog::EndSection; 2774 m_log << TestLog::EndSection; 2775 2776 glDeleteBuffers (1, &buf); 2777 glDeleteTextures (1, &texture); 2778 }); 2779 2780 // glTexStorage2D 2781 2782 ES3F_ADD_API_CASE(texstorage2d, "Invalid glTexStorage2D() usage", 2783 { 2784 deUint32 texture; 2785 glGenTextures (1, &texture); 2786 glBindTexture (GL_TEXTURE_2D, texture); 2787 2788 m_log << TestLog::Section("", "GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not a valid sized internal format."); 2789 glTexStorage2D (GL_TEXTURE_2D, 1, 0, 16, 16); 2790 expectError (GL_INVALID_ENUM, GL_INVALID_VALUE); 2791 glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA_INTEGER, 16, 16); 2792 expectError (GL_INVALID_ENUM, GL_INVALID_VALUE); 2793 m_log << TestLog::EndSection; 2794 2795 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not one of the accepted target enumerants."); 2796 glTexStorage2D (0, 1, GL_RGBA8, 16, 16); 2797 expectError (GL_INVALID_ENUM); 2798 glTexStorage2D (GL_TEXTURE_3D, 1, GL_RGBA8, 16, 16); 2799 expectError (GL_INVALID_ENUM); 2800 glTexStorage2D (GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 16, 16); 2801 expectError (GL_INVALID_ENUM); 2802 m_log << TestLog::EndSection; 2803 2804 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width or height are less than 1."); 2805 glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 0, 16); 2806 expectError (GL_INVALID_VALUE); 2807 glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 0); 2808 expectError (GL_INVALID_VALUE); 2809 glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 0, 0); 2810 expectError (GL_INVALID_VALUE); 2811 m_log << TestLog::EndSection; 2812 2813 glDeleteTextures(1, &texture); 2814 }); 2815 2816 ES3F_ADD_API_CASE(texstorage2d_invalid_binding, "Invalid glTexStorage2D() usage", 2817 { 2818 glBindTexture (GL_TEXTURE_2D, 0); 2819 2820 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the default texture object is curently bound to target."); 2821 glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); 2822 expectError (GL_INVALID_OPERATION); 2823 m_log << TestLog::EndSection; 2824 2825 deUint32 texture; 2826 glGenTextures (1, &texture); 2827 glBindTexture (GL_TEXTURE_2D, texture); 2828 2829 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the texture object currently bound to target already has GL_TEXTURE_IMMUTABLE_FORMAT set to GL_TRUE."); 2830 deInt32 immutable; 2831 glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); 2832 m_log << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 2833 glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); 2834 expectError (GL_NO_ERROR); 2835 glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); 2836 m_log << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 2837 glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); 2838 expectError (GL_INVALID_OPERATION); 2839 m_log << TestLog::EndSection; 2840 2841 glDeleteTextures(1, &texture); 2842 }); 2843 ES3F_ADD_API_CASE(texstorage2d_invalid_levels, "Invalid glTexStorage2D() usage", 2844 { 2845 deUint32 texture; 2846 glGenTextures (1, &texture); 2847 glBindTexture (GL_TEXTURE_2D, texture); 2848 2849 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if levels is less than 1."); 2850 glTexStorage2D (GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16); 2851 expectError (GL_INVALID_VALUE); 2852 glTexStorage2D (GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0); 2853 expectError (GL_INVALID_VALUE); 2854 m_log << TestLog::EndSection; 2855 2856 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if levels is greater than floor(log_2(max(width, height))) + 1"); 2857 deUint32 log2MaxSize = deLog2Floor32(deMax32(16, 4)) + 1 + 1; 2858 glTexStorage2D (GL_TEXTURE_2D, log2MaxSize, GL_RGBA8, 16, 4); 2859 expectError (GL_INVALID_OPERATION); 2860 glTexStorage2D (GL_TEXTURE_2D, log2MaxSize, GL_RGBA8, 4, 16); 2861 expectError (GL_INVALID_OPERATION); 2862 glTexStorage2D (GL_TEXTURE_2D, log2MaxSize, GL_RGBA8, 16, 16); 2863 expectError (GL_INVALID_OPERATION); 2864 m_log << TestLog::EndSection; 2865 2866 glDeleteTextures(1, &texture); 2867 }); 2868 2869 // glTexStorage3D 2870 2871 ES3F_ADD_API_CASE(texstorage3d, "Invalid glTexStorage3D() usage", 2872 { 2873 deUint32 texture; 2874 glGenTextures (1, &texture); 2875 glBindTexture (GL_TEXTURE_3D, texture); 2876 2877 m_log << TestLog::Section("", "GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not a valid sized internal format."); 2878 glTexStorage3D (GL_TEXTURE_3D, 1, 0, 4, 4, 4); 2879 expectError (GL_INVALID_ENUM, GL_INVALID_VALUE); 2880 glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA_INTEGER, 4, 4, 4); 2881 expectError (GL_INVALID_ENUM, GL_INVALID_VALUE); 2882 m_log << TestLog::EndSection; 2883 2884 m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not one of the accepted target enumerants."); 2885 glTexStorage3D (0, 1, GL_RGBA8, 4, 4, 4); 2886 expectError (GL_INVALID_ENUM); 2887 glTexStorage3D (GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 4, 4, 4); 2888 expectError (GL_INVALID_ENUM); 2889 glTexStorage3D (GL_TEXTURE_2D, 1, GL_RGBA8, 4, 4, 4); 2890 expectError (GL_INVALID_ENUM); 2891 m_log << TestLog::EndSection; 2892 2893 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width, height or depth are less than 1."); 2894 glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 0, 4, 4); 2895 expectError (GL_INVALID_VALUE); 2896 glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 0, 4); 2897 expectError (GL_INVALID_VALUE); 2898 glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 0); 2899 expectError (GL_INVALID_VALUE); 2900 glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 0, 0, 0); 2901 expectError (GL_INVALID_VALUE); 2902 m_log << TestLog::EndSection; 2903 2904 glDeleteTextures(1, &texture); 2905 }); 2906 ES3F_ADD_API_CASE(texstorage3d_invalid_binding, "Invalid glTexStorage3D() usage", 2907 { 2908 glBindTexture (GL_TEXTURE_3D, 0); 2909 2910 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the default texture object is curently bound to target."); 2911 glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); 2912 expectError (GL_INVALID_OPERATION); 2913 m_log << TestLog::EndSection; 2914 2915 deUint32 texture; 2916 glGenTextures (1, &texture); 2917 glBindTexture (GL_TEXTURE_3D, texture); 2918 2919 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the texture object currently bound to target already has GL_TEXTURE_IMMUTABLE_FORMAT set to GL_TRUE."); 2920 deInt32 immutable; 2921 glGetTexParameteriv(GL_TEXTURE_3D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); 2922 m_log << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 2923 glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); 2924 expectError (GL_NO_ERROR); 2925 glGetTexParameteriv(GL_TEXTURE_3D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); 2926 m_log << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 2927 glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); 2928 expectError (GL_INVALID_OPERATION); 2929 m_log << TestLog::EndSection; 2930 2931 glDeleteTextures(1, &texture); 2932 }); 2933 ES3F_ADD_API_CASE(texstorage3d_invalid_levels, "Invalid glTexStorage3D() usage", 2934 { 2935 deUint32 texture; 2936 glGenTextures (1, &texture); 2937 glBindTexture (GL_TEXTURE_3D, texture); 2938 2939 m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if levels is less than 1."); 2940 glTexStorage3D (GL_TEXTURE_3D, 0, GL_RGBA8, 4, 4, 4); 2941 expectError (GL_INVALID_VALUE); 2942 glTexStorage3D (GL_TEXTURE_3D, 0, GL_RGBA8, 0, 0, 0); 2943 expectError (GL_INVALID_VALUE); 2944 m_log << TestLog::EndSection; 2945 2946 m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if levels is greater than floor(log_2(max(width, height, depth))) + 1"); 2947 deUint32 log2MaxSize = deLog2Floor32(8) + 1 + 1; 2948 glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 8, 2, 2); 2949 expectError (GL_INVALID_OPERATION); 2950 glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 2, 8, 2); 2951 expectError (GL_INVALID_OPERATION); 2952 glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 2, 2, 8); 2953 expectError (GL_INVALID_OPERATION); 2954 glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 8, 8, 8); 2955 expectError (GL_INVALID_OPERATION); 2956 m_log << TestLog::EndSection; 2957 2958 glDeleteTextures(1, &texture); 2959 }); 2960} 2961 2962} // Functional 2963} // gles3 2964} // deqp 2965