1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Negative Texture API tests.
22 *//*--------------------------------------------------------------------*/
23
24 #include "es31fNegativeTextureApiTests.hpp"
25 #include "es31fNegativeTestShared.hpp"
26
27 #include "gluCallLogWrapper.hpp"
28 #include "gluContextInfo.hpp"
29 #include "gluRenderContext.hpp"
30
31 #include "glwDefs.hpp"
32 #include "glwEnums.hpp"
33
34 namespace deqp
35 {
36 namespace gles31
37 {
38 namespace Functional
39 {
40 namespace NegativeTestShared
41 {
42
43 using tcu::TestLog;
44 using glu::CallLogWrapper;
45 using namespace glw;
46
divRoundUp(int a,int b)47 static inline int divRoundUp (int a, int b)
48 {
49 return a/b + (a%b != 0 ? 1 : 0);
50 }
51
etc2DataSize(int width,int height)52 static inline int etc2DataSize (int width, int height)
53 {
54 return (int)(divRoundUp(width, 4) * divRoundUp(height, 4) * sizeof(deUint64));
55 }
56
etc2EacDataSize(int width,int height)57 static inline int etc2EacDataSize (int width, int height)
58 {
59 return 2 * etc2DataSize(width, height);
60 }
61
cubeFaceToGLFace(tcu::CubeFace face)62 static deUint32 cubeFaceToGLFace (tcu::CubeFace face)
63 {
64 switch (face)
65 {
66 case tcu::CUBEFACE_NEGATIVE_X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
67 case tcu::CUBEFACE_POSITIVE_X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X;
68 case tcu::CUBEFACE_NEGATIVE_Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
69 case tcu::CUBEFACE_POSITIVE_Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
70 case tcu::CUBEFACE_NEGATIVE_Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
71 case tcu::CUBEFACE_POSITIVE_Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
72 default:
73 DE_ASSERT(DE_FALSE);
74 return GL_NONE;
75 }
76 }
77
78 #define FOR_CUBE_FACES(FACE_GL_VAR, BODY) \
79 do \
80 { \
81 for (int faceIterTcu = 0; faceIterTcu < tcu::CUBEFACE_LAST; faceIterTcu++) \
82 { \
83 const GLenum FACE_GL_VAR = cubeFaceToGLFace((tcu::CubeFace)faceIterTcu); \
84 BODY \
85 } \
86 } while (false)
87
88
89 // glActiveTexture
90
activetexture(NegativeTestContext & ctx)91 void activetexture (NegativeTestContext& ctx)
92 {
93 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).");
94 ctx.glActiveTexture(-1);
95 ctx.expectError(GL_INVALID_ENUM);
96 int numMaxTextureUnits = ctx.getInteger(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
97 ctx.glActiveTexture(GL_TEXTURE0 + numMaxTextureUnits);
98 ctx.expectError(GL_INVALID_ENUM);
99 ctx.endSection();
100 }
101
102 // glBindTexture
103
bindtexture(NegativeTestContext & ctx)104 void bindtexture (NegativeTestContext& ctx)
105 {
106 GLuint texture[5];
107 ctx.glGenTextures(5, texture);
108
109 ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the allowable values.");
110 ctx.glBindTexture(0, 1);
111 ctx.expectError(GL_INVALID_ENUM);
112 ctx.glBindTexture(GL_FRAMEBUFFER, 1);
113 ctx.expectError(GL_INVALID_ENUM);
114 ctx.endSection();
115
116 ctx.beginSection("GL_INVALID_OPERATION is generated if texture was previously created with a target that doesn't match that of target.");
117 ctx.glBindTexture(GL_TEXTURE_2D, texture[0]);
118 ctx.expectError(GL_NO_ERROR);
119 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]);
120 ctx.expectError(GL_INVALID_OPERATION);
121 ctx.glBindTexture(GL_TEXTURE_3D, texture[0]);
122 ctx.expectError(GL_INVALID_OPERATION);
123 ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, texture[0]);
124 ctx.expectError(GL_INVALID_OPERATION);
125
126 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[1]);
127 ctx.expectError(GL_NO_ERROR);
128 ctx.glBindTexture(GL_TEXTURE_2D, texture[1]);
129 ctx.expectError(GL_INVALID_OPERATION);
130 ctx.glBindTexture(GL_TEXTURE_3D, texture[1]);
131 ctx.expectError(GL_INVALID_OPERATION);
132 ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, texture[1]);
133 ctx.expectError(GL_INVALID_OPERATION);
134
135 ctx.glBindTexture(GL_TEXTURE_3D, texture[2]);
136 ctx.expectError(GL_NO_ERROR);
137 ctx.glBindTexture(GL_TEXTURE_2D, texture[2]);
138 ctx.expectError(GL_INVALID_OPERATION);
139 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[2]);
140 ctx.expectError(GL_INVALID_OPERATION);
141 ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, texture[2]);
142 ctx.expectError(GL_INVALID_OPERATION);
143
144 ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, texture[3]);
145 ctx.expectError(GL_NO_ERROR);
146 ctx.glBindTexture(GL_TEXTURE_2D, texture[3]);
147 ctx.expectError(GL_INVALID_OPERATION);
148 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[3]);
149 ctx.expectError(GL_INVALID_OPERATION);
150 ctx.glBindTexture(GL_TEXTURE_3D, texture[3]);
151 ctx.expectError(GL_INVALID_OPERATION);
152
153 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
154 {
155 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texture[0]);
156 ctx.expectError(GL_INVALID_OPERATION);
157 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texture[1]);
158 ctx.expectError(GL_INVALID_OPERATION);
159 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texture[2]);
160 ctx.expectError(GL_INVALID_OPERATION);
161 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texture[3]);
162 ctx.expectError(GL_INVALID_OPERATION);
163 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texture[4]);
164 ctx.expectError(GL_NO_ERROR);
165 ctx.glBindTexture(GL_TEXTURE_2D, texture[4]);
166 ctx.expectError(GL_INVALID_OPERATION);
167 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[4]);
168 ctx.expectError(GL_INVALID_OPERATION);
169 ctx.glBindTexture(GL_TEXTURE_3D, texture[4]);
170 ctx.expectError(GL_INVALID_OPERATION);
171 ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, texture[4]);
172 ctx.expectError(GL_INVALID_OPERATION);
173 }
174 ctx.endSection();
175
176 ctx.glDeleteTextures(5, texture);
177 }
178
179 // glCompressedTexImage2D
180
compressedteximage2d_invalid_target(NegativeTestContext & ctx)181 void compressedteximage2d_invalid_target (NegativeTestContext& ctx)
182 {
183 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
184 ctx.glCompressedTexImage2D(0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
185 ctx.expectError(GL_INVALID_ENUM);
186 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
187 ctx.expectError(GL_INVALID_ENUM);
188 ctx.endSection();
189 }
190
compressedteximage2d_invalid_format(NegativeTestContext & ctx)191 void compressedteximage2d_invalid_format (NegativeTestContext& ctx)
192 {
193 ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS.");
194 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);
195 ctx.expectError(GL_INVALID_ENUM);
196 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 0, 0, 0);
197 ctx.expectError(GL_INVALID_ENUM);
198 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 0, 0, 0, 0, 0);
199 ctx.expectError(GL_INVALID_ENUM);
200 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0);
201 ctx.expectError(GL_INVALID_ENUM);
202 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0);
203 ctx.expectError(GL_INVALID_ENUM);
204 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0);
205 ctx.expectError(GL_INVALID_ENUM);
206 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0);
207 ctx.expectError(GL_INVALID_ENUM);
208 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0);
209 ctx.expectError(GL_INVALID_ENUM);
210 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0);
211 ctx.expectError(GL_INVALID_ENUM);
212 ctx.endSection();
213 }
214
compressedteximage2d_neg_level(NegativeTestContext & ctx)215 void compressedteximage2d_neg_level (NegativeTestContext& ctx)
216 {
217 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
218 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
219 ctx.expectError(GL_INVALID_VALUE);
220 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
221 ctx.expectError(GL_INVALID_VALUE);
222 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
223 ctx.expectError(GL_INVALID_VALUE);
224 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
225 ctx.expectError(GL_INVALID_VALUE);
226 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
227 ctx.expectError(GL_INVALID_VALUE);
228 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
229 ctx.expectError(GL_INVALID_VALUE);
230 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
231 ctx.expectError(GL_INVALID_VALUE);
232 ctx.endSection();
233 }
234
compressedteximage2d_max_level(NegativeTestContext & ctx)235 void compressedteximage2d_max_level (NegativeTestContext& ctx)
236 {
237 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE) for a 2d texture target.");
238 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
239 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_COMPRESSED_RGB8_ETC2, 16, 16, 0, etc2DataSize(16, 16), 0);
240 ctx.expectError(GL_INVALID_VALUE);
241 ctx.endSection();
242
243 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE) for a cubemap target.");
244 deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
245 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
246 ctx.expectError(GL_INVALID_VALUE);
247 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
248 ctx.expectError(GL_INVALID_VALUE);
249 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
250 ctx.expectError(GL_INVALID_VALUE);
251 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
252 ctx.expectError(GL_INVALID_VALUE);
253 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
254 ctx.expectError(GL_INVALID_VALUE);
255 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
256 ctx.expectError(GL_INVALID_VALUE);
257 ctx.endSection();
258 }
259
compressedteximage2d_neg_width_height(NegativeTestContext & ctx)260 void compressedteximage2d_neg_width_height (NegativeTestContext& ctx)
261 {
262 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0.");
263
264 ctx.beginSection("GL_TEXTURE_2D target");
265 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0);
266 ctx.expectError(GL_INVALID_VALUE);
267 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0);
268 ctx.expectError(GL_INVALID_VALUE);
269 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0);
270 ctx.expectError(GL_INVALID_VALUE);
271 ctx.endSection();
272
273 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
274 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0);
275 ctx.expectError(GL_INVALID_VALUE);
276 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0);
277 ctx.expectError(GL_INVALID_VALUE);
278 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0);
279 ctx.expectError(GL_INVALID_VALUE);
280 ctx.endSection();
281
282 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
283 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0);
284 ctx.expectError(GL_INVALID_VALUE);
285 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0);
286 ctx.expectError(GL_INVALID_VALUE);
287 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0);
288 ctx.expectError(GL_INVALID_VALUE);
289 ctx.endSection();
290
291 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target");
292 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0);
293 ctx.expectError(GL_INVALID_VALUE);
294 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0);
295 ctx.expectError(GL_INVALID_VALUE);
296 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0);
297 ctx.expectError(GL_INVALID_VALUE);
298 ctx.endSection();
299
300 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
301 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0);
302 ctx.expectError(GL_INVALID_VALUE);
303 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0);
304 ctx.expectError(GL_INVALID_VALUE);
305 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0);
306 ctx.expectError(GL_INVALID_VALUE);
307 ctx.endSection();
308
309 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
310 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0);
311 ctx.expectError(GL_INVALID_VALUE);
312 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0);
313 ctx.expectError(GL_INVALID_VALUE);
314 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0);
315 ctx.expectError(GL_INVALID_VALUE);
316 ctx.endSection();
317
318 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
319 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0);
320 ctx.expectError(GL_INVALID_VALUE);
321 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0);
322 ctx.expectError(GL_INVALID_VALUE);
323 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, 0, 0);
324 ctx.expectError(GL_INVALID_VALUE);
325 ctx.endSection();
326
327 ctx.endSection();
328 }
329
compressedteximage2d_max_width_height(NegativeTestContext & ctx)330 void compressedteximage2d_max_width_height (NegativeTestContext& ctx)
331 {
332 int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1;
333 int maxCubemapSize = ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
334 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
335
336 ctx.beginSection("GL_TEXTURE_2D target");
337 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 1, 0, etc2EacDataSize(maxTextureSize, 1), 0);
338 ctx.expectError(GL_INVALID_VALUE);
339 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxTextureSize, 0, etc2EacDataSize(1, maxTextureSize), 0);
340 ctx.expectError(GL_INVALID_VALUE);
341 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, 0, etc2EacDataSize(maxTextureSize, maxTextureSize), 0);
342 ctx.expectError(GL_INVALID_VALUE);
343 ctx.endSection();
344
345 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
346 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0);
347 ctx.expectError(GL_INVALID_VALUE);
348 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0);
349 ctx.expectError(GL_INVALID_VALUE);
350 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0);
351 ctx.expectError(GL_INVALID_VALUE);
352 ctx.endSection();
353
354 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
355 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0);
356 ctx.expectError(GL_INVALID_VALUE);
357 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0);
358 ctx.expectError(GL_INVALID_VALUE);
359 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0);
360 ctx.expectError(GL_INVALID_VALUE);
361 ctx.endSection();
362
363 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target");
364 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0);
365 ctx.expectError(GL_INVALID_VALUE);
366 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0);
367 ctx.expectError(GL_INVALID_VALUE);
368 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0);
369 ctx.expectError(GL_INVALID_VALUE);
370 ctx.endSection();
371
372 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
373 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0);
374 ctx.expectError(GL_INVALID_VALUE);
375 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0);
376 ctx.expectError(GL_INVALID_VALUE);
377 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0);
378 ctx.expectError(GL_INVALID_VALUE);
379 ctx.endSection();
380
381 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
382 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0);
383 ctx.expectError(GL_INVALID_VALUE);
384 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0);
385 ctx.expectError(GL_INVALID_VALUE);
386 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0);
387 ctx.expectError(GL_INVALID_VALUE);
388 ctx.endSection();
389
390 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
391 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, etc2EacDataSize(maxCubemapSize, 1), 0);
392 ctx.expectError(GL_INVALID_VALUE);
393 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, etc2EacDataSize(1, maxCubemapSize), 0);
394 ctx.expectError(GL_INVALID_VALUE);
395 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, maxCubemapSize, 0, etc2EacDataSize(maxCubemapSize, maxCubemapSize), 0);
396 ctx.expectError(GL_INVALID_VALUE);
397 ctx.endSection();
398
399 ctx.endSection();
400 }
401
compressedteximage2d_invalid_border(NegativeTestContext & ctx)402 void compressedteximage2d_invalid_border (NegativeTestContext& ctx)
403 {
404 ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0.");
405
406 ctx.beginSection("GL_TEXTURE_2D target");
407 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0);
408 ctx.expectError(GL_INVALID_VALUE);
409 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0);
410 ctx.expectError(GL_INVALID_VALUE);
411 ctx.endSection();
412
413 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
414 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0);
415 ctx.expectError(GL_INVALID_VALUE);
416 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0);
417 ctx.expectError(GL_INVALID_VALUE);
418 ctx.endSection();
419
420 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
421 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0);
422 ctx.expectError(GL_INVALID_VALUE);
423 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0);
424 ctx.expectError(GL_INVALID_VALUE);
425 ctx.endSection();
426
427 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target");
428 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0);
429 ctx.expectError(GL_INVALID_VALUE);
430 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0);
431 ctx.expectError(GL_INVALID_VALUE);
432 ctx.endSection();
433
434 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
435 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0);
436 ctx.expectError(GL_INVALID_VALUE);
437 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0);
438 ctx.expectError(GL_INVALID_VALUE);
439 ctx.endSection();
440
441 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
442 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0);
443 ctx.expectError(GL_INVALID_VALUE);
444 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0);
445 ctx.expectError(GL_INVALID_VALUE);
446 ctx.endSection();
447
448 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
449 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0);
450 ctx.expectError(GL_INVALID_VALUE);
451 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0);
452 ctx.expectError(GL_INVALID_VALUE);
453 ctx.endSection();
454
455 ctx.endSection();
456 }
457
compressedteximage2d_invalid_size(NegativeTestContext & ctx)458 void compressedteximage2d_invalid_size (NegativeTestContext& ctx)
459 {
460 ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.");
461 // Subtracting 1 to the imageSize field to deviate from the expected size. Removing the -1 would cause the imageSize to be correct.
462 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_R11_EAC, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 8 - 1, 0);
463 ctx.expectError(GL_INVALID_VALUE);
464 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SIGNED_R11_EAC, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 8 - 1, 0);
465 ctx.expectError(GL_INVALID_VALUE);
466 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RG11_EAC, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 16 - 1, 0);
467 ctx.expectError(GL_INVALID_VALUE);
468 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SIGNED_RG11_EAC, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 16 - 1, 0);
469 ctx.expectError(GL_INVALID_VALUE);
470 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 8 - 1, 0);
471 ctx.expectError(GL_INVALID_VALUE);
472 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ETC2, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 8 - 1, 0);
473 ctx.expectError(GL_INVALID_VALUE);
474 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 8 - 1, 0);
475 ctx.expectError(GL_INVALID_VALUE);
476 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 8 - 1, 0);
477 ctx.expectError(GL_INVALID_VALUE);
478 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 16 - 1, 0);
479 ctx.expectError(GL_INVALID_VALUE);
480 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 16 - 1, 0);
481 ctx.expectError(GL_INVALID_VALUE);
482
483 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
484 {
485 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_4x4, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 16 - 1, 0);
486 ctx.expectError(GL_INVALID_VALUE);
487 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_5x4, 1, 1, 0, divRoundUp(1, 5) * divRoundUp(1, 4) * 16 - 1, 0);
488 ctx.expectError(GL_INVALID_VALUE);
489 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_5x5, 1, 1, 0, divRoundUp(1, 5) * divRoundUp(1, 5) * 16 - 1, 0);
490 ctx.expectError(GL_INVALID_VALUE);
491 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_6x5, 1, 1, 0, divRoundUp(1, 6) * divRoundUp(1, 5) * 16 - 1, 0);
492 ctx.expectError(GL_INVALID_VALUE);
493 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_6x6, 1, 1, 0, divRoundUp(1, 6) * divRoundUp(1, 6) * 16 - 1, 0);
494 ctx.expectError(GL_INVALID_VALUE);
495 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_8x5, 1, 1, 0, divRoundUp(1, 8) * divRoundUp(1, 5) * 16 - 1, 0);
496 ctx.expectError(GL_INVALID_VALUE);
497 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_8x6, 1, 1, 0, divRoundUp(1, 8) * divRoundUp(1, 6) * 16 - 1, 0);
498 ctx.expectError(GL_INVALID_VALUE);
499 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_8x8, 1, 1, 0, divRoundUp(1, 8) * divRoundUp(1, 8) * 16 - 1, 0);
500 ctx.expectError(GL_INVALID_VALUE);
501 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_10x5, 1, 1, 0, divRoundUp(1, 10) * divRoundUp(1, 5) * 16 - 1, 0);
502 ctx.expectError(GL_INVALID_VALUE);
503 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_10x6, 1, 1, 0, divRoundUp(1, 10) * divRoundUp(1, 6) * 16 - 1, 0);
504 ctx.expectError(GL_INVALID_VALUE);
505 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_10x8, 1, 1, 0, divRoundUp(1, 10) * divRoundUp(1, 8) * 16 - 1, 0);
506 ctx.expectError(GL_INVALID_VALUE);
507 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_10x10, 1, 1, 0, divRoundUp(1, 10) * divRoundUp(1, 10) * 16 - 1, 0);
508 ctx.expectError(GL_INVALID_VALUE);
509 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_12x10, 1, 1, 0, divRoundUp(1, 12) * divRoundUp(1, 10) * 16 - 1, 0);
510 ctx.expectError(GL_INVALID_VALUE);
511 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_12x12, 1, 1, 0, divRoundUp(1, 12) * divRoundUp(1, 12) * 16 - 1, 0);
512 ctx.expectError(GL_INVALID_VALUE);
513 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 16 - 1, 0);
514 ctx.expectError(GL_INVALID_VALUE);
515 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4, 1, 1, 0, divRoundUp(1, 5) * divRoundUp(1, 4) * 16 - 1, 0);
516 ctx.expectError(GL_INVALID_VALUE);
517 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5, 1, 1, 0, divRoundUp(1, 5) * divRoundUp(1, 5) * 16 - 1, 0);
518 ctx.expectError(GL_INVALID_VALUE);
519 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5, 1, 1, 0, divRoundUp(1, 6) * divRoundUp(1, 5) * 16 - 1, 0);
520 ctx.expectError(GL_INVALID_VALUE);
521 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6, 1, 1, 0, divRoundUp(1, 6) * divRoundUp(1, 6) * 16 - 1, 0);
522 ctx.expectError(GL_INVALID_VALUE);
523 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5, 1, 1, 0, divRoundUp(1, 8) * divRoundUp(1, 5) * 16 - 1, 0);
524 ctx.expectError(GL_INVALID_VALUE);
525 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6, 1, 1, 0, divRoundUp(1, 8) * divRoundUp(1, 6) * 16 - 1, 0);
526 ctx.expectError(GL_INVALID_VALUE);
527 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8, 1, 1, 0, divRoundUp(1, 8) * divRoundUp(1, 8) * 16 - 1, 0);
528 ctx.expectError(GL_INVALID_VALUE);
529 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5, 1, 1, 0, divRoundUp(1, 10) * divRoundUp(1, 5) * 16 - 1, 0);
530 ctx.expectError(GL_INVALID_VALUE);
531 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6, 1, 1, 0, divRoundUp(1, 10) * divRoundUp(1, 6) * 16 - 1, 0);
532 ctx.expectError(GL_INVALID_VALUE);
533 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8, 1, 1, 0, divRoundUp(1, 10) * divRoundUp(1, 8) * 16 - 1, 0);
534 ctx.expectError(GL_INVALID_VALUE);
535 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10, 1, 1, 0, divRoundUp(1, 10) * divRoundUp(1, 10) * 16 - 1, 0);
536 ctx.expectError(GL_INVALID_VALUE);
537 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10, 1, 1, 0, divRoundUp(1, 12) * divRoundUp(1, 10) * 16 - 1, 0);
538 ctx.expectError(GL_INVALID_VALUE);
539 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12, 1, 1, 0, divRoundUp(1, 12) * divRoundUp(1, 12) * 16 - 1, 0);
540 ctx.expectError(GL_INVALID_VALUE);
541 }
542 ctx.endSection();
543 }
544
compressedteximage2d_neg_size(NegativeTestContext & ctx)545 void compressedteximage2d_neg_size (NegativeTestContext& ctx)
546 {
547 ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is negative.");
548 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_R11_EAC, 0, 0, 0, -1, 0);
549 ctx.expectError(GL_INVALID_VALUE);
550 ctx.endSection();
551 }
552
compressedteximage2d_invalid_width_height(NegativeTestContext & ctx)553 void compressedteximage2d_invalid_width_height (NegativeTestContext& ctx)
554 {
555 ctx.beginSection("GL_INVALID_VALUE is generated if target is a cube map face and width and height are not equal.");
556
557 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
558 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_R11_EAC, 1, 2, 0, divRoundUp(1, 4) * divRoundUp(2, 4) * 8, 0);
559 ctx.expectError(GL_INVALID_VALUE);
560 ctx.endSection();
561
562 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
563 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_R11_EAC, 1, 2, 0, divRoundUp(1, 4) * divRoundUp(2, 4) * 8, 0);
564 ctx.expectError(GL_INVALID_VALUE);
565 ctx.endSection();
566
567 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target");
568 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_R11_EAC, 1, 2, 0, divRoundUp(1, 4) * divRoundUp(2, 4) * 8, 0);
569 ctx.expectError(GL_INVALID_VALUE);
570 ctx.endSection();
571
572 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
573 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_R11_EAC, 1, 2, 0, divRoundUp(1, 4) * divRoundUp(2, 4) * 8, 0);
574 ctx.expectError(GL_INVALID_VALUE);
575 ctx.endSection();
576
577 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
578 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_R11_EAC, 1, 2, 0, divRoundUp(1, 4) * divRoundUp(2, 4) * 8, 0);
579 ctx.expectError(GL_INVALID_VALUE);
580 ctx.endSection();
581
582 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
583 ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_R11_EAC, 1, 2, 0, divRoundUp(1, 4) * divRoundUp(2, 4) * 8, 0);
584 ctx.expectError(GL_INVALID_VALUE);
585 ctx.endSection();
586
587 ctx.endSection();
588 }
589
compressedteximage2d_invalid_buffer_target(NegativeTestContext & ctx)590 void compressedteximage2d_invalid_buffer_target (NegativeTestContext& ctx)
591 {
592 deUint32 buf = 1234;
593 std::vector<GLubyte> data(64);
594
595 ctx.glGenBuffers (1, &buf);
596 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
597 ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY);
598 ctx.expectError (GL_NO_ERROR);
599
600 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.");
601 ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT);
602 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 4, 4, 0, etc2DataSize(4, 4), 0);
603 ctx.expectError (GL_INVALID_OPERATION);
604 ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
605 ctx.endSection();
606
607 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.");
608 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 0, etc2DataSize(16, 16), 0);
609 ctx.expectError (GL_INVALID_OPERATION);
610 ctx.endSection();
611
612 ctx.glDeleteBuffers (1, &buf);
613 }
614
615 // glCopyTexImage2D
616
copyteximage2d_invalid_target(NegativeTestContext & ctx)617 void copyteximage2d_invalid_target (NegativeTestContext& ctx)
618 {
619 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
620 ctx.glCopyTexImage2D(0, 0, GL_RGB, 0, 0, 64, 64, 0);
621 ctx.expectError(GL_INVALID_ENUM);
622 ctx.endSection();
623 }
624
copyteximage2d_invalid_format(NegativeTestContext & ctx)625 void copyteximage2d_invalid_format (NegativeTestContext& ctx)
626 {
627 ctx.beginSection("GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not an accepted format.");
628 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 64, 64, 0);
629 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
630 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 16, 16, 0);
631 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
632 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 16, 16, 0);
633 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
634 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 16, 16, 0);
635 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
636 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 16, 16, 0);
637 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
638 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 16, 16, 0);
639 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
640 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 16, 16, 0);
641 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
642 ctx.endSection();
643 }
644
copyteximage2d_inequal_width_height_cube(NegativeTestContext & ctx)645 void copyteximage2d_inequal_width_height_cube (NegativeTestContext& ctx)
646 {
647 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.");
648 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0);
649 ctx.expectError(GL_INVALID_VALUE);
650 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0);
651 ctx.expectError(GL_INVALID_VALUE);
652 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0);
653 ctx.expectError(GL_INVALID_VALUE);
654 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 16, 17, 0);
655 ctx.expectError(GL_INVALID_VALUE);
656 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 16, 17, 0);
657 ctx.expectError(GL_INVALID_VALUE);
658 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 16, 17, 0);
659 ctx.expectError(GL_INVALID_VALUE);
660 ctx.endSection();
661 }
662
copyteximage2d_neg_level(NegativeTestContext & ctx)663 void copyteximage2d_neg_level (NegativeTestContext& ctx)
664 {
665 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
666 ctx.glCopyTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 0, 0, 64, 64, 0);
667 ctx.expectError(GL_INVALID_VALUE);
668 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0);
669 ctx.expectError(GL_INVALID_VALUE);
670 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0);
671 ctx.expectError(GL_INVALID_VALUE);
672 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0);
673 ctx.expectError(GL_INVALID_VALUE);
674 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 0, 0, 16, 16, 0);
675 ctx.expectError(GL_INVALID_VALUE);
676 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 0, 0, 16, 16, 0);
677 ctx.expectError(GL_INVALID_VALUE);
678 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 0, 0, 16, 16, 0);
679 ctx.expectError(GL_INVALID_VALUE);
680 ctx.endSection();
681 }
682
copyteximage2d_max_level(NegativeTestContext & ctx)683 void copyteximage2d_max_level (NegativeTestContext& ctx)
684 {
685 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
686 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
687 ctx.glCopyTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 0, 0, 64, 64, 0);
688 ctx.expectError(GL_INVALID_VALUE);
689 ctx.endSection();
690
691 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
692 deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
693 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0);
694 ctx.expectError(GL_INVALID_VALUE);
695 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0);
696 ctx.expectError(GL_INVALID_VALUE);
697 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0);
698 ctx.expectError(GL_INVALID_VALUE);
699 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0);
700 ctx.expectError(GL_INVALID_VALUE);
701 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0);
702 ctx.expectError(GL_INVALID_VALUE);
703 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_RGB, 0, 0, 16, 16, 0);
704 ctx.expectError(GL_INVALID_VALUE);
705 ctx.endSection();
706 }
707
copyteximage2d_neg_width_height(NegativeTestContext & ctx)708 void copyteximage2d_neg_width_height (NegativeTestContext& ctx)
709 {
710 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0.");
711
712 ctx.beginSection("GL_TEXTURE_2D target");
713 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, 1, 0);
714 ctx.expectError(GL_INVALID_VALUE);
715 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, -1, 0);
716 ctx.expectError(GL_INVALID_VALUE);
717 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, -1, -1, 0);
718 ctx.expectError(GL_INVALID_VALUE);
719 ctx.endSection();
720
721 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
722 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, 1, 0);
723 ctx.expectError(GL_INVALID_VALUE);
724 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, -1, 0);
725 ctx.expectError(GL_INVALID_VALUE);
726 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0);
727 ctx.expectError(GL_INVALID_VALUE);
728 ctx.endSection();
729
730 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
731 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, 1, 0);
732 ctx.expectError(GL_INVALID_VALUE);
733 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, -1, 0);
734 ctx.expectError(GL_INVALID_VALUE);
735 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0);
736 ctx.expectError(GL_INVALID_VALUE);
737 ctx.endSection();
738
739 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target");
740 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, 1, 0);
741 ctx.expectError(GL_INVALID_VALUE);
742 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, -1, 0);
743 ctx.expectError(GL_INVALID_VALUE);
744 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0);
745 ctx.expectError(GL_INVALID_VALUE);
746 ctx.endSection();
747
748 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
749 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, 1, 0);
750 ctx.expectError(GL_INVALID_VALUE);
751 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, -1, 0);
752 ctx.expectError(GL_INVALID_VALUE);
753 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, -1, -1, 0);
754 ctx.expectError(GL_INVALID_VALUE);
755 ctx.endSection();
756
757 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
758 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, 1, 0);
759 ctx.expectError(GL_INVALID_VALUE);
760 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, -1, 0);
761 ctx.expectError(GL_INVALID_VALUE);
762 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, -1, -1, 0);
763 ctx.expectError(GL_INVALID_VALUE);
764 ctx.endSection();
765
766 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
767 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, 1, 0);
768 ctx.expectError(GL_INVALID_VALUE);
769 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, -1, 0);
770 ctx.expectError(GL_INVALID_VALUE);
771 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, -1, -1, 0);
772 ctx.expectError(GL_INVALID_VALUE);
773 ctx.endSection();
774
775 ctx.endSection();
776 }
777
copyteximage2d_max_width_height(NegativeTestContext & ctx)778 void copyteximage2d_max_width_height (NegativeTestContext& ctx)
779 {
780 int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1;
781 int maxCubemapSize = ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
782
783 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
784
785 ctx.beginSection("GL_TEXTURE_2D target");
786 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, 1, 0);
787 ctx.expectError(GL_INVALID_VALUE);
788 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, maxTextureSize, 0);
789 ctx.expectError(GL_INVALID_VALUE);
790 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
791 ctx.expectError(GL_INVALID_VALUE);
792 ctx.endSection();
793
794 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
795 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0);
796 ctx.expectError(GL_INVALID_VALUE);
797 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0);
798 ctx.expectError(GL_INVALID_VALUE);
799 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
800 ctx.expectError(GL_INVALID_VALUE);
801 ctx.endSection();
802
803 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
804 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0);
805 ctx.expectError(GL_INVALID_VALUE);
806 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0);
807 ctx.expectError(GL_INVALID_VALUE);
808 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
809 ctx.expectError(GL_INVALID_VALUE);
810 ctx.endSection();
811
812 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target");
813 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0);
814 ctx.expectError(GL_INVALID_VALUE);
815 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0);
816 ctx.expectError(GL_INVALID_VALUE);
817 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
818 ctx.expectError(GL_INVALID_VALUE);
819 ctx.endSection();
820
821 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
822 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0);
823 ctx.expectError(GL_INVALID_VALUE);
824 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0);
825 ctx.expectError(GL_INVALID_VALUE);
826 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
827 ctx.expectError(GL_INVALID_VALUE);
828 ctx.endSection();
829
830 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
831 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0);
832 ctx.expectError(GL_INVALID_VALUE);
833 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0);
834 ctx.expectError(GL_INVALID_VALUE);
835 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
836 ctx.expectError(GL_INVALID_VALUE);
837 ctx.endSection();
838
839 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
840 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 1, maxCubemapSize, 0);
841 ctx.expectError(GL_INVALID_VALUE);
842 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, 1, 0);
843 ctx.expectError(GL_INVALID_VALUE);
844 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
845 ctx.expectError(GL_INVALID_VALUE);
846 ctx.endSection();
847
848 ctx.endSection();
849 }
850
copyteximage2d_invalid_border(NegativeTestContext & ctx)851 void copyteximage2d_invalid_border (NegativeTestContext& ctx)
852 {
853 ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0.");
854
855 ctx.beginSection("GL_TEXTURE_2D target");
856 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 0, 0, -1);
857 ctx.expectError(GL_INVALID_VALUE);
858 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 0, 0, 1);
859 ctx.expectError(GL_INVALID_VALUE);
860 ctx.endSection();
861
862 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
863 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, 0, -1);
864 ctx.expectError(GL_INVALID_VALUE);
865 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, 0, 1);
866 ctx.expectError(GL_INVALID_VALUE);
867 ctx.endSection();
868
869 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
870 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 0, 0, -1);
871 ctx.expectError(GL_INVALID_VALUE);
872 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 0, 0, 0, 0, 1);
873 ctx.expectError(GL_INVALID_VALUE);
874 ctx.endSection();
875
876 ctx.beginSection("GL_TEXTURE_2D target");
877 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 0, 0, -1);
878 ctx.expectError(GL_INVALID_VALUE);
879 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 0, 0, 0, 0, 1);
880 ctx.expectError(GL_INVALID_VALUE);
881 ctx.endSection();
882
883 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
884 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 0, 0, -1);
885 ctx.expectError(GL_INVALID_VALUE);
886 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 0, 0, 0, 0, 1);
887 ctx.expectError(GL_INVALID_VALUE);
888 ctx.endSection();
889
890 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
891 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 0, 0, -1);
892 ctx.expectError(GL_INVALID_VALUE);
893 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 0, 0, 0, 0, 1);
894 ctx.expectError(GL_INVALID_VALUE);
895 ctx.endSection();
896
897 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
898 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 0, 0, -1);
899 ctx.expectError(GL_INVALID_VALUE);
900 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 0, 0, 0, 0, 1);
901 ctx.expectError(GL_INVALID_VALUE);
902 ctx.endSection();
903
904 ctx.endSection();
905 }
906
copyteximage2d_incomplete_framebuffer(NegativeTestContext & ctx)907 void copyteximage2d_incomplete_framebuffer (NegativeTestContext& ctx)
908 {
909 GLuint fbo = 0x1234;
910 ctx.glGenFramebuffers (1, &fbo);
911 ctx.glBindFramebuffer (GL_FRAMEBUFFER, fbo);
912 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
913
914 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
915 ctx.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, 0, 0, 0);
916 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
917 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA8, 0, 0, 0, 0, 0);
918 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
919 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA8, 0, 0, 0, 0, 0);
920 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
921 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA8, 0, 0, 0, 0, 0);
922 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
923 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA8, 0, 0, 0, 0, 0);
924 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
925 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA8, 0, 0, 0, 0, 0);
926 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
927 ctx.glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA8, 0, 0, 0, 0, 0);
928 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
929 ctx.endSection();
930
931 ctx.glBindFramebuffer (GL_FRAMEBUFFER, 0);
932 ctx.glDeleteFramebuffers(1, &fbo);
933 }
934
copytexsubimage2d_invalid_target(NegativeTestContext & ctx)935 void copytexsubimage2d_invalid_target (NegativeTestContext& ctx)
936 {
937 GLuint texture = 0x1234;
938 ctx.glGenTextures (1, &texture);
939 ctx.glBindTexture (GL_TEXTURE_2D, texture);
940 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
941
942 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
943 ctx.glCopyTexSubImage2D(0, 0, 0, 0, 0, 0, 4, 4);
944 ctx.expectError(GL_INVALID_ENUM);
945 ctx.endSection();
946
947 ctx.glDeleteTextures(1, &texture);
948 }
copytexsubimage2d_read_buffer_is_none(NegativeTestContext & ctx)949 void copytexsubimage2d_read_buffer_is_none (NegativeTestContext& ctx)
950 {
951 GLuint texture = 0x1234;
952 ctx.glGenTextures (1, &texture);
953 ctx.glBindTexture (GL_TEXTURE_2D, texture);
954 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
955
956 ctx.beginSection("GL_INVALID_OPERATION is generated if the read buffer is NONE");
957 ctx.glReadBuffer(GL_NONE);
958 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4);
959 ctx.expectError(GL_INVALID_OPERATION);
960 ctx.endSection();
961
962 ctx.glDeleteTextures(1, &texture);
963 }
964
copytexsubimage2d_texture_internalformat(NegativeTestContext & ctx)965 void copytexsubimage2d_texture_internalformat (NegativeTestContext& ctx)
966 {
967 GLuint texture = 0x1234;
968 ctx.glGenTextures (1, &texture);
969 ctx.glBindTexture (GL_TEXTURE_2D, texture);
970 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB9_E5, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
971
972 ctx.beginSection("GL_INVALID_OPERATION is generated if internal format of the texture is GL_RGB9_E5");
973 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4);
974 ctx.expectError(GL_INVALID_OPERATION);
975 ctx.endSection();
976
977 ctx.glDeleteTextures(1, &texture);
978 }
979
copytexsubimage2d_neg_level(NegativeTestContext & ctx)980 void copytexsubimage2d_neg_level (NegativeTestContext& ctx)
981 {
982 GLuint textures[2];
983 ctx.glGenTextures (2, &textures[0]);
984 ctx.glBindTexture (GL_TEXTURE_2D, textures[0]);
985 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
986 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]);
987 FOR_CUBE_FACES(faceGL, ctx.glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0););
988
989 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
990 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, 4, 4);
991 ctx.expectError(GL_INVALID_VALUE);
992 FOR_CUBE_FACES(faceGL,
993 {
994 ctx.glCopyTexSubImage2D(faceGL, -1, 0, 0, 0, 0, 4, 4);
995 ctx.expectError(GL_INVALID_VALUE);
996 });
997 ctx.endSection();
998
999 ctx.glDeleteTextures(2, &textures[0]);
1000 }
1001
copytexsubimage2d_max_level(NegativeTestContext & ctx)1002 void copytexsubimage2d_max_level (NegativeTestContext& ctx)
1003 {
1004 GLuint textures[2];
1005 ctx.glGenTextures (2, &textures[0]);
1006 ctx.glBindTexture (GL_TEXTURE_2D, textures[0]);
1007 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1008 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]);
1009 FOR_CUBE_FACES(faceGL, ctx.glTexImage2D(faceGL, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0););
1010
1011 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE) for 2D texture targets.");
1012 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
1013 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, 4, 4);
1014 ctx.expectError(GL_INVALID_VALUE);
1015 ctx.endSection();
1016
1017 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_SIZE) for cubemap targets.");
1018 deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1019 FOR_CUBE_FACES(faceGL,
1020 {
1021 ctx.glCopyTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, 4, 4);
1022 ctx.expectError(GL_INVALID_VALUE);
1023 });
1024 ctx.endSection();
1025
1026 ctx.glDeleteTextures(2, &textures[0]);
1027 }
1028
copytexsubimage2d_neg_offset(NegativeTestContext & ctx)1029 void copytexsubimage2d_neg_offset (NegativeTestContext& ctx)
1030 {
1031 GLuint texture = 0x1234;
1032 ctx.glGenTextures (1, &texture);
1033 ctx.glBindTexture (GL_TEXTURE_2D, texture);
1034 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1035
1036 ctx.beginSection("GL_INVALID_VALUE is generated if xoffset < 0 or yoffset < 0.");
1037 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, 4, 4);
1038 ctx.expectError(GL_INVALID_VALUE);
1039 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, 4, 4);
1040 ctx.expectError(GL_INVALID_VALUE);
1041 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, 4, 4);
1042 ctx.expectError(GL_INVALID_VALUE);
1043 ctx.endSection();
1044
1045 ctx.glDeleteTextures(1, &texture);
1046 }
1047
copytexsubimage2d_invalid_offset(NegativeTestContext & ctx)1048 void copytexsubimage2d_invalid_offset (NegativeTestContext& ctx)
1049 {
1050 GLuint texture = 0x1234;
1051 ctx.glGenTextures (1, &texture);
1052 ctx.glBindTexture (GL_TEXTURE_2D, texture);
1053 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1054
1055 ctx.beginSection("GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
1056 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 14, 0, 0, 0, 4, 4);
1057 ctx.expectError(GL_INVALID_VALUE);
1058 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 14, 0, 0, 4, 4);
1059 ctx.expectError(GL_INVALID_VALUE);
1060 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 14, 14, 0, 0, 4, 4);
1061 ctx.expectError(GL_INVALID_VALUE);
1062 ctx.endSection();
1063
1064 ctx.glDeleteTextures(1, &texture);
1065 }
1066
copytexsubimage2d_neg_width_height(NegativeTestContext & ctx)1067 void copytexsubimage2d_neg_width_height (NegativeTestContext& ctx)
1068 {
1069 GLuint texture = 0x1234;
1070 ctx.glGenTextures (1, &texture);
1071 ctx.glBindTexture (GL_TEXTURE_2D, texture);
1072 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1073
1074 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0.");
1075 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, 0);
1076 ctx.expectError(GL_INVALID_VALUE);
1077 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, -1);
1078 ctx.expectError(GL_INVALID_VALUE);
1079 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, -1, -1);
1080 ctx.expectError(GL_INVALID_VALUE);
1081 ctx.endSection();
1082
1083 ctx.glDeleteTextures(1, &texture);
1084 }
1085
copytexsubimage2d_incomplete_framebuffer(NegativeTestContext & ctx)1086 void copytexsubimage2d_incomplete_framebuffer (NegativeTestContext& ctx)
1087 {
1088 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1089
1090 GLuint texture[2];
1091 GLuint fbo = 0x1234;
1092
1093 ctx.glGenTextures (2, texture);
1094 ctx.glBindTexture (GL_TEXTURE_2D, texture[0]);
1095 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1096 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, texture[1]);
1097 ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1098 ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1099 ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1100 ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1101 ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1102 ctx.glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1103 ctx.expectError(GL_NO_ERROR);
1104
1105 ctx.glGenFramebuffers(1, &fbo);
1106 ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1107 ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1108 ctx.expectError(GL_NO_ERROR);
1109
1110 ctx.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);
1111 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1112 ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0);
1113 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1114 ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0);
1115 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1116 ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0);
1117 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1118 ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0);
1119 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1120 ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0);
1121 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1122 ctx.glCopyTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0);
1123 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1124
1125 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1126 ctx.glDeleteFramebuffers(1, &fbo);
1127 ctx.glDeleteTextures(2, texture);
1128
1129 ctx.endSection();
1130 }
1131
1132 // glDeleteTextures
1133
deletetextures(NegativeTestContext & ctx)1134 void deletetextures (NegativeTestContext& ctx)
1135 {
1136 GLuint texture = 0x1234;
1137 ctx.glGenTextures(1, &texture);
1138
1139 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1140 ctx.glDeleteTextures(-1, 0);
1141 ctx.expectError(GL_INVALID_VALUE);
1142
1143 ctx.glBindTexture(GL_TEXTURE_2D, texture);
1144 ctx.glDeleteTextures(-1, 0);
1145 ctx.expectError(GL_INVALID_VALUE);
1146 ctx.endSection();
1147
1148 ctx.glDeleteTextures(1, &texture);
1149 }
1150
1151 // glGenerateMipmap
1152
generatemipmap(NegativeTestContext & ctx)1153 void generatemipmap (NegativeTestContext& ctx)
1154 {
1155 GLuint texture[2];
1156 ctx.glGenTextures(2, texture);
1157
1158 ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.");
1159 ctx.glGenerateMipmap(0);
1160 ctx.expectError(GL_INVALID_ENUM);
1161 ctx.endSection();
1162
1163 ctx.beginSection("INVALID_OPERATION is generated if the texture bound to target is not cube complete.");
1164 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]);
1165 ctx.glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_REPEAT);
1166 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1167 ctx.glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
1168 ctx.expectError(GL_INVALID_OPERATION);
1169
1170 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texture[0]);
1171 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1172 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1173 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1174 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1175 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1176 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1177 ctx.glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
1178 ctx.expectError(GL_INVALID_OPERATION);
1179 ctx.endSection();
1180
1181 ctx.beginSection("GL_INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format.");
1182 ctx.glBindTexture(GL_TEXTURE_2D, texture[1]);
1183 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0);
1184 ctx.glGenerateMipmap(GL_TEXTURE_2D);
1185 ctx.expectError(GL_INVALID_OPERATION);
1186 ctx.endSection();
1187
1188 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.");
1189 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8_SNORM, 0, 0, 0, GL_RGB, GL_BYTE, 0);
1190 ctx.glGenerateMipmap(GL_TEXTURE_2D);
1191 ctx.expectError(GL_INVALID_OPERATION);
1192 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_R8I, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, 0);
1193 ctx.glGenerateMipmap(GL_TEXTURE_2D);
1194 ctx.expectError(GL_INVALID_OPERATION);
1195
1196 if (!(ctx.getContextInfo().isExtensionSupported("GL_EXT_color_buffer_float") && ctx.getContextInfo().isExtensionSupported("GL_OES_texture_float_linear")))
1197 {
1198 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 0, 0, 0, GL_RGBA, GL_FLOAT, 0);
1199 ctx.glGenerateMipmap(GL_TEXTURE_2D);
1200 ctx.expectError(GL_INVALID_OPERATION);
1201 }
1202
1203 ctx.endSection();
1204
1205 ctx.glDeleteTextures(2, texture);
1206 }
1207
1208 // glGenTextures
1209
gentextures(NegativeTestContext & ctx)1210 void gentextures (NegativeTestContext& ctx)
1211 {
1212 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1213 ctx.glGenTextures(-1, 0);
1214 ctx.expectError(GL_INVALID_VALUE);
1215 ctx.endSection();
1216 }
1217
1218 // glPixelStorei
1219
pixelstorei(NegativeTestContext & ctx)1220 void pixelstorei (NegativeTestContext& ctx)
1221 {
1222 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1223 ctx.glPixelStorei(0,1);
1224 ctx.expectError(GL_INVALID_ENUM);
1225 ctx.endSection();
1226
1227 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.");
1228 ctx.glPixelStorei(GL_PACK_ROW_LENGTH, -1);
1229 ctx.expectError(GL_INVALID_VALUE);
1230 ctx.glPixelStorei(GL_PACK_SKIP_ROWS, -1);
1231 ctx.expectError(GL_INVALID_VALUE);
1232 ctx.glPixelStorei(GL_PACK_SKIP_PIXELS, -1);
1233 ctx.expectError(GL_INVALID_VALUE);
1234 ctx.glPixelStorei(GL_UNPACK_ROW_LENGTH, -1);
1235 ctx.expectError(GL_INVALID_VALUE);
1236 ctx.glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, -1);
1237 ctx.expectError(GL_INVALID_VALUE);
1238 ctx.glPixelStorei(GL_UNPACK_SKIP_ROWS, -1);
1239 ctx.expectError(GL_INVALID_VALUE);
1240 ctx.glPixelStorei(GL_UNPACK_SKIP_PIXELS, -1);
1241 ctx.expectError(GL_INVALID_VALUE);
1242 ctx.glPixelStorei(GL_UNPACK_SKIP_IMAGES, -1);
1243 ctx.expectError(GL_INVALID_VALUE);
1244 ctx.glPixelStorei(GL_PACK_ALIGNMENT, 0);
1245 ctx.expectError(GL_INVALID_VALUE);
1246 ctx.glPixelStorei(GL_UNPACK_ALIGNMENT, 0);
1247 ctx.expectError(GL_INVALID_VALUE);
1248 ctx.glPixelStorei(GL_PACK_ALIGNMENT, 16);
1249 ctx.expectError(GL_INVALID_VALUE);
1250 ctx.glPixelStorei(GL_UNPACK_ALIGNMENT, 16);
1251 ctx.expectError(GL_INVALID_VALUE);
1252 ctx.endSection();
1253 }
1254
1255 // glTexImage2D
1256
teximage2d(NegativeTestContext & ctx)1257 void teximage2d (NegativeTestContext& ctx)
1258 {
1259 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
1260 ctx.glTexImage2D(0, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1261 ctx.expectError(GL_INVALID_ENUM);
1262 ctx.endSection();
1263
1264 ctx.beginSection("GL_INVALID_ENUM is generated if type is not a type constant.");
1265 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, 0, 0);
1266 ctx.expectError(GL_INVALID_ENUM);
1267 ctx.endSection();
1268
1269 ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid.");
1270 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1271 ctx.expectError(GL_INVALID_OPERATION);
1272 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0);
1273 ctx.expectError(GL_INVALID_OPERATION);
1274 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5_A1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
1275 ctx.expectError(GL_INVALID_OPERATION);
1276 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB10_A2, 1, 1, 0, GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV, 0);
1277 ctx.expectError(GL_INVALID_OPERATION);
1278 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0);
1279 ctx.expectError(GL_INVALID_OPERATION);
1280 ctx.endSection();
1281 }
1282
teximage2d_inequal_width_height_cube(NegativeTestContext & ctx)1283 void teximage2d_inequal_width_height_cube (NegativeTestContext& ctx)
1284 {
1285 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.");
1286 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1287 ctx.expectError(GL_INVALID_VALUE);
1288 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1289 ctx.expectError(GL_INVALID_VALUE);
1290 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1291 ctx.expectError(GL_INVALID_VALUE);
1292 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1293 ctx.expectError(GL_INVALID_VALUE);
1294 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1295 ctx.expectError(GL_INVALID_VALUE);
1296 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1297 ctx.expectError(GL_INVALID_VALUE);
1298 ctx.endSection();
1299 }
1300
teximage2d_neg_level(NegativeTestContext & ctx)1301 void teximage2d_neg_level (NegativeTestContext& ctx)
1302 {
1303 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
1304 ctx.glTexImage2D(GL_TEXTURE_2D, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1305 ctx.expectError(GL_INVALID_VALUE);
1306 ctx.endSection();
1307
1308 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
1309 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1310 ctx.expectError(GL_INVALID_VALUE);
1311 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1312 ctx.expectError(GL_INVALID_VALUE);
1313 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1314 ctx.expectError(GL_INVALID_VALUE);
1315 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1316 ctx.expectError(GL_INVALID_VALUE);
1317 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1318 ctx.expectError(GL_INVALID_VALUE);
1319 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1320 ctx.expectError(GL_INVALID_VALUE);
1321 ctx.endSection();
1322 }
1323
teximage2d_max_level(NegativeTestContext & ctx)1324 void teximage2d_max_level (NegativeTestContext& ctx)
1325 {
1326 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
1327 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
1328 ctx.glTexImage2D(GL_TEXTURE_2D, log2MaxTextureSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1329 ctx.expectError(GL_INVALID_VALUE);
1330 ctx.endSection();
1331
1332 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
1333 deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1334 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1335 ctx.expectError(GL_INVALID_VALUE);
1336 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1337 ctx.expectError(GL_INVALID_VALUE);
1338 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1339 ctx.expectError(GL_INVALID_VALUE);
1340 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1341 ctx.expectError(GL_INVALID_VALUE);
1342 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1343 ctx.expectError(GL_INVALID_VALUE);
1344 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1345 ctx.expectError(GL_INVALID_VALUE);
1346 ctx.endSection();
1347 }
1348
teximage2d_neg_width_height(NegativeTestContext & ctx)1349 void teximage2d_neg_width_height (NegativeTestContext& ctx)
1350 {
1351 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0.");
1352
1353 ctx.beginSection("GL_TEXTURE_2D target");
1354 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1355 ctx.expectError(GL_INVALID_VALUE);
1356 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1357 ctx.expectError(GL_INVALID_VALUE);
1358 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1359 ctx.expectError(GL_INVALID_VALUE);
1360 ctx.endSection();
1361
1362 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
1363 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1364 ctx.expectError(GL_INVALID_VALUE);
1365 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1366 ctx.expectError(GL_INVALID_VALUE);
1367 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1368 ctx.expectError(GL_INVALID_VALUE);
1369 ctx.endSection();
1370
1371 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
1372 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1373 ctx.expectError(GL_INVALID_VALUE);
1374 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1375 ctx.expectError(GL_INVALID_VALUE);
1376 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1377 ctx.expectError(GL_INVALID_VALUE);
1378 ctx.endSection();
1379
1380 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target");
1381 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1382 ctx.expectError(GL_INVALID_VALUE);
1383 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1384 ctx.expectError(GL_INVALID_VALUE);
1385 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1386 ctx.expectError(GL_INVALID_VALUE);
1387 ctx.endSection();
1388
1389 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
1390 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1391 ctx.expectError(GL_INVALID_VALUE);
1392 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1393 ctx.expectError(GL_INVALID_VALUE);
1394 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1395 ctx.expectError(GL_INVALID_VALUE);
1396 ctx.endSection();
1397
1398 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
1399 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1400 ctx.expectError(GL_INVALID_VALUE);
1401 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1402 ctx.expectError(GL_INVALID_VALUE);
1403 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1404 ctx.expectError(GL_INVALID_VALUE);
1405 ctx.endSection();
1406
1407 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
1408 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1409 ctx.expectError(GL_INVALID_VALUE);
1410 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1411 ctx.expectError(GL_INVALID_VALUE);
1412 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, -1, -1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1413 ctx.expectError(GL_INVALID_VALUE);
1414 ctx.endSection();
1415
1416 ctx.endSection();
1417 }
1418
teximage2d_max_width_height(NegativeTestContext & ctx)1419 void teximage2d_max_width_height (NegativeTestContext& ctx)
1420 {
1421 int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1;
1422 int maxCubemapSize = ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE) + 1;
1423
1424 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_TEXTURE_SIZE.");
1425 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1426 ctx.expectError(GL_INVALID_VALUE);
1427 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1428 ctx.expectError(GL_INVALID_VALUE);
1429 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maxTextureSize, maxTextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1430 ctx.expectError(GL_INVALID_VALUE);
1431 ctx.endSection();
1432
1433 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_CUBE_MAP_TEXTURE_SIZE.");
1434
1435 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target");
1436 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1437 ctx.expectError(GL_INVALID_VALUE);
1438 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1439 ctx.expectError(GL_INVALID_VALUE);
1440 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1441 ctx.expectError(GL_INVALID_VALUE);
1442 ctx.endSection();
1443
1444 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target");
1445 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1446 ctx.expectError(GL_INVALID_VALUE);
1447 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1448 ctx.expectError(GL_INVALID_VALUE);
1449 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1450 ctx.expectError(GL_INVALID_VALUE);
1451 ctx.endSection();
1452
1453 ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target");
1454 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1455 ctx.expectError(GL_INVALID_VALUE);
1456 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1457 ctx.expectError(GL_INVALID_VALUE);
1458 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1459 ctx.expectError(GL_INVALID_VALUE);
1460 ctx.endSection();
1461
1462 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target");
1463 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1464 ctx.expectError(GL_INVALID_VALUE);
1465 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1466 ctx.expectError(GL_INVALID_VALUE);
1467 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1468 ctx.expectError(GL_INVALID_VALUE);
1469 ctx.endSection();
1470
1471 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target");
1472 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1473 ctx.expectError(GL_INVALID_VALUE);
1474 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1475 ctx.expectError(GL_INVALID_VALUE);
1476 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1477 ctx.expectError(GL_INVALID_VALUE);
1478 ctx.endSection();
1479
1480 ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target");
1481 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxCubemapSize, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1482 ctx.expectError(GL_INVALID_VALUE);
1483 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1484 ctx.expectError(GL_INVALID_VALUE);
1485 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, maxCubemapSize, maxCubemapSize, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1486 ctx.expectError(GL_INVALID_VALUE);
1487 ctx.endSection();
1488
1489 ctx.endSection();
1490 }
1491
teximage2d_invalid_border(NegativeTestContext & ctx)1492 void teximage2d_invalid_border (NegativeTestContext& ctx)
1493 {
1494 ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0.");
1495 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1496 ctx.expectError(GL_INVALID_VALUE);
1497 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1498 ctx.expectError(GL_INVALID_VALUE);
1499 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1500 ctx.expectError(GL_INVALID_VALUE);
1501 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1502 ctx.expectError(GL_INVALID_VALUE);
1503 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1504 ctx.expectError(GL_INVALID_VALUE);
1505 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1506 ctx.expectError(GL_INVALID_VALUE);
1507 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1508 ctx.expectError(GL_INVALID_VALUE);
1509 ctx.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, 0);
1510 ctx.expectError(GL_INVALID_VALUE);
1511 ctx.endSection();
1512 }
1513
teximage2d_invalid_buffer_target(NegativeTestContext & ctx)1514 void teximage2d_invalid_buffer_target (NegativeTestContext& ctx)
1515 {
1516 deUint32 buf = 0x1234;
1517 deUint32 texture = 0x1234;
1518 std::vector<GLubyte> data(64);
1519
1520 ctx.glGenBuffers (1, &buf);
1521 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
1522 ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY);
1523 ctx.glGenTextures (1, &texture);
1524 ctx.glBindTexture (GL_TEXTURE_2D, texture);
1525 ctx.expectError (GL_NO_ERROR);
1526
1527 ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and...");
1528 ctx.beginSection("...the buffer object's data store is currently mapped.");
1529 ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT);
1530 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1531 ctx.expectError (GL_INVALID_OPERATION);
1532 ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
1533 ctx.endSection();
1534
1535 ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.");
1536 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1537 ctx.expectError (GL_INVALID_OPERATION);
1538 ctx.endSection();
1539
1540 ctx.beginSection("...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type.");
1541 ctx.getLog() << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage;
1542 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB5_A1, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (const GLvoid*)3);
1543 ctx.expectError (GL_INVALID_OPERATION);
1544 ctx.endSection();
1545 ctx.endSection();
1546
1547 ctx.glDeleteBuffers (1, &buf);
1548 ctx.glDeleteTextures (1, &texture);
1549 }
1550
1551 // glTexSubImage2D
1552
texsubimage2d(NegativeTestContext & ctx)1553 void texsubimage2d (NegativeTestContext& ctx)
1554 {
1555 deUint32 texture = 0x1234;
1556 ctx.glGenTextures (1, &texture);
1557 ctx.glBindTexture (GL_TEXTURE_2D, texture);
1558 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1559 ctx.expectError (GL_NO_ERROR);
1560
1561 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
1562 ctx.glTexSubImage2D(0, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1563 ctx.expectError(GL_INVALID_ENUM);
1564 ctx.endSection();
1565
1566 ctx.beginSection("GL_INVALID_ENUM is generated if format is not an accepted format constant.");
1567 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 4, 4, GL_UNSIGNED_BYTE, 0);
1568 ctx.expectError(GL_INVALID_ENUM);
1569 ctx.endSection();
1570
1571 ctx.beginSection("GL_INVALID_ENUM is generated if type is not a type constant.");
1572 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, 0, 0);
1573 ctx.expectError(GL_INVALID_ENUM);
1574 ctx.endSection();
1575
1576 ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid.");
1577 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, 0);
1578 ctx.expectError(GL_INVALID_OPERATION);
1579 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0);
1580 ctx.expectError(GL_INVALID_OPERATION);
1581 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
1582 ctx.expectError(GL_INVALID_OPERATION);
1583 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
1584 ctx.expectError(GL_INVALID_OPERATION);
1585 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0);
1586 ctx.expectError(GL_INVALID_OPERATION);
1587 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_FLOAT, 0);
1588 ctx.expectError(GL_INVALID_OPERATION);
1589 ctx.endSection();
1590
1591 ctx.glDeleteTextures (1, &texture);
1592 }
1593
texsubimage2d_neg_level(NegativeTestContext & ctx)1594 void texsubimage2d_neg_level (NegativeTestContext& ctx)
1595 {
1596 deUint32 textures[2];
1597 ctx.glGenTextures (2, &textures[0]);
1598 ctx.glBindTexture (GL_TEXTURE_2D, textures[0]);
1599 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1600 ctx.glBindTexture (GL_TEXTURE_2D, textures[1]);
1601 FOR_CUBE_FACES(faceGL, ctx.glTexImage2D(faceGL, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0););
1602 ctx.expectError (GL_NO_ERROR);
1603
1604 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
1605 ctx.glTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1606 ctx.expectError(GL_INVALID_VALUE);
1607 ctx.endSection();
1608
1609 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
1610 FOR_CUBE_FACES(faceGL,
1611 {
1612 ctx.glTexSubImage2D(faceGL, -1, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1613 ctx.expectError(GL_INVALID_VALUE);
1614 });
1615 ctx.endSection();
1616
1617 ctx.glDeleteTextures(2, &textures[0]);
1618 }
1619
texsubimage2d_max_level(NegativeTestContext & ctx)1620 void texsubimage2d_max_level (NegativeTestContext& ctx)
1621 {
1622 deUint32 textures[2];
1623 ctx.glGenTextures (2, &textures[0]);
1624 ctx.glBindTexture (GL_TEXTURE_2D, textures[0]);
1625 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1626 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]);
1627 FOR_CUBE_FACES(faceGL, ctx.glTexImage2D(faceGL, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0););
1628 ctx.expectError (GL_NO_ERROR);
1629
1630 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
1631 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
1632 ctx.glTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1633 ctx.expectError(GL_INVALID_VALUE);
1634 ctx.endSection();
1635
1636 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
1637 deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1638 FOR_CUBE_FACES(faceGL,
1639 {
1640 ctx.glTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1641 ctx.expectError(GL_INVALID_VALUE);
1642 });
1643 ctx.endSection();
1644
1645 ctx.glDeleteTextures(2, &textures[0]);
1646 }
1647
texsubimage2d_neg_offset(NegativeTestContext & ctx)1648 void texsubimage2d_neg_offset (NegativeTestContext& ctx)
1649 {
1650 deUint32 texture = 0x1234;
1651 ctx.glGenTextures(1, &texture);
1652 ctx.glBindTexture(GL_TEXTURE_2D, texture);
1653 ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1654 ctx.expectError(GL_NO_ERROR);
1655
1656 ctx.beginSection("GL_INVALID_VALUE is generated if xoffset or yoffset are negative.");
1657 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, -1, 0, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1658 ctx.expectError(GL_INVALID_VALUE);
1659 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, -1, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1660 ctx.expectError(GL_INVALID_VALUE);
1661 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, -1, -1, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1662 ctx.expectError(GL_INVALID_VALUE);
1663 ctx.endSection();
1664
1665 ctx.glDeleteTextures(1, &texture);
1666 }
1667
texsubimage2d_invalid_offset(NegativeTestContext & ctx)1668 void texsubimage2d_invalid_offset (NegativeTestContext& ctx)
1669 {
1670 deUint32 texture = 0x1234;
1671 ctx.glGenTextures (1, &texture);
1672 ctx.glBindTexture (GL_TEXTURE_2D, texture);
1673 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1674 ctx.expectError (GL_NO_ERROR);
1675
1676 ctx.beginSection("GL_INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
1677 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 30, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1678 ctx.expectError(GL_INVALID_VALUE);
1679 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 30, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1680 ctx.expectError(GL_INVALID_VALUE);
1681 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 30, 30, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1682 ctx.expectError(GL_INVALID_VALUE);
1683 ctx.endSection();
1684
1685 ctx.glDeleteTextures (1, &texture);
1686 }
1687
texsubimage2d_neg_width_height(NegativeTestContext & ctx)1688 void texsubimage2d_neg_width_height (NegativeTestContext& ctx)
1689 {
1690 deUint32 texture = 0x1234;
1691 ctx.glGenTextures (1, &texture);
1692 ctx.glBindTexture (GL_TEXTURE_2D, texture);
1693 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1694 ctx.expectError (GL_NO_ERROR);
1695
1696 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0.");
1697 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1698 ctx.expectError(GL_INVALID_VALUE);
1699 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1700 ctx.expectError(GL_INVALID_VALUE);
1701 ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1702 ctx.expectError(GL_INVALID_VALUE);
1703 ctx.endSection();
1704
1705 ctx.glDeleteTextures (1, &texture);
1706 }
1707
texsubimage2d_invalid_buffer_target(NegativeTestContext & ctx)1708 void texsubimage2d_invalid_buffer_target (NegativeTestContext& ctx)
1709 {
1710 deUint32 buf = 0x1234;
1711 deUint32 texture = 0x1234;
1712 std::vector<GLubyte> data(64);
1713
1714 ctx.glGenTextures (1, &texture);
1715 ctx.glBindTexture (GL_TEXTURE_2D, texture);
1716 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1717 ctx.glGenBuffers (1, &buf);
1718 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
1719 ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY);
1720 ctx.expectError (GL_NO_ERROR);
1721
1722 ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and...");
1723 ctx.beginSection("...the buffer object's data store is currently mapped.");
1724 ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 32, GL_MAP_WRITE_BIT);
1725 ctx.glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1726 ctx.expectError (GL_INVALID_OPERATION);
1727 ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
1728 ctx.endSection();
1729
1730 ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.");
1731 ctx.glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 32, 32, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1732 ctx.expectError (GL_INVALID_OPERATION);
1733 ctx.endSection();
1734
1735 ctx.beginSection("...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type.");
1736 ctx.getLog() << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage;
1737 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
1738 ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 0);
1739 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
1740 ctx.expectError (GL_NO_ERROR);
1741 ctx.glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (const GLvoid*)3);
1742 ctx.expectError (GL_INVALID_OPERATION);
1743 ctx.endSection();
1744 ctx.endSection();
1745
1746 ctx.glDeleteBuffers (1, &buf);
1747 ctx.glDeleteTextures (1, &texture);
1748 }
1749
1750 // glTexParameteri
1751
texparameteri(NegativeTestContext & ctx)1752 void texparameteri (NegativeTestContext& ctx)
1753 {
1754 GLuint texture = 0x1234;
1755 GLint textureMode = -1;
1756
1757 ctx.glGenTextures(1, &texture);
1758 ctx.glBindTexture(GL_TEXTURE_2D, texture);
1759
1760 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1761 ctx.glTexParameteri(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1762 ctx.expectError(GL_INVALID_ENUM);
1763 ctx.glTexParameteri(GL_TEXTURE_2D, 0, GL_LINEAR);
1764 ctx.expectError(GL_INVALID_ENUM);
1765 ctx.glTexParameteri(0, 0, GL_LINEAR);
1766 ctx.expectError(GL_INVALID_ENUM);
1767 ctx.endSection();
1768
1769 ctx.beginSection("GL_INVALID_ENUM is generated if pname is enum and the value of param(s) is not a valid value.");
1770 ctx.glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, textureMode);
1771 ctx.expectError(GL_INVALID_ENUM);
1772 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, textureMode);
1773 ctx.expectError(GL_INVALID_ENUM);
1774 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, textureMode);
1775 ctx.expectError(GL_INVALID_ENUM);
1776 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, textureMode);
1777 ctx.expectError(GL_INVALID_ENUM);
1778 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, textureMode);
1779 ctx.expectError(GL_INVALID_ENUM);
1780 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, textureMode);
1781 ctx.expectError(GL_INVALID_ENUM);
1782 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, textureMode);
1783 ctx.expectError(GL_INVALID_ENUM);
1784 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, textureMode);
1785 ctx.expectError(GL_INVALID_ENUM);
1786 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, textureMode);
1787 ctx.expectError(GL_INVALID_ENUM);
1788 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureMode);
1789 ctx.expectError(GL_INVALID_ENUM);
1790 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureMode);
1791 ctx.expectError(GL_INVALID_ENUM);
1792 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, textureMode);
1793 ctx.expectError(GL_INVALID_ENUM);
1794 ctx.endSection();
1795
1796 ctx.beginSection("GL_INVALID_VALUE is generated if pname is GL_TEXTURE_BASE_LEVEL or GL_TEXTURE_MAX_LEVEL and param(s) is negative.");
1797 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, -1);
1798 ctx.expectError(GL_INVALID_VALUE);
1799 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, -1);
1800 ctx.expectError(GL_INVALID_VALUE);
1801 ctx.endSection();
1802
1803 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1804 {
1805 ctx.beginSection("GL_INVALID_ENUM is generated if pname is a non-scalar parameter.");
1806 ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, 0);
1807 ctx.expectError(GL_INVALID_ENUM);
1808 ctx.endSection();
1809 }
1810
1811 ctx.beginSection("GL_INVALID_ENUM error is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname is not valid.");
1812 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BORDER_COLOR, textureMode);
1813 ctx.expectError(GL_INVALID_ENUM);
1814 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, textureMode);
1815 ctx.expectError(GL_INVALID_ENUM);
1816 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, textureMode);
1817 ctx.expectError(GL_INVALID_ENUM);
1818 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, textureMode);
1819 ctx.expectError(GL_INVALID_ENUM);
1820 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, textureMode);
1821 ctx.expectError(GL_INVALID_ENUM);
1822 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_R, textureMode);
1823 ctx.expectError(GL_INVALID_ENUM);
1824 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_LOD, textureMode);
1825 ctx.expectError(GL_INVALID_ENUM);
1826 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD, textureMode);
1827 ctx.expectError(GL_INVALID_ENUM);
1828 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_MODE, textureMode);
1829 ctx.expectError(GL_INVALID_ENUM);
1830 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, textureMode);
1831 ctx.expectError(GL_INVALID_ENUM);
1832
1833 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
1834 {
1835 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, textureMode);
1836 ctx.expectError(GL_INVALID_ENUM);
1837 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_FILTER, textureMode);
1838 ctx.expectError(GL_INVALID_ENUM);
1839 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAG_FILTER, textureMode);
1840 ctx.expectError(GL_INVALID_ENUM);
1841 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_S, textureMode);
1842 ctx.expectError(GL_INVALID_ENUM);
1843 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_T, textureMode);
1844 ctx.expectError(GL_INVALID_ENUM);
1845 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_R, textureMode);
1846 ctx.expectError(GL_INVALID_ENUM);
1847 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_LOD, textureMode);
1848 ctx.expectError(GL_INVALID_ENUM);
1849 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAX_LOD, textureMode);
1850 ctx.expectError(GL_INVALID_ENUM);
1851 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_MODE, textureMode);
1852 ctx.expectError(GL_INVALID_ENUM);
1853 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_FUNC, textureMode);
1854 ctx.expectError(GL_INVALID_ENUM);
1855 }
1856 ctx.endSection();
1857
1858 ctx.beginSection("GL_INVALID_OPERATION is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname GL_TEXTURE_BASE_LEVEL is not 0.");
1859 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, 1);
1860 ctx.expectError(GL_INVALID_OPERATION);
1861
1862 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
1863 {
1864 ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, 1);
1865 ctx.expectError(GL_INVALID_OPERATION);
1866 }
1867 ctx.endSection();
1868
1869 ctx.glDeleteTextures(1, &texture);
1870 }
1871
1872 // glTexParameterf
1873
texparameterf(NegativeTestContext & ctx)1874 void texparameterf (NegativeTestContext& ctx)
1875 {
1876 GLuint texture = 0x1234;
1877 GLfloat textureMode = -1.0f;
1878 ctx.glGenTextures(1, &texture);
1879 ctx.glBindTexture(GL_TEXTURE_2D, texture);
1880
1881 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
1882 ctx.glTexParameterf(0, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1883 ctx.expectError(GL_INVALID_ENUM);
1884 ctx.glTexParameterf(GL_TEXTURE_2D, 0, GL_LINEAR);
1885 ctx.expectError(GL_INVALID_ENUM);
1886 ctx.glTexParameterf(0, 0, GL_LINEAR);
1887 ctx.expectError(GL_INVALID_ENUM);
1888 ctx.endSection();
1889
1890 ctx.beginSection("GL_INVALID_ENUM is generated if pname is enum and the value of param(s) is not a valid value.");
1891 ctx.glTexParameterf(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, textureMode);
1892 ctx.expectError(GL_INVALID_ENUM);
1893 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, textureMode);
1894 ctx.expectError(GL_INVALID_ENUM);
1895 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, textureMode);
1896 ctx.expectError(GL_INVALID_ENUM);
1897 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, textureMode);
1898 ctx.expectError(GL_INVALID_ENUM);
1899 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, textureMode);
1900 ctx.expectError(GL_INVALID_ENUM);
1901 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, textureMode);
1902 ctx.expectError(GL_INVALID_ENUM);
1903 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, textureMode);
1904 ctx.expectError(GL_INVALID_ENUM);
1905 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, textureMode);
1906 ctx.expectError(GL_INVALID_ENUM);
1907 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, textureMode);
1908 ctx.expectError(GL_INVALID_ENUM);
1909 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureMode);
1910 ctx.expectError(GL_INVALID_ENUM);
1911 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureMode);
1912 ctx.expectError(GL_INVALID_ENUM);
1913 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, textureMode);
1914 ctx.expectError(GL_INVALID_ENUM);
1915 ctx.endSection();
1916
1917 ctx.beginSection("GL_INVALID_VALUE is generated if pname is GL_TEXTURE_BASE_LEVEL or GL_TEXTURE_MAX_LEVEL and param(s) is negative.");
1918 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, -1.0f);
1919 ctx.expectError(GL_INVALID_VALUE);
1920 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, -1.0f);
1921 ctx.expectError(GL_INVALID_VALUE);
1922 ctx.endSection();
1923
1924 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1925 {
1926 ctx.beginSection("GL_INVALID_ENUM is generated if pname is a non-scalar parameter.");
1927 ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, 0.0f);
1928 ctx.expectError(GL_INVALID_ENUM);
1929 ctx.endSection();
1930 }
1931
1932 ctx.beginSection("GL_INVALID_ENUM error is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname is not valid.");
1933 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BORDER_COLOR, textureMode);
1934 ctx.expectError(GL_INVALID_ENUM);
1935 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, textureMode);
1936 ctx.expectError(GL_INVALID_ENUM);
1937 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, textureMode);
1938 ctx.expectError(GL_INVALID_ENUM);
1939 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, textureMode);
1940 ctx.expectError(GL_INVALID_ENUM);
1941 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, textureMode);
1942 ctx.expectError(GL_INVALID_ENUM);
1943 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_R, textureMode);
1944 ctx.expectError(GL_INVALID_ENUM);
1945 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_LOD, textureMode);
1946 ctx.expectError(GL_INVALID_ENUM);
1947 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD, textureMode);
1948 ctx.expectError(GL_INVALID_ENUM);
1949 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_MODE, textureMode);
1950 ctx.expectError(GL_INVALID_ENUM);
1951 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, textureMode);
1952 ctx.expectError(GL_INVALID_ENUM);
1953
1954 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
1955 {
1956 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, textureMode);
1957 ctx.expectError(GL_INVALID_ENUM);
1958 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_FILTER, textureMode);
1959 ctx.expectError(GL_INVALID_ENUM);
1960 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAG_FILTER, textureMode);
1961 ctx.expectError(GL_INVALID_ENUM);
1962 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_S, textureMode);
1963 ctx.expectError(GL_INVALID_ENUM);
1964 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_T, textureMode);
1965 ctx.expectError(GL_INVALID_ENUM);
1966 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_R, textureMode);
1967 ctx.expectError(GL_INVALID_ENUM);
1968 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_LOD, textureMode);
1969 ctx.expectError(GL_INVALID_ENUM);
1970 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAX_LOD, textureMode);
1971 ctx.expectError(GL_INVALID_ENUM);
1972 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_MODE, textureMode);
1973 ctx.expectError(GL_INVALID_ENUM);
1974 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_FUNC, textureMode);
1975 ctx.expectError(GL_INVALID_ENUM);
1976 }
1977 ctx.endSection();
1978
1979 ctx.beginSection("GL_INVALID_OPERATION is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname GL_TEXTURE_BASE_LEVEL is not 0.");
1980 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, 1.0f);
1981 ctx.expectError(GL_INVALID_OPERATION);
1982
1983 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
1984 {
1985 ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, 1.0f);
1986 ctx.expectError(GL_INVALID_OPERATION);
1987 }
1988 ctx.endSection();
1989
1990 ctx.glDeleteTextures(1, &texture);
1991 }
1992
1993 // glTexParameteriv
1994
texparameteriv(NegativeTestContext & ctx)1995 void texparameteriv (NegativeTestContext& ctx)
1996 {
1997 GLint params[1] = {GL_LINEAR};
1998 GLuint texture = 0x1234;
1999 ctx.glGenTextures(1, &texture);
2000 ctx.glBindTexture(GL_TEXTURE_2D, texture);
2001
2002 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
2003 ctx.glTexParameteriv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
2004 ctx.expectError(GL_INVALID_ENUM);
2005 ctx.glTexParameteriv(GL_TEXTURE_2D, 0, ¶ms[0]);
2006 ctx.expectError(GL_INVALID_ENUM);
2007 ctx.glTexParameteriv(0, 0, ¶ms[0]);
2008 ctx.expectError(GL_INVALID_ENUM);
2009 ctx.endSection();
2010
2011 ctx.beginSection("GL_INVALID_ENUM is generated if pname is enum and the value of param(s) is not a valid value.");
2012 params[0] = -1;
2013 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, ¶ms[0]);
2014 ctx.expectError(GL_INVALID_ENUM);
2015 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, ¶ms[0]);
2016 ctx.expectError(GL_INVALID_ENUM);
2017 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, ¶ms[0]);
2018 ctx.expectError(GL_INVALID_ENUM);
2019 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
2020 ctx.expectError(GL_INVALID_ENUM);
2021 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
2022 ctx.expectError(GL_INVALID_ENUM);
2023 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, ¶ms[0]);
2024 ctx.expectError(GL_INVALID_ENUM);
2025 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, ¶ms[0]);
2026 ctx.expectError(GL_INVALID_ENUM);
2027 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, ¶ms[0]);
2028 ctx.expectError(GL_INVALID_ENUM);
2029 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, ¶ms[0]);
2030 ctx.expectError(GL_INVALID_ENUM);
2031 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]);
2032 ctx.expectError(GL_INVALID_ENUM);
2033 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]);
2034 ctx.expectError(GL_INVALID_ENUM);
2035 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, ¶ms[0]);
2036 ctx.expectError(GL_INVALID_ENUM);
2037 ctx.endSection();
2038
2039 ctx.beginSection("GL_INVALID_VALUE is generated if pname is GL_TEXTURE_BASE_LEVEL or GL_TEXTURE_MAX_LEVEL and param(s) is negative.");
2040 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, ¶ms[0]);
2041 ctx.expectError(GL_INVALID_VALUE);
2042 ctx.glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, ¶ms[0]);
2043 ctx.expectError(GL_INVALID_VALUE);
2044 ctx.endSection();
2045
2046 ctx.beginSection("GL_INVALID_ENUM error is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname is not valid.");
2047 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BORDER_COLOR, ¶ms[0]);
2048 ctx.expectError(GL_INVALID_ENUM);
2049 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
2050 ctx.expectError(GL_INVALID_ENUM);
2051 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
2052 ctx.expectError(GL_INVALID_ENUM);
2053 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, ¶ms[0]);
2054 ctx.expectError(GL_INVALID_ENUM);
2055 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, ¶ms[0]);
2056 ctx.expectError(GL_INVALID_ENUM);
2057 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_R, ¶ms[0]);
2058 ctx.expectError(GL_INVALID_ENUM);
2059 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_LOD, ¶ms[0]);
2060 ctx.expectError(GL_INVALID_ENUM);
2061 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD, ¶ms[0]);
2062 ctx.expectError(GL_INVALID_ENUM);
2063 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_MODE, ¶ms[0]);
2064 ctx.expectError(GL_INVALID_ENUM);
2065 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, ¶ms[0]);
2066 ctx.expectError(GL_INVALID_ENUM);
2067
2068 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
2069 {
2070 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, ¶ms[0]);
2071 ctx.expectError(GL_INVALID_ENUM);
2072 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
2073 ctx.expectError(GL_INVALID_ENUM);
2074 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
2075 ctx.expectError(GL_INVALID_ENUM);
2076 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_S, ¶ms[0]);
2077 ctx.expectError(GL_INVALID_ENUM);
2078 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_T, ¶ms[0]);
2079 ctx.expectError(GL_INVALID_ENUM);
2080 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_R, ¶ms[0]);
2081 ctx.expectError(GL_INVALID_ENUM);
2082 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_LOD, ¶ms[0]);
2083 ctx.expectError(GL_INVALID_ENUM);
2084 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAX_LOD, ¶ms[0]);
2085 ctx.expectError(GL_INVALID_ENUM);
2086 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_MODE, ¶ms[0]);
2087 ctx.expectError(GL_INVALID_ENUM);
2088 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_FUNC, ¶ms[0]);
2089 ctx.expectError(GL_INVALID_ENUM);
2090 }
2091 ctx.endSection();
2092
2093 ctx.beginSection("GL_INVALID_OPERATION is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname GL_TEXTURE_BASE_LEVEL is not 0.");
2094 params[0] = 1;
2095 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, ¶ms[0]);
2096 ctx.expectError(GL_INVALID_OPERATION);
2097
2098 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
2099 {
2100 params[0] = 1;
2101 ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, ¶ms[0]);
2102 ctx.expectError(GL_INVALID_OPERATION);
2103 }
2104 ctx.endSection();
2105
2106 ctx.glDeleteTextures(1, &texture);
2107 }
2108
2109 // glTexParameterfv
2110
texparameterfv(NegativeTestContext & ctx)2111 void texparameterfv (NegativeTestContext& ctx)
2112 {
2113 GLfloat params[1] = {GL_LINEAR};
2114 GLuint texture = 0x1234;
2115 ctx.glGenTextures(1, &texture);
2116 ctx.glBindTexture(GL_TEXTURE_2D, texture);
2117
2118 ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not one of the accepted defined values.");
2119 params[0] = GL_LINEAR;
2120 ctx.glTexParameterfv(0, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
2121 ctx.expectError(GL_INVALID_ENUM);
2122 ctx.glTexParameterfv(GL_TEXTURE_2D, 0, ¶ms[0]);
2123 ctx.expectError(GL_INVALID_ENUM);
2124 ctx.glTexParameterfv(0, 0, ¶ms[0]);
2125 ctx.expectError(GL_INVALID_ENUM);
2126 ctx.endSection();
2127
2128 ctx.beginSection("GL_INVALID_ENUM is generated if pname is enum and the value of param(s) is not a valid value.");
2129 params[0] = -1.0f;
2130 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, ¶ms[0]);
2131 ctx.expectError(GL_INVALID_ENUM);
2132 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, ¶ms[0]);
2133 ctx.expectError(GL_INVALID_ENUM);
2134 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, ¶ms[0]);
2135 ctx.expectError(GL_INVALID_ENUM);
2136 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
2137 ctx.expectError(GL_INVALID_ENUM);
2138 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
2139 ctx.expectError(GL_INVALID_ENUM);
2140 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, ¶ms[0]);
2141 ctx.expectError(GL_INVALID_ENUM);
2142 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, ¶ms[0]);
2143 ctx.expectError(GL_INVALID_ENUM);
2144 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, ¶ms[0]);
2145 ctx.expectError(GL_INVALID_ENUM);
2146 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, ¶ms[0]);
2147 ctx.expectError(GL_INVALID_ENUM);
2148 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ¶ms[0]);
2149 ctx.expectError(GL_INVALID_ENUM);
2150 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ¶ms[0]);
2151 ctx.expectError(GL_INVALID_ENUM);
2152 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, ¶ms[0]);
2153 ctx.expectError(GL_INVALID_ENUM);
2154 ctx.endSection();
2155
2156 ctx.beginSection("GL_INVALID_VALUE is generated if pname is GL_TEXTURE_BASE_LEVEL or GL_TEXTURE_MAX_LEVEL and param(s) is negative.");
2157 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, ¶ms[0]);
2158 ctx.expectError(GL_INVALID_VALUE);
2159 ctx.glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, ¶ms[0]);
2160 ctx.expectError(GL_INVALID_VALUE);
2161 ctx.endSection();
2162
2163 ctx.beginSection("GL_INVALID_ENUM error is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname is not valid.");
2164 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BORDER_COLOR, ¶ms[0]);
2165 ctx.expectError(GL_INVALID_ENUM);
2166 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
2167 ctx.expectError(GL_INVALID_ENUM);
2168 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
2169 ctx.expectError(GL_INVALID_ENUM);
2170 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, ¶ms[0]);
2171 ctx.expectError(GL_INVALID_ENUM);
2172 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, ¶ms[0]);
2173 ctx.expectError(GL_INVALID_ENUM);
2174 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_R, ¶ms[0]);
2175 ctx.expectError(GL_INVALID_ENUM);
2176 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_LOD, ¶ms[0]);
2177 ctx.expectError(GL_INVALID_ENUM);
2178 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD, ¶ms[0]);
2179 ctx.expectError(GL_INVALID_ENUM);
2180 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_MODE, ¶ms[0]);
2181 ctx.expectError(GL_INVALID_ENUM);
2182 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, ¶ms[0]);
2183 ctx.expectError(GL_INVALID_ENUM);
2184
2185 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
2186 {
2187 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, ¶ms[0]);
2188 ctx.expectError(GL_INVALID_ENUM);
2189 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_FILTER, ¶ms[0]);
2190 ctx.expectError(GL_INVALID_ENUM);
2191 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
2192 ctx.expectError(GL_INVALID_ENUM);
2193 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_S, ¶ms[0]);
2194 ctx.expectError(GL_INVALID_ENUM);
2195 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_T, ¶ms[0]);
2196 ctx.expectError(GL_INVALID_ENUM);
2197 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_R, ¶ms[0]);
2198 ctx.expectError(GL_INVALID_ENUM);
2199 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_LOD, ¶ms[0]);
2200 ctx.expectError(GL_INVALID_ENUM);
2201 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAX_LOD, ¶ms[0]);
2202 ctx.expectError(GL_INVALID_ENUM);
2203 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_MODE, ¶ms[0]);
2204 ctx.expectError(GL_INVALID_ENUM);
2205 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_FUNC, ¶ms[0]);
2206 ctx.expectError(GL_INVALID_ENUM);
2207 }
2208 ctx.endSection();
2209
2210 ctx.beginSection("GL_INVALID_OPERATION is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname GL_TEXTURE_BASE_LEVEL is not 0.");
2211 params[0] = 1.0f;
2212 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, ¶ms[0]);
2213 ctx.expectError(GL_INVALID_OPERATION);
2214
2215 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
2216 {
2217 params[0] = 1.0f;
2218 ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, ¶ms[0]);
2219 ctx.expectError(GL_INVALID_OPERATION);
2220 }
2221 ctx.endSection();
2222
2223 ctx.glDeleteTextures(1, &texture);
2224 }
2225
2226 // glTexParameterIiv
2227
texparameterIiv(NegativeTestContext & ctx)2228 void texparameterIiv (NegativeTestContext& ctx)
2229 {
2230 if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
2231 throw tcu::NotSupportedError("glTexParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__);
2232
2233 GLint textureMode[] = { GL_DEPTH_COMPONENT, GL_STENCIL_INDEX };
2234 ctx.beginSection("GL_INVALID_ENUM is generated if target is not a valid target.");
2235 ctx.glTexParameterIiv(0, GL_DEPTH_STENCIL_TEXTURE_MODE, textureMode);
2236 ctx.expectError(GL_INVALID_ENUM);
2237 ctx.endSection();
2238
2239 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not a valid parameter.");
2240 ctx.glTexParameterIiv(GL_TEXTURE_2D, 0, textureMode);
2241 ctx.expectError(GL_INVALID_ENUM);
2242 ctx.endSection();
2243
2244 ctx.beginSection("GL_INVALID_ENUM is generated if pname is enum and the value of param(s) is not a valid value.");
2245 textureMode[0] = -1;
2246 textureMode[1] = -1;
2247 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, textureMode);
2248 ctx.expectError(GL_INVALID_ENUM);
2249 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, textureMode);
2250 ctx.expectError(GL_INVALID_ENUM);
2251 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, textureMode);
2252 ctx.expectError(GL_INVALID_ENUM);
2253 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, textureMode);
2254 ctx.expectError(GL_INVALID_ENUM);
2255 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, textureMode);
2256 ctx.expectError(GL_INVALID_ENUM);
2257 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, textureMode);
2258 ctx.expectError(GL_INVALID_ENUM);
2259 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, textureMode);
2260 ctx.expectError(GL_INVALID_ENUM);
2261 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, textureMode);
2262 ctx.expectError(GL_INVALID_ENUM);
2263 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, textureMode);
2264 ctx.expectError(GL_INVALID_ENUM);
2265 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureMode);
2266 ctx.expectError(GL_INVALID_ENUM);
2267 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureMode);
2268 ctx.expectError(GL_INVALID_ENUM);
2269 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, textureMode);
2270 ctx.expectError(GL_INVALID_ENUM);
2271 ctx.endSection();
2272
2273 ctx.beginSection("GL_INVALID_VALUE is generated if pname is GL_TEXTURE_BASE_LEVEL or GL_TEXTURE_MAX_LEVEL and param(s) is negative.");
2274 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, textureMode);
2275 ctx.expectError(GL_INVALID_VALUE);
2276 ctx.glTexParameterIiv(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, textureMode);
2277 ctx.expectError(GL_INVALID_VALUE);
2278 ctx.endSection();
2279
2280 ctx.beginSection("GL_INVALID_ENUM error is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname is not valid.");
2281 textureMode[0] = 0;
2282 textureMode[1] = 0;
2283 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BORDER_COLOR, textureMode);
2284 ctx.expectError(GL_INVALID_ENUM);
2285 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, textureMode);
2286 ctx.expectError(GL_INVALID_ENUM);
2287 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, textureMode);
2288 ctx.expectError(GL_INVALID_ENUM);
2289 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, textureMode);
2290 ctx.expectError(GL_INVALID_ENUM);
2291 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, textureMode);
2292 ctx.expectError(GL_INVALID_ENUM);
2293 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_R, textureMode);
2294 ctx.expectError(GL_INVALID_ENUM);
2295 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_LOD, textureMode);
2296 ctx.expectError(GL_INVALID_ENUM);
2297 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD, textureMode);
2298 ctx.expectError(GL_INVALID_ENUM);
2299 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_MODE, textureMode);
2300 ctx.expectError(GL_INVALID_ENUM);
2301 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, textureMode);
2302 ctx.expectError(GL_INVALID_ENUM);
2303
2304 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, textureMode);
2305 ctx.expectError(GL_INVALID_ENUM);
2306 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_FILTER, textureMode);
2307 ctx.expectError(GL_INVALID_ENUM);
2308 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAG_FILTER, textureMode);
2309 ctx.expectError(GL_INVALID_ENUM);
2310 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_S, textureMode);
2311 ctx.expectError(GL_INVALID_ENUM);
2312 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_T, textureMode);
2313 ctx.expectError(GL_INVALID_ENUM);
2314 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_R, textureMode);
2315 ctx.expectError(GL_INVALID_ENUM);
2316 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_LOD, textureMode);
2317 ctx.expectError(GL_INVALID_ENUM);
2318 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAX_LOD, textureMode);
2319 ctx.expectError(GL_INVALID_ENUM);
2320 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_MODE, textureMode);
2321 ctx.expectError(GL_INVALID_ENUM);
2322 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_FUNC, textureMode);
2323 ctx.expectError(GL_INVALID_ENUM);
2324 ctx.endSection();
2325
2326 ctx.beginSection("GL_INVALID_OPERATION is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname GL_TEXTURE_BASE_LEVEL is not 0.");
2327 textureMode[0] = 1;
2328 textureMode[1] = 1;
2329 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, textureMode);
2330 ctx.expectError(GL_INVALID_OPERATION);
2331 ctx.glTexParameterIiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, textureMode);
2332 ctx.expectError(GL_INVALID_OPERATION);
2333 ctx.endSection();
2334 }
2335
2336 // glTexParameterIuiv
2337
texparameterIuiv(NegativeTestContext & ctx)2338 void texparameterIuiv (NegativeTestContext& ctx)
2339 {
2340 if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
2341 throw tcu::NotSupportedError("glTexParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__);
2342
2343 GLuint textureMode[] = { GL_DEPTH_COMPONENT, GL_STENCIL_INDEX };
2344 ctx.beginSection("GL_INVALID_ENUM is generated if target is not a valid target.");
2345 ctx.glTexParameterIuiv(0, GL_DEPTH_STENCIL_TEXTURE_MODE, textureMode);
2346 ctx.expectError(GL_INVALID_ENUM);
2347 ctx.endSection();
2348
2349 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not a valid parameter.");
2350 ctx.glTexParameterIuiv(GL_TEXTURE_2D, 0, textureMode);
2351 ctx.expectError(GL_INVALID_ENUM);
2352 ctx.endSection();
2353
2354 ctx.beginSection("GL_INVALID_ENUM is generated if pname is enum and the value of param(s) is not a valid value.");
2355 textureMode[0] = GL_DONT_CARE;
2356 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_DEPTH_STENCIL_TEXTURE_MODE, textureMode);
2357 ctx.expectError(GL_INVALID_ENUM);
2358 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, textureMode);
2359 ctx.expectError(GL_INVALID_ENUM);
2360 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, textureMode);
2361 ctx.expectError(GL_INVALID_ENUM);
2362 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, textureMode);
2363 ctx.expectError(GL_INVALID_ENUM);
2364 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, textureMode);
2365 ctx.expectError(GL_INVALID_ENUM);
2366 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, textureMode);
2367 ctx.expectError(GL_INVALID_ENUM);
2368 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, textureMode);
2369 ctx.expectError(GL_INVALID_ENUM);
2370 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, textureMode);
2371 ctx.expectError(GL_INVALID_ENUM);
2372 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, textureMode);
2373 ctx.expectError(GL_INVALID_ENUM);
2374 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureMode);
2375 ctx.expectError(GL_INVALID_ENUM);
2376 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureMode);
2377 ctx.expectError(GL_INVALID_ENUM);
2378 ctx.glTexParameterIuiv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, textureMode);
2379 ctx.expectError(GL_INVALID_ENUM);
2380 ctx.endSection();
2381
2382 ctx.beginSection("GL_INVALID_ENUM error is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname is not valid.");
2383 textureMode[0] = 0;
2384 textureMode[1] = 0;
2385 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BORDER_COLOR, textureMode);
2386 ctx.expectError(GL_INVALID_ENUM);
2387 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_FILTER, textureMode);
2388 ctx.expectError(GL_INVALID_ENUM);
2389 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAG_FILTER, textureMode);
2390 ctx.expectError(GL_INVALID_ENUM);
2391 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, textureMode);
2392 ctx.expectError(GL_INVALID_ENUM);
2393 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, textureMode);
2394 ctx.expectError(GL_INVALID_ENUM);
2395 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_R, textureMode);
2396 ctx.expectError(GL_INVALID_ENUM);
2397 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MIN_LOD, textureMode);
2398 ctx.expectError(GL_INVALID_ENUM);
2399 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD, textureMode);
2400 ctx.expectError(GL_INVALID_ENUM);
2401 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_MODE, textureMode);
2402 ctx.expectError(GL_INVALID_ENUM);
2403 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, textureMode);
2404 ctx.expectError(GL_INVALID_ENUM);
2405
2406 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, textureMode);
2407 ctx.expectError(GL_INVALID_ENUM);
2408 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_FILTER, textureMode);
2409 ctx.expectError(GL_INVALID_ENUM);
2410 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAG_FILTER, textureMode);
2411 ctx.expectError(GL_INVALID_ENUM);
2412 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_S, textureMode);
2413 ctx.expectError(GL_INVALID_ENUM);
2414 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_T, textureMode);
2415 ctx.expectError(GL_INVALID_ENUM);
2416 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_WRAP_R, textureMode);
2417 ctx.expectError(GL_INVALID_ENUM);
2418 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MIN_LOD, textureMode);
2419 ctx.expectError(GL_INVALID_ENUM);
2420 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAX_LOD, textureMode);
2421 ctx.expectError(GL_INVALID_ENUM);
2422 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_MODE, textureMode);
2423 ctx.expectError(GL_INVALID_ENUM);
2424 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_COMPARE_FUNC, textureMode);
2425 ctx.expectError(GL_INVALID_ENUM);
2426 ctx.endSection();
2427
2428 ctx.beginSection("GL_INVALID_OPERATION is generated if target is GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY and pname GL_TEXTURE_BASE_LEVEL is not 0.");
2429 textureMode[0] = 1;
2430 textureMode[1] = 1;
2431 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, textureMode);
2432 ctx.expectError(GL_INVALID_OPERATION);
2433 ctx.glTexParameterIuiv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, textureMode);
2434 ctx.expectError(GL_INVALID_OPERATION);
2435 ctx.endSection();
2436 }
2437
2438 // glCompressedTexSubImage2D
2439
compressedtexsubimage2d(NegativeTestContext & ctx)2440 void compressedtexsubimage2d (NegativeTestContext& ctx)
2441 {
2442 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
2443 ctx.glCompressedTexSubImage2D(0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0);
2444 ctx.expectError(GL_INVALID_ENUM);
2445 ctx.endSection();
2446
2447 deUint32 texture = 0x1234;
2448 ctx.glGenTextures (1, &texture);
2449 ctx.glBindTexture (GL_TEXTURE_2D, texture);
2450 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0);
2451 ctx.expectError (GL_NO_ERROR);
2452
2453 ctx.beginSection("GL_INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified.");
2454 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0);
2455 ctx.expectError(GL_INVALID_OPERATION);
2456 ctx.endSection();
2457
2458 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.");
2459 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 4, 0, 10, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(10, 4), 0);
2460 ctx.expectError(GL_INVALID_OPERATION);
2461 ctx.endSection();
2462
2463 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.");
2464 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 4, 4, 10, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 10), 0);
2465 ctx.expectError(GL_INVALID_OPERATION);
2466 ctx.endSection();
2467
2468 ctx.beginSection("For ETC2/EAC images GL_INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four.");
2469 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 1, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
2470 ctx.expectError(GL_INVALID_OPERATION);
2471 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 1, 0, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
2472 ctx.expectError(GL_INVALID_OPERATION);
2473 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
2474 ctx.expectError(GL_INVALID_OPERATION);
2475 ctx.endSection();
2476
2477 ctx.glDeleteTextures (1, &texture);
2478 }
2479
compressedtexsubimage2d_neg_level(NegativeTestContext & ctx)2480 void compressedtexsubimage2d_neg_level (NegativeTestContext& ctx)
2481 {
2482 deUint32 textures[2];
2483 ctx.glGenTextures (2, &textures[0]);
2484 ctx.glBindTexture (GL_TEXTURE_2D, textures[0]);
2485 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0);
2486 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]);
2487 FOR_CUBE_FACES(faceGL, ctx.glCompressedTexImage2D(faceGL, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0););
2488 ctx.expectError (GL_NO_ERROR);
2489
2490 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
2491 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, -1, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2492 ctx.expectError(GL_INVALID_VALUE);
2493 ctx.endSection();
2494
2495 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
2496 FOR_CUBE_FACES(faceGL,
2497 {
2498 ctx.glCompressedTexSubImage2D(faceGL, -1, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2499 ctx.expectError(GL_INVALID_VALUE);
2500 });
2501 ctx.endSection();
2502
2503 ctx.glDeleteTextures(2, &textures[0]);
2504 }
2505
compressedtexsubimage2d_max_level(NegativeTestContext & ctx)2506 void compressedtexsubimage2d_max_level (NegativeTestContext& ctx)
2507 {
2508 deUint32 textures[2];
2509 ctx.glGenTextures (2, &textures[0]);
2510 ctx.glBindTexture (GL_TEXTURE_2D, textures[0]);
2511 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0);
2512 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP, textures[1]);
2513 FOR_CUBE_FACES(faceGL, ctx.glCompressedTexImage2D(faceGL, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, etc2EacDataSize(18, 18), 0););
2514 ctx.expectError (GL_NO_ERROR);
2515
2516 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
2517 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
2518 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2519 ctx.expectError(GL_INVALID_VALUE);
2520 ctx.endSection();
2521
2522 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
2523 deUint32 log2MaxCubemapSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
2524 FOR_CUBE_FACES(faceGL,
2525 {
2526 ctx.glCompressedTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2527 ctx.expectError(GL_INVALID_VALUE);
2528 });
2529 ctx.endSection();
2530
2531 ctx.glDeleteTextures(2, &textures[0]);
2532 }
2533
compressedtexsubimage2d_neg_offset(NegativeTestContext & ctx)2534 void compressedtexsubimage2d_neg_offset (NegativeTestContext& ctx)
2535 {
2536 GLuint texture = 0x1234;
2537 ctx.glGenTextures(1, &texture);
2538 ctx.glBindTexture(GL_TEXTURE_2D, texture);
2539 ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 8, 8, 0, etc2EacDataSize(8, 8), 0);
2540
2541 // \note Both GL_INVALID_VALUE and GL_INVALID_OPERATION are valid here since implementation may
2542 // first check if offsets are valid for certain format and only after that check that they
2543 // are not negative.
2544 ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset or yoffset are negative.");
2545
2546 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2547 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2548 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2549 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2550 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, -4, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2551 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2552
2553 ctx.endSection();
2554
2555 ctx.glDeleteTextures(1, &texture);
2556 }
2557
compressedtexsubimage2d_invalid_offset(NegativeTestContext & ctx)2558 void compressedtexsubimage2d_invalid_offset (NegativeTestContext& ctx)
2559 {
2560 deUint32 texture = 0x1234;
2561 ctx.glGenTextures (1, &texture);
2562 ctx.glBindTexture (GL_TEXTURE_2D, texture);
2563 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
2564 ctx.expectError (GL_NO_ERROR);
2565
2566 ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
2567
2568 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 12, 0, 8, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 4), 0);
2569 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2570 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 12, 4, 8, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 8), 0);
2571 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2572 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 12, 12, 8, 8, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 8), 0);
2573 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2574 ctx.endSection();
2575
2576 ctx.glDeleteTextures (1, &texture);
2577 }
2578
compressedtexsubimage2d_neg_width_height(NegativeTestContext & ctx)2579 void compressedtexsubimage2d_neg_width_height (NegativeTestContext& ctx)
2580 {
2581 deUint32 texture = 0x1234;
2582 ctx.glGenTextures (1, &texture);
2583 ctx.glBindTexture (GL_TEXTURE_2D, texture);
2584 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
2585 ctx.expectError (GL_NO_ERROR);
2586
2587 ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if width or height is less than 0.");
2588 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -4, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2589 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2590 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2591 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2592 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -4, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
2593 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
2594 ctx.endSection();
2595
2596 ctx.glDeleteTextures(1, &texture);
2597 }
2598
compressedtexsubimage2d_invalid_size(NegativeTestContext & ctx)2599 void compressedtexsubimage2d_invalid_size (NegativeTestContext& ctx)
2600 {
2601 deUint32 texture = 0x1234;
2602 ctx.glGenTextures (1, &texture);
2603 ctx.glBindTexture (GL_TEXTURE_2D, texture);
2604 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
2605 ctx.expectError (GL_NO_ERROR);
2606
2607 ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.");
2608 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0);
2609 ctx.expectError(GL_INVALID_VALUE);
2610
2611 ctx.glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL_COMPRESSED_RGBA8_ETC2_EAC, 4*4*16-1, 0);
2612 ctx.expectError(GL_INVALID_VALUE);
2613 ctx.endSection();
2614
2615 ctx.glDeleteTextures (1, &texture);
2616 }
2617
compressedtexsubimage2d_invalid_buffer_target(NegativeTestContext & ctx)2618 void compressedtexsubimage2d_invalid_buffer_target (NegativeTestContext& ctx)
2619 {
2620 deUint32 buf = 0x1234;
2621 deUint32 texture = 0x1234;
2622 std::vector<GLubyte> data(128);
2623
2624 ctx.glGenTextures (1, &texture);
2625 ctx.glBindTexture (GL_TEXTURE_2D, texture);
2626 ctx.glCompressedTexImage2D (GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, etc2EacDataSize(16, 16), 0);
2627 ctx.glGenBuffers (1, &buf);
2628 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
2629 ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 128, &data[0], GL_DYNAMIC_COPY);
2630 ctx.expectError (GL_NO_ERROR);
2631
2632 ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and...");
2633 ctx.beginSection("...the buffer object's data store is currently mapped.");
2634 ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 128, GL_MAP_WRITE_BIT);
2635 ctx.glCompressedTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
2636 ctx.expectError (GL_INVALID_OPERATION);
2637 ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
2638 ctx.endSection();
2639
2640 ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.");
2641 ctx.glCompressedTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 16, 16, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(16, 16), 0);
2642 ctx.expectError (GL_INVALID_OPERATION);
2643 ctx.endSection();
2644 ctx.endSection();
2645
2646 ctx.glDeleteBuffers (1, &buf);
2647 ctx.glDeleteTextures (1, &texture);
2648 }
2649
2650 // glTexImage3D
2651
teximage3d(NegativeTestContext & ctx)2652 void teximage3d (NegativeTestContext& ctx)
2653 {
2654 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
2655 ctx.glTexImage3D(0, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2656 ctx.expectError(GL_INVALID_ENUM);
2657 ctx.glTexImage3D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2658 ctx.expectError(GL_INVALID_ENUM);
2659 ctx.endSection();
2660
2661 ctx.beginSection("GL_INVALID_ENUM is generated if type is not a type constant.");
2662 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, 0, 0);
2663 ctx.expectError(GL_INVALID_ENUM);
2664 ctx.endSection();
2665
2666 ctx.beginSection("GL_INVALID_ENUM is generated if format is not an accepted format constant.");
2667 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, 0, GL_UNSIGNED_BYTE, 0);
2668 ctx.expectError(GL_INVALID_ENUM);
2669 ctx.endSection();
2670
2671 ctx.beginSection("GL_INVALID_VALUE is generated if internalFormat is not one of the accepted resolution and format symbolic constants.");
2672 ctx.glTexImage3D(GL_TEXTURE_3D, 0, 0, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2673 ctx.expectError(GL_INVALID_VALUE);
2674 ctx.endSection();
2675
2676 ctx.beginSection("GL_INVALID_OPERATION is generated if target is GL_TEXTURE_3D and format is GL_DEPTH_COMPONENT, or GL_DEPTH_STENCIL.");
2677 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_BYTE, 0);
2678 ctx.expectError(GL_INVALID_OPERATION);
2679 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
2680 ctx.expectError(GL_INVALID_OPERATION);
2681 ctx.endSection();
2682
2683 ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid.");
2684 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2685 ctx.expectError(GL_INVALID_OPERATION);
2686 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0);
2687 ctx.expectError(GL_INVALID_OPERATION);
2688 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB5_A1, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
2689 ctx.expectError(GL_INVALID_OPERATION);
2690 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB10_A2, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV, 0);
2691 ctx.expectError(GL_INVALID_OPERATION);
2692 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32UI, 1, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0);
2693 ctx.expectError(GL_INVALID_OPERATION);
2694 ctx.endSection();
2695
2696 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
2697 {
2698 ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TEXTURE_CUBE_MAP_ARRAY and width and height are not equal.");
2699 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 2, 1, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2700 ctx.expectError(GL_INVALID_VALUE);
2701 ctx.endSection();
2702
2703 ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TEXTURE_CUBE_MAP_ARRAY and depth is not a multiple of six.");
2704 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2705 ctx.expectError(GL_INVALID_VALUE);
2706 ctx.endSection();
2707 }
2708 }
2709
teximage3d_neg_level(NegativeTestContext & ctx)2710 void teximage3d_neg_level (NegativeTestContext& ctx)
2711 {
2712 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
2713 ctx.glTexImage3D(GL_TEXTURE_3D, -1, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
2714 ctx.expectError(GL_INVALID_VALUE);
2715 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, -1, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
2716 ctx.expectError(GL_INVALID_VALUE);
2717
2718 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
2719 {
2720 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, -1, GL_RGBA, 1, 1, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2721 ctx.expectError(GL_INVALID_VALUE);
2722 }
2723
2724 ctx.endSection();
2725
2726 }
2727
teximage3d_max_level(NegativeTestContext & ctx)2728 void teximage3d_max_level (NegativeTestContext& ctx)
2729 {
2730 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE).");
2731 deUint32 log2Max3DTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_3D_TEXTURE_SIZE)) + 1;
2732 ctx.glTexImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
2733 ctx.expectError(GL_INVALID_VALUE);
2734 ctx.endSection();
2735
2736 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
2737 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
2738 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
2739 ctx.expectError(GL_INVALID_VALUE);
2740 ctx.endSection();
2741 }
2742
teximage3d_neg_width_height_depth(NegativeTestContext & ctx)2743 void teximage3d_neg_width_height_depth (NegativeTestContext& ctx)
2744 {
2745 ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than 0.");
2746 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, -1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2747 ctx.expectError(GL_INVALID_VALUE);
2748 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, -1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2749 ctx.expectError(GL_INVALID_VALUE);
2750 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2751 ctx.expectError(GL_INVALID_VALUE);
2752 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, -1, -1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2753 ctx.expectError(GL_INVALID_VALUE);
2754
2755 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, -1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2756 ctx.expectError(GL_INVALID_VALUE);
2757 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, -1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2758 ctx.expectError(GL_INVALID_VALUE);
2759 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, 1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2760 ctx.expectError(GL_INVALID_VALUE);
2761 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, -1, -1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2762 ctx.expectError(GL_INVALID_VALUE);
2763
2764 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
2765 {
2766 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, -1, 1, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2767 ctx.expectError(GL_INVALID_VALUE);
2768 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 1, -1, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2769 ctx.expectError(GL_INVALID_VALUE);
2770 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 1, 1, -6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2771 ctx.expectError(GL_INVALID_VALUE);
2772 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, -1, -1, -6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2773 ctx.expectError(GL_INVALID_VALUE);
2774 }
2775 ctx.endSection();
2776 }
2777
teximage3d_max_width_height_depth(NegativeTestContext & ctx)2778 void teximage3d_max_width_height_depth (NegativeTestContext& ctx)
2779 {
2780 int max3DTextureSize = ctx.getInteger(GL_MAX_3D_TEXTURE_SIZE) + 1;
2781 int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1;
2782
2783 ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_3D_TEXTURE_SIZE.");
2784 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, max3DTextureSize, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2785 ctx.expectError(GL_INVALID_VALUE);
2786 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, max3DTextureSize, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2787 ctx.expectError(GL_INVALID_VALUE);
2788 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, max3DTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2789 ctx.expectError(GL_INVALID_VALUE);
2790 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, max3DTextureSize, max3DTextureSize, max3DTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2791 ctx.expectError(GL_INVALID_VALUE);
2792 ctx.endSection();
2793
2794 ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_TEXTURE_SIZE.");
2795 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, maxTextureSize, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2796 ctx.expectError(GL_INVALID_VALUE);
2797 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, maxTextureSize, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2798 ctx.expectError(GL_INVALID_VALUE);
2799 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 1, 1, maxTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2800 ctx.expectError(GL_INVALID_VALUE);
2801 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, maxTextureSize, maxTextureSize, maxTextureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2802 ctx.expectError(GL_INVALID_VALUE);
2803 ctx.endSection();
2804 }
2805
teximage3d_invalid_border(NegativeTestContext & ctx)2806 void teximage3d_invalid_border (NegativeTestContext& ctx)
2807 {
2808 ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0 or 1.");
2809 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0);
2810 ctx.expectError(GL_INVALID_VALUE);
2811 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, 2, GL_RGB, GL_UNSIGNED_BYTE, 0);
2812 ctx.expectError(GL_INVALID_VALUE);
2813 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 1, 1, 1, -1, GL_RGB, GL_UNSIGNED_BYTE, 0);
2814 ctx.expectError(GL_INVALID_VALUE);
2815 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 1, 1, 1, 2, GL_RGB, GL_UNSIGNED_BYTE, 0);
2816 ctx.expectError(GL_INVALID_VALUE);
2817
2818 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
2819 {
2820 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA, 1, 1, 6, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2821 ctx.expectError(GL_INVALID_VALUE);
2822 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA, 1, 1, 6, 1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2823 ctx.expectError(GL_INVALID_VALUE);
2824 }
2825
2826 ctx.endSection();
2827 }
2828
teximage3d_invalid_buffer_target(NegativeTestContext & ctx)2829 void teximage3d_invalid_buffer_target (NegativeTestContext& ctx)
2830 {
2831 deUint32 buf = 0x1234;
2832 deUint32 texture = 0x1234;
2833 std::vector<GLubyte> data(512);
2834
2835 ctx.glGenBuffers (1, &buf);
2836 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
2837 ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 512, &data[0], GL_DYNAMIC_COPY);
2838 ctx.glGenTextures (1, &texture);
2839 ctx.glBindTexture (GL_TEXTURE_3D, texture);
2840 ctx.expectError (GL_NO_ERROR);
2841
2842 ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and...");
2843
2844 ctx.beginSection("...the buffer object's data store is currently mapped.");
2845 ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 128, GL_MAP_WRITE_BIT);
2846 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2847 ctx.expectError (GL_INVALID_OPERATION);
2848 ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
2849 ctx.endSection();
2850
2851 ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.");
2852 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 64, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2853 ctx.expectError (GL_INVALID_OPERATION);
2854 ctx.endSection();
2855
2856 ctx.beginSection("...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type.");
2857 ctx.getLog() << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage;
2858 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);
2859 ctx.expectError (GL_INVALID_OPERATION);
2860 ctx.endSection();
2861
2862 ctx.endSection();
2863
2864 ctx.glDeleteBuffers (1, &buf);
2865 ctx.glDeleteTextures (1, &texture);
2866 }
2867
2868 // glTexSubImage3D
2869
texsubimage3d(NegativeTestContext & ctx)2870 void texsubimage3d (NegativeTestContext& ctx)
2871 {
2872 deUint32 texture = 0x1234;
2873 ctx.glGenTextures (1, &texture);
2874 ctx.glBindTexture (GL_TEXTURE_3D, texture);
2875 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2876 ctx.expectError (GL_NO_ERROR);
2877
2878 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
2879 ctx.glTexSubImage3D(0, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2880 ctx.expectError(GL_INVALID_ENUM);
2881 ctx.glTexSubImage3D(GL_TEXTURE_2D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2882 ctx.expectError(GL_INVALID_ENUM);
2883 ctx.endSection();
2884
2885 ctx.beginSection("GL_INVALID_ENUM is generated if format is not an accepted format constant.");
2886 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 4, 4, 4, GL_UNSIGNED_BYTE, 0);
2887 ctx.expectError(GL_INVALID_ENUM);
2888 ctx.endSection();
2889
2890 ctx.beginSection("GL_INVALID_ENUM is generated if type is not a type constant.");
2891 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, 0, 0);
2892 ctx.expectError(GL_INVALID_ENUM);
2893 ctx.endSection();
2894
2895 ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid.");
2896 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0);
2897 ctx.expectError(GL_INVALID_OPERATION);
2898 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
2899 ctx.expectError(GL_INVALID_OPERATION);
2900 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0);
2901 ctx.expectError(GL_INVALID_OPERATION);
2902 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0);
2903 ctx.expectError(GL_INVALID_OPERATION);
2904 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_FLOAT, 0);
2905 ctx.expectError(GL_INVALID_OPERATION);
2906 ctx.endSection();
2907
2908 ctx.glDeleteTextures (1, &texture);
2909 }
2910
texsubimage3d_neg_level(NegativeTestContext & ctx)2911 void texsubimage3d_neg_level (NegativeTestContext& ctx)
2912 {
2913 deUint32 textures[3];
2914 ctx.glGenTextures (3, &textures[0]);
2915 ctx.glBindTexture (GL_TEXTURE_3D, textures[0]);
2916 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2917 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]);
2918 ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2919 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]);
2920 ctx.glTexImage3D (GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2921 ctx.expectError (GL_NO_ERROR);
2922
2923 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
2924 ctx.glTexSubImage3D(GL_TEXTURE_3D, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2925 ctx.expectError(GL_INVALID_VALUE);
2926 ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2927 ctx.expectError(GL_INVALID_VALUE);
2928
2929 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
2930 {
2931 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2932 ctx.expectError(GL_INVALID_VALUE);
2933 }
2934
2935 ctx.endSection();
2936
2937 ctx.glDeleteTextures (3, &textures[0]);
2938 }
2939
texsubimage3d_max_level(NegativeTestContext & ctx)2940 void texsubimage3d_max_level (NegativeTestContext& ctx)
2941 {
2942 deUint32 textures[2];
2943 ctx.glGenTextures (2, &textures[0]);
2944 ctx.glBindTexture (GL_TEXTURE_3D, textures[0]);
2945 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2946 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]);
2947 ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2948 ctx.expectError (GL_NO_ERROR);
2949
2950 deUint32 log2Max3DTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_3D_TEXTURE_SIZE)) + 1;
2951 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
2952
2953 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE).");
2954 ctx.glTexSubImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2955 ctx.expectError(GL_INVALID_VALUE);
2956 ctx.endSection();
2957
2958 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
2959 ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2960 ctx.expectError(GL_INVALID_VALUE);
2961 ctx.endSection();
2962
2963 ctx.glDeleteTextures (2, &textures[0]);
2964 }
2965
texsubimage3d_neg_offset(NegativeTestContext & ctx)2966 void texsubimage3d_neg_offset (NegativeTestContext& ctx)
2967 {
2968 deUint32 textures[3];
2969 ctx.glGenTextures (3, &textures[0]);
2970 ctx.glBindTexture (GL_TEXTURE_3D, textures[0]);
2971 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2972 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, textures[1]);
2973 ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2974 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]);
2975 ctx.glTexImage3D (GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2976 ctx.expectError (GL_NO_ERROR);
2977
2978 ctx.beginSection("GL_INVALID_VALUE is generated if xoffset, yoffset or zoffset are negative.");
2979 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, -1, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2980 ctx.expectError(GL_INVALID_VALUE);
2981 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2982 ctx.expectError(GL_INVALID_VALUE);
2983 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2984 ctx.expectError(GL_INVALID_VALUE);
2985 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, -1, -1, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2986 ctx.expectError(GL_INVALID_VALUE);
2987 ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -1, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2988 ctx.expectError(GL_INVALID_VALUE);
2989 ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2990 ctx.expectError(GL_INVALID_VALUE);
2991 ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2992 ctx.expectError(GL_INVALID_VALUE);
2993 ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -1, -1, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2994 ctx.expectError(GL_INVALID_VALUE);
2995
2996 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
2997 {
2998 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, -1, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
2999 ctx.expectError(GL_INVALID_VALUE);
3000 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, -1, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3001 ctx.expectError(GL_INVALID_VALUE);
3002 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3003 ctx.expectError(GL_INVALID_VALUE);
3004 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, -1, -1, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3005 ctx.expectError(GL_INVALID_VALUE);
3006 }
3007
3008 ctx.endSection();
3009
3010 ctx.glDeleteTextures (3, &textures[0]);
3011 }
3012
texsubimage3d_invalid_offset(NegativeTestContext & ctx)3013 void texsubimage3d_invalid_offset (NegativeTestContext& ctx)
3014 {
3015 deUint32 texture = 0x1234;
3016 ctx.glGenTextures (1, &texture);
3017 ctx.glBindTexture (GL_TEXTURE_3D, texture);
3018 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3019 ctx.expectError (GL_NO_ERROR);
3020
3021 ctx.beginSection("GL_INVALID_VALUE is generated if xoffset + width > texture_width.");
3022 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 2, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3023 ctx.expectError(GL_INVALID_VALUE);
3024 ctx.endSection();
3025
3026 ctx.beginSection("GL_INVALID_VALUE is generated if yoffset + height > texture_height.");
3027 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 2, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3028 ctx.expectError(GL_INVALID_VALUE);
3029 ctx.endSection();
3030
3031 ctx.beginSection("GL_INVALID_VALUE is generated if zoffset + depth > texture_depth.");
3032 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 2, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3033 ctx.expectError(GL_INVALID_VALUE);
3034 ctx.endSection();
3035
3036 ctx.glDeleteTextures (1, &texture);
3037 }
3038
texsubimage3d_neg_width_height(NegativeTestContext & ctx)3039 void texsubimage3d_neg_width_height (NegativeTestContext& ctx)
3040 {
3041 ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is less than 0.");
3042 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, -1, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3043 ctx.expectError(GL_INVALID_VALUE);
3044 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3045 ctx.expectError(GL_INVALID_VALUE);
3046 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3047 ctx.expectError(GL_INVALID_VALUE);
3048 ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, -1, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3049 ctx.expectError(GL_INVALID_VALUE);
3050
3051 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3052 {
3053 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, 0, -1, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3054 ctx.expectError(GL_INVALID_VALUE);
3055 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, 0, 0, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3056 ctx.expectError(GL_INVALID_VALUE);
3057 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3058 ctx.expectError(GL_INVALID_VALUE);
3059 ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, 0, -1, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3060 ctx.expectError(GL_INVALID_VALUE);
3061 }
3062
3063 ctx.endSection();
3064 }
3065
texsubimage3d_invalid_buffer_target(NegativeTestContext & ctx)3066 void texsubimage3d_invalid_buffer_target (NegativeTestContext& ctx)
3067 {
3068 deUint32 buf = 0x1234;
3069 deUint32 texture = 0x1234;
3070 std::vector<GLubyte> data(512);
3071
3072 ctx.glGenTextures (1, &texture);
3073 ctx.glBindTexture (GL_TEXTURE_3D, texture);
3074 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 16, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3075 ctx.glGenBuffers (1, &buf);
3076 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
3077 ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 512, &data[0], GL_DYNAMIC_COPY);
3078 ctx.expectError (GL_NO_ERROR);
3079
3080 ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and...");
3081
3082 ctx.beginSection("...the buffer object's data store is currently mapped.");
3083 ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 512, GL_MAP_WRITE_BIT);
3084 ctx.glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3085 ctx.expectError (GL_INVALID_OPERATION);
3086 ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
3087 ctx.endSection();
3088
3089 ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.");
3090 ctx.glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 16, 16, 16, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3091 ctx.expectError (GL_INVALID_OPERATION);
3092 ctx.endSection();
3093
3094 ctx.beginSection("...data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type.");
3095 ctx.getLog() << TestLog::Message << "// Set byte offset = 3" << TestLog::EndMessage;
3096 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
3097 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 0);
3098 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
3099 ctx.expectError (GL_NO_ERROR);
3100 ctx.glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (const GLvoid*)3);
3101 ctx.expectError (GL_INVALID_OPERATION);
3102 ctx.endSection();
3103
3104 ctx.endSection();
3105
3106 ctx.glDeleteBuffers (1, &buf);
3107 ctx.glDeleteTextures (1, &texture);
3108 }
3109
3110 // glCopyTexSubImage3D
3111
copytexsubimage3d(NegativeTestContext & ctx)3112 void copytexsubimage3d (NegativeTestContext& ctx)
3113 {
3114 GLuint texture = 0x1234;
3115 ctx.glGenTextures (1, &texture);
3116 ctx.glBindTexture (GL_TEXTURE_3D, texture);
3117 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3118
3119 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
3120 ctx.glCopyTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 4, 4);
3121 ctx.expectError(GL_INVALID_ENUM);
3122 ctx.endSection();
3123
3124 ctx.glDeleteTextures(1, &texture);
3125 }
3126
copytexsubimage3d_neg_level(NegativeTestContext & ctx)3127 void copytexsubimage3d_neg_level (NegativeTestContext& ctx)
3128 {
3129 deUint32 textures[3];
3130 ctx.glGenTextures(3, &textures[0]);
3131 ctx.glBindTexture(GL_TEXTURE_3D, textures[0]);
3132 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3133 ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, textures[1]);
3134 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3135 ctx.expectError(GL_NO_ERROR);
3136
3137 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
3138 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, -1, 0, 0, 0, 0, 0, 4, 4);
3139 ctx.expectError(GL_INVALID_VALUE);
3140 ctx.glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 4, 4);
3141 ctx.expectError(GL_INVALID_VALUE);
3142
3143 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3144 {
3145 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]);
3146 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3147 ctx.expectError(GL_NO_ERROR);
3148 ctx.glCopyTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, -1, 0, 0, 0, 0, 0, 4, 4);
3149 ctx.expectError(GL_INVALID_VALUE);
3150 }
3151
3152 ctx.endSection();
3153
3154 ctx.glDeleteTextures(3, &textures[0]);
3155 }
3156
copytexsubimage3d_max_level(NegativeTestContext & ctx)3157 void copytexsubimage3d_max_level (NegativeTestContext& ctx)
3158 {
3159 deUint32 log2Max3DTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_3D_TEXTURE_SIZE)) + 1;
3160 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
3161 deUint32 log2MaxCubeMapTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
3162
3163 deUint32 textures[3];
3164 ctx.glGenTextures(3, &textures[0]);
3165 ctx.glBindTexture(GL_TEXTURE_3D, textures[0]);
3166 ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3167 ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, textures[1]);
3168 ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3169 ctx.expectError(GL_NO_ERROR);
3170
3171 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_3D_TEXTURE_SIZE).");
3172 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 4, 4);
3173 ctx.expectError(GL_INVALID_VALUE);
3174 ctx.endSection();
3175
3176 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
3177 ctx.glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 4, 4);
3178 ctx.expectError(GL_INVALID_VALUE);
3179 ctx.endSection();
3180
3181 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3182 {
3183 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]);
3184 ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3185 ctx.expectError(GL_NO_ERROR);
3186 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_CUBE_MAP_TEXTURE_SIZE).");
3187 ctx.glCopyTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, log2MaxCubeMapTextureSize, 0, 0, 0, 0, 0, 4, 4);
3188 ctx.expectError(GL_INVALID_VALUE);
3189 ctx.endSection();
3190 }
3191
3192 ctx.glDeleteTextures(3, &textures[0]);
3193 }
3194
copytexsubimage3d_neg_offset(NegativeTestContext & ctx)3195 void copytexsubimage3d_neg_offset (NegativeTestContext& ctx)
3196 {
3197 GLuint texture = 0x1234;
3198 ctx.glGenTextures (1, &texture);
3199 ctx.glBindTexture (GL_TEXTURE_3D, texture);
3200 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3201
3202 ctx.beginSection("GL_INVALID_VALUE is generated if xoffset, yoffset or zoffset is negative.");
3203 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, -1, 0, 0, 0, 0, 4, 4);
3204 ctx.expectError(GL_INVALID_VALUE);
3205 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, -1, 0, 0, 0, 4, 4);
3206 ctx.expectError(GL_INVALID_VALUE);
3207 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, -1, 0, 0, 4, 4);
3208 ctx.expectError(GL_INVALID_VALUE);
3209 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, -1, -1, -1, 0, 0, 4, 4);
3210 ctx.expectError(GL_INVALID_VALUE);
3211 ctx.endSection();
3212
3213 ctx.glDeleteTextures(1, &texture);
3214 }
3215
copytexsubimage3d_invalid_offset(NegativeTestContext & ctx)3216 void copytexsubimage3d_invalid_offset (NegativeTestContext& ctx)
3217 {
3218 GLuint texture = 0x1234;
3219 ctx.glGenTextures (1, &texture);
3220 ctx.glBindTexture (GL_TEXTURE_3D, texture);
3221 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3222
3223 ctx.beginSection("GL_INVALID_VALUE is generated if xoffset + width > texture_width.");
3224 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 1, 0, 0, 0, 0, 4, 4);
3225 ctx.expectError(GL_INVALID_VALUE);
3226 ctx.endSection();
3227
3228 ctx.beginSection("GL_INVALID_VALUE is generated if yoffset + height > texture_height.");
3229 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 1, 0, 0, 0, 4, 4);
3230 ctx.expectError(GL_INVALID_VALUE);
3231 ctx.endSection();
3232
3233 ctx.beginSection("GL_INVALID_VALUE is generated if zoffset + 1 > texture_depth.");
3234 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 4, 0, 0, 4, 4);
3235 ctx.expectError(GL_INVALID_VALUE);
3236 ctx.endSection();
3237
3238 ctx.glDeleteTextures(1, &texture);
3239 }
3240
copytexsubimage3d_neg_width_height(NegativeTestContext & ctx)3241 void copytexsubimage3d_neg_width_height (NegativeTestContext& ctx)
3242 {
3243 GLuint texture = 0x1234;
3244 ctx.glGenTextures (1, &texture);
3245 ctx.glBindTexture (GL_TEXTURE_3D, texture);
3246 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3247
3248 ctx.beginSection("GL_INVALID_VALUE is generated if width < 0.");
3249 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, -4, 4);
3250 ctx.expectError(GL_INVALID_VALUE);
3251 ctx.endSection();
3252
3253 ctx.beginSection("GL_INVALID_VALUE is generated if height < 0.");
3254 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, -4);
3255 ctx.expectError(GL_INVALID_VALUE);
3256 ctx.endSection();
3257
3258 ctx.glDeleteTextures(1, &texture);
3259 }
3260
copytexsubimage3d_incomplete_framebuffer(NegativeTestContext & ctx)3261 void copytexsubimage3d_incomplete_framebuffer (NegativeTestContext& ctx)
3262 {
3263 GLuint fbo = 0x1234;
3264 GLuint texture[2];
3265
3266 ctx.glGenTextures (2, texture);
3267 ctx.glBindTexture (GL_TEXTURE_3D, texture[0]);
3268 ctx.glTexImage3D (GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3269 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture[1]);
3270 ctx.glTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
3271 ctx.glGenFramebuffers (1, &fbo);
3272 ctx.glBindFramebuffer (GL_READ_FRAMEBUFFER, fbo);
3273 ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
3274
3275 ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
3276 ctx.glCopyTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, 4);
3277 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
3278 ctx.glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 4, 4);
3279 ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
3280 ctx.endSection();
3281
3282 ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3283 ctx.glDeleteFramebuffers(1, &fbo);
3284 ctx.glDeleteTextures(2, texture);
3285 }
3286
3287 // glCompressedTexImage3D
3288
compressedteximage3d(NegativeTestContext & ctx)3289 void compressedteximage3d (NegativeTestContext& ctx)
3290 {
3291 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
3292 ctx.glCompressedTexImage3D(0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0);
3293 ctx.expectError(GL_INVALID_ENUM);
3294 ctx.glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0);
3295 ctx.expectError(GL_INVALID_ENUM);
3296 ctx.endSection();
3297
3298 ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not one of the specific compressed internal formats.");
3299 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 0, 0);
3300 ctx.expectError(GL_INVALID_ENUM);
3301 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 0, 0, 0, 0, 0, 0);
3302 ctx.expectError(GL_INVALID_ENUM);
3303 ctx.endSection();
3304 }
3305
compressedteximage3d_neg_level(NegativeTestContext & ctx)3306 void compressedteximage3d_neg_level (NegativeTestContext& ctx)
3307 {
3308 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
3309 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, -1, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0);
3310 ctx.expectError(GL_INVALID_VALUE);
3311 ctx.endSection();
3312 }
3313
compressedteximage3d_max_level(NegativeTestContext & ctx)3314 void compressedteximage3d_max_level (NegativeTestContext& ctx)
3315 {
3316 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
3317 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
3318 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0, 0);
3319 ctx.expectError(GL_INVALID_VALUE);
3320 ctx.endSection();
3321 }
3322
compressedteximage3d_neg_width_height_depth(NegativeTestContext & ctx)3323 void compressedteximage3d_neg_width_height_depth (NegativeTestContext& ctx)
3324 {
3325 ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is less than 0.");
3326 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, 0, 0);
3327 ctx.expectError(GL_INVALID_VALUE);
3328 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, 0, 0);
3329 ctx.expectError(GL_INVALID_VALUE);
3330 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0, 0);
3331 ctx.expectError(GL_INVALID_VALUE);
3332 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, -1, -1, 0, 0, 0);
3333 ctx.expectError(GL_INVALID_VALUE);
3334 ctx.endSection();
3335 }
3336
compressedteximage3d_max_width_height_depth(NegativeTestContext & ctx)3337 void compressedteximage3d_max_width_height_depth (NegativeTestContext& ctx)
3338 {
3339 int maxTextureSize = ctx.getInteger(GL_MAX_TEXTURE_SIZE) + 1;
3340
3341 ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth is greater than GL_MAX_TEXTURE_SIZE.");
3342 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 0, 0, 0, 0, 0);
3343 ctx.expectError(GL_INVALID_VALUE);
3344 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, maxTextureSize, 0, 0, 0, 0);
3345 ctx.expectError(GL_INVALID_VALUE);
3346 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, maxTextureSize, 0, 0, 0);
3347 ctx.expectError(GL_INVALID_VALUE);
3348 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, maxTextureSize, 0, 0, 0);
3349 ctx.expectError(GL_INVALID_VALUE);
3350 ctx.endSection();
3351 }
3352
compressedteximage3d_invalid_border(NegativeTestContext & ctx)3353 void compressedteximage3d_invalid_border (NegativeTestContext& ctx)
3354 {
3355 ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0.");
3356 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, -1, 0, 0);
3357 ctx.expectError(GL_INVALID_VALUE);
3358 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 1, 0, 0);
3359 ctx.expectError(GL_INVALID_VALUE);
3360 ctx.endSection();
3361 }
3362
compressedteximage3d_invalid_size(NegativeTestContext & ctx)3363 void compressedteximage3d_invalid_size (NegativeTestContext& ctx)
3364 {
3365 ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.");
3366 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, -1, 0);
3367 ctx.expectError(GL_INVALID_VALUE);
3368 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, 4*4*8, 0);
3369 ctx.expectError(GL_INVALID_VALUE);
3370 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 1, 0, 4*4*16, 0);
3371 ctx.expectError(GL_INVALID_VALUE);
3372 ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_SIGNED_R11_EAC, 16, 16, 1, 0, 4*4*16, 0);
3373 ctx.expectError(GL_INVALID_VALUE);
3374 ctx.endSection();
3375 }
3376
compressedteximage3d_invalid_width_height(NegativeTestContext & ctx)3377 void compressedteximage3d_invalid_width_height (NegativeTestContext& ctx)
3378 {
3379 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3380 {
3381 const int width = 4;
3382 const int height = 6;
3383 const int depth = 6;
3384 const int blockSize = 16;
3385 const int imageSize = divRoundUp(width, 4) * divRoundUp(height, 4) * depth * blockSize;
3386 std::vector<GLubyte> data (imageSize);
3387 ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TEXTURE_CUBE_MAP_ARRAY and width and height are not equal.");
3388 ctx.glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, width, height, depth, 0, imageSize, &data[0]);
3389 ctx.expectError(GL_INVALID_VALUE);
3390 ctx.endSection();
3391 }
3392 }
3393
compressedteximage3d_invalid_buffer_target(NegativeTestContext & ctx)3394 void compressedteximage3d_invalid_buffer_target (NegativeTestContext& ctx)
3395 {
3396 deUint32 buf = 0x1234;
3397 std::vector<GLubyte> data(512);
3398
3399 ctx.glGenBuffers (1, &buf);
3400 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
3401 ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, 64, &data[0], GL_DYNAMIC_COPY);
3402 ctx.expectError (GL_NO_ERROR);
3403
3404 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.");
3405 ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, 64, GL_MAP_WRITE_BIT);
3406 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 4, 4, 1, 0, etc2DataSize(4, 4), 0);
3407 ctx.expectError (GL_INVALID_OPERATION);
3408 ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
3409 ctx.endSection();
3410
3411 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.");
3412 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGB8_ETC2, 16, 16, 1, 0, etc2DataSize(16, 16), 0);
3413 ctx.expectError (GL_INVALID_OPERATION);
3414 ctx.endSection();
3415
3416 ctx.glDeleteBuffers (1, &buf);
3417 }
3418
3419 // glCompressedTexSubImage3D
3420
compressedtexsubimage3d(NegativeTestContext & ctx)3421 void compressedtexsubimage3d (NegativeTestContext& ctx)
3422 {
3423 ctx.beginSection("GL_INVALID_ENUM is generated if target is invalid.");
3424 ctx.glCompressedTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3425 ctx.expectError(GL_INVALID_ENUM);
3426 ctx.endSection();
3427
3428 deUint32 texture = 0x1234;
3429 ctx.glGenTextures (1, &texture);
3430 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture);
3431 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 1, 0, etc2EacDataSize(18, 18), 0);
3432 ctx.expectError (GL_NO_ERROR);
3433
3434 ctx.beginSection("GL_INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified.");
3435 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGB8_ETC2, 0, 0);
3436 ctx.expectError(GL_INVALID_OPERATION);
3437 ctx.endSection();
3438
3439 ctx.beginSection("GL_INVALID_OPERATION is generated if internalformat is an ETC2/EAC format and target is not GL_TEXTURE_2D_ARRAY.");
3440 ctx.glCompressedTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 18, 18, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(18, 18), 0);
3441 ctx.expectError(GL_INVALID_OPERATION);
3442 ctx.endSection();
3443
3444 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.");
3445 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 4, 0, 0, 10, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(10, 4), 0);
3446 ctx.expectError(GL_INVALID_OPERATION);
3447 ctx.endSection();
3448
3449 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.");
3450 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 4, 0, 4, 10, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 10), 0);
3451 ctx.expectError(GL_INVALID_OPERATION);
3452 ctx.endSection();
3453
3454 ctx.beginSection("For ETC2/EAC images GL_INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four.");
3455 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 1, 0, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
3456 ctx.expectError(GL_INVALID_OPERATION);
3457 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 1, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
3458 ctx.expectError(GL_INVALID_OPERATION);
3459 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 1, 1, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
3460 ctx.expectError(GL_INVALID_OPERATION);
3461 ctx.endSection();
3462
3463 ctx.glDeleteTextures (1, &texture);
3464 }
3465
compressedtexsubimage3d_neg_level(NegativeTestContext & ctx)3466 void compressedtexsubimage3d_neg_level (NegativeTestContext& ctx)
3467 {
3468 deUint32 texture = 0x1234;
3469 ctx.glGenTextures (1, &texture);
3470 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture);
3471 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0);
3472 ctx.expectError (GL_NO_ERROR);
3473
3474 ctx.beginSection("GL_INVALID_VALUE is generated if level is less than 0.");
3475 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3476 ctx.expectError(GL_INVALID_VALUE);
3477 ctx.endSection();
3478
3479 ctx.glDeleteTextures (1, &texture);
3480 }
3481
compressedtexsubimage3d_max_level(NegativeTestContext & ctx)3482 void compressedtexsubimage3d_max_level (NegativeTestContext& ctx)
3483 {
3484 deUint32 texture = 0x1234;
3485 ctx.glGenTextures (1, &texture);
3486 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture);
3487 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0);
3488 ctx.expectError (GL_NO_ERROR);
3489
3490 ctx.beginSection("GL_INVALID_VALUE is generated if level is greater than log_2(GL_MAX_TEXTURE_SIZE).");
3491 deUint32 log2MaxTextureSize = deLog2Floor32(ctx.getInteger(GL_MAX_TEXTURE_SIZE)) + 1;
3492 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3493 ctx.expectError(GL_INVALID_VALUE);
3494 ctx.endSection();
3495
3496 ctx.glDeleteTextures (1, &texture);
3497 }
3498
compressedtexsubimage3d_neg_offset(NegativeTestContext & ctx)3499 void compressedtexsubimage3d_neg_offset (NegativeTestContext& ctx)
3500 {
3501 deUint32 texture = 0x1234;
3502 ctx.glGenTextures (1, &texture);
3503 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture);
3504 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0);
3505 ctx.expectError (GL_NO_ERROR);
3506
3507 ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset, yoffset or zoffset are negative.");
3508 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -4, 0, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3509 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3510 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, -4, 0, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3511 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3512 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3513 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3514 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -4, -4, -4, 0, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3515 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3516 ctx.endSection();
3517
3518 ctx.glDeleteTextures (1, &texture);
3519 }
3520
compressedtexsubimage3d_invalid_offset(NegativeTestContext & ctx)3521 void compressedtexsubimage3d_invalid_offset (NegativeTestContext& ctx)
3522 {
3523 deUint32 texture = 0x1234;
3524 ctx.glGenTextures (1, &texture);
3525 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture);
3526 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 1, 0, etc2EacDataSize(4, 4), 0);
3527 ctx.expectError (GL_NO_ERROR);
3528
3529 ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height.");
3530
3531 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 12, 0, 0, 8, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 4), 0);
3532 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3533 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 12, 0, 4, 8, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 8), 0);
3534 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3535 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 12, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
3536 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3537 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 12, 12, 12, 8, 8, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(8, 8), 0);
3538 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3539 ctx.endSection();
3540
3541 ctx.glDeleteTextures (1, &texture);
3542 }
3543
compressedtexsubimage3d_neg_width_height_depth(NegativeTestContext & ctx)3544 void compressedtexsubimage3d_neg_width_height_depth (NegativeTestContext& ctx)
3545 {
3546 deUint32 texture = 0x1234;
3547 ctx.glGenTextures (1, &texture);
3548 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture);
3549 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0);
3550 ctx.expectError (GL_NO_ERROR);
3551
3552 ctx.beginSection("GL_INVALID_VALUE or GL_INVALID_OPERATION is generated if width, height or depth are negative.");
3553 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, 0, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3554 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3555 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, -4, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3556 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3557 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3558 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3559 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, -4, -4, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0);
3560 ctx.expectError(GL_INVALID_VALUE, GL_INVALID_OPERATION);
3561 ctx.endSection();
3562
3563 ctx.glDeleteTextures (1, &texture);
3564 }
3565
compressedtexsubimage3d_invalid_size(NegativeTestContext & ctx)3566 void compressedtexsubimage3d_invalid_size (NegativeTestContext& ctx)
3567 {
3568 deUint32 texture = 0x1234;
3569 ctx.glGenTextures (1, &texture);
3570 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture);
3571 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, 4*4*16, 0);
3572 ctx.expectError (GL_NO_ERROR);
3573
3574 ctx.beginSection("GL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.");
3575 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, -1, 0);
3576 ctx.expectError(GL_INVALID_VALUE);
3577
3578 ctx.glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, 4*4*16-1, 0);
3579 ctx.expectError(GL_INVALID_VALUE);
3580 ctx.endSection();
3581
3582 ctx.glDeleteTextures (1, &texture);
3583 }
3584
compressedtexsubimage3d_invalid_buffer_target(NegativeTestContext & ctx)3585 void compressedtexsubimage3d_invalid_buffer_target (NegativeTestContext& ctx)
3586 {
3587 deUint32 buf = 0x1234;
3588 deUint32 texture = 0x1234;
3589 GLsizei bufferSize = etc2EacDataSize(4, 4);
3590 std::vector<GLubyte> data(bufferSize);
3591
3592 ctx.glGenTextures (1, &texture);
3593 ctx.glBindTexture (GL_TEXTURE_2D_ARRAY, texture);
3594 ctx.glCompressedTexImage3D (GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, etc2EacDataSize(16, 16), 0);
3595 ctx.glGenBuffers (1, &buf);
3596 ctx.glBindBuffer (GL_PIXEL_UNPACK_BUFFER, buf);
3597 ctx.glBufferData (GL_PIXEL_UNPACK_BUFFER, bufferSize, &data[0], GL_DYNAMIC_COPY);
3598 ctx.expectError (GL_NO_ERROR);
3599
3600 ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_UNPACK_BUFFER target and...");
3601 ctx.beginSection("...the buffer object's data store is currently mapped.");
3602 ctx.glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0, bufferSize, GL_MAP_WRITE_BIT);
3603 ctx.glCompressedTexSubImage3D (GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 4, 4, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(4, 4), 0);
3604 ctx.expectError (GL_INVALID_OPERATION);
3605 ctx.glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
3606 ctx.endSection();
3607
3608 ctx.beginSection("...the data would be unpacked from the buffer object such that the memory reads required would exceed the data store size.");
3609 ctx.glCompressedTexSubImage3D (GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, GL_COMPRESSED_RGBA8_ETC2_EAC, etc2EacDataSize(16, 16), 0);
3610 ctx.expectError (GL_INVALID_OPERATION);
3611 ctx.endSection();
3612 ctx.endSection();
3613
3614 ctx.glDeleteBuffers (1, &buf);
3615 ctx.glDeleteTextures (1, &texture);
3616 }
3617
3618 // glTexStorage2D
3619
texstorage2d(NegativeTestContext & ctx)3620 void texstorage2d (NegativeTestContext& ctx)
3621 {
3622 deUint32 textures[] = {0x1234, 0x1234};
3623
3624 ctx.glGenTextures(2, textures);
3625 ctx.glBindTexture(GL_TEXTURE_2D, textures[0]);
3626 ctx.expectError(GL_NO_ERROR);
3627
3628 ctx.beginSection("GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not a valid sized internal format.");
3629 ctx.glTexStorage2D(GL_TEXTURE_2D, 1, 0, 16, 16);
3630 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
3631 ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA_INTEGER, 16, 16);
3632 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
3633 ctx.endSection();
3634
3635 ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted target enumerants.");
3636 ctx.glTexStorage2D(0, 1, GL_RGBA8, 16, 16);
3637 ctx.expectError(GL_INVALID_ENUM);
3638 ctx.glTexStorage2D(GL_TEXTURE_3D, 1, GL_RGBA8, 16, 16);
3639 ctx.expectError(GL_INVALID_ENUM);
3640 ctx.glTexStorage2D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 16, 16);
3641 ctx.expectError(GL_INVALID_ENUM);
3642 ctx.endSection();
3643
3644 ctx.beginSection("GL_INVALID_VALUE is generated if width or height are less than 1.");
3645 ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 0, 16);
3646 ctx.expectError(GL_INVALID_VALUE);
3647 ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 16, 0);
3648 ctx.expectError(GL_INVALID_VALUE);
3649 ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 0, 0);
3650 ctx.expectError(GL_INVALID_VALUE);
3651
3652 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
3653 {
3654 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, textures[1]);
3655 ctx.expectError(GL_NO_ERROR);
3656 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 0, 16);
3657 ctx.expectError(GL_INVALID_VALUE);
3658 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 16, 0);
3659 ctx.expectError(GL_INVALID_VALUE);
3660 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 0, 0);
3661 ctx.expectError(GL_INVALID_VALUE);
3662 }
3663 ctx.endSection();
3664
3665 ctx.glDeleteTextures(2, textures);
3666 }
3667
texstorage2d_invalid_binding(NegativeTestContext & ctx)3668 void texstorage2d_invalid_binding (NegativeTestContext& ctx)
3669 {
3670 deUint32 textures[] = {0x1234, 0x1234};
3671 deInt32 immutable = 0x1234;
3672 const bool isES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
3673
3674 ctx.beginSection("GL_INVALID_OPERATION is generated if the default texture object is curently bound to target.");
3675 ctx.glBindTexture(GL_TEXTURE_2D, 0);
3676 ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16);
3677 ctx.expectError(GL_INVALID_OPERATION);
3678
3679 if (isES32)
3680 {
3681 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
3682 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 16, 16);
3683 ctx.expectError(GL_INVALID_OPERATION);
3684 }
3685 ctx.endSection();
3686
3687 ctx.glGenTextures(2, textures);
3688
3689 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.");
3690 ctx.glBindTexture(GL_TEXTURE_2D, textures[0]);
3691 ctx.glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable);
3692 ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
3693 ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16);
3694 ctx.expectError(GL_NO_ERROR);
3695 ctx.glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable);
3696 ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
3697 ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16);
3698 ctx.expectError(GL_INVALID_OPERATION);
3699
3700 if (isES32)
3701 {
3702 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, textures[1]);
3703 ctx.glGetTexParameteriv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable);
3704 ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
3705 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 16, 16);
3706 ctx.expectError(GL_NO_ERROR);
3707 ctx.glGetTexParameteriv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable);
3708 ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
3709 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 16, 16);
3710 ctx.expectError(GL_INVALID_OPERATION);
3711 }
3712 ctx.endSection();
3713
3714 ctx.glDeleteTextures(2, textures);
3715 }
3716
texstorage2d_invalid_levels(NegativeTestContext & ctx)3717 void texstorage2d_invalid_levels (NegativeTestContext& ctx)
3718 {
3719 deUint32 textures[] = {0x1234, 0x1234};
3720 deUint32 log2MaxSize = deLog2Floor32(deMax32(16, 16)) + 1 + 1;
3721 const bool isES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
3722
3723 ctx.glGenTextures(2, textures);
3724 ctx.glBindTexture(GL_TEXTURE_2D, textures[0]);
3725
3726 if (isES32)
3727 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, textures[1]);
3728
3729 ctx.expectError(GL_NO_ERROR);
3730
3731 ctx.beginSection("GL_INVALID_VALUE is generated if levels is less than 1.");
3732 ctx.glTexStorage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16);
3733 ctx.expectError(GL_INVALID_VALUE);
3734 ctx.glTexStorage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0);
3735 ctx.expectError(GL_INVALID_VALUE);
3736
3737 if (isES32)
3738 {
3739 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 0, GL_RGBA8, 16, 16);
3740 ctx.expectError(GL_INVALID_VALUE);
3741 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 0, GL_RGBA8, 0, 0);
3742 ctx.expectError(GL_INVALID_VALUE);
3743 }
3744 ctx.endSection();
3745
3746 ctx.beginSection("GL_INVALID_OPERATION is generated if levels is greater than floor(log_2(max(width, height))) + 1");
3747 ctx.glTexStorage2D(GL_TEXTURE_2D, log2MaxSize, GL_RGBA8, 16, 16);
3748 ctx.expectError(GL_INVALID_OPERATION);
3749
3750 if (isES32)
3751 {
3752 ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, log2MaxSize, GL_RGBA8, 16, 16);
3753 ctx.expectError(GL_INVALID_OPERATION);
3754 }
3755 ctx.endSection();
3756
3757 ctx.glDeleteTextures(2, textures);
3758 }
3759
3760 // glTexStorage3D
3761
texstorage3d(NegativeTestContext & ctx)3762 void texstorage3d (NegativeTestContext& ctx)
3763 {
3764 deUint32 textures[] = {0x1234, 0x1234};
3765
3766 ctx.glGenTextures(2, textures);
3767 ctx.glBindTexture(GL_TEXTURE_3D, textures[0]);
3768 ctx.expectError(GL_NO_ERROR);
3769
3770 ctx.beginSection("GL_INVALID_ENUM or GL_INVALID_VALUE is generated if internalformat is not a valid sized internal format.");
3771 ctx.glTexStorage3D(GL_TEXTURE_3D, 1, 0, 4, 4, 4);
3772 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
3773 ctx.glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA_INTEGER, 4, 4, 4);
3774 ctx.expectError(GL_INVALID_ENUM, GL_INVALID_VALUE);
3775 ctx.endSection();
3776
3777 ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted target enumerants.");
3778 ctx.glTexStorage3D(0, 1, GL_RGBA8, 4, 4, 4);
3779 ctx.expectError(GL_INVALID_ENUM);
3780 ctx.glTexStorage3D(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 4, 4, 4);
3781 ctx.expectError(GL_INVALID_ENUM);
3782 ctx.glTexStorage3D(GL_TEXTURE_2D, 1, GL_RGBA8, 4, 4, 4);
3783 ctx.expectError(GL_INVALID_ENUM);
3784 ctx.endSection();
3785
3786 ctx.beginSection("GL_INVALID_VALUE is generated if width, height or depth are less than 1.");
3787 ctx.glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA8, 0, 4, 4);
3788 ctx.expectError(GL_INVALID_VALUE);
3789 ctx.glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA8, 4, 0, 4);
3790 ctx.expectError(GL_INVALID_VALUE);
3791 ctx.glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 0);
3792 ctx.expectError(GL_INVALID_VALUE);
3793 ctx.glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA8, 0, 0, 0);
3794 ctx.expectError(GL_INVALID_VALUE);
3795
3796 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3797 {
3798 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures[1]);
3799 ctx.expectError(GL_NO_ERROR);
3800 ctx.glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA8, 0, 4, 4);
3801 ctx.expectError(GL_INVALID_VALUE);
3802 ctx.glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA8, 4, 0, 4);
3803 ctx.expectError(GL_INVALID_VALUE);
3804 ctx.glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA8, 4, 4, 0);
3805 ctx.expectError(GL_INVALID_VALUE);
3806 ctx.glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA8, 0, 0, 0);
3807 ctx.expectError(GL_INVALID_VALUE);
3808 }
3809 ctx.endSection();
3810
3811 ctx.glDeleteTextures(2, textures);
3812 }
3813
texstorage3d_invalid_binding(NegativeTestContext & ctx)3814 void texstorage3d_invalid_binding (NegativeTestContext& ctx)
3815 {
3816 deUint32 textures[] = {0x1234, 0x1234};
3817 deInt32 immutable = 0x1234;
3818
3819 ctx.beginSection("GL_INVALID_OPERATION is generated if the default texture object is curently bound to target.");
3820 ctx.glBindTexture (GL_TEXTURE_3D, 0);
3821 ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4);
3822 ctx.expectError (GL_INVALID_OPERATION);
3823
3824 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3825 {
3826 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, 0);
3827 ctx.glTexStorage3D (GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA8, 4, 4, 6);
3828 ctx.expectError (GL_INVALID_OPERATION);
3829 }
3830 ctx.endSection();
3831
3832 ctx.glGenTextures (2, textures);
3833
3834 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.");
3835 ctx.glBindTexture (GL_TEXTURE_3D, textures[0]);
3836 ctx.glGetTexParameteriv(GL_TEXTURE_3D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable);
3837 ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
3838 ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4);
3839 ctx.expectError (GL_NO_ERROR);
3840 ctx.glGetTexParameteriv(GL_TEXTURE_3D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable);
3841 ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
3842 ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4);
3843 ctx.expectError (GL_INVALID_OPERATION);
3844
3845 if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3846 {
3847 ctx.glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, textures[1]);
3848 ctx.glGetTexParameteriv(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable);
3849 ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
3850 ctx.glTexStorage3D (GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA8, 4, 4, 6);
3851 ctx.expectError (GL_NO_ERROR);
3852 ctx.glGetTexParameteriv(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable);
3853 ctx.getLog() << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
3854 ctx.glTexStorage3D (GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA8, 4, 4, 6);
3855 ctx.expectError (GL_INVALID_OPERATION);
3856 }
3857 ctx.endSection();
3858
3859 ctx.glDeleteTextures(2, textures);
3860 }
3861
texstorage3d_invalid_levels(NegativeTestContext & ctx)3862 void texstorage3d_invalid_levels (NegativeTestContext& ctx)
3863 {
3864 deUint32 textures[] = {0x1234, 0x1234};
3865 deUint32 log2MaxSize = deLog2Floor32(8) + 1 + 1;
3866 const bool isES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
3867 ctx.glGenTextures(2, textures);
3868 ctx.glBindTexture(GL_TEXTURE_3D, textures[0]);
3869
3870 ctx.beginSection("GL_INVALID_VALUE is generated if levels is less than 1.");
3871 ctx.glTexStorage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 4, 4, 4);
3872 ctx.expectError(GL_INVALID_VALUE);
3873 ctx.glTexStorage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 0, 0, 0);
3874 ctx.expectError(GL_INVALID_VALUE);
3875
3876 if (isES32 || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3877 {
3878 ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures[1]);
3879 ctx.glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA8, 4, 4, 6);
3880 ctx.expectError(GL_INVALID_VALUE);
3881 ctx.glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA8, 0, 0, 6);
3882 ctx.expectError(GL_INVALID_VALUE);
3883 }
3884 ctx.endSection();
3885
3886 ctx.beginSection("GL_INVALID_OPERATION is generated if levels is greater than floor(log_2(max(width, height, depth))) + 1");
3887 ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 8, 2, 2);
3888 ctx.expectError (GL_INVALID_OPERATION);
3889 ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 2, 8, 2);
3890 ctx.expectError (GL_INVALID_OPERATION);
3891 ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 2, 2, 8);
3892 ctx.expectError (GL_INVALID_OPERATION);
3893 ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 8, 8, 8);
3894 ctx.expectError (GL_INVALID_OPERATION);
3895
3896 if (isES32 || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array"))
3897 {
3898 ctx.glTexStorage3D (GL_TEXTURE_CUBE_MAP_ARRAY, log2MaxSize, GL_RGBA8, 2, 2, 6);
3899 ctx.expectError (GL_INVALID_OPERATION);
3900 ctx.glTexStorage3D (GL_TEXTURE_CUBE_MAP_ARRAY, log2MaxSize, GL_RGBA8, 8, 8, 6);
3901 ctx.expectError (GL_INVALID_OPERATION);
3902 }
3903 ctx.endSection();
3904
3905 ctx.glDeleteTextures(2, textures);
3906 }
3907
getNegativeTextureApiTestFunctions()3908 std::vector<FunctionContainer> getNegativeTextureApiTestFunctions()
3909 {
3910 FunctionContainer funcs[] =
3911 {
3912 {activetexture, "activetexture", "Invalid glActiveTexture() usage" },
3913 {bindtexture, "bindtexture", "Invalid glBindTexture() usage" },
3914 {compressedteximage2d_invalid_target, "compressedteximage2d_invalid_target", "Invalid glCompressedTexImage2D() usage" },
3915 {compressedteximage2d_invalid_format, "compressedteximage2d_invalid_format", "Invalid glCompressedTexImage2D() usage" },
3916 {compressedteximage2d_neg_level, "compressedteximage2d_neg_level", "Invalid glCompressedTexImage2D() usage" },
3917 {compressedteximage2d_max_level, "compressedteximage2d_max_level", "Invalid glCompressedTexImage2D() usage" },
3918 {compressedteximage2d_neg_width_height, "compressedteximage2d_neg_width_height", "Invalid glCompressedTexImage2D() usage" },
3919 {compressedteximage2d_max_width_height, "compressedteximage2d_max_width_height", "Invalid glCompressedTexImage2D() usage" },
3920 {compressedteximage2d_invalid_border, "compressedteximage2d_invalid_border", "Invalid glCompressedTexImage2D() usage" },
3921 {compressedteximage2d_invalid_size, "compressedteximage2d_invalid_size", "Invalid glCompressedTexImage2D() usage" },
3922 {compressedteximage2d_neg_size, "compressedteximage2d_neg_size", "Invalid glCompressedTexImage2D() usage" },
3923 {compressedteximage2d_invalid_width_height, "compressedteximage2d_invalid_width_height", "Invalid glCompressedTexImage2D() usage" },
3924 {compressedteximage2d_invalid_buffer_target, "compressedteximage2d_invalid_buffer_target", "Invalid glCompressedTexImage2D() usage" },
3925 {copyteximage2d_invalid_target, "copyteximage2d_invalid_target", "Invalid glCopyTexImage2D() usage" },
3926 {copyteximage2d_invalid_format, "copyteximage2d_invalid_format", "Invalid glCopyTexImage2D() usage" },
3927 {copyteximage2d_inequal_width_height_cube, "copyteximage2d_inequal_width_height_cube", "Invalid glCopyTexImage2D() usage" },
3928 {copyteximage2d_neg_level, "copyteximage2d_neg_level", "Invalid glCopyTexImage2D() usage" },
3929 {copyteximage2d_max_level, "copyteximage2d_max_level", "Invalid glCopyTexImage2D() usage" },
3930 {copyteximage2d_neg_width_height, "copyteximage2d_neg_width_height", "Invalid glCopyTexImage2D() usage" },
3931 {copyteximage2d_max_width_height, "copyteximage2d_max_width_height", "Invalid glCopyTexImage2D() usage" },
3932 {copyteximage2d_invalid_border, "copyteximage2d_invalid_border", "Invalid glCopyTexImage2D() usage" },
3933 {copyteximage2d_incomplete_framebuffer, "copyteximage2d_incomplete_framebuffer", "Invalid glCopyTexImage2D() usage" },
3934 {copytexsubimage2d_invalid_target, "copytexsubimage2d_invalid_target", "Invalid glCopyTexSubImage2D() usage" },
3935 {copytexsubimage2d_read_buffer_is_none, "copytexsubimage2d_read_buffer_is_none", "Invalid glCopyTexSubImage2D() usage" },
3936 {copytexsubimage2d_texture_internalformat, "copytexsubimage2d_texture_internalformat", "Invalid glCopyTexSubImage2D() usage" },
3937 {copytexsubimage2d_neg_level, "copytexsubimage2d_neg_level", "Invalid glCopyTexSubImage2D() usage" },
3938 {copytexsubimage2d_max_level, "copytexsubimage2d_max_level", "Invalid glCopyTexSubImage2D() usage" },
3939 {copytexsubimage2d_neg_offset, "copytexsubimage2d_neg_offset", "Invalid glCopyTexSubImage2D() usage" },
3940 {copytexsubimage2d_invalid_offset, "copytexsubimage2d_invalid_offset", "Invalid glCopyTexSubImage2D() usage" },
3941 {copytexsubimage2d_neg_width_height, "copytexsubimage2d_neg_width_height", "Invalid glCopyTexSubImage2D() usage" },
3942 {copytexsubimage2d_incomplete_framebuffer, "copytexsubimage2d_incomplete_framebuffer", "Invalid glCopyTexSubImage2D() usage" },
3943 {deletetextures, "deletetextures", "Invalid glDeleteTextures() usage" },
3944 {generatemipmap, "generatemipmap", "Invalid glGenerateMipmap() usage" },
3945 {gentextures, "gentextures", "Invalid glGenTextures() usage" },
3946 {pixelstorei, "pixelstorei", "Invalid glPixelStorei() usage" },
3947 {teximage2d, "teximage2d", "Invalid glTexImage2D() usage" },
3948 {teximage2d_inequal_width_height_cube, "teximage2d_inequal_width_height_cube", "Invalid glTexImage2D() usage" },
3949 {teximage2d_neg_level, "teximage2d_neg_level", "Invalid glTexImage2D() usage" },
3950 {teximage2d_max_level, "teximage2d_max_level", "Invalid glTexImage2D() usage" },
3951 {teximage2d_neg_width_height, "teximage2d_neg_width_height", "Invalid glTexImage2D() usage" },
3952 {teximage2d_max_width_height, "teximage2d_max_width_height", "Invalid glTexImage2D() usage" },
3953 {teximage2d_invalid_border, "teximage2d_invalid_border", "Invalid glTexImage2D() usage" },
3954 {teximage2d_invalid_buffer_target, "teximage2d_invalid_buffer_target", "Invalid glTexImage2D() usage" },
3955 {texsubimage2d, "texsubimage2d", "Invalid glTexSubImage2D() usage" },
3956 {texsubimage2d_neg_level, "texsubimage2d_neg_level", "Invalid glTexSubImage2D() usage" },
3957 {texsubimage2d_max_level, "texsubimage2d_max_level", "Invalid glTexSubImage2D() usage" },
3958 {texsubimage2d_neg_offset, "texsubimage2d_neg_offset", "Invalid glTexSubImage2D() usage" },
3959 {texsubimage2d_invalid_offset, "texsubimage2d_invalid_offset", "Invalid glTexSubImage2D() usage" },
3960 {texsubimage2d_neg_width_height, "texsubimage2d_neg_width_height", "Invalid glTexSubImage2D() usage" },
3961 {texsubimage2d_invalid_buffer_target, "texsubimage2d_invalid_buffer_target", "Invalid glTexSubImage2D() usage" },
3962 {texparameteri, "texparameteri", "Invalid glTexParameteri() usage" },
3963 {texparameterf, "texparameterf", "Invalid glTexParameterf() usage" },
3964 {texparameteriv, "texparameteriv", "Invalid glTexParameteriv() usage" },
3965 {texparameterfv, "texparameterfv", "Invalid glTexParameterfv() usage" },
3966 {texparameterIiv, "texparameterIiv", "Invalid glTexParameterIiv() usage" },
3967 {texparameterIuiv, "texparameterIuiv", "Invalid glTexParameterIuiv() usage" },
3968 {compressedtexsubimage2d, "compressedtexsubimage2d", "Invalid glCompressedTexSubImage2D() usage"},
3969 {compressedtexsubimage2d_neg_level, "compressedtexsubimage2d_neg_level", "Invalid glCompressedTexSubImage2D() usage"},
3970 {compressedtexsubimage2d_max_level, "compressedtexsubimage2d_max_level", "Invalid glCompressedTexSubImage2D() usage"},
3971 {compressedtexsubimage2d_neg_offset, "compressedtexsubimage2d_neg_offset", "Invalid glCompressedTexSubImage2D() usage"},
3972 {compressedtexsubimage2d_invalid_offset, "compressedtexsubimage2d_invalid_offset", "Invalid glCompressedTexSubImage2D() usage"},
3973 {compressedtexsubimage2d_neg_width_height, "compressedtexsubimage2d_neg_width_height", "Invalid glCompressedTexSubImage2D() usage"},
3974 {compressedtexsubimage2d_invalid_size, "compressedtexsubimage2d_invalid_size", "Invalid glCompressedTexImage2D() usage" },
3975 {compressedtexsubimage2d_invalid_buffer_target, "compressedtexsubimage2d_invalid_buffer_target", "Invalid glCompressedTexSubImage2D() usage"},
3976 {teximage3d, "teximage3d", "Invalid glTexImage3D() usage" },
3977 {teximage3d_neg_level, "teximage3d_neg_level", "Invalid glTexImage3D() usage" },
3978 {teximage3d_max_level, "teximage3d_max_level", "Invalid glTexImage3D() usage" },
3979 {teximage3d_neg_width_height_depth, "teximage3d_neg_width_height_depth", "Invalid glTexImage3D() usage" },
3980 {teximage3d_max_width_height_depth, "teximage3d_max_width_height_depth", "Invalid glTexImage3D() usage" },
3981 {teximage3d_invalid_border, "teximage3d_invalid_border", "Invalid glTexImage3D() usage" },
3982 {teximage3d_invalid_buffer_target, "teximage3d_invalid_buffer_target", "Invalid glTexImage3D() usage" },
3983 {texsubimage3d, "texsubimage3d", "Invalid glTexSubImage3D() usage" },
3984 {texsubimage3d_neg_level, "texsubimage3d_neg_level", "Invalid glTexSubImage3D() usage" },
3985 {texsubimage3d_max_level, "texsubimage3d_max_level", "Invalid glTexSubImage3D() usage" },
3986 {texsubimage3d_neg_offset, "texsubimage3d_neg_offset", "Invalid glTexSubImage3D() usage" },
3987 {texsubimage3d_invalid_offset, "texsubimage3d_invalid_offset", "Invalid glTexSubImage3D() usage" },
3988 {texsubimage3d_neg_width_height, "texsubimage3d_neg_width_height", "Invalid glTexSubImage3D() usage" },
3989 {texsubimage3d_invalid_buffer_target, "texsubimage3d_invalid_buffer_target", "Invalid glTexSubImage3D() usage" },
3990 {copytexsubimage3d, "copytexsubimage3d", "Invalid glCopyTexSubImage3D() usage" },
3991 {copytexsubimage3d_neg_level, "copytexsubimage3d_neg_level", "Invalid glCopyTexSubImage3D() usage" },
3992 {copytexsubimage3d_max_level, "copytexsubimage3d_max_level", "Invalid glCopyTexSubImage3D() usage" },
3993 {copytexsubimage3d_neg_offset, "copytexsubimage3d_neg_offset", "Invalid glCopyTexSubImage3D() usage" },
3994 {copytexsubimage3d_invalid_offset, "copytexsubimage3d_invalid_offset", "Invalid glCopyTexSubImage3D() usage" },
3995 {copytexsubimage3d_neg_width_height, "copytexsubimage3d_neg_width_height", "Invalid glCopyTexSubImage3D() usage" },
3996 {copytexsubimage3d_incomplete_framebuffer, "copytexsubimage3d_incomplete_framebuffer", "Invalid glCopyTexSubImage3D() usage" },
3997 {compressedteximage3d, "compressedteximage3d", "Invalid glCompressedTexImage3D() usage" },
3998 {compressedteximage3d_neg_level, "compressedteximage3d_neg_level", "Invalid glCompressedTexImage3D() usage" },
3999 {compressedteximage3d_max_level, "compressedteximage3d_max_level", "Invalid glCompressedTexImage3D() usage" },
4000 {compressedteximage3d_neg_width_height_depth, "compressedteximage3d_neg_width_height_depth", "Invalid glCompressedTexImage3D() usage" },
4001 {compressedteximage3d_max_width_height_depth, "compressedteximage3d_max_width_height_depth", "Invalid glCompressedTexImage3D() usage" },
4002 {compressedteximage3d_invalid_border, "compressedteximage3d_invalid_border", "Invalid glCompressedTexImage3D() usage" },
4003 {compressedteximage3d_invalid_size, "compressedteximage3d_invalid_size", "Invalid glCompressedTexImage3D() usage" },
4004 {compressedteximage3d_invalid_width_height, "compressedteximage3d_invalid_width_height", "Invalid glCompressedTexImage3D() usage" },
4005 {compressedteximage3d_invalid_buffer_target, "compressedteximage3d_invalid_buffer_target", "Invalid glCompressedTexImage3D() usage" },
4006 {compressedtexsubimage3d, "compressedtexsubimage3d", "Invalid glCompressedTexSubImage3D() usage"},
4007 {compressedtexsubimage3d_neg_level, "compressedtexsubimage3d_neg_level", "Invalid glCompressedTexSubImage3D() usage"},
4008 {compressedtexsubimage3d_max_level, "compressedtexsubimage3d_max_level", "Invalid glCompressedTexSubImage3D() usage"},
4009 {compressedtexsubimage3d_neg_offset, "compressedtexsubimage3d_neg_offset", "Invalid glCompressedTexSubImage3D() usage"},
4010 {compressedtexsubimage3d_invalid_offset, "compressedtexsubimage3d_invalid_offset", "Invalid glCompressedTexSubImage3D() usage"},
4011 {compressedtexsubimage3d_neg_width_height_depth,"compressedtexsubimage3d_neg_width_height_depth", "Invalid glCompressedTexSubImage3D() usage"},
4012 {compressedtexsubimage3d_invalid_size, "compressedtexsubimage3d_invalid_size", "Invalid glCompressedTexSubImage3D() usage"},
4013 {compressedtexsubimage3d_invalid_buffer_target, "compressedtexsubimage3d_invalid_buffer_target", "Invalid glCompressedTexSubImage3D() usage"},
4014 {texstorage2d, "texstorage2d", "Invalid glTexStorage2D() usage" },
4015 {texstorage2d_invalid_binding, "texstorage2d_invalid_binding", "Invalid glTexStorage2D() usage" },
4016 {texstorage2d_invalid_levels, "texstorage2d_invalid_levels", "Invalid glTexStorage2D() usage" },
4017 {texstorage3d, "texstorage3d", "Invalid glTexStorage3D() usage" },
4018 {texstorage3d_invalid_binding, "texstorage3d_invalid_binding", "Invalid glTexStorage3D() usage" },
4019 {texstorage3d_invalid_levels, "texstorage3d_invalid_levels", "Invalid glTexStorage3D() usage" },
4020 };
4021
4022 return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
4023 }
4024
4025 } // NegativeTestShared
4026 } // Functional
4027 } // gles31
4028 } // deqp
4029