1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.0 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief Negative Texture API tests.
22 *//*--------------------------------------------------------------------*/
24 goog.provide('functional.gles3.es3fNegativeTextureApiTests');
26 goog.require('framework.common.tcuTestCase');
27 goog.require('framework.common.tcuTexture');
28 goog.require('functional.gles3.es3fApiCase');
29 goog.require('framework.opengl.gluTexture');
30 goog.require('framework.opengl.gluTextureUtil');
32 goog.scope(function() {
34 var es3fNegativeTextureApiTests = functional.gles3.es3fNegativeTextureApiTests;
35 var tcuTexture = framework.common.tcuTexture;
36 var es3fApiCase = functional.gles3.es3fApiCase;
37 var tcuTestCase = framework.common.tcuTestCase;
38 var gluTexture = framework.opengl.gluTexture;
39 var gluTextureUtil = framework.opengl.gluTextureUtil;
41 function etc2Unsupported() {
42 debug("Skipping test: no support for WEBGL_compressed_texture_etc");
47 * @param {number} width
48 * @param {number} height
51 es3fNegativeTextureApiTests.etc2DataSize = function(width, height) {
52 return Math.ceil(width / 4) * Math.ceil(height / 4) * 8;
56 * @param {number} width
57 * @param {number} height
60 es3fNegativeTextureApiTests.etc2EacDataSize = function(width, height) {
61 return 2 * es3fNegativeTextureApiTests.etc2DataSize(width, height);
65 * @param {function(number)} func
67 es3fNegativeTextureApiTests.forCubeFaces = function(func) {
69 for (var faceIterTcu in tcuTexture.CubeFace) {
70 faceGLVar = gluTexture.cubeFaceToGLFace(tcuTexture.CubeFace[faceIterTcu]);
76 * @param {WebGL2RenderingContext} gl
78 es3fNegativeTextureApiTests.init = function(gl) {
80 var haveCompressedTextureETC = gluTextureUtil.enableCompressedTextureETC();
82 var testGroup = tcuTestCase.runner.testCases;
84 testGroup.addChild(new es3fApiCase.ApiCaseCallback('activetexture', 'Invalid gl.ActiveTexture() usage', gl,
86 bufferedLogToConsole('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).');
88 this.expectError(gl.INVALID_ENUM);
89 var numMaxTextureUnits = /** @type {number} */(gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS));
90 gl.activeTexture(gl.TEXTURE0 + numMaxTextureUnits);
91 this.expectError(gl.INVALID_ENUM);
97 testGroup.addChild(new es3fApiCase.ApiCaseCallback('bindTexture', 'Invalid gl.bindTexture() usage', gl,
100 /** @type {Array<WebGLTexture>} */ var texture = [];
101 texture[0] = gl.createTexture();
102 texture[1] = gl.createTexture();
104 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is not one of the allowable values.');
105 gl.bindTexture(0, texture[0]);
106 this.expectError(gl.INVALID_ENUM);
107 gl.bindTexture(gl.FRAMEBUFFER, texture[0]);
108 this.expectError(gl.INVALID_ENUM);
110 bufferedLogToConsole('gl.INVALID_OPERATION is generated if texture was previously created with a target that doesn\'t match that of target.');
111 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
112 this.expectError(gl.NO_ERROR);
113 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[0]);
114 this.expectError(gl.INVALID_OPERATION);
115 gl.bindTexture(gl.TEXTURE_3D, texture[0]);
116 this.expectError(gl.INVALID_OPERATION);
117 gl.bindTexture(gl.TEXTURE_2D_ARRAY, texture[0]);
118 this.expectError(gl.INVALID_OPERATION);
120 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
121 this.expectError(gl.NO_ERROR);
122 gl.bindTexture(gl.TEXTURE_2D, texture[1]);
123 this.expectError(gl.INVALID_OPERATION);
124 gl.bindTexture(gl.TEXTURE_3D, texture[1]);
125 this.expectError(gl.INVALID_OPERATION);
126 gl.bindTexture(gl.TEXTURE_2D_ARRAY, texture[1]);
127 this.expectError(gl.INVALID_OPERATION);
129 gl.deleteTexture(texture[0]);
130 gl.deleteTexture(texture[1]);
133 // gl.compressedTexImage2D
135 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_invalid_target', 'Invalid gl.compressedTexImage2D() usage', gl,
137 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
139 /** @type {Array<WebGLTexture>} */ var texture = [];
140 texture[0] = gl.createTexture();
141 texture[1] = gl.createTexture();
142 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
143 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
146 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
147 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);
148 gl.compressedTexImage2D(0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
149 this.expectError(gl.INVALID_ENUM);
150 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
151 this.expectError(gl.INVALID_ENUM);
154 gl.deleteTexture(texture[0]);
155 gl.deleteTexture(texture[1]);
160 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_invalid_format', 'Invalid gl.compressedTexImage2D() usage', gl,
164 /** @type {Array<WebGLTexture>} */ var texture = [];
165 texture[0] = gl.createTexture();
166 texture[1] = gl.createTexture();
167 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
168 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
171 bufferedLogToConsole('gl.INVALID_ENUM is generated if internalformat is not a supported format returned in gl.COMPRESSED_TEXTURE_FORMATS.');
172 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);
173 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, uint8);
174 this.expectError(gl.INVALID_ENUM);
175 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, 0, uint8);
176 this.expectError(gl.INVALID_ENUM);
177 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, 0, 0, 0, uint8);
178 this.expectError(gl.INVALID_ENUM);
179 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, uint8);
180 this.expectError(gl.INVALID_ENUM);
181 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, uint8);
182 this.expectError(gl.INVALID_ENUM);
183 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, uint8);
184 this.expectError(gl.INVALID_ENUM);
185 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, uint8);
186 this.expectError(gl.INVALID_ENUM);
187 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, uint8);
188 this.expectError(gl.INVALID_ENUM);
189 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, uint8);
190 this.expectError(gl.INVALID_ENUM);
193 gl.deleteTexture(texture[0]);
194 gl.deleteTexture(texture[1]);
198 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_neg_level', 'Invalid gl.compressedTexImage2D() usage', gl,
200 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
203 /** @type {Array<WebGLTexture>} */ var texture = [];
204 texture[0] = gl.createTexture();
205 texture[1] = gl.createTexture();
206 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
207 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
210 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
211 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);
212 gl.compressedTexImage2D(gl.TEXTURE_2D, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
213 this.expectError(gl.INVALID_VALUE);
214 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
215 this.expectError(gl.INVALID_VALUE);
216 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
217 this.expectError(gl.INVALID_VALUE);
218 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
219 this.expectError(gl.INVALID_VALUE);
220 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
221 this.expectError(gl.INVALID_VALUE);
222 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
223 this.expectError(gl.INVALID_VALUE);
224 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, uint8);
225 this.expectError(gl.INVALID_VALUE);
228 gl.deleteTexture(texture[0]);
229 gl.deleteTexture(texture[1]);
234 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_max_level', 'Invalid gl.compressedTexImage2D() usage', gl,
236 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
239 /** @type {Array<WebGLTexture>} */ var texture = [];
240 texture[0] = gl.createTexture();
241 texture[1] = gl.createTexture();
242 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
243 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
246 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE) for a 2d texture target.');
247 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16));
249 /** @type {number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type {number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
250 gl.compressedTexImage2D(gl.TEXTURE_2D, log2MaxTextureSize, gl.COMPRESSED_RGB8_ETC2, 16, 16, 0, uint8);
251 this.expectError(gl.INVALID_VALUE);
253 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE) for a cubemap target.');
254 /** @type {number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type {number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;
256 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);
257 this.expectError(gl.INVALID_VALUE);
258 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);
259 this.expectError(gl.INVALID_VALUE);
260 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);
261 this.expectError(gl.INVALID_VALUE);
262 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);
263 this.expectError(gl.INVALID_VALUE);
264 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);
265 this.expectError(gl.INVALID_VALUE);
266 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, uint8);
267 this.expectError(gl.INVALID_VALUE);
270 gl.deleteTexture(texture[0]);
271 gl.deleteTexture(texture[1]);
276 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_neg_width_height', 'Invalid gl.compressedTexImage2D() usage', gl,
278 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
281 /** @type {Array<WebGLTexture>} */ var texture = [];
282 texture[0] = gl.createTexture();
283 texture[1] = gl.createTexture();
284 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
285 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
288 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');
290 bufferedLogToConsole('gl.TEXTURE_2D target');
291 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);
292 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);
293 this.expectError(gl.INVALID_VALUE);
294 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);
295 this.expectError(gl.INVALID_VALUE);
296 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);
297 this.expectError(gl.INVALID_VALUE);
299 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');
300 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);
301 this.expectError(gl.INVALID_VALUE);
302 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);
303 this.expectError(gl.INVALID_VALUE);
304 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);
305 this.expectError(gl.INVALID_VALUE);
307 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');
308 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);
309 this.expectError(gl.INVALID_VALUE);
310 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);
311 this.expectError(gl.INVALID_VALUE);
312 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);
313 this.expectError(gl.INVALID_VALUE);
315 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');
316 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);
317 this.expectError(gl.INVALID_VALUE);
318 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);
319 this.expectError(gl.INVALID_VALUE);
320 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);
321 this.expectError(gl.INVALID_VALUE);
323 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');
324 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);
325 this.expectError(gl.INVALID_VALUE);
326 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);
327 this.expectError(gl.INVALID_VALUE);
328 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);
329 this.expectError(gl.INVALID_VALUE);
331 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');
332 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);
333 this.expectError(gl.INVALID_VALUE);
334 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);
335 this.expectError(gl.INVALID_VALUE);
336 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);
337 this.expectError(gl.INVALID_VALUE);
339 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');
340 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, uint8);
341 this.expectError(gl.INVALID_VALUE);
342 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, uint8);
343 this.expectError(gl.INVALID_VALUE);
344 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, 0, uint8);
345 this.expectError(gl.INVALID_VALUE);
348 gl.deleteTexture(texture[0]);
349 gl.deleteTexture(texture[1]);
354 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_max_width_height', 'Invalid gl.compressedTexImage2D() usage', gl,
356 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
359 /** @type {Array<WebGLTexture>} */ var texture = [];
360 texture[0] = gl.createTexture();
361 texture[1] = gl.createTexture();
362 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
363 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
365 var maxTextureSize = /** @type {number} */ (gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;
366 var maxCubemapSize = /** @type {number} */ (gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
367 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is greater than gl.MAX_TEXTURE_SIZE.');
369 var maxSideSize = Math.max(maxCubemapSize, maxTextureSize);
370 var scratchBuffer = new ArrayBuffer(
371 Math.max(es3fNegativeTextureApiTests.etc2EacDataSize(maxSideSize, 1),
372 es3fNegativeTextureApiTests.etc2EacDataSize(1, maxSideSize)));
373 function getUint8ArrayEtc2EacDataSize(w, h) {
374 return new Uint8Array(scratchBuffer, 0, es3fNegativeTextureApiTests.etc2EacDataSize(w, h));
377 var dataTextureMaxByOne = getUint8ArrayEtc2EacDataSize(maxTextureSize, 1);
378 var dataTextureOneByMax = getUint8ArrayEtc2EacDataSize(1, maxTextureSize);
380 bufferedLogToConsole('gl.TEXTURE_2D target');
381 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 1, 0, dataTextureMaxByOne);
382 this.expectError(gl.INVALID_VALUE);
383 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxTextureSize, 0, dataTextureOneByMax);
384 this.expectError(gl.INVALID_VALUE);
386 var dataCubemapMaxByOne = getUint8ArrayEtc2EacDataSize(maxCubemapSize, 1);
387 var dataCubemapOneByMax = getUint8ArrayEtc2EacDataSize(1, maxCubemapSize);
389 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');
390 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, dataCubemapMaxByOne);
391 this.expectError(gl.INVALID_VALUE);
392 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, dataCubemapOneByMax);
393 this.expectError(gl.INVALID_VALUE);
395 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');
396 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, dataCubemapMaxByOne);
397 this.expectError(gl.INVALID_VALUE);
398 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, dataCubemapOneByMax);
399 this.expectError(gl.INVALID_VALUE);
401 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');
402 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, dataCubemapMaxByOne);
403 this.expectError(gl.INVALID_VALUE);
404 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, dataCubemapOneByMax);
405 this.expectError(gl.INVALID_VALUE);
407 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');
408 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, dataCubemapMaxByOne);
409 this.expectError(gl.INVALID_VALUE);
410 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, dataCubemapOneByMax);
411 this.expectError(gl.INVALID_VALUE);
413 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');
414 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, dataCubemapMaxByOne);
415 this.expectError(gl.INVALID_VALUE);
416 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, dataCubemapOneByMax);
417 this.expectError(gl.INVALID_VALUE);
419 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');
420 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxCubemapSize, 1, 0, dataCubemapMaxByOne);
421 this.expectError(gl.INVALID_VALUE);
422 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 1, maxCubemapSize, 0, dataCubemapOneByMax);
423 this.expectError(gl.INVALID_VALUE);
426 gl.deleteTexture(texture[0]);
427 gl.deleteTexture(texture[1]);
432 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_invalid_border', 'Invalid gl.compressedTexImage2D() usage', gl,
434 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
437 /** @type {Array<WebGLTexture>} */ var texture = [];
438 texture[0] = gl.createTexture();
439 texture[1] = gl.createTexture();
440 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
441 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
444 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(0);
446 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0.');
448 bufferedLogToConsole('gl.TEXTURE_2D target');
449 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);
450 this.expectError(gl.INVALID_VALUE);
451 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);
452 this.expectError(gl.INVALID_VALUE);
454 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');
455 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);
456 this.expectError(gl.INVALID_VALUE);
457 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);
458 this.expectError(gl.INVALID_VALUE);
460 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');
461 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);
462 this.expectError(gl.INVALID_VALUE);
463 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);
464 this.expectError(gl.INVALID_VALUE);
466 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');
467 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);
468 this.expectError(gl.INVALID_VALUE);
469 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);
470 this.expectError(gl.INVALID_VALUE);
472 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');
473 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);
474 this.expectError(gl.INVALID_VALUE);
475 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);
476 this.expectError(gl.INVALID_VALUE);
478 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');
479 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);
480 this.expectError(gl.INVALID_VALUE);
481 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);
482 this.expectError(gl.INVALID_VALUE);
484 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');
485 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, uint8);
486 this.expectError(gl.INVALID_VALUE);
487 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, uint8);
488 this.expectError(gl.INVALID_VALUE);
491 gl.deleteTexture(texture[0]);
492 gl.deleteTexture(texture[1]);
497 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage2d_invalid_size', 'Invalid gl.compressedTexImage2D() usage', gl,
499 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
502 /** @type {WebGLTexture} */ var texture;
503 texture = gl.createTexture();
504 gl.bindTexture(gl.TEXTURE_2D, texture);
507 bufferedLogToConsole('gl.INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.');
508 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, new Uint8Array(1));
509 this.expectError(gl.INVALID_VALUE);
510 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, new Uint8Array(4 * 4 * 8));
511 this.expectError(gl.INVALID_VALUE);
512 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGB8_ETC2, 16, 16, 0, new Uint8Array(4 * 4 * 16));
513 this.expectError(gl.INVALID_VALUE);
514 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_SIGNED_R11_EAC, 16, 16, 0, new Uint8Array(4 * 4 * 16));
515 this.expectError(gl.INVALID_VALUE);
518 gl.deleteTexture(texture);
525 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_invalid_target', 'Invalid gl.copyTexImage2D() usage', gl,
529 /** @type {WebGLTexture} */ var texture;
530 texture = gl.createTexture();
531 gl.bindTexture(gl.TEXTURE_2D, texture);
534 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
535 gl.copyTexImage2D(0, 0, gl.RGB, 0, 0, 64, 64, 0);
536 this.expectError(gl.INVALID_ENUM);
539 gl.deleteTexture(texture);
544 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_invalid_format', 'Invalid gl.copyTexImage2D() usage', gl,
548 /** @type {Array<WebGLTexture>} */ var texture = [];
549 texture[0] = gl.createTexture();
550 texture[1] = gl.createTexture();
551 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
552 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
555 bufferedLogToConsole('gl.INVALID_ENUM or gl.INVALID_VALUE is generated if internalformat is not an accepted format.');
556 gl.copyTexImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 64, 64, 0);
557 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);
558 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 16, 16, 0);
559 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);
560 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 16, 16, 0);
561 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);
562 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 16, 16, 0);
563 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);
564 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 16, 16, 0);
565 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);
566 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 16, 16, 0);
567 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);
568 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 16, 16, 0);
569 this.expectError([gl.INVALID_ENUM, gl.INVALID_VALUE]);
572 gl.deleteTexture(texture[0]);
573 gl.deleteTexture(texture[1]);
578 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_inequal_width_height_cube', 'Invalid gl.copyTexImage2D() usage', gl,
582 /** @type {WebGLTexture} */ var texture;
583 texture = gl.createTexture();
584 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);
587 bufferedLogToConsole('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.');
588 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 16, 17, 0);
589 this.expectError(gl.INVALID_VALUE);
590 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 16, 17, 0);
591 this.expectError(gl.INVALID_VALUE);
592 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 16, 17, 0);
593 this.expectError(gl.INVALID_VALUE);
594 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 16, 17, 0);
595 this.expectError(gl.INVALID_VALUE);
596 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 16, 17, 0);
597 this.expectError(gl.INVALID_VALUE);
598 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 16, 17, 0);
599 this.expectError(gl.INVALID_VALUE);
602 gl.deleteTexture(texture);
607 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_neg_level', 'Invalid gl.copyTexImage2D() usage', gl,
611 /** @type {Array<WebGLTexture>} */ var texture = [];
612 texture[0] = gl.createTexture();
613 texture[1] = gl.createTexture();
614 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
615 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
618 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
619 gl.copyTexImage2D(gl.TEXTURE_2D, -1, gl.RGB, 0, 0, 64, 64, 0);
620 this.expectError(gl.INVALID_VALUE);
621 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, -1, gl.RGB, 0, 0, 16, 16, 0);
622 this.expectError(gl.INVALID_VALUE);
623 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, -1, gl.RGB, 0, 0, 16, 16, 0);
624 this.expectError(gl.INVALID_VALUE);
625 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, -1, gl.RGB, 0, 0, 16, 16, 0);
626 this.expectError(gl.INVALID_VALUE);
627 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, -1, gl.RGB, 0, 0, 16, 16, 0);
628 this.expectError(gl.INVALID_VALUE);
629 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, gl.RGB, 0, 0, 16, 16, 0);
630 this.expectError(gl.INVALID_VALUE);
631 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, gl.RGB, 0, 0, 16, 16, 0);
632 this.expectError(gl.INVALID_VALUE);
635 gl.deleteTexture(texture[0]);
636 gl.deleteTexture(texture[1]);
640 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_max_level', 'Invalid gl.copyTexImage2D() usage', gl,
643 /** @type {Array<WebGLTexture>} */ var texture = [];
644 texture[0] = gl.createTexture();
645 texture[1] = gl.createTexture();
646 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
647 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
650 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
651 /** @type {number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type {number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
652 gl.copyTexImage2D(gl.TEXTURE_2D, log2MaxTextureSize, gl.RGB, 0, 0, 64, 64, 0);
653 this.expectError(gl.INVALID_VALUE);
655 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE).');
656 /** @type {number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type {number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;
657 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);
658 this.expectError(gl.INVALID_VALUE);
659 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);
660 this.expectError(gl.INVALID_VALUE);
661 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);
662 this.expectError(gl.INVALID_VALUE);
663 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);
664 this.expectError(gl.INVALID_VALUE);
665 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);
666 this.expectError(gl.INVALID_VALUE);
667 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, gl.RGB, 0, 0, 16, 16, 0);
668 this.expectError(gl.INVALID_VALUE);
671 gl.deleteTexture(texture[0]);
672 gl.deleteTexture(texture[1]);
677 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_neg_width_height', 'Invalid gl.copyTexImage2D() usage', gl,
681 /** @type {Array<WebGLTexture>} */ var texture = [];
682 texture[0] = gl.createTexture();
683 texture[1] = gl.createTexture();
684 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
685 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
688 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');
690 bufferedLogToConsole('gl.TEXTURE_2D target');
691 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, -1, 1, 0);
692 this.expectError(gl.INVALID_VALUE);
693 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, 1, -1, 0);
694 this.expectError(gl.INVALID_VALUE);
695 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, -1, -1, 0);
696 this.expectError(gl.INVALID_VALUE);
698 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');
699 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, -1, 1, 0);
700 this.expectError(gl.INVALID_VALUE);
701 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 1, -1, 0);
702 this.expectError(gl.INVALID_VALUE);
703 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, -1, -1, 0);
704 this.expectError(gl.INVALID_VALUE);
706 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');
707 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, -1, 1, 0);
708 this.expectError(gl.INVALID_VALUE);
709 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 1, -1, 0);
710 this.expectError(gl.INVALID_VALUE);
711 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, -1, -1, 0);
712 this.expectError(gl.INVALID_VALUE);
714 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');
715 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, -1, 1, 0);
716 this.expectError(gl.INVALID_VALUE);
717 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 1, -1, 0);
718 this.expectError(gl.INVALID_VALUE);
719 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, -1, -1, 0);
720 this.expectError(gl.INVALID_VALUE);
722 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');
723 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, -1, 1, 0);
724 this.expectError(gl.INVALID_VALUE);
725 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 1, -1, 0);
726 this.expectError(gl.INVALID_VALUE);
727 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, -1, -1, 0);
728 this.expectError(gl.INVALID_VALUE);
730 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');
731 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, -1, 1, 0);
732 this.expectError(gl.INVALID_VALUE);
733 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 1, -1, 0);
734 this.expectError(gl.INVALID_VALUE);
735 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, -1, -1, 0);
736 this.expectError(gl.INVALID_VALUE);
738 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');
739 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, -1, 1, 0);
740 this.expectError(gl.INVALID_VALUE);
741 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 1, -1, 0);
742 this.expectError(gl.INVALID_VALUE);
743 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, -1, -1, 0);
744 this.expectError(gl.INVALID_VALUE);
747 gl.deleteTexture(texture[0]);
748 gl.deleteTexture(texture[1]);
752 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_max_width_height', 'Invalid gl.copyTexImage2D() usage', gl,
756 /** @type {Array<WebGLTexture>} */ var texture = [];
757 texture[0] = gl.createTexture();
758 texture[1] = gl.createTexture();
759 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
760 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
763 var maxTextureSize = /** @type {number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;
764 var maxCubemapSize = /** @type {number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
766 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is greater than gl.MAX_TEXTURE_SIZE.');
768 bufferedLogToConsole('gl.TEXTURE_2D target');
769 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, maxTextureSize, 1, 0);
770 this.expectError(gl.INVALID_VALUE);
771 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, 1, maxTextureSize, 0);
772 this.expectError(gl.INVALID_VALUE);
773 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, maxTextureSize, maxTextureSize, 0);
774 this.expectError(gl.INVALID_VALUE);
776 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');
777 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);
778 this.expectError(gl.INVALID_VALUE);
779 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);
780 this.expectError(gl.INVALID_VALUE);
781 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
782 this.expectError(gl.INVALID_VALUE);
784 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');
785 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);
786 this.expectError(gl.INVALID_VALUE);
787 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);
788 this.expectError(gl.INVALID_VALUE);
789 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
790 this.expectError(gl.INVALID_VALUE);
792 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');
793 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);
794 this.expectError(gl.INVALID_VALUE);
795 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);
796 this.expectError(gl.INVALID_VALUE);
797 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
798 this.expectError(gl.INVALID_VALUE);
800 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');
801 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);
802 this.expectError(gl.INVALID_VALUE);
803 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);
804 this.expectError(gl.INVALID_VALUE);
805 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
806 this.expectError(gl.INVALID_VALUE);
808 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');
809 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);
810 this.expectError(gl.INVALID_VALUE);
811 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);
812 this.expectError(gl.INVALID_VALUE);
813 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
814 this.expectError(gl.INVALID_VALUE);
816 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');
817 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 1, maxCubemapSize, 0);
818 this.expectError(gl.INVALID_VALUE);
819 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, maxCubemapSize, 1, 0);
820 this.expectError(gl.INVALID_VALUE);
821 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, maxCubemapSize, maxCubemapSize, 0);
822 this.expectError(gl.INVALID_VALUE);
825 gl.deleteTexture(texture[0]);
826 gl.deleteTexture(texture[1]);
831 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_invalid_border', 'Invalid gl.copyTexImage2D() usage', gl,
835 /** @type {Array<WebGLTexture>} */ var texture = [];
836 texture[0] = gl.createTexture();
837 texture[1] = gl.createTexture();
838 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
839 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
842 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0.');
844 bufferedLogToConsole('gl.TEXTURE_2D target');
845 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, 0, 0, -1);
846 this.expectError(gl.INVALID_VALUE);
847 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGB, 0, 0, 0, 0, 1);
848 this.expectError(gl.INVALID_VALUE);
850 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');
851 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 0, 0, -1);
852 this.expectError(gl.INVALID_VALUE);
853 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 0, 0, 1);
854 this.expectError(gl.INVALID_VALUE);
856 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');
857 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 0, 0, -1);
858 this.expectError(gl.INVALID_VALUE);
859 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 0, 0, 0, 0, 1);
860 this.expectError(gl.INVALID_VALUE);
862 bufferedLogToConsole('gl.TEXTURE_2D target');
863 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 0, 0, -1);
864 this.expectError(gl.INVALID_VALUE);
865 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 0, 0, 0, 0, 1);
866 this.expectError(gl.INVALID_VALUE);
868 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');
869 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 0, 0, -1);
870 this.expectError(gl.INVALID_VALUE);
871 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 0, 0, 0, 0, 1);
872 this.expectError(gl.INVALID_VALUE);
874 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');
875 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 0, 0, -1);
876 this.expectError(gl.INVALID_VALUE);
877 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 0, 0, 0, 0, 1);
878 this.expectError(gl.INVALID_VALUE);
880 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');
881 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 0, 0, -1);
882 this.expectError(gl.INVALID_VALUE);
883 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 0, 0, 0, 0, 1);
884 this.expectError(gl.INVALID_VALUE);
887 gl.deleteTexture(texture[0]);
888 gl.deleteTexture(texture[1]);
893 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copyteximage2d_incomplete_framebuffer', 'Invalid gl.copyTexImage2D() usage', gl,
897 /** @type {Array<WebGLTexture>} */ var texture = [];
898 texture[0] = gl.createTexture();
899 texture[1] = gl.createTexture();
900 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
901 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
904 /** @type {WebGLFramebuffer} */ var fbo;
905 fbo = gl.createFramebuffer();
906 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
907 gl.checkFramebufferStatus(gl.FRAMEBUFFER);
909 bufferedLogToConsole('gl.INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.');
910 gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, 0, 0, 0, 0, 0);
911 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
912 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA8, 0, 0, 0, 0, 0);
913 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
914 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGBA8, 0, 0, 0, 0, 0);
915 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
916 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGBA8, 0, 0, 0, 0, 0);
917 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
918 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA8, 0, 0, 0, 0, 0);
919 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
920 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGBA8, 0, 0, 0, 0, 0);
921 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
922 gl.copyTexImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGBA8, 0, 0, 0, 0, 0);
923 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
925 gl.bindFramebuffer(gl.FRAMEBUFFER, null);
926 gl.deleteFramebuffer(fbo);
929 gl.deleteTexture(texture[0]);
930 gl.deleteTexture(texture[1]);
934 // gl.copyTexSubImage2D
936 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_invalid_target', 'Invalid gl.copyTexSubImage2D() usage', gl,
939 /** @type {WebGLTexture} */ var texture;
940 texture = gl.createTexture();
941 gl.bindTexture(gl.TEXTURE_2D, texture);
942 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
944 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
945 gl.copyTexSubImage2D(0, 0, 0, 0, 0, 0, 4, 4);
946 this.expectError(gl.INVALID_ENUM);
948 gl.deleteTexture(texture);
951 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_neg_level', 'Invalid gl.copyTexSubImage2D() usage', gl,
953 /** @type {Array<WebGLTexture>} */ var texture = [];
954 texture[0] = gl.createTexture();
955 texture[1] = gl.createTexture();
956 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
957 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
958 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
959 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
960 gl.texImage2D(faceGL, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
963 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
964 gl.copyTexSubImage2D(gl.TEXTURE_2D, -1, 0, 0, 0, 0, 4, 4);
965 this.expectError(gl.INVALID_VALUE);
967 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
968 gl.copyTexSubImage2D(faceGL, -1, 0, 0, 0, 0, 4, 4);
969 local.expectError(gl.INVALID_VALUE);
972 gl.deleteTexture(texture[0]);
973 gl.deleteTexture(texture[1]);
976 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_max_level', 'Invalid gl.copyTexSubImage2D() usage', gl,
978 /** @type{Array<WebGLTexture>} */ var texture = [];
979 texture[0] = gl.createTexture();
980 texture[1] = gl.createTexture();
981 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
982 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
983 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
984 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
985 gl.texImage2D(faceGL, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
988 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE) for 2D texture targets.');
989 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
990 gl.copyTexSubImage2D(gl.TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, 4, 4);
991 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
993 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_SIZE) for cubemap targets.');
994 /** @type{number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;
996 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
997 gl.copyTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, 4, 4);
998 local.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1001 gl.deleteTexture(texture[0]);
1002 gl.deleteTexture(texture[1]);
1005 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_neg_offset', 'Invalid gl.copyTexSubImage2D() usage', gl,
1007 /** @type{WebGLTexture} */ var texture;
1008 texture = gl.createTexture();
1009 gl.bindTexture(gl.TEXTURE_2D, texture);
1010 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1012 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset < 0 or yoffset < 0.');
1013 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, -1, 0, 0, 0, 4, 4);
1014 this.expectError(gl.INVALID_VALUE);
1015 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, -1, 0, 0, 4, 4);
1016 this.expectError(gl.INVALID_VALUE);
1017 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, -1, -1, 0, 0, 4, 4);
1018 this.expectError(gl.INVALID_VALUE);
1020 gl.deleteTexture(texture);
1023 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_invalid_offset', 'Invalid gl.copyTexSubImage2D() usage', gl,
1025 /** @type{WebGLTexture} */ var texture;
1026 texture = gl.createTexture();
1027 gl.bindTexture(gl.TEXTURE_2D, texture);
1028 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1030 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.');
1031 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 14, 0, 0, 0, 4, 4);
1032 this.expectError(gl.INVALID_VALUE);
1033 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 14, 0, 0, 4, 4);
1034 this.expectError(gl.INVALID_VALUE);
1035 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 14, 14, 0, 0, 4, 4);
1036 this.expectError(gl.INVALID_VALUE);
1038 gl.deleteTexture(texture);
1041 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_neg_width_height', 'Invalid gl.copyTexSubImage2D() usage', gl,
1043 /** @type{WebGLTexture} */ var texture;
1044 texture = gl.createTexture();
1045 gl.bindTexture(gl.TEXTURE_2D, texture);
1046 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1048 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');
1049 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, -1, 0);
1050 this.expectError(gl.INVALID_VALUE);
1051 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 0, -1);
1052 this.expectError(gl.INVALID_VALUE);
1053 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, -1, -1);
1054 this.expectError(gl.INVALID_VALUE);
1056 gl.deleteTexture(texture);
1059 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage2d_incomplete_framebuffer', 'Invalid gl.copyTexSubImage2D() usage', gl,
1061 bufferedLogToConsole('gl.INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.');
1062 /** @type{Array<WebGLTexture>} */ var texture = [];
1063 /** @type{WebGLFramebuffer} */ var fbo;
1064 texture[0] = gl.createTexture();
1065 texture[1] = gl.createTexture();
1066 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1067 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1068 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1069 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1070 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1071 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1072 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1073 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1074 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGBA, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1075 this.expectError(gl.NO_ERROR);
1077 fbo = gl.createFramebuffer();
1078 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
1079 gl.checkFramebufferStatus(gl.FRAMEBUFFER);
1080 this.expectError(gl.NO_ERROR);
1082 gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0);
1083 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
1084 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 0, 0, 0, 0);
1085 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
1086 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 0, 0, 0, 0);
1087 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
1088 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 0, 0, 0, 0);
1089 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
1090 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 0, 0, 0, 0);
1091 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
1092 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 0, 0, 0, 0);
1093 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
1094 gl.copyTexSubImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 0, 0, 0, 0);
1095 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
1097 gl.bindFramebuffer(gl.FRAMEBUFFER, null);
1098 gl.deleteFramebuffer(fbo);
1099 gl.deleteTexture(texture[0]);
1100 gl.deleteTexture(texture[1]);
1106 testGroup.addChild(new es3fApiCase.ApiCaseCallback('deletetextures', 'glDeleteTextures() usage', gl,
1108 /** @type{WebGLTexture} */ var texture;
1109 texture = gl.createTexture();
1111 bufferedLogToConsole('gl.NO_ERROR is generated if texture is null.');
1112 gl.deleteTexture(null);
1113 this.expectError(gl.NO_ERROR);
1115 gl.bindTexture(gl.TEXTURE_2D, texture);
1116 gl.deleteTexture(null);
1117 this.expectError(gl.NO_ERROR);
1119 gl.deleteTexture(texture);
1122 // gl.generateMipmap
1124 testGroup.addChild(new es3fApiCase.ApiCaseCallback('generatemipmap', 'Invalid gl.generateMipmap() usage', gl,
1126 /** @type{Array<WebGLTexture>} */ var texture = [];
1127 /** @type{WebGLFramebuffer} */ var fbo;
1128 texture[0] = gl.createTexture();
1129 texture[1] = gl.createTexture();
1131 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is not gl.TEXTURE_2D or gl.TEXTURE_CUBE_MAP.');
1132 gl.generateMipmap(0);
1133 this.expectError(gl.INVALID_ENUM);
1135 bufferedLogToConsole('INVALID_OPERATION is generated if the texture bound to target is not cube complete.');
1136 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[0]);
1137 gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.REPEAT);
1138 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1139 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
1140 this.expectError(gl.INVALID_OPERATION);
1142 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[0]);
1143 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1144 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1145 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1146 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1147 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1148 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1149 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
1150 this.expectError(gl.INVALID_OPERATION);
1152 if (haveCompressedTextureETC) {
1153 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format.');
1154 gl.bindTexture(gl.TEXTURE_2D, texture[1]);
1155 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, new Uint8Array(0));
1156 gl.generateMipmap(gl.TEXTURE_2D);
1157 this.expectError(gl.INVALID_OPERATION);
1162 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the level base array was not specified with an unsized internal format or a sized internal format that is both color-renderable and texture-filterable.');
1163 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB8_SNORM, 0, 0, 0, gl.RGB, gl.BYTE, null);
1164 gl.generateMipmap(gl.TEXTURE_2D);
1165 this.expectError(gl.INVALID_OPERATION);
1166 gl.texImage2D(gl.TEXTURE_2D, 0, gl.R8I, 0, 0, 0, gl.RED_INTEGER, gl.BYTE, null);
1167 gl.generateMipmap(gl.TEXTURE_2D);
1168 this.expectError(gl.INVALID_OPERATION);
1169 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, 0, 0, 0, gl.RGBA, gl.FLOAT, null);
1170 gl.generateMipmap(gl.TEXTURE_2D);
1171 this.expectError(gl.INVALID_OPERATION);
1173 gl.deleteTexture(texture[0]);
1174 gl.deleteTexture(texture[1]);
1179 testGroup.addChild(new es3fApiCase.ApiCaseCallback('pixelstorei', 'Invalid gl.pixelStorei() usage', gl,
1181 bufferedLogToConsole('gl.INVALID_ENUM is generated if pname is not an accepted value.');
1182 gl.pixelStorei(0,1);
1183 this.expectError(gl.INVALID_ENUM);
1185 bufferedLogToConsole('gl.INVALID_VALUE is generated if a negative row length, pixel skip, or row skip value is specified, or if alignment is specified as other than 1, 2, 4, or 8.');
1186 gl.pixelStorei(gl.PACK_ROW_LENGTH, -1);
1187 this.expectError(gl.INVALID_VALUE);
1188 gl.pixelStorei(gl.PACK_SKIP_ROWS, -1);
1189 this.expectError(gl.INVALID_VALUE);
1190 gl.pixelStorei(gl.PACK_SKIP_PIXELS, -1);
1191 this.expectError(gl.INVALID_VALUE);
1192 gl.pixelStorei(gl.UNPACK_ROW_LENGTH, -1);
1193 this.expectError(gl.INVALID_VALUE);
1194 gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, -1);
1195 this.expectError(gl.INVALID_VALUE);
1196 gl.pixelStorei(gl.UNPACK_SKIP_ROWS, -1);
1197 this.expectError(gl.INVALID_VALUE);
1198 gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, -1);
1199 this.expectError(gl.INVALID_VALUE);
1200 gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, -1);
1201 this.expectError(gl.INVALID_VALUE);
1202 gl.pixelStorei(gl.PACK_ALIGNMENT, 0);
1203 this.expectError(gl.INVALID_VALUE);
1204 gl.pixelStorei(gl.UNPACK_ALIGNMENT, 0);
1205 this.expectError(gl.INVALID_VALUE);
1206 gl.pixelStorei(gl.PACK_ALIGNMENT, 16);
1207 this.expectError(gl.INVALID_VALUE);
1208 gl.pixelStorei(gl.UNPACK_ALIGNMENT, 16);
1209 this.expectError(gl.INVALID_VALUE);
1215 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d', 'Invalid gl.texImage2D() usage', gl,
1219 /** @type {WebGLTexture} */ var texture;
1220 texture = gl.createTexture();
1221 gl.bindTexture(gl.TEXTURE_2D, texture);
1224 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
1225 gl.texImage2D(0, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1226 this.expectError(gl.INVALID_ENUM);
1228 bufferedLogToConsole('gl.INVALID_ENUM is generated if type is not a type constant.');
1229 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, 0, null);
1230 this.expectError(gl.INVALID_ENUM);
1232 bufferedLogToConsole('gl.INVALID_ENUM is generated if format is not an accepted format constant.');
1233 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, 0, gl.UNSIGNED_BYTE, null);
1234 this.expectError(gl.INVALID_ENUM);
1236 bufferedLogToConsole('gl.INVALID_VALUE is generated if internalFormat is not one of the accepted resolution and format symbolic constants.');
1237 gl.texImage2D(gl.TEXTURE_2D, 0, 0, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1238 this.expectError(gl.INVALID_VALUE);
1240 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid.');
1241 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1242 this.expectError(gl.INVALID_OPERATION);
1243 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT_4_4_4_4, null);
1244 this.expectError(gl.INVALID_OPERATION);
1245 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB5_A1, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, null);
1246 this.expectError(gl.INVALID_OPERATION);
1247 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB10_A2, 1, 1, 0, gl.RGB, gl.UNSIGNED_INT_2_10_10_10_REV, null);
1248 this.expectError(gl.INVALID_OPERATION);
1249 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32UI, 1, 1, 0, gl.RGBA_INTEGER, gl.INT, null);
1250 this.expectError(gl.INVALID_OPERATION);
1253 gl.deleteTexture(texture);
1258 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_inequal_width_height_cube', 'Invalid gl.texImage2D() usage', gl,
1261 /** @type {WebGLTexture} */ var texture;
1262 texture = gl.createTexture();
1263 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);
1265 bufferedLogToConsole('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.');
1266 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1267 this.expectError(gl.INVALID_VALUE);
1268 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1269 this.expectError(gl.INVALID_VALUE);
1270 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1271 this.expectError(gl.INVALID_VALUE);
1272 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1273 this.expectError(gl.INVALID_VALUE);
1274 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1275 this.expectError(gl.INVALID_VALUE);
1276 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 1, 2, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1277 this.expectError(gl.INVALID_VALUE);
1280 gl.deleteTexture(texture);
1285 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_neg_level', 'Invalid gl.texImage2D() usage', gl,
1288 /** @type {Array<WebGLTexture>} */ var texture = [];
1289 texture[0] = gl.createTexture();
1290 texture[1] = gl.createTexture();
1291 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1292 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1295 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
1296 gl.texImage2D(gl.TEXTURE_2D, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1297 this.expectError(gl.INVALID_VALUE);
1299 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
1300 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1301 this.expectError(gl.INVALID_VALUE);
1302 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1303 this.expectError(gl.INVALID_VALUE);
1304 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1305 this.expectError(gl.INVALID_VALUE);
1306 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1307 this.expectError(gl.INVALID_VALUE);
1308 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1309 this.expectError(gl.INVALID_VALUE);
1310 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, -1, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1311 this.expectError(gl.INVALID_VALUE);
1314 gl.deleteTexture(texture[0]);
1315 gl.deleteTexture(texture[1]);
1320 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_max_level', 'Invalid gl.texImage2D() usage', gl,
1323 /** @type {Array<WebGLTexture>} */ var texture = [];
1324 texture[0] = gl.createTexture();
1325 texture[1] = gl.createTexture();
1326 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1327 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1330 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
1331 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
1332 gl.texImage2D(gl.TEXTURE_2D, log2MaxTextureSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1333 this.expectError(gl.INVALID_VALUE);
1335 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE).');
1336 /** @type{number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;
1337 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1338 this.expectError(gl.INVALID_VALUE);
1339 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1340 this.expectError(gl.INVALID_VALUE);
1341 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1342 this.expectError(gl.INVALID_VALUE);
1343 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1344 this.expectError(gl.INVALID_VALUE);
1345 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1346 this.expectError(gl.INVALID_VALUE);
1347 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, log2MaxCubemapSize, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1348 this.expectError(gl.INVALID_VALUE);
1351 gl.deleteTexture(texture[0]);
1352 gl.deleteTexture(texture[1]);
1356 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_neg_width_height', 'Invalid gl.texImage2D() usage', gl,
1359 /** @type {Array<WebGLTexture>} */ var texture = [];
1360 texture[0] = gl.createTexture();
1361 texture[1] = gl.createTexture();
1362 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1363 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1366 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');
1368 bufferedLogToConsole('gl.TEXTURE_2D target');
1369 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1370 this.expectError(gl.INVALID_VALUE);
1371 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1372 this.expectError(gl.INVALID_VALUE);
1373 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1374 this.expectError(gl.INVALID_VALUE);
1376 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');
1377 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1378 this.expectError(gl.INVALID_VALUE);
1379 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1380 this.expectError(gl.INVALID_VALUE);
1381 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1382 this.expectError(gl.INVALID_VALUE);
1384 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');
1385 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1386 this.expectError(gl.INVALID_VALUE);
1387 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1388 this.expectError(gl.INVALID_VALUE);
1389 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1390 this.expectError(gl.INVALID_VALUE);
1392 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');
1393 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1394 this.expectError(gl.INVALID_VALUE);
1395 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1396 this.expectError(gl.INVALID_VALUE);
1397 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1398 this.expectError(gl.INVALID_VALUE);
1400 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');
1401 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1402 this.expectError(gl.INVALID_VALUE);
1403 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1404 this.expectError(gl.INVALID_VALUE);
1405 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1406 this.expectError(gl.INVALID_VALUE);
1408 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');
1409 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1410 this.expectError(gl.INVALID_VALUE);
1411 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1412 this.expectError(gl.INVALID_VALUE);
1413 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1414 this.expectError(gl.INVALID_VALUE);
1416 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');
1417 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, -1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1418 this.expectError(gl.INVALID_VALUE);
1419 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1420 this.expectError(gl.INVALID_VALUE);
1421 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, -1, -1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1422 this.expectError(gl.INVALID_VALUE);
1425 gl.deleteTexture(texture[0]);
1426 gl.deleteTexture(texture[1]);
1431 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_max_width_height', 'Invalid gl.texImage2D() usage', gl,
1434 /** @type {Array<WebGLTexture>} */ var texture = [];
1435 texture[0] = gl.createTexture();
1436 texture[1] = gl.createTexture();
1437 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1438 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1441 var maxTextureSize = /** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;
1442 var maxCubemapSize = /** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)) + 1;
1444 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is greater than gl.MAX_TEXTURE_SIZE.');
1445 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, maxTextureSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1446 this.expectError(gl.INVALID_VALUE);
1447 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, maxTextureSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1448 this.expectError(gl.INVALID_VALUE);
1449 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, maxTextureSize, maxTextureSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1450 this.expectError(gl.INVALID_VALUE);
1452 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is greater than gl.MAX_CUBE_MAP_TEXTURE_SIZE.');
1454 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_X target');
1455 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1456 this.expectError(gl.INVALID_VALUE);
1457 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1458 this.expectError(gl.INVALID_VALUE);
1459 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1460 this.expectError(gl.INVALID_VALUE);
1462 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Y target');
1463 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1464 this.expectError(gl.INVALID_VALUE);
1465 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1466 this.expectError(gl.INVALID_VALUE);
1467 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1468 this.expectError(gl.INVALID_VALUE);
1470 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_POSITIVE_Z target');
1471 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1472 this.expectError(gl.INVALID_VALUE);
1473 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1474 this.expectError(gl.INVALID_VALUE);
1475 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1476 this.expectError(gl.INVALID_VALUE);
1478 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_X target');
1479 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1480 this.expectError(gl.INVALID_VALUE);
1481 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1482 this.expectError(gl.INVALID_VALUE);
1483 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1484 this.expectError(gl.INVALID_VALUE);
1486 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Y target');
1487 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1488 this.expectError(gl.INVALID_VALUE);
1489 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1490 this.expectError(gl.INVALID_VALUE);
1491 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1492 this.expectError(gl.INVALID_VALUE);
1494 bufferedLogToConsole('gl.TEXTURE_CUBE_MAP_NEGATIVE_Z target');
1495 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, maxCubemapSize, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1496 this.expectError(gl.INVALID_VALUE);
1497 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 1, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1498 this.expectError(gl.INVALID_VALUE);
1499 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, maxCubemapSize, maxCubemapSize, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1500 this.expectError(gl.INVALID_VALUE);
1503 gl.deleteTexture(texture[0]);
1504 gl.deleteTexture(texture[1]);
1509 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage2d_invalid_border', 'Invalid gl.texImage2D() usage', gl,
1512 /** @type {Array<WebGLTexture>} */ var texture = [];
1513 texture[0] = gl.createTexture();
1514 texture[1] = gl.createTexture();
1515 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1516 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1519 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0.');
1520 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);
1521 this.expectError(gl.INVALID_VALUE);
1522 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, -1, gl.RGB, gl.UNSIGNED_BYTE, null);
1523 this.expectError(gl.INVALID_VALUE);
1524 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);
1525 this.expectError(gl.INVALID_VALUE);
1526 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);
1527 this.expectError(gl.INVALID_VALUE);
1528 gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);
1529 this.expectError(gl.INVALID_VALUE);
1530 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);
1531 this.expectError(gl.INVALID_VALUE);
1532 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);
1533 this.expectError(gl.INVALID_VALUE);
1534 gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, 1, 1, 1, gl.RGB, gl.UNSIGNED_BYTE, null);
1535 this.expectError(gl.INVALID_VALUE);
1538 gl.deleteTexture(texture[0]);
1539 gl.deleteTexture(texture[1]);
1545 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d', 'Invalid gl.texSubImage2D() usage', gl,
1547 /** @type{WebGLTexture} */ var texture;
1548 texture = gl.createTexture();
1549 gl.bindTexture(gl.TEXTURE_2D, texture);
1550 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1551 this.expectError(gl.NO_ERROR);
1553 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(64);
1554 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
1555 gl.texSubImage2D(0, 0, 0, 0, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
1556 this.expectError(gl.INVALID_ENUM);
1558 bufferedLogToConsole('gl.INVALID_ENUM is generated if format is not an accepted format constant.');
1559 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 4, 4, gl.UNSIGNED_BYTE, uint8);
1560 this.expectError(gl.INVALID_ENUM);
1562 bufferedLogToConsole('gl.INVALID_ENUM is generated if type is not a type constant.');
1563 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, 0, uint8);
1564 this.expectError(gl.INVALID_ENUM);
1566 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid.');
1567 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGBA, gl.UNSIGNED_SHORT_5_6_5, uint8);
1568 this.expectError(gl.INVALID_OPERATION);
1569 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_4_4_4_4, uint8);
1570 this.expectError(gl.INVALID_OPERATION);
1571 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, uint8);
1572 this.expectError(gl.INVALID_OPERATION);
1573 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, uint8);
1574 this.expectError(gl.INVALID_OPERATION);
1575 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGBA_INTEGER, gl.UNSIGNED_INT, uint8);
1576 this.expectError(gl.INVALID_OPERATION);
1577 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 4, 4, gl.RGB, gl.FLOAT, uint8);
1578 this.expectError(gl.INVALID_OPERATION);
1580 gl.deleteTexture(texture);
1583 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_neg_level', 'Invalid gl.texSubImage2D() usage', gl,
1585 /** @type{Array<WebGLTexture>} */ var texture = [];
1586 texture[0] = gl.createTexture();
1587 texture[1] = gl.createTexture();
1588 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1589 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1590 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1591 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
1592 gl.texImage2D(faceGL, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1594 this.expectError(gl.NO_ERROR);
1596 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);
1597 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
1598 gl.texSubImage2D(gl.TEXTURE_2D, -1, 0, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);
1599 this.expectError(gl.INVALID_VALUE);
1601 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
1603 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
1604 gl.texSubImage2D(faceGL, -1, 0, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);
1605 local.expectError(gl.INVALID_VALUE);
1608 gl.deleteTexture(texture[0]);
1609 gl.deleteTexture(texture[1]);
1612 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_max_level', 'Invalid gl.texSubImage2D() usage', gl,
1614 /** @type{Array<WebGLTexture>} */ var texture = [];
1615 texture[0] = gl.createTexture();
1616 texture[1] = gl.createTexture();
1617 gl.bindTexture (gl.TEXTURE_2D, texture[0]);
1618 gl.texImage2D (gl.TEXTURE_2D, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1619 gl.bindTexture (gl.TEXTURE_CUBE_MAP, texture[1]);
1620 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
1621 gl.texImage2D(faceGL, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1624 this.expectError (gl.NO_ERROR);
1626 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);
1627 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
1628 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
1629 gl.texSubImage2D(gl.TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);
1630 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1632 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE).');
1633 /** @type{number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;
1635 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
1636 gl.texSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);
1637 local.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1640 gl.deleteTexture(texture[0]);
1641 gl.deleteTexture(texture[1]);
1644 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_neg_offset', 'Invalid gl.texSubImage2D() usage', gl,
1646 /** @type{WebGLTexture} */ var texture;
1647 texture = gl.createTexture();
1648 gl.bindTexture(gl.TEXTURE_2D, texture);
1649 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 32, 32, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
1650 this.expectError(gl.NO_ERROR);
1652 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);
1653 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset or yoffset are negative.');
1654 gl.texSubImage2D(gl.TEXTURE_2D, 0, -1, 0, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);
1655 this.expectError(gl.INVALID_VALUE);
1656 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, -1, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);
1657 this.expectError(gl.INVALID_VALUE);
1658 gl.texSubImage2D(gl.TEXTURE_2D, 0, -1, -1, 0, 0, gl.RGB, gl.UNSIGNED_BYTE, uint8);
1659 this.expectError(gl.INVALID_VALUE);
1661 gl.deleteTexture(texture);
1664 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_invalid_offset', 'Invalid gl.texSubImage2D() usage', gl,
1666 /** @type{WebGLTexture} */ var texture;
1667 texture = gl.createTexture();
1668 gl.bindTexture(gl.TEXTURE_2D, texture);
1669 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1670 this.expectError(gl.NO_ERROR);
1672 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(64);
1673 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset + width > texture_width or yoffset + height > texture_height.');
1674 gl.texSubImage2D(gl.TEXTURE_2D, 0, 30, 0, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
1675 this.expectError(gl.INVALID_VALUE);
1676 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 30, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
1677 this.expectError(gl.INVALID_VALUE);
1678 gl.texSubImage2D(gl.TEXTURE_2D, 0, 30, 30, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
1679 this.expectError(gl.INVALID_VALUE);
1681 gl.deleteTexture(texture);
1684 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage2d_neg_width_height', 'Invalid gl.texSubImage2D() usage', gl,
1686 /** @type{WebGLTexture} */ var texture;
1687 texture = gl.createTexture();
1688 gl.bindTexture(gl.TEXTURE_2D, texture);
1689 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
1690 this.expectError(gl.NO_ERROR);
1692 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);
1693 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');
1694 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
1695 this.expectError(gl.INVALID_VALUE);
1696 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, -1, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
1697 this.expectError(gl.INVALID_VALUE);
1698 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, -1, -1, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
1699 this.expectError(gl.INVALID_VALUE);
1701 gl.deleteTexture(texture);
1706 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texparameteri', 'Invalid gl.texParameteri() usage', gl,
1708 bufferedLogToConsole('gl.INVALID_ENUM is generated if target or pname is not one of the accepted defined values.');
1709 gl.texParameteri(0, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
1710 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1711 gl.texParameteri(gl.TEXTURE_2D, 0, gl.LINEAR);
1712 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1713 gl.texParameteri(0, 0, gl.LINEAR);
1714 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1716 bufferedLogToConsole('gl.INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.');
1717 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, 0);
1718 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1719 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.REPEAT);
1720 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1721 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, 0);
1722 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1723 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.NEAREST);
1724 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1726 /** @type{WebGLTexture} */ var texture;
1727 texture = gl.createTexture();
1728 gl.bindTexture(gl.TEXTURE_2D, texture);
1730 bufferedLogToConsole('gl.INVALID_ENUM is generated if target or pname is not one of the accepted defined values.');
1731 gl.texParameteri(0, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
1732 this.expectError(gl.INVALID_ENUM);
1733 gl.texParameteri(gl.TEXTURE_2D, 0, gl.LINEAR);
1734 this.expectError(gl.INVALID_ENUM);
1735 gl.texParameteri(0, 0, gl.LINEAR);
1736 this.expectError(gl.INVALID_ENUM);
1738 bufferedLogToConsole('gl.INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.');
1739 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, 0);
1740 this.expectError(gl.INVALID_ENUM);
1741 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.REPEAT);
1742 this.expectError(gl.INVALID_ENUM);
1743 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, 0);
1744 this.expectError(gl.INVALID_ENUM);
1745 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.NEAREST);
1746 this.expectError(gl.INVALID_ENUM);
1748 gl.deleteTexture(texture);
1753 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texparameterf', 'Invalid gl.texParameterf() usage', gl,
1755 bufferedLogToConsole('gl.INVALID_ENUM is generated if target or pname is not one of the accepted defined values.');
1756 gl.texParameterf(0, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
1757 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1758 gl.texParameterf(gl.TEXTURE_2D, 0, gl.LINEAR);
1759 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1760 gl.texParameterf(0, 0, gl.LINEAR);
1761 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1763 bufferedLogToConsole('gl.INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.');
1764 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, 0);
1765 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1766 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.REPEAT);
1767 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1768 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, 0);
1769 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1770 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.NEAREST);
1771 this.expectError([gl.INVALID_ENUM, gl.INVALID_OPERATION]);
1773 /** @type{ WebGLTexture} */ var texture;
1774 texture = gl.createTexture();
1775 gl.bindTexture(gl.TEXTURE_2D, texture);
1777 bufferedLogToConsole('gl.INVALID_ENUM is generated if target or pname is not one of the accepted defined values.');
1778 gl.texParameterf(0, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
1779 this.expectError(gl.INVALID_ENUM);
1780 gl.texParameterf(gl.TEXTURE_2D, 0, gl.LINEAR);
1781 this.expectError(gl.INVALID_ENUM);
1782 gl.texParameterf(0, 0, gl.LINEAR);
1783 this.expectError(gl.INVALID_ENUM);
1785 bufferedLogToConsole('gl.INVALID_ENUM is generated if params should have a defined symbolic constant value (based on the value of pname) and does not.');
1786 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, 0);
1787 this.expectError(gl.INVALID_ENUM);
1788 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.REPEAT);
1789 this.expectError(gl.INVALID_ENUM);
1790 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, 0);
1791 this.expectError(gl.INVALID_ENUM);
1792 gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.NEAREST);
1793 this.expectError(gl.INVALID_ENUM);
1795 gl.deleteTexture(texture);
1798 // gl.compressedTexSubImage2D
1800 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d', 'Invalid gl.compressedTexSubImage2D() usage', gl,
1802 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
1804 /** @type{WebGLTexture} */ var texture;
1805 texture = gl.createTexture();
1806 gl.bindTexture (gl.TEXTURE_2D, texture);
1808 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
1809 gl.compressedTexSubImage2D(0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGB8_ETC2, new Uint8Array(0));
1810 this.expectError(gl.INVALID_ENUM);
1812 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));
1813 this.expectError (gl.NO_ERROR);
1815 bufferedLogToConsole('gl.INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified.');
1816 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, gl.COMPRESSED_RGB8_ETC2, new Uint8Array(0));
1817 this.expectError(gl.INVALID_OPERATION);
1819 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if width is not a multiple of four, and width + xoffset is not equal to the width of the texture level.');
1820 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 4, 0, 10, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(10, 4)));
1821 this.expectError(gl.INVALID_OPERATION);
1823 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if height is not a multiple of four, and height + yoffset is not equal to the height of the texture level.');
1824 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 4, 4, 10, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 10)));
1825 this.expectError(gl.INVALID_OPERATION);
1827 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four.');
1828 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 1, 4, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));
1829 this.expectError(gl.INVALID_OPERATION);
1830 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 1, 0, 4, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));
1831 this.expectError(gl.INVALID_OPERATION);
1832 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 1, 1, 4, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));
1833 this.expectError(gl.INVALID_OPERATION);
1835 gl.deleteTexture(texture);
1838 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_neg_level', 'Invalid gl.compressedTexSubImage2D() usage', gl,
1840 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
1842 /** @type{Array<WebGLTexture>} */ var texture = [];
1843 texture[0] = gl.createTexture();
1844 texture[1] = gl.createTexture();
1845 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1846 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));
1847 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1848 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
1849 gl.compressedTexImage2D(faceGL, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));
1852 this.expectError(gl.NO_ERROR);
1854 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
1855 gl.compressedTexSubImage2D(gl.TEXTURE_2D, -1, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1856 this.expectError(gl.INVALID_VALUE);
1858 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
1860 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
1861 gl.compressedTexSubImage2D(faceGL, -1, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1862 local.expectError(gl.INVALID_VALUE);
1865 gl.deleteTexture(texture[0]);
1866 gl.deleteTexture(texture[1]);
1869 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_max_level', 'Invalid gl.compressedTexSubImage2D() usage', gl,
1871 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
1873 /** @type{Array<WebGLTexture>} */ var texture = [];
1874 texture[0] = gl.createTexture();
1875 texture[1] = gl.createTexture();
1876 gl.bindTexture(gl.TEXTURE_2D, texture[0]);
1877 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));
1878 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture[1]);
1879 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
1880 gl.compressedTexImage2D(faceGL, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));
1883 this.expectError(gl.NO_ERROR);
1885 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
1886 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
1887 gl.compressedTexSubImage2D(gl.TEXTURE_2D, log2MaxTextureSize, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1888 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1890 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_CUBE_MAP_TEXTURE_SIZE).');
1891 /** @type{number} */ var log2MaxCubemapSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)))) + 1;
1893 es3fNegativeTextureApiTests.forCubeFaces(function(faceGL) {
1894 gl.compressedTexSubImage2D(faceGL, log2MaxCubemapSize, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1895 local.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1898 gl.deleteTexture(texture[0]);
1899 gl.deleteTexture(texture[1]);
1902 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_neg_offset', 'Invalid gl.compressedTexSubImage2D() usage', gl,
1904 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
1906 /** @type{ WebGLTexture} */ var texture;
1907 texture = gl.createTexture();
1908 gl.bindTexture(gl.TEXTURE_2D, texture);
1909 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 8, 8, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 8)));
1911 // \note Both gl.INVALID_VALUE and gl.INVALID_OPERATION are valid here since implementation may
1912 // first check if offsets are valid for certain format and only after that check that they
1913 // are not negative.
1914 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if xoffset or yoffset are negative.');
1916 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, -4, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1917 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1918 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, -4, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1919 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1920 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, -4, -4, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1921 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1923 gl.deleteTexture(texture);
1926 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_invalid_offset', 'Invalid gl.compressedTexSubImage2D() usage', gl,
1928 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
1930 /** @type{WebGLTexture} */ var texture;
1931 texture = gl.createTexture();
1932 gl.bindTexture (gl.TEXTURE_2D, texture);
1933 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));
1934 this.expectError (gl.NO_ERROR);
1936 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height.');
1938 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 12, 0, 8, 4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 4)));
1939 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1940 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 12, 4, 8, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 8)));
1941 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1942 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 12, 12, 8, 8, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 8)));
1943 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1945 gl.deleteTexture(texture);
1948 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_neg_width_height', 'Invalid gl.compressedTexSubImage2D() usage', gl,
1950 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
1952 /** @type{WebGLTexture} */ var texture;
1953 texture = gl.createTexture();
1954 gl.bindTexture (gl.TEXTURE_2D, texture);
1955 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));
1956 this.expectError (gl.NO_ERROR);
1958 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if width or height is less than 0.');
1959 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, -4, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1960 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1961 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, -4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1962 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1963 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, -4, -4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
1964 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
1966 gl.deleteTexture(texture);
1969 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage2d_invalid_size', 'Invalid gl.compressedTexImage2D() usage', gl,
1971 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
1973 /** @type{WebGLTexture} */ var texture;
1974 texture = gl.createTexture();
1975 gl.bindTexture (gl.TEXTURE_2D, texture);
1976 gl.compressedTexImage2D (gl.TEXTURE_2D, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));
1977 this.expectError (gl.NO_ERROR);
1979 bufferedLogToConsole('gl.INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.');
1980 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(1));
1981 this.expectError(gl.INVALID_VALUE);
1983 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 16, 16, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(4*4*16-1));
1984 this.expectError(gl.INVALID_VALUE);
1986 gl.deleteTexture(texture);
1991 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d', 'Invalid gl.texImage3D() usage', gl,
1993 /** @type{Array<WebGLTexture>} */ var texture = [];
1994 texture[0] = gl.createTexture();
1995 texture[1] = gl.createTexture();
1996 gl.bindTexture (gl.TEXTURE_2D, texture[0]);
1997 gl.bindTexture (gl.TEXTURE_3D, texture[1]);
1999 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
2000 gl.texImage3D(0, 0, gl.RGBA, 1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2001 this.expectError(gl.INVALID_ENUM);
2002 gl.texImage3D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2003 this.expectError(gl.INVALID_ENUM);
2005 bufferedLogToConsole('gl.INVALID_ENUM is generated if type is not a type constant.');
2006 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, gl.RGBA, 0, null);
2007 this.expectError(gl.INVALID_ENUM);
2009 bufferedLogToConsole('gl.INVALID_ENUM is generated if format is not an accepted format constant.');
2010 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, 0, gl.UNSIGNED_BYTE, null);
2011 this.expectError(gl.INVALID_ENUM);
2013 bufferedLogToConsole('gl.INVALID_VALUE is generated if internalFormat is not one of the accepted resolution and format symbolic constants.');
2014 gl.texImage3D(gl.TEXTURE_3D, 0, 0, 1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2015 this.expectError(gl.INVALID_VALUE);
2017 bufferedLogToConsole('gl.INVALID_OPERATION is generated if target is gl.TEXTURE_3D and format is gl.DEPTH_COMPONENT, or gl.DEPTH_STENCIL.');
2018 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_BYTE, null);
2019 this.expectError(gl.INVALID_OPERATION);
2020 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_BYTE, null);
2021 this.expectError(gl.INVALID_OPERATION);
2023 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid.');
2024 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB, 1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2025 this.expectError(gl.INVALID_OPERATION);
2026 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT_4_4_4_4, null);
2027 this.expectError(gl.INVALID_OPERATION);
2028 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB5_A1, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, null);
2029 this.expectError(gl.INVALID_OPERATION);
2030 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB10_A2, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_INT_2_10_10_10_REV, null);
2031 this.expectError(gl.INVALID_OPERATION);
2032 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA32UI, 1, 1, 1, 0, gl.RGBA_INTEGER, gl.INT, null);
2033 this.expectError(gl.INVALID_OPERATION);
2035 gl.deleteTexture(texture[0]);
2036 gl.deleteTexture(texture[1]);
2039 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_neg_level', 'Invalid gl.texImage3D() usage', gl,
2041 // NOTE: this method hangs the browser if the textures are binded.
2042 /** @type{Array<WebGLTexture>} */ var texture = [];
2043 texture[0] = gl.createTexture();
2044 texture[1] = gl.createTexture();
2045 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2046 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2048 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
2049 gl.texImage3D(gl.TEXTURE_3D, -1, gl.RGB, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
2050 this.expectError(gl.INVALID_VALUE);
2051 gl.texImage3D(gl.TEXTURE_2D_ARRAY, -1, gl.RGB, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
2052 this.expectError(gl.INVALID_VALUE);
2054 gl.deleteTexture(texture[0]);
2055 gl.deleteTexture(texture[1]);
2059 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_max_level', 'Invalid gl.texImage3D() usage', gl,
2062 /** @type{Array<WebGLTexture>} */ var texture = [];
2063 texture[0] = gl.createTexture();
2064 texture[1] = gl.createTexture();
2065 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2066 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2068 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_3D_TEXTURE_SIZE).');
2069 /** @type{number} */ var log2Max3DTextureSize = Math.floor(Math.log2(/** @type{number} */ (gl.getParameter(gl.MAX_3D_TEXTURE_SIZE)))) + 1;
2070 gl.texImage3D(gl.TEXTURE_3D, log2Max3DTextureSize, gl.RGB, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
2071 this.expectError(gl.INVALID_VALUE);
2073 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
2074 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */ (gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
2075 gl.texImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, gl.RGB, 1, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, null);
2076 this.expectError(gl.INVALID_VALUE);
2078 gl.deleteTexture(texture[0]);
2079 gl.deleteTexture(texture[1]);
2083 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_neg_width_height_depth', 'Invalid gl.texImage3D() usage', gl,
2086 /** @type{Array<WebGLTexture>} */ var texture = [];
2087 texture[0] = gl.createTexture();
2088 texture[1] = gl.createTexture();
2089 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2090 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2092 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height is less than 0.');
2093 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, -1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2094 this.expectError(gl.INVALID_VALUE);
2095 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, -1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2096 this.expectError(gl.INVALID_VALUE);
2097 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2098 this.expectError(gl.INVALID_VALUE);
2099 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, -1, -1, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2100 this.expectError(gl.INVALID_VALUE);
2102 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, -1, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2103 this.expectError(gl.INVALID_VALUE);
2104 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 1, -1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2105 this.expectError(gl.INVALID_VALUE);
2106 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 1, 1, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2107 this.expectError(gl.INVALID_VALUE);
2108 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, -1, -1, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2109 this.expectError(gl.INVALID_VALUE);
2111 gl.deleteTexture(texture[0]);
2112 gl.deleteTexture(texture[1]);
2115 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_max_width_height_depth', 'Invalid gl.texImage3D() usage', gl,
2118 /** @type{Array<WebGLTexture>} */ var texture = [];
2119 texture[0] = gl.createTexture();
2120 texture[1] = gl.createTexture();
2121 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2122 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2124 var max3DTextureSize = /** @type{number} */ (gl.getParameter(gl.MAX_3D_TEXTURE_SIZE)) + 1;
2125 var maxTextureSize = /** @type{number} */ (gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;
2127 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is greater than gl.MAX_3D_TEXTURE_SIZE.');
2128 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, max3DTextureSize, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2129 this.expectError(gl.INVALID_VALUE);
2130 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, max3DTextureSize, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2131 this.expectError(gl.INVALID_VALUE);
2132 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, max3DTextureSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2133 this.expectError(gl.INVALID_VALUE);
2134 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, max3DTextureSize, max3DTextureSize, max3DTextureSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2135 this.expectError(gl.INVALID_VALUE);
2137 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is greater than gl.MAX_TEXTURE_SIZE.');
2138 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, maxTextureSize, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2139 this.expectError(gl.INVALID_VALUE);
2140 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 1, maxTextureSize, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2141 this.expectError(gl.INVALID_VALUE);
2142 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 1, 1, maxTextureSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2143 this.expectError(gl.INVALID_VALUE);
2144 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, maxTextureSize, maxTextureSize, maxTextureSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2145 this.expectError(gl.INVALID_VALUE);
2147 gl.deleteTexture(texture[0]);
2148 gl.deleteTexture(texture[1]);
2151 testGroup.addChild(new es3fApiCase.ApiCaseCallback('teximage3d_invalid_border', 'Invalid gl.texImage3D() usage', gl,
2153 /** @type{Array<WebGLTexture>} */ var texture = [];
2154 texture[0] = gl.createTexture();
2155 texture[1] = gl.createTexture();
2156 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2157 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2159 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0 or 1.');
2160 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB, 1, 1, 1, -1, gl.RGB, gl.UNSIGNED_BYTE, null);
2161 this.expectError(gl.INVALID_VALUE);
2162 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGB, 1, 1, 1, 2, gl.RGB, gl.UNSIGNED_BYTE, null);
2163 this.expectError(gl.INVALID_VALUE);
2164 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGB, 1, 1, 1, -1, gl.RGB, gl.UNSIGNED_BYTE, null);
2165 this.expectError(gl.INVALID_VALUE);
2166 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGB, 1, 1, 1, 2, gl.RGB, gl.UNSIGNED_BYTE, null);
2167 this.expectError(gl.INVALID_VALUE);
2169 gl.deleteTexture(texture[0]);
2170 gl.deleteTexture(texture[1]);
2175 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d', 'Invalid gl.texSubImage3D() usage', gl,
2177 /** @type{WebGLTexture} */ var texture;
2178 texture = gl.createTexture();
2179 gl.bindTexture (gl.TEXTURE_3D, texture);
2180 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2181 this.expectError (gl.NO_ERROR);
2183 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(256);
2184 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
2185 gl.texSubImage3D(0, 0, 0, 0, 0, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2186 this.expectError(gl.INVALID_ENUM);
2187 gl.texSubImage3D(gl.TEXTURE_2D, 0, 0, 0, 0, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2188 this.expectError(gl.INVALID_ENUM);
2190 bufferedLogToConsole('gl.INVALID_ENUM is generated if format is not an accepted format constant.');
2191 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 4, 4, 4, gl.UNSIGNED_BYTE, uint8);
2192 this.expectError(gl.INVALID_ENUM);
2194 bufferedLogToConsole('gl.INVALID_ENUM is generated if type is not a type constant.');
2195 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, 0, uint8);
2196 this.expectError(gl.INVALID_ENUM);
2198 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the combination of internalFormat of the previously specified texture array, format and type is not valid.');
2199 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_4_4_4_4, uint8);
2200 this.expectError(gl.INVALID_OPERATION);
2201 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, uint8);
2202 this.expectError(gl.INVALID_OPERATION);
2203 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, gl.UNSIGNED_SHORT_5_5_5_1, uint8);
2204 this.expectError(gl.INVALID_OPERATION);
2205 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGBA_INTEGER, gl.UNSIGNED_INT, uint8);
2206 this.expectError(gl.INVALID_OPERATION);
2207 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, gl.RGB, gl.FLOAT, uint8);
2208 this.expectError(gl.INVALID_OPERATION);
2210 gl.deleteTexture(texture);
2213 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_neg_level', 'Invalid gl.texSubImage3D() usage', gl,
2215 /** @type{Array<WebGLTexture>} */ var texture = [];
2216 texture[0] = gl.createTexture();
2217 texture[1] = gl.createTexture();
2218 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2219 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2220 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2221 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2222 this.expectError (gl.NO_ERROR);
2224 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);
2225 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
2226 gl.texSubImage3D(gl.TEXTURE_3D, -1, 0, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2227 this.expectError(gl.INVALID_VALUE);
2228 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2229 this.expectError(gl.INVALID_VALUE);
2231 gl.deleteTexture(texture[0]);
2232 gl.deleteTexture(texture[1]);
2235 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_max_level', 'Invalid gl.texSubImage3D() usage', gl,
2237 /** @type{Array<WebGLTexture>} */ var texture = [];
2238 texture[0] = gl.createTexture();
2239 texture[1] = gl.createTexture();
2240 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2241 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2242 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2243 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2244 this.expectError (gl.NO_ERROR);
2246 /** @type{number} */ var log2Max3DTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_3D_TEXTURE_SIZE)))) + 1;
2247 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
2249 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);
2250 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_3D_TEXTURE_SIZE).');
2251 gl.texSubImage3D(gl.TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2252 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2254 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
2255 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2256 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2258 gl.deleteTexture(texture[0]);
2259 gl.deleteTexture(texture[1]);
2262 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_neg_offset', 'Invalid gl.texSubImage3D() usage', gl,
2264 /** @type{Array<WebGLTexture>} */ var texture = [];
2265 texture[0] = gl.createTexture();
2266 texture[1] = gl.createTexture();
2267 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2268 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2269 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2270 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2271 this.expectError (gl.NO_ERROR);
2273 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);
2274 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset, yoffset or zoffset are negative.');
2275 gl.texSubImage3D(gl.TEXTURE_3D, 0, -1, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2276 this.expectError(gl.INVALID_VALUE);
2277 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, -1, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2278 this.expectError(gl.INVALID_VALUE);
2279 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, -1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2280 this.expectError(gl.INVALID_VALUE);
2281 gl.texSubImage3D(gl.TEXTURE_3D, 0, -1, -1, -1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2282 this.expectError(gl.INVALID_VALUE);
2283 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, -1, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2284 this.expectError(gl.INVALID_VALUE);
2285 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, -1, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2286 this.expectError(gl.INVALID_VALUE);
2287 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, -1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2288 this.expectError(gl.INVALID_VALUE);
2289 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, -1, -1, -1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2290 this.expectError(gl.INVALID_VALUE);
2292 gl.deleteTexture(texture[0]);
2293 gl.deleteTexture(texture[1]);
2296 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_invalid_offset', 'Invalid gl.texSubImage3D() usage', gl,
2298 /** @type{WebGLTexture} */ var texture;
2299 texture = gl.createTexture();
2300 gl.bindTexture (gl.TEXTURE_3D, texture);
2301 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2302 this.expectError (gl.NO_ERROR);
2304 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(256);
2305 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset + width > texture_width.');
2306 gl.texSubImage3D(gl.TEXTURE_3D, 0, 2, 0, 0, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2307 this.expectError(gl.INVALID_VALUE);
2309 bufferedLogToConsole('gl.INVALID_VALUE is generated if yoffset + height > texture_height.');
2310 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 2, 0, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2311 this.expectError(gl.INVALID_VALUE);
2313 bufferedLogToConsole('gl.INVALID_VALUE is generated if zoffset + depth > texture_depth.');
2314 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 2, 4, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2315 this.expectError(gl.INVALID_VALUE);
2317 gl.deleteTexture(texture);
2320 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texsubimage3d_neg_width_height', 'Invalid gl.texSubImage3D() usage', gl,
2322 /** @type{WebGLTexture} */ var texture;
2323 texture = gl.createTexture();
2324 gl.bindTexture (gl.TEXTURE_3D, texture);
2325 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2327 /** @type {ArrayBufferView} */ var uint8 = new Uint8Array(4);
2328 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is less than 0.');
2329 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, -1, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2330 this.expectError(gl.INVALID_VALUE);
2331 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2332 this.expectError(gl.INVALID_VALUE);
2333 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 0, -1, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2334 this.expectError(gl.INVALID_VALUE);
2335 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, -1, -1, -1, gl.RGBA, gl.UNSIGNED_BYTE, uint8);
2336 this.expectError(gl.INVALID_VALUE);
2338 gl.deleteTexture(texture);
2342 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d', 'Invalid gl.copyTexSubImage3D() usage', gl,
2344 /** @type{WebGLTexture} */ var texture;
2345 texture = gl.createTexture();
2346 gl.bindTexture (gl.TEXTURE_3D, texture);
2347 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2349 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
2350 gl.copyTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 4, 0);
2351 this.expectError(gl.INVALID_ENUM);
2353 gl.deleteTexture(texture);
2355 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_neg_level', 'Invalid gl.copyTexSubImage3D() usage', gl,
2357 /** @type{Array<WebGLTexture>} */ var texture = [];
2358 texture[0] = gl.createTexture();
2359 texture[1] = gl.createTexture();
2360 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2361 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2362 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2363 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2364 this.expectError (gl.NO_ERROR);
2366 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
2367 gl.copyTexSubImage3D(gl.TEXTURE_3D, -1, 0, 0, 0, 0, 0, 4, 0);
2368 this.expectError(gl.INVALID_VALUE);
2369 gl.copyTexSubImage3D(gl.TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 4, 0);
2370 this.expectError(gl.INVALID_VALUE);
2372 gl.deleteTexture(texture[0]);
2373 gl.deleteTexture(texture[1]);
2376 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_max_level', 'Invalid gl.copyTexSubImage3D() usage', gl,
2378 /** @type{number} */ var log2Max3DTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_3D_TEXTURE_SIZE)))) + 1;
2379 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
2381 /** @type{Array<WebGLTexture>} */ var texture = [];
2382 texture[0] = gl.createTexture();
2383 texture[1] = gl.createTexture();
2384 gl.bindTexture (gl.TEXTURE_3D, texture[0]);
2385 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2386 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2387 gl.texImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2388 this.expectError (gl.NO_ERROR);
2390 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_3D_TEXTURE_SIZE).');
2391 gl.copyTexSubImage3D(gl.TEXTURE_3D, log2Max3DTextureSize, 0, 0, 0, 0, 0, 4, 0);
2392 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2394 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
2395 gl.copyTexSubImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 4, 0);
2396 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2398 gl.deleteTexture(texture[0]);
2399 gl.deleteTexture(texture[1]);
2402 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_neg_offset', 'Invalid gl.copyTexSubImage3D() usage', gl,
2404 /** @type{ WebGLTexture} */ var texture;
2405 texture = gl.createTexture();
2406 gl.bindTexture (gl.TEXTURE_3D, texture);
2407 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2409 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset, yoffset or zoffset is negative.');
2410 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, -1, 0, 0, 0, 0, 4, 4);
2411 this.expectError(gl.INVALID_VALUE);
2412 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, -1, 0, 0, 0, 4, 4);
2413 this.expectError(gl.INVALID_VALUE);
2414 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, -1, 0, 0, 4, 4);
2415 this.expectError(gl.INVALID_VALUE);
2416 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, -1, -1, -1, 0, 0, 4, 4);
2417 this.expectError(gl.INVALID_VALUE);
2419 gl.deleteTexture(texture);
2422 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_invalid_offset', 'Invalid gl.copyTexSubImage3D() usage', gl,
2424 /** @type{WebGLTexture} */ var texture;
2425 texture = gl.createTexture();
2426 gl.bindTexture (gl.TEXTURE_3D, texture);
2427 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2429 bufferedLogToConsole('gl.INVALID_VALUE is generated if xoffset + width > texture_width.');
2430 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 1, 0, 0, 0, 0, 4, 4);
2431 this.expectError(gl.INVALID_VALUE);
2433 bufferedLogToConsole('gl.INVALID_VALUE is generated if yoffset + height > texture_height.');
2434 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 1, 0, 0, 0, 4, 4);
2435 this.expectError(gl.INVALID_VALUE);
2437 bufferedLogToConsole('gl.INVALID_VALUE is generated if zoffset + 1 > texture_depth.');
2438 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 4, 0, 0, 4, 4);
2439 this.expectError(gl.INVALID_VALUE);
2441 gl.deleteTexture(texture);
2444 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_neg_width_height', 'Invalid gl.copyTexSubImage3D() usage', gl,
2446 /** @type{ WebGLTexture} */ var texture;
2447 texture = gl.createTexture();
2448 gl.bindTexture (gl.TEXTURE_3D, texture);
2449 gl.texImage3D (gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2451 bufferedLogToConsole('gl.INVALID_VALUE is generated if width < 0.');
2452 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 0, -4, 4);
2453 this.expectError(gl.INVALID_VALUE);
2455 bufferedLogToConsole('gl.INVALID_VALUE is generated if height < 0.');
2456 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, -4);
2457 this.expectError(gl.INVALID_VALUE);
2459 gl.deleteTexture(texture);
2462 testGroup.addChild(new es3fApiCase.ApiCaseCallback('copytexsubimage3d_incomplete_framebuffer', 'Invalid gl.copyTexSubImage3D() usage', gl,
2464 bufferedLogToConsole('gl.INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.');
2465 /** @type{Array<WebGLTexture>} */ var texture = [];
2466 /** @type{WebGLFramebuffer} */ var fbo;
2467 texture[0] = gl.createTexture();
2468 texture[1] = gl.createTexture();
2469 gl.bindTexture(gl.TEXTURE_3D, texture[0]);
2470 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2471 gl.bindTexture(gl.TEXTURE_2D_ARRAY, texture[1]);
2472 gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA, 4, 4, 4, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
2473 this.expectError(gl.NO_ERROR);
2475 fbo = gl.createFramebuffer();
2476 gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo);
2477 gl.checkFramebufferStatus(gl.READ_FRAMEBUFFER);
2478 this.expectError(gl.NO_ERROR);
2480 gl.copyTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 0, 0, 4, 4);
2481 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
2482 gl.copyTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 4, 4);
2483 this.expectError(gl.INVALID_FRAMEBUFFER_OPERATION);
2485 gl.bindFramebuffer(gl.FRAMEBUFFER, null);
2486 gl.deleteFramebuffer(fbo);
2487 gl.deleteTexture(texture[0]);
2488 gl.deleteTexture(texture[1]);
2491 // gl.compressedTexImage3D
2493 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d', 'Invalid gl.compressedTexImage3D() usage', gl,
2495 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2497 /** @type{Array<WebGLTexture>} */ var texture = [];
2499 // We have to create and bind textures to each target for the test because default textures are not supported by WebGL.
2500 texture[0] = gl.createTexture();
2501 texture[1] = gl.createTexture();
2502 gl.bindTexture (gl.TEXTURE_CUBE_MAP, texture[0]);
2503 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture[1]);
2505 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
2506 gl.compressedTexImage3D(0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(0));
2507 this.expectError(gl.INVALID_ENUM);
2508 gl.compressedTexImage3D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(0));
2509 this.expectError(gl.INVALID_ENUM);
2511 bufferedLogToConsole('gl.INVALID_ENUM is generated if internalformat is not one of the specific compressed internal formats.');
2512 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, new Uint8Array(0));
2513 this.expectError(gl.INVALID_ENUM);
2514 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA8, 0, 0, 0, 0, new Uint8Array(0));
2515 this.expectError(gl.INVALID_ENUM);
2517 gl.deleteTexture(texture[0]);
2518 gl.deleteTexture(texture[1]);
2521 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_neg_level', 'Invalid gl.compressedTexImage3D() usage', gl,
2523 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2525 /** @type{ WebGLTexture} */ var texture;
2526 texture = gl.createTexture();
2527 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2529 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
2530 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, -1, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(0));
2531 this.expectError(gl.INVALID_VALUE);
2533 gl.deleteTexture(texture);
2536 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_max_level', 'Invalid gl.compressedTexImage3D() usage', gl,
2538 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2540 /** @type{ WebGLTexture} */ var texture;
2541 texture = gl.createTexture();
2542 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2544 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
2545 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
2546 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(0));
2547 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2549 gl.deleteTexture(texture);
2553 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_neg_width_height_depth', 'Invalid gl.compressedTexImage3D() usage', gl,
2555 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2557 /** @type{ WebGLTexture} */ var texture;
2558 texture = gl.createTexture();
2559 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2561 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is less than 0.');
2562 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, 0, 0, 0, new Uint8Array(0));
2563 this.expectError(gl.INVALID_VALUE);
2564 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, -1, 0, 0, new Uint8Array(0));
2565 this.expectError(gl.INVALID_VALUE);
2566 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, new Uint8Array(0));
2567 this.expectError(gl.INVALID_VALUE);
2568 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, -1, -1, -1, 0, new Uint8Array(0));
2569 this.expectError(gl.INVALID_VALUE);
2571 gl.deleteTexture(texture);
2575 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_max_width_height_depth', 'Invalid gl.compressedTexImage3D() usage', gl,
2577 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2579 /** @type{ WebGLTexture} */ var texture;
2580 texture = gl.createTexture();
2581 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2583 var maxTextureSize = /** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)) + 1;
2585 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth is greater than gl.MAX_TEXTURE_SIZE.');
2586 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, 0, 0, 0, new Uint8Array(0));
2587 this.expectError(gl.INVALID_VALUE);
2588 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, maxTextureSize, 0, 0, new Uint8Array(0));
2589 this.expectError(gl.INVALID_VALUE);
2590 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, maxTextureSize, 0, new Uint8Array(0));
2591 this.expectError(gl.INVALID_VALUE);
2592 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, maxTextureSize, 0, new Uint8Array(0));
2593 this.expectError(gl.INVALID_VALUE);
2595 gl.deleteTexture(texture);
2599 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_invalid_border', 'Invalid gl.compressedTexImage3D() usage', gl,
2601 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2603 /** @type{ WebGLTexture} */ var texture;
2604 texture = gl.createTexture();
2605 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2607 bufferedLogToConsole('gl.INVALID_VALUE is generated if border is not 0.');
2608 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, -1, new Uint8Array(0));
2609 this.expectError(gl.INVALID_VALUE);
2610 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 1, new Uint8Array(0));
2611 this.expectError(gl.INVALID_VALUE);
2613 gl.deleteTexture(texture);
2617 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedteximage3d_invalid_size', 'Invalid gl.compressedTexImage3D() usage', gl,
2619 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2621 /** @type{ WebGLTexture} */ var texture;
2622 texture = gl.createTexture();
2623 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2625 bufferedLogToConsole('gl.INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.');
2626 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, new Uint8Array(1));
2627 this.expectError(gl.INVALID_VALUE);
2628 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(4*4*8));
2629 this.expectError(gl.INVALID_VALUE);
2630 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGB8_ETC2, 16, 16, 1, 0, new Uint8Array(4*4*16));
2631 this.expectError(gl.INVALID_VALUE);
2632 gl.compressedTexImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_SIGNED_R11_EAC, 16, 16, 1, 0, new Uint8Array(4*4*16));
2633 this.expectError(gl.INVALID_VALUE);
2635 gl.deleteTexture(texture);
2639 // gl.compressedTexSubImage3D
2641 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d', 'Invalid gl.compressedTexSubImage3D() usage', gl,
2643 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2645 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is invalid.');
2646 /** @type{WebGLTexture} */ var texture;
2647 texture = gl.createTexture();
2648 gl.compressedTexSubImage3D(0, 0, 0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2649 this.expectError(gl.INVALID_ENUM);
2651 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2652 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 18, 18, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));
2653 this.expectError (gl.NO_ERROR);
2655 bufferedLogToConsole('gl.INVALID_OPERATION is generated if format does not match the internal format of the texture image being modified.');
2656 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGB8_ETC2, new Uint8Array(0));
2657 this.expectError(gl.INVALID_OPERATION);
2659 bufferedLogToConsole('gl.INVALID_OPERATION is generated if internalformat is an ETC2/EAC format and target is not gl.TEXTURE_2D_ARRAY.');
2660 gl.compressedTexSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 18, 18, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(18, 18)));
2661 this.expectError(gl.INVALID_OPERATION);
2663 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if width is not a multiple of four, and width + xoffset is not equal to the width of the texture level.');
2664 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 4, 0, 0, 10, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(10, 4)));
2665 this.expectError(gl.INVALID_OPERATION);
2667 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if height is not a multiple of four, and height + yoffset is not equal to the height of the texture level.');
2668 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 4, 0, 4, 10, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 10)));
2669 this.expectError(gl.INVALID_OPERATION);
2671 bufferedLogToConsole('For ETC2/EAC images gl.INVALID_OPERATION is generated if xoffset or yoffset is not a multiple of four.');
2672 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 1, 0, 0, 4, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));
2673 this.expectError(gl.INVALID_OPERATION);
2674 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 1, 0, 4, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));
2675 this.expectError(gl.INVALID_OPERATION);
2676 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 1, 1, 0, 4, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));
2677 this.expectError(gl.INVALID_OPERATION);
2679 gl.deleteTexture(texture);
2682 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_neg_level', 'Invalid gl.compressedTexSubImage3D() usage', gl,
2684 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2686 /** @type{WebGLTexture} */ var texture;
2687 texture = gl.createTexture();
2688 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2689 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));
2690 this.expectError (gl.NO_ERROR);
2692 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is less than 0.');
2693 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2694 this.expectError(gl.INVALID_VALUE);
2696 gl.deleteTexture(texture);
2699 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_max_level', 'Invalid gl.compressedTexSubImage3D() usage', gl,
2701 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2703 /** @type{WebGLTexture} */ var texture;
2704 texture = gl.createTexture();
2705 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2706 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));
2707 this.expectError (gl.NO_ERROR);
2709 bufferedLogToConsole('gl.INVALID_VALUE is generated if level is greater than log_2(gl.MAX_TEXTURE_SIZE).');
2710 /** @type{number} */ var log2MaxTextureSize = Math.floor(Math.log2(/** @type{number} */(gl.getParameter(gl.MAX_TEXTURE_SIZE)))) + 1;
2711 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, log2MaxTextureSize, 0, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2712 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2714 gl.deleteTexture(texture);
2717 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_neg_offset', 'Invalid gl.compressedTexSubImage3D() usage', gl,
2719 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2721 /** @type{WebGLTexture} */ var texture;
2722 texture = gl.createTexture();
2723 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2724 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));
2725 this.expectError (gl.NO_ERROR);
2727 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if xoffset, yoffset or zoffset are negative.');
2728 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, -4, 0, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2729 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2730 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, -4, 0, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2731 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2732 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, -4, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2733 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2734 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, -4, -4, -4, 0, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2735 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2737 gl.deleteTexture(texture);
2740 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_invalid_offset', 'Invalid gl.compressedTexSubImage3D() usage', gl,
2742 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2744 /** @type{WebGLTexture} */ var texture;
2745 texture = gl.createTexture();
2746 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2747 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));
2748 this.expectError (gl.NO_ERROR);
2750 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if xoffset + width > texture_width or yoffset + height > texture_height.');
2752 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 12, 0, 0, 8, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 4)));
2753 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2754 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 12, 0, 4, 8, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 8)));
2755 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2756 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 12, 4, 4, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(4, 4)));
2757 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2758 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 12, 12, 12, 8, 8, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(8, 8)));
2759 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2761 gl.deleteTexture(texture);
2764 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_neg_width_height_depth', 'Invalid gl.compressedTexSubImage3D() usage', gl,
2766 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2768 /** @type{WebGLTexture} */ var texture;
2769 texture = gl.createTexture();
2770 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2771 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(es3fNegativeTextureApiTests.etc2EacDataSize(16, 16)));
2772 this.expectError (gl.NO_ERROR);
2774 bufferedLogToConsole('gl.INVALID_VALUE or gl.INVALID_OPERATION is generated if width, height or depth are negative.');
2775 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, 0, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2776 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2777 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, -4, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2778 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2779 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 0, 0, -4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2780 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2781 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, -4, -4, -4, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2782 this.expectError([gl.INVALID_VALUE, gl.INVALID_OPERATION]);
2784 gl.deleteTexture(texture);
2787 testGroup.addChild(new es3fApiCase.ApiCaseCallback('compressedtexsubimage3d_invalid_size', 'Invalid gl.compressedTexSubImage3D() usage', gl,
2789 if (!haveCompressedTextureETC) { etc2Unsupported(); return; }
2791 /** @type{WebGLTexture} */ var texture;
2792 texture = gl.createTexture();
2793 gl.bindTexture (gl.TEXTURE_2D_ARRAY, texture);
2794 gl.compressedTexImage3D (gl.TEXTURE_2D_ARRAY, 0, gl.COMPRESSED_RGBA8_ETC2_EAC, 16, 16, 1, 0, new Uint8Array(4*4*16));
2795 this.expectError (gl.NO_ERROR);
2797 bufferedLogToConsole('gl.INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.');
2798 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(0));
2799 this.expectError(gl.INVALID_VALUE);
2801 gl.compressedTexSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, 16, 16, 1, gl.COMPRESSED_RGBA8_ETC2_EAC, new Uint8Array(4*4*16-1));
2802 this.expectError(gl.INVALID_VALUE);
2804 gl.deleteTexture(texture);
2809 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texstorage2d', 'Invalid gl.texStorage2D() usage', gl,
2811 /** @type{WebGLTexture} */ var texture;
2812 texture = gl.createTexture();
2813 gl.bindTexture (gl.TEXTURE_2D, texture);
2815 bufferedLogToConsole('gl.INVALID_ENUM or gl.INVALID_VALUE is generated if internalformat is not a valid sized internal format.');
2816 gl.texStorage2D (gl.TEXTURE_2D, 1, 0, 16, 16);
2817 this.expectError ([gl.INVALID_ENUM, gl.INVALID_VALUE]);
2818 gl.texStorage2D (gl.TEXTURE_2D, 1, gl.RGBA_INTEGER, 16, 16);
2819 this.expectError ([gl.INVALID_ENUM, gl.INVALID_VALUE]);
2821 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is not one of the accepted target enumerants.');
2822 gl.texStorage2D (0, 1, gl.RGBA8, 16, 16);
2823 this.expectError (gl.INVALID_ENUM);
2824 gl.texStorage2D (gl.TEXTURE_3D, 1, gl.RGBA8, 16, 16);
2825 this.expectError (gl.INVALID_ENUM);
2826 gl.texStorage2D (gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, 16, 16);
2827 this.expectError (gl.INVALID_ENUM);
2829 bufferedLogToConsole('gl.INVALID_VALUE is generated if width or height are less than 1.');
2830 gl.texStorage2D (gl.TEXTURE_2D, 1, gl.RGBA8, 0, 16);
2831 this.expectError (gl.INVALID_VALUE);
2832 gl.texStorage2D (gl.TEXTURE_2D, 1, gl.RGBA8, 16, 0);
2833 this.expectError (gl.INVALID_VALUE);
2834 gl.texStorage2D (gl.TEXTURE_2D, 1, gl.RGBA8, 0, 0);
2835 this.expectError (gl.INVALID_VALUE);
2837 gl.deleteTexture(texture);
2840 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texstorage2d_invalid_binding', 'Invalid gl.texStorage2D() usage', gl,
2842 gl.bindTexture (gl.TEXTURE_2D, null);
2844 bufferedLogToConsole('gl.INVALID_OPERATION is generated if there is no texture object curently bound to target.');
2845 gl.texStorage2D (gl.TEXTURE_2D, 1, gl.RGBA8, 16, 16);
2846 this.expectError (gl.INVALID_OPERATION);
2848 /** @type{WebGLTexture} */ var texture;
2849 texture = gl.createTexture();
2850 gl.bindTexture (gl.TEXTURE_2D, texture);
2852 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the texture object currently bound to target already has gl.TEXTURE_IMMUTABLE_FORMAT set to true.');
2853 /** @type{number} */ var immutable;
2854 immutable = /** @type{number} */(gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_IMMUTABLE_FORMAT));
2855 bufferedLogToConsole('// gl.TEXTURE_IMMUTABLE_FORMAT = ' + ((immutable != 0) ? 'true' : 'false'));
2856 gl.texStorage2D (gl.TEXTURE_2D, 1, gl.RGBA8, 16, 16);
2857 this.expectError (gl.NO_ERROR);
2858 immutable = /** @type{number} */(gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_IMMUTABLE_FORMAT));
2859 bufferedLogToConsole('// gl.TEXTURE_IMMUTABLE_FORMAT = ' + ((immutable != 0) ? 'true' : 'false'));
2860 gl.texStorage2D (gl.TEXTURE_2D, 1, gl.RGBA8, 16, 16);
2861 this.expectError (gl.INVALID_OPERATION);
2863 gl.deleteTexture(texture);
2866 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texstorage2d_invalid_levels', 'Invalid gl.texStorage2D() usage', gl,
2868 /** @type{WebGLTexture} */ var texture;
2869 texture = gl.createTexture();
2870 gl.bindTexture (gl.TEXTURE_2D, texture);
2872 bufferedLogToConsole('gl.INVALID_VALUE is generated if levels is less than 1.');
2873 gl.texStorage2D (gl.TEXTURE_2D, 0, gl.RGBA8, 16, 16);
2874 this.expectError (gl.INVALID_VALUE);
2875 gl.texStorage2D (gl.TEXTURE_2D, 0, gl.RGBA8, 0, 0);
2876 this.expectError (gl.INVALID_VALUE);
2878 bufferedLogToConsole('gl.INVALID_OPERATION is generated if levels is greater than floor(log_2(max(width, height))) + 1');
2879 /** @type{number} */ var log2MaxSize = Math.floor(Math.log2(Math.max(16, 4))) + 1 + 1;
2880 gl.texStorage2D (gl.TEXTURE_2D, log2MaxSize, gl.RGBA8, 16, 4);
2881 this.expectError (gl.INVALID_OPERATION);
2882 gl.texStorage2D (gl.TEXTURE_2D, log2MaxSize, gl.RGBA8, 4, 16);
2883 this.expectError (gl.INVALID_OPERATION);
2884 gl.texStorage2D (gl.TEXTURE_2D, log2MaxSize, gl.RGBA8, 16, 16);
2885 this.expectError (gl.INVALID_OPERATION);
2887 gl.deleteTexture(texture);
2892 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texstorage3d', 'Invalid gl.texStorage3D() usage', gl,
2894 /** @type{WebGLTexture} */ var texture;
2895 texture = gl.createTexture();
2896 gl.bindTexture (gl.TEXTURE_3D, texture);
2898 bufferedLogToConsole('gl.INVALID_ENUM or gl.INVALID_VALUE is generated if internalformat is not a valid sized internal format.');
2899 gl.texStorage3D (gl.TEXTURE_3D, 1, 0, 4, 4, 4);
2900 this.expectError ([gl.INVALID_ENUM, gl.INVALID_VALUE]);
2901 gl.texStorage3D (gl.TEXTURE_3D, 1, gl.RGBA_INTEGER, 4, 4, 4);
2902 this.expectError ([gl.INVALID_ENUM, gl.INVALID_VALUE]);
2904 bufferedLogToConsole('gl.INVALID_ENUM is generated if target is not one of the accepted target enumerants.');
2905 gl.texStorage3D (0, 1, gl.RGBA8, 4, 4, 4);
2906 this.expectError (gl.INVALID_ENUM);
2907 gl.texStorage3D (gl.TEXTURE_CUBE_MAP, 1, gl.RGBA8, 4, 4, 4);
2908 this.expectError (gl.INVALID_ENUM);
2909 gl.texStorage3D (gl.TEXTURE_2D, 1, gl.RGBA8, 4, 4, 4);
2910 this.expectError (gl.INVALID_ENUM);
2912 bufferedLogToConsole('gl.INVALID_VALUE is generated if width, height or depth are less than 1.');
2913 gl.texStorage3D (gl.TEXTURE_3D, 1, gl.RGBA8, 0, 4, 4);
2914 this.expectError (gl.INVALID_VALUE);
2915 gl.texStorage3D (gl.TEXTURE_3D, 1, gl.RGBA8, 4, 0, 4);
2916 this.expectError (gl.INVALID_VALUE);
2917 gl.texStorage3D (gl.TEXTURE_3D, 1, gl.RGBA8, 4, 4, 0);
2918 this.expectError (gl.INVALID_VALUE);
2919 gl.texStorage3D (gl.TEXTURE_3D, 1, gl.RGBA8, 0, 0, 0);
2920 this.expectError (gl.INVALID_VALUE);
2922 gl.deleteTexture(texture);
2925 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texstorage3d_invalid_binding', 'Invalid gl.texStorage3D() usage', gl,
2927 gl.bindTexture (gl.TEXTURE_3D, null);
2929 bufferedLogToConsole('gl.INVALID_OPERATION is generated if there is no texture object curently bound to target.');
2930 gl.texStorage3D (gl.TEXTURE_3D, 1, gl.RGBA8, 4, 4, 4);
2931 this.expectError (gl.INVALID_OPERATION);
2933 /** @type{WebGLTexture} */ var texture;
2934 texture = gl.createTexture();
2935 gl.bindTexture (gl.TEXTURE_3D, texture);
2937 bufferedLogToConsole('gl.INVALID_OPERATION is generated if the texture object currently bound to target already has gl.TEXTURE_IMMUTABLE_FORMAT set to true.');
2938 /** @type{number} */ var immutable;
2939 immutable = /** @type{number} */(gl.getTexParameter(gl.TEXTURE_3D, gl.TEXTURE_IMMUTABLE_FORMAT));
2940 bufferedLogToConsole('// gl.TEXTURE_IMMUTABLE_FORMAT = ' + ((immutable != 0) ? 'true' : 'false'));
2941 gl.texStorage3D (gl.TEXTURE_3D, 1, gl.RGBA8, 4, 4, 4);
2942 this.expectError (gl.NO_ERROR);
2943 immutable = /** @type{number} */(gl.getTexParameter(gl.TEXTURE_3D, gl.TEXTURE_IMMUTABLE_FORMAT));
2944 bufferedLogToConsole('// gl.TEXTURE_IMMUTABLE_FORMAT = ' + ((immutable != 0) ? 'true' : 'false'));
2945 gl.texStorage3D (gl.TEXTURE_3D, 1, gl.RGBA8, 4, 4, 4);
2946 this.expectError (gl.INVALID_OPERATION);
2948 gl.deleteTexture(texture);
2951 // NOTE: the test doesn't cause glError using the parameters defined in the original test of C code
2952 testGroup.addChild(new es3fApiCase.ApiCaseCallback('texstorage3d_invalid_levels', 'Invalid gl.texStorage3D() usage', gl,
2954 /** @type{WebGLTexture} */ var texture;
2955 texture = gl.createTexture();
2956 gl.bindTexture (gl.TEXTURE_3D, texture);
2958 bufferedLogToConsole('gl.INVALID_VALUE is generated if levels is less than 1.');
2959 gl.texStorage3D (gl.TEXTURE_3D, 0, gl.RGBA8, 4, 4, 4);
2960 this.expectError (gl.INVALID_VALUE);
2961 gl.texStorage3D (gl.TEXTURE_3D, 0, gl.RGBA8, 0, 0, 0);
2962 this.expectError (gl.INVALID_VALUE);
2964 bufferedLogToConsole('gl.INVALID_OPERATION is generated if levels is greater than floor(log_2(max(width, height, depth))) + 1');
2965 /** @type{number} */ var log2MaxSize = Math.floor(Math.log2(8)) + 1 + 1;
2966 gl.texStorage3D (gl.TEXTURE_3D, log2MaxSize, gl.RGBA8, 8, 2, 2);
2967 this.expectError (gl.INVALID_OPERATION);
2968 gl.texStorage3D (gl.TEXTURE_3D, log2MaxSize, gl.RGBA8, 2, 8, 2);
2969 this.expectError (gl.INVALID_OPERATION);
2970 gl.texStorage3D (gl.TEXTURE_3D, log2MaxSize, gl.RGBA8, 2, 2, 8);
2971 this.expectError (gl.INVALID_OPERATION);
2972 gl.texStorage3D (gl.TEXTURE_3D, log2MaxSize, gl.RGBA8, 8, 8, 8);
2973 this.expectError (gl.INVALID_OPERATION);
2975 gl.deleteTexture(texture);
2980 * @param {WebGL2RenderingContext} gl
2982 es3fNegativeTextureApiTests.run = function(gl) {
2983 var testName = 'negativeTextureApi';
2984 var testDescription = 'Negative Texture API tests';
2985 var state = tcuTestCase.runner;
2987 state.testName = testName;
2988 state.testCases = tcuTestCase.newTest(testName, testDescription, null);
2990 //Set up name and description of this test series.
2991 setCurrentTestName(testName);
2992 description(testDescription);
2994 es3fNegativeTextureApiTests.init(gl);
2995 tcuTestCase.runner.runCallback(tcuTestCase.runTestCases);
2997 bufferedLogToConsole(err);
2998 tcuTestCase.runner.terminate();