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