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