es31fNegativeTextureApiTests.cpp revision 971d41d7125e65b9020d562ec2aeec57ce6b3924
13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.1 Module 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Negative Texture API tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es31fNegativeTextureApiTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es31fNegativeTestShared.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluCallLogWrapper.hpp" 289ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi#include "gluContextInfo.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwDefs.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles31 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace NegativeTestShared 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog; 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing glu::CallLogWrapper; 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace glw; 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic inline int divRoundUp (int a, int b) 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return a/b + (a%b != 0 ? 1 : 0); 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic inline int etc2DataSize (int width, int height) 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return (int)(divRoundUp(width, 4) * divRoundUp(height, 4) * sizeof(deUint64)); 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic inline int etc2EacDataSize (int width, int height) 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return 2 * etc2DataSize(width, height); 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic deUint32 cubeFaceToGLFace (tcu::CubeFace face) 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (face) 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case tcu::CUBEFACE_NEGATIVE_X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X; 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case tcu::CUBEFACE_POSITIVE_X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X; 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case tcu::CUBEFACE_NEGATIVE_Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case tcu::CUBEFACE_POSITIVE_Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y; 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case tcu::CUBEFACE_NEGATIVE_Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case tcu::CUBEFACE_POSITIVE_Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(DE_FALSE); 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return GL_NONE; 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define FOR_CUBE_FACES(FACE_GL_VAR, BODY) \ 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry do \ 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { \ 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int faceIterTcu = 0; faceIterTcu < tcu::CUBEFACE_LAST; faceIterTcu++) \ 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { \ 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum FACE_GL_VAR = cubeFaceToGLFace((tcu::CubeFace)faceIterTcu); \ 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BODY \ 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } \ 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } while (false) 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glActiveTexture 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid activetexture (NegativeTestContext& ctx) 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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)."); 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glActiveTexture(-1); 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int numMaxTextureUnits = ctx.getInteger(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS); 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glActiveTexture(GL_TEXTURE0 + numMaxTextureUnits); 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glBindTexture 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid bindtexture (NegativeTestContext& ctx) 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture[2]; 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(2, texture); 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the allowable values."); 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(0, 1); 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_FRAMEBUFFER, 1); 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if texture was previously created with a target that doesn't match that of target."); 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture[0]); 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]); 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_3D, texture[0]); 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, texture[0]); 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[1]); 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture[1]); 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_3D, texture[1]); 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, texture[1]); 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, texture); 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glCompressedTexImage2D 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_invalid_target (NegativeTestContext& ctx) 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_invalid_format (NegativeTestContext& ctx) 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS."); 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0); 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 0, 0, 0); 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 0, 0, 0, 0, 0); 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0); 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0); 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0); 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0); 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0); 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0); 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_neg_level (NegativeTestContext& ctx) 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_max_level (NegativeTestContext& ctx) 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE) for a 2d texture target."); 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_COMPRESSED_RGB8_ETC2, 16, 16, 0, etc2DataSize(16, 16), 0); 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE) for a cubemap target."); 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_neg_width_height (NegativeTestContext& ctx) 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0."); 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_2D target"); 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0); 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0); 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0); 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_max_width_height (NegativeTestContext& ctx) 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1; 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int maxCubemapSize = ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1; 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE."); 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_2D target"); 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 1, 0, etc2EacDataSize(maxTextureSize, 1), 0); 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxTextureSize, 0, etc2EacDataSize(1, maxTextureSize), 0); 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, 0, etc2EacDataSize(maxTextureSize, maxTextureSize), 0); 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0); 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0); 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0); 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_invalid_border (NegativeTestContext& ctx) 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0."); 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_2D target"); 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); 4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_invalid_size (NegativeTestContext& ctx) 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data."); 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, -1, 0); 4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, 4*4*8, 0); 4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 0, 4*4*16, 0); 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SIGNED_R11_EAC, 16, 16, 0, 4*4*16, 0); 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage2d_invalid_buffer_target (NegativeTestContext& ctx) 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 buf = 1234; 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLubyte> data(64); 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers (1, &buf); 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY); 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT); 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 4, 4, 0, etc2DataSize(4, 4), 0); 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 0, etc2DataSize(16, 16), 0); 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers (1, &buf); 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glCopyTexImage2D 4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_invalid_target (NegativeTestContext& ctx) 4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(0, 0, GL_RGB, 0, 0, 64, 64, 0); 4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_invalid_format (NegativeTestContext& ctx) 4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not an accepted format."); 4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 64, 64, 0); 4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 16, 16, 0); 4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 16, 16, 0); 4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 16, 16, 0); 4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 16, 16, 0); 4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 16, 16, 0); 4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 16, 16, 0); 4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE); 4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_inequal_width_height_cube (NegativeTestContext& ctx) 4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0); 4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0); 4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0); 4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0); 4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0); 4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0); 5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_neg_level (NegativeTestContext& ctx) 5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 0, 0, 64, 64, 0); 5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0); 5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0); 5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0); 5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0); 5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0); 5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0); 5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_max_level (NegativeTestContext& ctx) 5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 0, 0, 64, 64, 0); 5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE)."); 5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0); 5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_neg_width_height (NegativeTestContext& ctx) 5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0."); 5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_2D target"); 5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, 1, 0); 5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, -1, 0); 5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, -1, 0); 5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, 1, 0); 5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, -1, 0); 5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0); 5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, 1, 0); 5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, -1, 0); 5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0); 5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, 1, 0); 5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, -1, 0); 5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0); 5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, 1, 0); 5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, -1, 0); 5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0); 5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, 1, 0); 6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, -1, 0); 6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0); 6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, 1, 0); 6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, -1, 0); 6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0); 6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_max_width_height (NegativeTestContext& ctx) 6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1; 6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int maxCubemapSize = ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1; 6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE."); 6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_2D target"); 6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0); 6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0); 6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0); 6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0); 6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0); 6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0); 6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_invalid_border (NegativeTestContext& ctx) 6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0."); 6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_2D target"); 6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 0, 0, -1); 6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 0, 0, 1); 7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, 0, -1); 7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, 0, 1); 7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 0, 0, -1); 7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 0, 0, 1); 7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_2D target"); 7183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 0, 0, -1); 7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 0, 0, 1); 7213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 0, 0, -1); 7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 0, 0, 1); 7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 7323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 0, 0, -1); 7333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 0, 0, 1); 7353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 0, 0, -1); 7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 0, 0, 1); 7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copyteximage2d_incomplete_framebuffer (NegativeTestContext& ctx) 7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint fbo = 0x1234; 7513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenFramebuffers (1, &fbo); 7523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer (GL_FRAMEBUFFER, fbo); 7533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER); 7543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete."); 7563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, 0, 0, 0); 7573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA8, 0, 0, 0, 0, 0); 7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA8, 0, 0, 0, 0, 0); 7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA8, 0, 0, 0, 0, 0); 7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA8, 0, 0, 0, 0, 0); 7653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 7663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA8, 0, 0, 0, 0, 0); 7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 7683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA8, 0, 0, 0, 0, 0); 7693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer (GL_FRAMEBUFFER, 0); 7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteFramebuffers(1, &fbo); 7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage2d_invalid_target (NegativeTestContext& ctx) 7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 7803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 7813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 7843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(0, 0, 0, 0, 0, 0, 4, 4); 7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 7863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage2d_neg_level (NegativeTestContext& ctx) 7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textures[2]; 7943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 7953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, textures[0]); 7963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 7973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 7983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, ctx.glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);); 7993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 8013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, 4, 4); 8023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, 8043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(faceGL, -1, 0, 0, 0, 0, 4, 4); 8063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }); 8083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, &textures[0]); 8113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8133c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage2d_max_level (NegativeTestContext& ctx) 8143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textures[2]; 8163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 8173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, textures[0]); 8183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 8193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 8203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, ctx.glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);); 8213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE) for 2D texture targets."); 8233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 8243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, 4, 4); 8253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_SIZE) for cubemap targets."); 8293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 8303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, 8313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, 4, 4); 8333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }); 8353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, &textures[0]); 8383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage2d_neg_offset (NegativeTestContext& ctx) 8413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 8433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 8443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 8453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 8463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if xoffset < 0 or yoffset < 0."); 8483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, 4, 4); 8493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, 4, 4); 8513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, 4, 4); 8533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 8573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage2d_invalid_offset (NegativeTestContext& ctx) 8603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 8623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 8633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 8643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 8653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height."); 8673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 14, 0, 0, 0, 4, 4); 8683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 14, 0, 0, 4, 4); 8703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 14, 14, 0, 0, 4, 4); 8723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 8763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8783c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage2d_neg_width_height (NegativeTestContext& ctx) 8793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 8813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 8823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 8833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 8843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0."); 8863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, 0); 8873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, -1); 8893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, -1); 8913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 8923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 8953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage2d_incomplete_framebuffer (NegativeTestContext& ctx) 8983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete."); 9003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture[2]; 9023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint fbo = 0x1234; 9033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, texture); 9053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture[0]); 9063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 9073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, texture[1]); 9083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 9093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 9103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 9113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 9123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 9133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 9143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 9153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenFramebuffers(1, &fbo); 9173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo); 9183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER); 9193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 9203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0); 9223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 9233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0); 9243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 9253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0); 9263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 9273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0); 9283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 9293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0); 9303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 9313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0); 9323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 9333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0); 9343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 9353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0); 9373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteFramebuffers(1, &fbo); 9383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, texture); 9393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glDeleteTextures 9443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid deletetextures (NegativeTestContext& ctx) 9463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 9483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(1, &texture); 9493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if n is negative."); 9513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(-1, 0); 9523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 9533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture); 9553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(-1, 0); 9563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 9573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 9603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glGenerateMipmap 9633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid generatemipmap (NegativeTestContext& ctx) 9653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture[2]; 9673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(2, texture); 9683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP."); 9703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenerateMipmap(0); 9713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 9723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("INVALID_OPERATION is generated if the texture bound to target is not cube complete."); 9753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]); 9763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_REPEAT); 9773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 9783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenerateMipmap(GL_TEXTURE_CUBE_MAP); 9793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 9803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]); 9823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 9833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 9843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 9853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 9863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 9873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 9883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenerateMipmap(GL_TEXTURE_CUBE_MAP); 9893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 9903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format."); 9933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture[1]); 9943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); 9953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenerateMipmap(GL_TEXTURE_2D); 9963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 9973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 10003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8_SNORM, 0, 0, 0, GL_RGB, GL_BYTE, 0); 10013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenerateMipmap(GL_TEXTURE_2D); 10023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 10033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_R8I, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, 0); 10043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenerateMipmap(GL_TEXTURE_2D); 10053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 10069ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi 10079ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi if (!(ctx.getContextInfo().isExtensionSupported("GL_EXT_color_buffer_float") && ctx.getContextInfo().isExtensionSupported("GL_OES_texture_float_linear"))) 10089ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi { 10099ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 0, 0, 0, GL_RGBA, GL_FLOAT, 0); 10109ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi ctx.glGenerateMipmap(GL_TEXTURE_2D); 10119ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi ctx.expectError(GL_INVALID_OPERATION); 10129ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi } 10139ffcdca48772cb951540a7ce02b11a42a2b35c3bMika Isojärvi 10143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, texture); 10173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glGenTextures 10203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid gentextures (NegativeTestContext& ctx) 10223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if n is negative."); 10243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(-1, 0); 10253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glPixelStorei 10303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid pixelstorei (NegativeTestContext& ctx) 10323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 10343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(0,1); 10353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 10363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 10393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_PACK_ROW_LENGTH, -1); 10403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_PACK_SKIP_ROWS, -1); 10423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_PACK_SKIP_PIXELS, -1); 10443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_UNPACK_ROW_LENGTH, -1); 10463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, -1); 10483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_UNPACK_SKIP_ROWS, -1); 10503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_UNPACK_SKIP_PIXELS, -1); 10523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_UNPACK_SKIP_IMAGES, -1); 10543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_PACK_ALIGNMENT, 0); 10563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_UNPACK_ALIGNMENT, 0); 10583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_PACK_ALIGNMENT, 16); 10603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glPixelStorei(GL_UNPACK_ALIGNMENT, 16); 10623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexImage2D 10673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage2d (NegativeTestContext& ctx) 10693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 10713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(0, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 10723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 10733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if type is not a type constant."); 10763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, 0, 0); 10773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 10783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid."); 10813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 10823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 10833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); 10843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 10853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5_A1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 10863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 10873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB10_A2, 1, 1, 0, GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV, 0); 10883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 10893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0); 10903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 10913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10943c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage2d_inequal_width_height_cube (NegativeTestContext& ctx) 10953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 10973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 10983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 10993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 11113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11123c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage2d_neg_level (NegativeTestContext& ctx) 11133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 11143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 11153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 11203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 11343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage2d_max_level (NegativeTestContext& ctx) 11363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 11373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 11383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 11393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE)."); 11443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 11453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 11593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11603c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage2d_neg_width_height (NegativeTestContext& ctx) 11613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 11623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0."); 11633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_2D target"); 11653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 11743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 11833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 11923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 11973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 11983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 11993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 12013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 12103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 12193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 12293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12303c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage2d_max_width_height (NegativeTestContext& ctx) 12313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 12323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1; 12333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int maxCubemapSize = ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1; 12343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE."); 12363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE."); 12453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); 12473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); 12563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); 12653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); 12743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); 12833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 12913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); 12923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 12973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 12983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 12993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 13023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage2d_invalid_border (NegativeTestContext& ctx) 13043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 13053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0."); 13063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 13073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 13083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0); 13093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 13103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 13113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 13123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 13133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 13143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 13153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 13163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 13173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 13183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 13193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 13203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0); 13213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 13223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 13243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13253c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage2d_invalid_buffer_target (NegativeTestContext& ctx) 13263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 13273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 buf = 0x1234; 13283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 13293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLubyte> data(64); 13303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers (1, &buf); 13323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 13333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY); 13343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 13353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 13363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 13373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 13393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the buffer object's data store is currently mapped."); 13403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT); 13413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 13423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 13433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 13443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 13473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 13483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 13493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type."); 13523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage; 13533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB5_A1, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (const GLvoid*)3); 13543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 13553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers (1, &buf); 13593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 13603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 13613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexSubImage2D 13633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage2d (NegativeTestContext& ctx) 13653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 13663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 13673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 13683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 13693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 13703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 13713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 13733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(0, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 13743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 13753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if format is not an accepted format constant."); 13783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 4, 4, GL_UNSIGNED_BYTE, 0); 13793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 13803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if type is not a type constant."); 13833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, 0, 0); 13843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 13853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 13863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 13873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid."); 13883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, 0); 13893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 13903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); 13913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 13923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 13933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 13943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 13953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 13963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0); 13973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 13983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_FLOAT, 0); 13993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 14003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 14013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 14033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 14043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14053c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage2d_neg_level (NegativeTestContext& ctx) 14063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 14073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 14083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 14093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, textures[0]); 14103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, textures[1]); 14123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, ctx.glTexImage2D(faceGL, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);); 14133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 14143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 14163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 14193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 14213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, 14223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 14233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(faceGL, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }); 14263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 14273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, &textures[0]); 14293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 14303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage2d_max_level (NegativeTestContext& ctx) 14323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 14333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 14343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 14353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, textures[0]); 14363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 14383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, ctx.glTexImage2D(faceGL, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);); 14393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 14403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 14423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 14433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 14463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE)."); 14483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 14493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, 14503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 14513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }); 14543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 14553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, &textures[0]); 14573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 14583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage2d_neg_offset (NegativeTestContext& ctx) 14603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 14613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 14623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(1, &texture); 14633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture); 14643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 14663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if xoffset or yoffset are negative."); 14683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 14733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 14753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 14773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 14783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14793c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage2d_invalid_offset (NegativeTestContext& ctx) 14803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 14813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 14823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 14833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 14843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 14853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 14863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height."); 14883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 30, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 14893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 30, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 14913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 30, 30, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 14933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 14943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 14953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 14973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 14983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 14993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage2d_neg_width_height (NegativeTestContext& ctx) 15003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 15013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 15023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 15033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 15043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 15053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 15063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0."); 15083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 15093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 15103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); 15113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 15123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); 15133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 15143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 15153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 15173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 15183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage2d_invalid_buffer_target (NegativeTestContext& ctx) 15203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 15213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 buf = 0x1234; 15223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 15233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLubyte> data(64); 15243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 15263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 15273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 15283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers (1, &buf); 15293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 15303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY); 15313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 15323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 15343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the buffer object's data store is currently mapped."); 15353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT); 15363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 15373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 15383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 15393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 15403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 15423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 32, 32, GL_RGBA, GL_UNSIGNED_BYTE, 0); 15433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 15443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 15453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type."); 15473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage; 15483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0); 15493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 0); 15503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 15513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 15523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (const GLvoid*)3); 15533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 15543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 15553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 15563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers (1, &buf); 15583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 15593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 15603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexParameteri 15623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15633c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texparameteri (NegativeTestContext& ctx) 15643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 15653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 15663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 15673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR); 15693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(0, 0, GL_LINEAR); 15713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 15733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not."); 15753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0); 15763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT); 15783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0); 15803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST); 15823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 15843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 15863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(1, &texture); 15873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture); 15883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 15903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 15913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR); 15933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(0, 0, GL_LINEAR); 15953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 15963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 15973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 15983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not."); 15993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0); 16003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT); 16023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0); 16043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST); 16063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 16083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 16103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 16113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexParameterf 16133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16143c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texparameterf (NegativeTestContext& ctx) 16153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 16163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 16173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 16183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR); 16203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(0, 0, GL_LINEAR); 16223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 16243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not."); 16263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0); 16273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT); 16293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0); 16313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST); 16333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 16353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 16373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(1, &texture); 16383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture); 16393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 16413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 16423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR); 16443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(0, 0, GL_LINEAR); 16463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 16483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not."); 16503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 0); 16513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_REPEAT); 16533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 0); 16553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_NEAREST); 16573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 16593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 16613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 16623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexParameteriv 16643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texparameteriv (NegativeTestContext& ctx) 16663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 16673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 16683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params[1] = {GL_LINEAR}; 16693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 16703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, 0, ¶ms[0]); 16723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(0, 0, ¶ms[0]); 16743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 16763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not."); 16783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = 0; 16793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 16803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_REPEAT; 16823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 16833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = 0; 16853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]); 16863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_NEAREST; 16883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]); 16893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 16903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 16913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 16933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(1, &texture); 16943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture); 16953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 16963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 16973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_LINEAR; 16983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 16993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, 0, ¶ms[0]); 17013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(0, 0, ¶ms[0]); 17033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 17053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not."); 17073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = 0; 17083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 17093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_REPEAT; 17113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 17123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = 0; 17143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]); 17153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_NEAREST; 17173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]); 17183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 17203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 17223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 17233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexParameterfv 17253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texparameterfv (NegativeTestContext& ctx) 17273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 17283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 17293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLfloat params[1] = {GL_LINEAR}; 17303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 17313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, 0, ¶ms[0]); 17333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(0, 0, ¶ms[0]); 17353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 17373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not."); 17393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = 0.0f; 17403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 17413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_REPEAT; 17433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 17443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = 0.0f; 17463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]); 17473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_NEAREST; 17493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]); 17503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 17523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 17543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(1, &texture); 17553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture); 17563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values."); 17583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_LINEAR; 17593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 17603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, 0, ¶ms[0]); 17623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(0, 0, ¶ms[0]); 17643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 17663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not."); 17683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = 0.0f; 17693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 17703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_REPEAT; 17723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]); 17733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = 0.0f; 17753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]); 17763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params[0] = GL_NEAREST; 17783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]); 17793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 17813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 17833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 17843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glCompressedTexSubImage2D 17863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17873c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage2d (NegativeTestContext& ctx) 17883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 17893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 17903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0); 17913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 17923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 17933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 17943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 17953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 17963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 17973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0); 17983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 17993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified."); 18013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0); 18023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 18033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 18043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 18063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 4, 0, 10, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(10, 4), 0); 18073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 18083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 18093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 18113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 4, 4, 10, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 10), 0); 18123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 18133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 18143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("For ETC2/EAC images GL_INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four."); 18163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 1, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 18173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 18183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 1, 0, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 18193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 18203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 18213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 18223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 18233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 18253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 18263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18273c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage2d_neg_level (NegativeTestContext& ctx) 18283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 18293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 18303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 18313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, textures[0]); 18323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0); 18333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 18343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, ctx.glCompressedTexImage2D(faceGL, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0);); 18353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 18363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 18383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 18393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 18403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 18413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 18433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, 18443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(faceGL, -1, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 18463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 18473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }); 18483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 18493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, &textures[0]); 18513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 18523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage2d_max_level (NegativeTestContext& ctx) 18543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 18553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 18563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 18573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, textures[0]); 18583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0); 18593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]); 18603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, ctx.glCompressedTexImage2D(faceGL, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0);); 18613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 18623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 18643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 18653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 18663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 18673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 18683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE)."); 18703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1; 18713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_CUBE_FACES(faceGL, 18723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 18733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 18743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 18753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }); 18763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 18773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, &textures[0]); 18793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 18803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage2d_neg_offset (NegativeTestContext& ctx) 18823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 18833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 18843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures(1, &texture); 18853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture(GL_TEXTURE_2D, texture); 18863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 8, 8, 0, etc2EacDataSize(8, 8), 0); 18873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note Both GL_INVALID_VALUE and GL_INVALID_OPERATION are valid here since implementation may 18893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // first check if offsets are valid for certain format and only after that check that they 18903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // are not negative. 18913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset or yoffset are negative."); 18923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 18933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 18943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 18953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 18963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 18973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -4, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 18983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 18993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 19013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 19033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 19043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19053c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage2d_invalid_offset (NegativeTestContext& ctx) 19063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 19073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 19083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 19093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 19103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 19113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 19123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height."); 19143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 12, 0, 8, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 4), 0); 19163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 19173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 12, 4, 8, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 8), 0); 19183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 19193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 12, 12, 8, 8, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 8), 0); 19203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 19213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 19223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 19243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 19253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage2d_neg_width_height (NegativeTestContext& ctx) 19273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 19283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 19293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 19303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 19313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 19323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 19333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if width or height is less than 0."); 19353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -4, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 19363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 19373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 19383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 19393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -4, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 19403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 19413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 19423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 19443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 19453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage2d_invalid_size (NegativeTestContext& ctx) 19473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 19483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 19493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 19503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 19513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 19523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 19533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data."); 19553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0); 19563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 19573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL_COMPRESSED_RGBA8_ETC2_EAC, 4*4*16-1, 0); 19593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 19603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 19613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 19633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 19643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage2d_invalid_buffer_target (NegativeTestContext& ctx) 19663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 19673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 buf = 0x1234; 19683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 19693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLubyte> data(128); 19703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 19723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 19733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0); 19743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers (1, &buf); 19753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 19763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 128, &data[0], GL_DYNAMIC_COPY); 19773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 19783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 19803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the buffer object's data store is currently mapped."); 19813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 128, GL_MAP_WRITE_BIT); 19823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 19833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 19843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 19853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 19863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 19883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(16, 16), 0); 19893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 19903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 19913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 19923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers (1, &buf); 19943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 19953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 19963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexImage3D 19983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 19993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage3d (NegativeTestContext& ctx) 20003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 20013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 20023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(0, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 20043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 20063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if type is not a type constant."); 20093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, 0, 0); 20103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 20113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if format is not an accepted format constant."); 20143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, 0, GL_UNSIGNED_BYTE, 0); 20153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 20163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if internalFormat is not one of the accepted resolution and format symbolic constants."); 20193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, 0, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if target is GL_TEXTURE_3D and format is GL_DEPTH_COMPONENT, or GL_DEPTH_STENCIL."); 20243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_BYTE, 0); 20253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 20263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0); 20273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 20283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid."); 20313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 20333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); 20343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 20353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB5_A1, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 20363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 20373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB10_A2, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV, 0); 20383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 20393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32UI, 1, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0); 20403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 20413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 20433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage3d_neg_level (NegativeTestContext& ctx) 20453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 20463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 20473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, -1, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 20483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, -1, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 20503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 20533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage3d_max_level (NegativeTestContext& ctx) 20553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 20563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE)."); 20573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2Max3DTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_3D_TEXTURE_SIZE)) + 1; 20583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 20593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 20633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 20643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 20653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 20683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20693c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage3d_neg_width_height_depth (NegativeTestContext& ctx) 20703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 20713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0."); 20723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, -1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, -1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, -1, -1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, -1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, -1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, 1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, -1, -1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 20893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 20903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 20913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage3d_max_width_height_depth (NegativeTestContext& ctx) 20933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 20943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int max3DTextureSize = ctx.getInteger(GL_MAX_3D_TEXTURE_SIZE) + 1; 20953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1; 20963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 20973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_3D_TEXTURE_SIZE."); 20983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, max3DTextureSize, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 20993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, max3DTextureSize, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, max3DTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, max3DTextureSize, max3DTextureSize, max3DTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_TEXTURE_SIZE."); 21093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, maxTextureSize, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, maxTextureSize, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, 1, maxTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, maxTextureSize, maxTextureSize, maxTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 21193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21203c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage3d_invalid_border (NegativeTestContext& ctx) 21213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 21223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0 or 1."); 21233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0); 21243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, 2, GL_RGB, GL_UNSIGNED_BYTE, 0); 21263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 1, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0); 21283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 1, 1, 1, 2, GL_RGB, GL_UNSIGNED_BYTE, 0); 21303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 21313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 21333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid teximage3d_invalid_buffer_target (NegativeTestContext& ctx) 21353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 21363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 buf = 0x1234; 21373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 21383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLubyte> data(512); 21393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers (1, &buf); 21413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 21423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 512, &data[0], GL_DYNAMIC_COPY); 21433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 21443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 21453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 21463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 21483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the buffer object's data store is currently mapped."); 21503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 128, GL_MAP_WRITE_BIT); 21513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 21533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 21543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 21573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 64, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 21593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type."); 21623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage; 21633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGB5_A1, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (const GLvoid*)3); 21643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 21653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers (1, &buf); 21703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 21713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 21723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexSubImage3D 21743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21753c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage3d (NegativeTestContext& ctx) 21763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 21773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 21783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 21793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 21803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 21823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 21843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(0, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 21863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_2D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 21873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 21883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if format is not an accepted format constant."); 21913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 4, 4, 4, GL_UNSIGNED_BYTE, 0); 21923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 21933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 21953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if type is not a type constant."); 21963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, 0, 0); 21973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 21983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 21993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid."); 22013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); 22023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 22033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 22043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 22053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); 22063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 22073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0); 22083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 22093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_FLOAT, 0); 22103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 22113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 22123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 22143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 22153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22163c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage3d_neg_level (NegativeTestContext& ctx) 22173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 22183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 22193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 22203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, textures[0]); 22213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 22233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 22253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 22273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 22323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (2, &textures[0]); 22343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 22353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage3d_max_level (NegativeTestContext& ctx) 22373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 22383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 22393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 22403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, textures[0]); 22413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 22433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 22453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2Max3DTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_3D_TEXTURE_SIZE)) + 1; 22473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 22483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE)."); 22503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 22533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 22553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 22583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (2, &textures[0]); 22603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 22613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage3d_neg_offset (NegativeTestContext& ctx) 22633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 22643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 22653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 22663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, textures[0]); 22673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 22693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 22713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if xoffset, yoffset or zoffset are negative."); 22733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, -1, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, -1, -1, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -1, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -1, -1, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 22883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 22893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 22903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (2, &textures[0]); 22923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 22933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 22943c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage3d_invalid_offset (NegativeTestContext& ctx) 22953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 22963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 22973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 22983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 22993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 23013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if xoffset + width > texture_width."); 23033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 2, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 23053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if yoffset + height > texture_height."); 23083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 2, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 23103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if zoffset + depth > texture_depth."); 23133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 2, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 23153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 23183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 23193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23203c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage3d_neg_width_height (NegativeTestContext& ctx) 23213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 23223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is less than 0."); 23233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, -1, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 23253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 23273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 23293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, -1, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 23313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 23333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texsubimage3d_invalid_buffer_target (NegativeTestContext& ctx) 23353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 23363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 buf = 0x1234; 23373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 23383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLubyte> data(512); 23393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 23413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 23423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 16, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers (1, &buf); 23443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 23453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 512, &data[0], GL_DYNAMIC_COPY); 23463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 23473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 23493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the buffer object's data store is currently mapped."); 23513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 512, GL_MAP_WRITE_BIT); 23523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 23543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 23553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 23583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 16, 16, 16, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 23603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type."); 23633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage; 23643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0); 23653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 0); 23663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 23673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 23683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (const GLvoid*)3); 23693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 23703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers (1, &buf); 23753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 23763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 23773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glCopyTexSubImage3D 23793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23803c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage3d (NegativeTestContext& ctx) 23813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 23823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 23833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 23843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 23853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 23863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 23883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 4, 4); 23893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 23903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 23913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 23933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 23943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 23953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage3d_neg_level (NegativeTestContext& ctx) 23963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 23973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 23983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 23993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, textures[0]); 24003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 24013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 24023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 24033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 24043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 24063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, -1, 0, 0, 0, 0, 0, 4, 4); 24073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 4, 4); 24093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 24113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, &textures[0]); 24133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 24143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24153c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage3d_max_level (NegativeTestContext& ctx) 24163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 24173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2Max3DTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_3D_TEXTURE_SIZE)) + 1; 24183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 24193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 textures[2]; 24213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, &textures[0]); 24223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, textures[0]); 24233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 24243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]); 24253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 24263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 24273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE)."); 24293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 4, 4); 24303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 24323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 24343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 4, 4); 24353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 24373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, &textures[0]); 24393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 24403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage3d_neg_offset (NegativeTestContext& ctx) 24423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 24433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 24443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 24453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 24463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 24473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if xoffset, yoffset or zoffset is negative."); 24493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, -1, 0, 0, 0, 0, 4, 4); 24503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, -1, 0, 0, 0, 4, 4); 24523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, -1, 0, 0, 4, 4); 24543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, -1, -1, -1, 0, 0, 4, 4); 24563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 24583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 24603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 24613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage3d_invalid_offset (NegativeTestContext& ctx) 24633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 24643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 24653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 24663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 24673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 24683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if xoffset + width > texture_width."); 24703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 1, 0, 0, 0, 0, 4, 4); 24713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 24733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if yoffset + height > texture_height."); 24753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 1, 0, 0, 0, 4, 4); 24763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 24783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if zoffset + 1 > texture_depth."); 24803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 4, 0, 0, 4, 4); 24813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 24833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 24853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 24863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24873c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage3d_neg_width_height (NegativeTestContext& ctx) 24883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 24893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture = 0x1234; 24903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 24913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 24923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 24933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width < 0."); 24953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, -4, 4); 24963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 24973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 24983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 24993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if height < 0."); 25003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, -4); 25013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 25033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 25053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 25063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25073c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid copytexsubimage3d_incomplete_framebuffer (NegativeTestContext& ctx) 25083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 25093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint fbo = 0x1234; 25103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint texture[2]; 25113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (2, texture); 25133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture[0]); 25143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 25153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture[1]); 25163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 25173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenFramebuffers (1, &fbo); 25183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer (GL_READ_FRAMEBUFFER, fbo); 25193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); 25203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete."); 25223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, 4); 25233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 25243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 4, 4); 25253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION); 25263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 25273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0); 25293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteFramebuffers(1, &fbo); 25303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(2, texture); 25313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 25323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glCompressedTexImage3D 25343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage3d (NegativeTestContext& ctx) 25363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 25373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 25383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0); 25393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 25403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0); 25413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 25423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 25433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not one of the specific compressed internal formats."); 25453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 0, 0); 25463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 25473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 0, 0, 0, 0, 0, 0); 25483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 25493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 25503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 25513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage3d_neg_level (NegativeTestContext& ctx) 25533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 25543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 25553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0); 25563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 25583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 25593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25603c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage3d_max_level (NegativeTestContext& ctx) 25613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 25623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 25633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 25643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0); 25653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 25673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 25683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25693c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage3d_neg_width_height_depth (NegativeTestContext& ctx) 25703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 25713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is less than 0."); 25723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0, 0); 25733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0, 0); 25753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0, 0); 25773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, -1, 0, 0, 0); 25793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 25813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 25823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage3d_max_width_height_depth (NegativeTestContext& ctx) 25843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 25853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1; 25863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_TEXTURE_SIZE."); 25883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 0, 0, 0, 0, 0); 25893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, maxTextureSize, 0, 0, 0, 0); 25913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, maxTextureSize, 0, 0, 0); 25933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, maxTextureSize, 0, 0, 0); 25953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 25963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 25973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 25983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 25993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage3d_invalid_border (NegativeTestContext& ctx) 26003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 26013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0."); 26023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, -1, 0, 0); 26033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 26043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 1, 0, 0); 26053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 26063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 26083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage3d_invalid_size (NegativeTestContext& ctx) 26103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 26113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data."); 26123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, -1, 0); 26133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 26143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, 4*4*8, 0); 26153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 26163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 1, 0, 4*4*16, 0); 26173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 26183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_SIGNED_R11_EAC, 16, 16, 1, 0, 4*4*16, 0); 26193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 26203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 26223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26233c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedteximage3d_invalid_buffer_target (NegativeTestContext& ctx) 26243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 26253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 buf = 0x1234; 26263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLubyte> data(512); 26273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers (1, &buf); 26293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 26303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY); 26313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 26323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 26343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 64, GL_MAP_WRITE_BIT); 26353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 4, 4, 1, 0, etc2DataSize(4, 4), 0); 26363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 26373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 26383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 26413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 1, 0, etc2DataSize(16, 16), 0); 26423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 26433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers (1, &buf); 26463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 26473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glCompressedTexSubImage3D 26493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage3d (NegativeTestContext& ctx) 26513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 26523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid."); 26533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 26543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 26553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 26583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 26593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 26603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 1, 0, etc2EacDataSize(18, 18), 0); 26613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 26623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified."); 26643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0); 26653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 26663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if internalformat is an ETC2/EAC format and target is not GL_TEXTURE_2D_ARRAY."); 26693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 18, 18, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(18, 18), 0); 26703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 26713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 26743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 4, 0, 0, 10, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(10, 4), 0); 26753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 26763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("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."); 26793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 4, 0, 4, 10, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 10), 0); 26803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 26813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("For ETC2/EAC images GL_INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four."); 26843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 1, 0, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 26853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 26863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 1, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 26873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 26883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 1, 1, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 26893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 26903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 26913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 26933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 26943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 26953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage3d_neg_level (NegativeTestContext& ctx) 26963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 26973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 26983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 26993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 27003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 27013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 27023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0."); 27043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 27063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 27073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 27093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 27103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27113c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage3d_max_level (NegativeTestContext& ctx) 27123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 27133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 27143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 27153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 27163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 27173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 27183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE)."); 27203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1; 27213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 27233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 27243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 27263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 27273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27283c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage3d_neg_offset (NegativeTestContext& ctx) 27293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 27303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 27313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 27323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 27333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 27343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 27353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset, yoffset or zoffset are negative."); 27373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -4, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, -4, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -4, -4, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 27463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 27483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 27493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage3d_invalid_offset (NegativeTestContext& ctx) 27513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 27523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 27533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 27543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 27553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 1, 0, etc2EacDataSize(4, 4), 0); 27563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 27573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height."); 27593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 12, 0, 0, 8, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 4), 0); 27613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 12, 0, 4, 8, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 8), 0); 27633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 12, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 27653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 12, 12, 12, 8, 8, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 8), 0); 27673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 27693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 27713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 27723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage3d_neg_width_height_depth (NegativeTestContext& ctx) 27743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 27753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 27763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 27773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 27783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 27793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 27803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if width, height or depth are negative."); 27823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, -4, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, -4, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0); 27893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION); 27903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 27913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 27933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 27943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 27953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage3d_invalid_size (NegativeTestContext& ctx) 27963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 27973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 27983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 27993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 28003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, 4*4*16, 0); 28013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 28023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data."); 28043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0); 28053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 28063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, 4*4*16-1, 0); 28083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 28093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 28103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 28123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 28133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28143c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid compressedtexsubimage3d_invalid_buffer_target (NegativeTestContext& ctx) 28153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2816971d41d7125e65b9020d562ec2aeec57ce6b3924Mika Isojärvi deUint32 buf = 0x1234; 2817971d41d7125e65b9020d562ec2aeec57ce6b3924Mika Isojärvi deUint32 texture = 0x1234; 2818971d41d7125e65b9020d562ec2aeec57ce6b3924Mika Isojärvi GLsizei bufferSize = etc2EacDataSize(4, 4); 2819971d41d7125e65b9020d562ec2aeec57ce6b3924Mika Isojärvi std::vector<GLubyte> data(bufferSize); 28203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 28223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture); 28233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0); 28243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers (1, &buf); 28253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf); 2826971d41d7125e65b9020d562ec2aeec57ce6b3924Mika Isojärvi ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, bufferSize, &data[0], GL_DYNAMIC_COPY); 28273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 28283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and..."); 28303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the buffer object's data store is currently mapped."); 2831971d41d7125e65b9020d562ec2aeec57ce6b3924Mika Isojärvi ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, bufferSize, GL_MAP_WRITE_BIT); 28323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCompressedTexSubImage3D (GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0); 28333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 28343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER); 28353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 28363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size."); 2838971d41d7125e65b9020d562ec2aeec57ce6b3924Mika Isojärvi ctx.glCompressedTexSubImage3D (GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(16, 16), 0); 28393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 28403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 28413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 28423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers (1, &buf); 28443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures (1, &texture); 28453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 28463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexStorage2D 28483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texstorage2d (NegativeTestContext& ctx) 28503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 28513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 28523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 28533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 28543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not a valid sized internal format."); 28563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 1, 0, 16, 16); 28573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM, GL_INVALID_VALUE); 28583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA_INTEGER, 16, 16); 28593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM, GL_INVALID_VALUE); 28603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 28613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted target enumerants."); 28633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (0, 1, GL_RGBA8, 16, 16); 28643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 28653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_3D, 1, GL_RGBA8, 16, 16); 28663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 28673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 16, 16); 28683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 28693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 28703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width or height are less than 1."); 28723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 0, 16); 28733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 28743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 0); 28753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 28763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 0, 0); 28773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 28783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 28793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 28813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 28823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texstorage2d_invalid_binding (NegativeTestContext& ctx) 28843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 28853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, 0); 28863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the default texture object is curently bound to target."); 28883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); 28893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 28903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 28913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 28933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 28943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 28953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 28963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the texture object currently bound to target already has GL_TEXTURE_IMMUTABLE_FORMAT set to GL_TRUE."); 28973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deInt32 immutable = 0x1234; 28983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); 28993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 29003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); 29013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 29023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); 29033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 29043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); 29053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 29063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 29073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 29093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 29103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29113c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texstorage2d_invalid_levels (NegativeTestContext& ctx) 29123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 29133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 29143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 29153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_2D, texture); 29163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if levels is less than 1."); 29183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16); 29193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 29203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0); 29213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 29223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 29233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if levels is greater than floor(log_2(max(width, height))) + 1"); 29253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxSize = deLog2Floor32(deMax32(16, 4)) + 1 + 1; 29263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, log2MaxSize, GL_RGBA8, 16, 4); 29273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 29283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, log2MaxSize, GL_RGBA8, 4, 16); 29293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 29303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage2D (GL_TEXTURE_2D, log2MaxSize, GL_RGBA8, 16, 16); 29313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 29323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 29333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 29353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 29363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// glTexStorage3D 29383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29393c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texstorage3d (NegativeTestContext& ctx) 29403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 29413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 29423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 29433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 29443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not a valid sized internal format."); 29463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, 0, 4, 4, 4); 29473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM, GL_INVALID_VALUE); 29483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA_INTEGER, 4, 4, 4); 29493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM, GL_INVALID_VALUE); 29503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 29513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted target enumerants."); 29533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (0, 1, GL_RGBA8, 4, 4, 4); 29543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 29553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 4, 4, 4); 29563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 29573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_2D, 1, GL_RGBA8, 4, 4, 4); 29583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 29593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 29603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth are less than 1."); 29623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 0, 4, 4); 29633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 29643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 0, 4); 29653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 29663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 0); 29673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 29683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 0, 0, 0); 29693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 29703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 29713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 29733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 29743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29753c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texstorage3d_invalid_binding (NegativeTestContext& ctx) 29763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 29773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, 0); 29783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the default texture object is curently bound to target."); 29803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); 29813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 29823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 29833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 29853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 29863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 29873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 29883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the texture object currently bound to target already has GL_TEXTURE_IMMUTABLE_FORMAT set to GL_TRUE."); 29893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deInt32 immutable = 0x1234; 29903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameteriv(GL_TEXTURE_3D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); 29913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 29923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); 29933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 29943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameteriv(GL_TEXTURE_3D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); 29953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 29963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); 29973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 29983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 29993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 30003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 30013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 30023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 30033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid texstorage3d_invalid_levels (NegativeTestContext& ctx) 30043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 30053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texture = 0x1234; 30063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenTextures (1, &texture); 30073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindTexture (GL_TEXTURE_3D, texture); 30083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 30093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if levels is less than 1."); 30103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 0, GL_RGBA8, 4, 4, 4); 30113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 30123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, 0, GL_RGBA8, 0, 0, 0); 30133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 30143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 30153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 30163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if levels is greater than floor(log_2(max(width, height, depth))) + 1"); 30173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 log2MaxSize = deLog2Floor32(8) + 1 + 1; 30183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 8, 2, 2); 30193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 30203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 2, 8, 2); 30213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 30223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 2, 2, 8); 30233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 30243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 8, 8, 8); 30253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 30263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 30273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 30283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteTextures(1, &texture); 30293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 30303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 30313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystd::vector<FunctionContainer> getNegativeTextureApiTestFunctions() 30323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 30333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FunctionContainer funcs[] = 30343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 30353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {activetexture, "activetexture", "Invalid glActiveTexture() usage" }, 30363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {bindtexture, "bindtexture", "Invalid glBindTexture() usage" }, 30373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_invalid_target, "compressedteximage2d_invalid_target", "Invalid glCompressedTexImage2D() usage" }, 30383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_invalid_format, "compressedteximage2d_invalid_format", "Invalid glCompressedTexImage2D() usage" }, 30393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_neg_level, "compressedteximage2d_neg_level", "Invalid glCompressedTexImage2D() usage" }, 30403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_max_level, "compressedteximage2d_max_level", "Invalid glCompressedTexImage2D() usage" }, 30413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_neg_width_height, "compressedteximage2d_neg_width_height", "Invalid glCompressedTexImage2D() usage" }, 30423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_max_width_height, "compressedteximage2d_max_width_height", "Invalid glCompressedTexImage2D() usage" }, 30433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_invalid_border, "compressedteximage2d_invalid_border", "Invalid glCompressedTexImage2D() usage" }, 30443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_invalid_size, "compressedteximage2d_invalid_size", "Invalid glCompressedTexImage2D() usage" }, 30453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage2d_invalid_buffer_target, "compressedteximage2d_invalid_buffer_target", "Invalid glCompressedTexImage2D() usage" }, 30463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_invalid_target, "copyteximage2d_invalid_target", "Invalid glCopyTexImage2D() usage" }, 30473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_invalid_format, "copyteximage2d_invalid_format", "Invalid glCopyTexImage2D() usage" }, 30483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_inequal_width_height_cube, "copyteximage2d_inequal_width_height_cube", "Invalid glCopyTexImage2D() usage" }, 30493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_neg_level, "copyteximage2d_neg_level", "Invalid glCopyTexImage2D() usage" }, 30503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_max_level, "copyteximage2d_max_level", "Invalid glCopyTexImage2D() usage" }, 30513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_neg_width_height, "copyteximage2d_neg_width_height", "Invalid glCopyTexImage2D() usage" }, 30523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_max_width_height, "copyteximage2d_max_width_height", "Invalid glCopyTexImage2D() usage" }, 30533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_invalid_border, "copyteximage2d_invalid_border", "Invalid glCopyTexImage2D() usage" }, 30543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copyteximage2d_incomplete_framebuffer, "copyteximage2d_incomplete_framebuffer", "Invalid glCopyTexImage2D() usage" }, 30553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage2d_invalid_target, "copytexsubimage2d_invalid_target", "Invalid glCopyTexSubImage2D() usage" }, 30563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage2d_neg_level, "copytexsubimage2d_neg_level", "Invalid glCopyTexSubImage2D() usage" }, 30573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage2d_max_level, "copytexsubimage2d_max_level", "Invalid glCopyTexSubImage2D() usage" }, 30583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage2d_neg_offset, "copytexsubimage2d_neg_offset", "Invalid glCopyTexSubImage2D() usage" }, 30593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage2d_invalid_offset, "copytexsubimage2d_invalid_offset", "Invalid glCopyTexSubImage2D() usage" }, 30603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage2d_neg_width_height, "copytexsubimage2d_neg_width_height", "Invalid glCopyTexSubImage2D() usage" }, 30613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage2d_incomplete_framebuffer, "copytexsubimage2d_incomplete_framebuffer", "Invalid glCopyTexSubImage2D() usage" }, 30623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {deletetextures, "deletetextures", "Invalid glDeleteTextures() usage" }, 30633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {generatemipmap, "generatemipmap", "Invalid glGenerateMipmap() usage" }, 30643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {gentextures, "gentextures", "Invalid glGenTextures() usage" }, 30653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {pixelstorei, "pixelstorei", "Invalid glPixelStorei() usage" }, 30663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage2d, "teximage2d", "Invalid glTexImage2D() usage" }, 30673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage2d_inequal_width_height_cube, "teximage2d_inequal_width_height_cube", "Invalid glTexImage2D() usage" }, 30683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage2d_neg_level, "teximage2d_neg_level", "Invalid glTexImage2D() usage" }, 30693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage2d_max_level, "teximage2d_max_level", "Invalid glTexImage2D() usage" }, 30703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage2d_neg_width_height, "teximage2d_neg_width_height", "Invalid glTexImage2D() usage" }, 30713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage2d_max_width_height, "teximage2d_max_width_height", "Invalid glTexImage2D() usage" }, 30723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage2d_invalid_border, "teximage2d_invalid_border", "Invalid glTexImage2D() usage" }, 30733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage2d_invalid_buffer_target, "teximage2d_invalid_buffer_target", "Invalid glTexImage2D() usage" }, 30743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage2d, "texsubimage2d", "Invalid glTexSubImage2D() usage" }, 30753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage2d_neg_level, "texsubimage2d_neg_level", "Invalid glTexSubImage2D() usage" }, 30763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage2d_max_level, "texsubimage2d_max_level", "Invalid glTexSubImage2D() usage" }, 30773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage2d_neg_offset, "texsubimage2d_neg_offset", "Invalid glTexSubImage2D() usage" }, 30783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage2d_invalid_offset, "texsubimage2d_invalid_offset", "Invalid glTexSubImage2D() usage" }, 30793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage2d_neg_width_height, "texsubimage2d_neg_width_height", "Invalid glTexSubImage2D() usage" }, 30803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage2d_invalid_buffer_target, "texsubimage2d_invalid_buffer_target", "Invalid glTexSubImage2D() usage" }, 30813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texparameteri, "texparameteri", "Invalid glTexParameteri() usage" }, 30823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texparameterf, "texparameterf", "Invalid glTexParameterf() usage" }, 30833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texparameteriv, "texparameteriv", "Invalid glTexParameteriv() usage" }, 30843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texparameterfv, "texparameterfv", "Invalid glTexParameterfv() usage" }, 30853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage2d, "compressedtexsubimage2d", "Invalid glCompressedTexSubImage2D() usage"}, 30863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage2d_neg_level, "compressedtexsubimage2d_neg_level", "Invalid glCompressedTexSubImage2D() usage"}, 30873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage2d_max_level, "compressedtexsubimage2d_max_level", "Invalid glCompressedTexSubImage2D() usage"}, 30883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage2d_neg_offset, "compressedtexsubimage2d_neg_offset", "Invalid glCompressedTexSubImage2D() usage"}, 30893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage2d_invalid_offset, "compressedtexsubimage2d_invalid_offset", "Invalid glCompressedTexSubImage2D() usage"}, 30903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage2d_neg_width_height, "compressedtexsubimage2d_neg_width_height", "Invalid glCompressedTexSubImage2D() usage"}, 30913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage2d_invalid_size, "compressedtexsubimage2d_invalid_size", "Invalid glCompressedTexImage2D() usage" }, 30923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage2d_invalid_buffer_target, "compressedtexsubimage2d_invalid_buffer_target", "Invalid glCompressedTexSubImage2D() usage"}, 30933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage3d, "teximage3d", "Invalid glTexImage3D() usage" }, 30943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage3d_neg_level, "teximage3d_neg_level", "Invalid glTexImage3D() usage" }, 30953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage3d_max_level, "teximage3d_max_level", "Invalid glTexImage3D() usage" }, 30963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage3d_neg_width_height_depth, "teximage3d_neg_width_height_depth", "Invalid glTexImage3D() usage" }, 30973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage3d_max_width_height_depth, "teximage3d_max_width_height_depth", "Invalid glTexImage3D() usage" }, 30983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage3d_invalid_border, "teximage3d_invalid_border", "Invalid glTexImage3D() usage" }, 30993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {teximage3d_invalid_buffer_target, "teximage3d_invalid_buffer_target", "Invalid glTexImage3D() usage" }, 31003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage3d, "texsubimage3d", "Invalid glTexSubImage3D() usage" }, 31013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage3d_neg_level, "texsubimage3d_neg_level", "Invalid glTexSubImage3D() usage" }, 31023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage3d_max_level, "texsubimage3d_max_level", "Invalid glTexSubImage3D() usage" }, 31033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage3d_neg_offset, "texsubimage3d_neg_offset", "Invalid glTexSubImage3D() usage" }, 31043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage3d_invalid_offset, "texsubimage3d_invalid_offset", "Invalid glTexSubImage3D() usage" }, 31053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage3d_neg_width_height, "texsubimage3d_neg_width_height", "Invalid glTexSubImage3D() usage" }, 31063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texsubimage3d_invalid_buffer_target, "texsubimage3d_invalid_buffer_target", "Invalid glTexSubImage3D() usage" }, 31073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage3d, "copytexsubimage3d", "Invalid glCopyTexSubImage3D() usage" }, 31083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage3d_neg_level, "copytexsubimage3d_neg_level", "Invalid glCopyTexSubImage3D() usage" }, 31093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage3d_max_level, "copytexsubimage3d_max_level", "Invalid glCopyTexSubImage3D() usage" }, 31103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage3d_neg_offset, "copytexsubimage3d_neg_offset", "Invalid glCopyTexSubImage3D() usage" }, 31113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage3d_invalid_offset, "copytexsubimage3d_invalid_offset", "Invalid glCopyTexSubImage3D() usage" }, 31123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage3d_neg_width_height, "copytexsubimage3d_neg_width_height", "Invalid glCopyTexSubImage3D() usage" }, 31133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {copytexsubimage3d_incomplete_framebuffer, "copytexsubimage3d_incomplete_framebuffer", "Invalid glCopyTexSubImage3D() usage" }, 31143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage3d, "compressedteximage3d", "Invalid glCompressedTexImage3D() usage" }, 31153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage3d_neg_level, "compressedteximage3d_neg_level", "Invalid glCompressedTexImage3D() usage" }, 31163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage3d_max_level, "compressedteximage3d_max_level", "Invalid glCompressedTexImage3D() usage" }, 31173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage3d_neg_width_height_depth, "compressedteximage3d_neg_width_height_depth", "Invalid glCompressedTexImage3D() usage" }, 31183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage3d_max_width_height_depth, "compressedteximage3d_max_width_height_depth", "Invalid glCompressedTexImage3D() usage" }, 31193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage3d_invalid_border, "compressedteximage3d_invalid_border", "Invalid glCompressedTexImage3D() usage" }, 31203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage3d_invalid_size, "compressedteximage3d_invalid_size", "Invalid glCompressedTexImage3D() usage" }, 31213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedteximage3d_invalid_buffer_target, "compressedteximage3d_invalid_buffer_target", "Invalid glCompressedTexImage3D() usage" }, 31223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage3d, "compressedtexsubimage3d", "Invalid glCompressedTexSubImage3D() usage"}, 31233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage3d_neg_level, "compressedtexsubimage3d_neg_level", "Invalid glCompressedTexSubImage3D() usage"}, 31243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage3d_max_level, "compressedtexsubimage3d_max_level", "Invalid glCompressedTexSubImage3D() usage"}, 31253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage3d_neg_offset, "compressedtexsubimage3d_neg_offset", "Invalid glCompressedTexSubImage3D() usage"}, 31263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage3d_invalid_offset, "compressedtexsubimage3d_invalid_offset", "Invalid glCompressedTexSubImage3D() usage"}, 31273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage3d_neg_width_height_depth,"compressedtexsubimage3d_neg_width_height_depth", "Invalid glCompressedTexSubImage3D() usage"}, 31283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage3d_invalid_size, "compressedtexsubimage3d_invalid_size", "Invalid glCompressedTexSubImage3D() usage"}, 31293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {compressedtexsubimage3d_invalid_buffer_target, "compressedtexsubimage3d_invalid_buffer_target", "Invalid glCompressedTexSubImage3D() usage"}, 31303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texstorage2d, "texstorage2d", "Invalid glTexStorage2D() usage" }, 31313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texstorage2d_invalid_binding, "texstorage2d_invalid_binding", "Invalid glTexStorage2D() usage" }, 31323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texstorage2d_invalid_levels, "texstorage2d_invalid_levels", "Invalid glTexStorage2D() usage" }, 31333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texstorage3d, "texstorage3d", "Invalid glTexStorage3D() usage" }, 31343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texstorage3d_invalid_binding, "texstorage3d_invalid_binding", "Invalid glTexStorage3D() usage" }, 31353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {texstorage3d_invalid_levels, "texstorage3d_invalid_levels", "Invalid glTexStorage3D() usage" }, 31363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 31373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 31383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs)); 31393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 31403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 31413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // NegativeTestShared 31423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 31433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles31 31443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 3145