es3fVertexArrayTests.js (49300B)
1 /*------------------------------------------------------------------------- 2 * drawElements Quality Program OpenGL ES Utilities 3 * ------------------------------------------------ 4 * 5 * Copyright 2014 The Android Open Source Project 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 */ 20 21 'use strict'; 22 goog.provide('functional.gles3.es3fVertexArrayTests'); 23 goog.require('framework.common.tcuSurface'); 24 goog.require('framework.common.tcuTestCase'); 25 goog.require('framework.common.tcuTexture'); 26 goog.require('framework.delibs.debase.deMath'); 27 goog.require('framework.delibs.debase.deRandom'); 28 goog.require('framework.delibs.debase.deString'); 29 goog.require('framework.delibs.debase.deUtil'); 30 goog.require('framework.opengl.gluDrawUtil'); 31 goog.require('framework.opengl.gluShaderProgram'); 32 goog.require('framework.opengl.gluShaderUtil'); 33 goog.require('framework.opengl.gluTexture'); 34 goog.require('framework.opengl.gluVarType'); 35 goog.require('modules.shared.glsVertexArrayTests'); 36 37 goog.scope(function() { 38 39 var es3fVertexArrayTests = functional.gles3.es3fVertexArrayTests; 40 var gluDrawUtil = framework.opengl.gluDrawUtil; 41 var gluShaderUtil = framework.opengl.gluShaderUtil; 42 var gluShaderProgram = framework.opengl.gluShaderProgram; 43 var gluTexture = framework.opengl.gluTexture; 44 var gluVarType = framework.opengl.gluVarType; 45 var tcuTestCase = framework.common.tcuTestCase; 46 var tcuSurface = framework.common.tcuSurface; 47 var tcuTexture = framework.common.tcuTexture; 48 var deMath = framework.delibs.debase.deMath; 49 var deString = framework.delibs.debase.deString; 50 var deRandom = framework.delibs.debase.deRandom; 51 var deUtil = framework.delibs.debase.deUtil; 52 var glsVertexArrayTests = modules.shared.glsVertexArrayTests; 53 54 var DE_ASSERT = function(x) { 55 if (!x) 56 throw new Error('Assert failed'); 57 }; 58 59 /** 60 * es3fVertexArrayTests.SingleVertexArrayUsageGroup 61 * @constructor 62 * @extends {tcuTestCase.DeqpTest} 63 * @param {glsVertexArrayTests.deArray.Usage} usage 64 */ 65 es3fVertexArrayTests.SingleVertexArrayUsageGroup = function(usage) { 66 tcuTestCase.DeqpTest.call( 67 this, 68 "single_attribute.usages." + glsVertexArrayTests.deArray.usageTypeToString(usage), 69 glsVertexArrayTests.deArray.usageTypeToString(usage) 70 ); 71 this.makeExecutable(); 72 this.m_usage = usage; 73 }; 74 75 es3fVertexArrayTests.SingleVertexArrayUsageGroup.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 76 es3fVertexArrayTests.SingleVertexArrayUsageGroup.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayUsageGroup; 77 78 /** 79 * init 80 */ 81 es3fVertexArrayTests.SingleVertexArrayUsageGroup.prototype.init = function() { 82 /** @type {Array<number>} */ var counts = [1, 256]; 83 /** @type {Array<number>} */ var strides = [0, -1, 17, 32]; // Treat negative value as sizeof input. Same as 0, but done outside of GL. 84 /** @type {Array<glsVertexArrayTests.deArray.InputType>} */ var inputTypes = [ 85 glsVertexArrayTests.deArray.InputType.FLOAT, 86 /*glsVertexArrayTests.deArray.InputType.FIXED,*/ 87 glsVertexArrayTests.deArray.InputType.SHORT, 88 glsVertexArrayTests.deArray.InputType.BYTE 89 ]; 90 91 for (var inputTypeNdx = 0; inputTypeNdx < inputTypes.length; inputTypeNdx++) { 92 for (var countNdx = 0; countNdx < counts.length; countNdx++) { 93 for (var strideNdx = 0; strideNdx < strides.length; strideNdx++) { 94 /** @type {number} */ var stride = (strides[strideNdx] < 0 ? glsVertexArrayTests.deArray.inputTypeSize(inputTypes[inputTypeNdx]) * 2 : strides[strideNdx]); 95 /** @type {boolean} */ var aligned = (stride % glsVertexArrayTests.deArray.inputTypeSize(inputTypes[inputTypeNdx])) == 0; 96 /** @type {string} */ var name = 'stride' + stride + '_' + glsVertexArrayTests.deArray.inputTypeToString(inputTypes[inputTypeNdx]) + '_quads' + counts[countNdx]; 97 98 var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 99 inputTypes[inputTypeNdx], 100 glsVertexArrayTests.deArray.OutputType.VEC2, 101 glsVertexArrayTests.deArray.Storage.BUFFER, 102 this.m_usage, 103 2, 104 0, 105 stride, 106 false, 107 glsVertexArrayTests.GLValue.getMinValue(inputTypes[inputTypeNdx]), 108 glsVertexArrayTests.GLValue.getMaxValue(inputTypes[inputTypeNdx]) 109 ); 110 111 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 112 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 113 spec.drawCount = counts[countNdx]; 114 spec.first = 0; 115 spec.arrays.push(arraySpec); 116 117 if (aligned) 118 this.addChild( 119 new glsVertexArrayTests.MultiVertexArrayTest( 120 spec, name, name 121 ) 122 ); 123 } 124 } 125 } 126 }; 127 128 /** 129 * es3fVertexArrayTests.SingleVertexArrayStrideGroup 130 * @constructor 131 * @extends {tcuTestCase.DeqpTest} 132 * @param {glsVertexArrayTests.deArray.InputType} type 133 */ 134 es3fVertexArrayTests.SingleVertexArrayStrideGroup = function(type) { 135 tcuTestCase.DeqpTest.call(this, glsVertexArrayTests.deArray.inputTypeToString(type), glsVertexArrayTests.deArray.inputTypeToString(type)); 136 this.makeExecutable(); 137 this.m_type = type; 138 }; 139 140 es3fVertexArrayTests.SingleVertexArrayStrideGroup.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 141 es3fVertexArrayTests.SingleVertexArrayStrideGroup.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayStrideGroup; 142 143 /** 144 * init 145 */ 146 es3fVertexArrayTests.SingleVertexArrayStrideGroup.prototype.init = function() { 147 /** @type {Array<glsVertexArrayTests.deArray.Storage>} */ var storages = [ 148 // User storage not supported in WebGL - glsVertexArrayTests.deArray.Storage.USER, 149 glsVertexArrayTests.deArray.Storage.BUFFER 150 ]; 151 var counts = [1, 256]; 152 var strides = [/*0,*/ -1, 17, 32]; // Treat negative value as sizeof input. Same as 0, but done outside of GL. 153 154 for (var storageNdx = 0; storageNdx < storages.length; storageNdx++) { 155 for (var componentCount = 2; componentCount < 5; componentCount++) { 156 for (var countNdx = 0; countNdx < counts.length; countNdx++) { 157 for (var strideNdx = 0; strideNdx < strides.length; strideNdx++) { 158 /** @type {boolean} */ var packed = this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10 || this.m_type == glsVertexArrayTests.deArray.InputType.INT_2_10_10_10; 159 /** @type {number} */ var stride = (strides[strideNdx] < 0) ? ((packed) ? (16) : (glsVertexArrayTests.deArray.inputTypeSize(this.m_type) * componentCount)) : (strides[strideNdx]); 160 /** @type {number} */ var alignment = (packed) ? (glsVertexArrayTests.deArray.inputTypeSize(this.m_type) * componentCount) : (glsVertexArrayTests.deArray.inputTypeSize(this.m_type)); 161 /** @type {boolean} */ var bufferUnaligned = (storages[storageNdx] == glsVertexArrayTests.deArray.Storage.BUFFER) && (stride % alignment) != 0; 162 163 /** @type {string} */ var name = glsVertexArrayTests.deArray.storageToString(storages[storageNdx]) + '_stride' + stride + '_components' + componentCount + '_quads' + counts[countNdx]; 164 165 if ((this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10 || 166 this.m_type == glsVertexArrayTests.deArray.InputType.INT_2_10_10_10) && componentCount != 4) 167 continue; 168 169 /** @type {glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec} */ var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 170 this.m_type, 171 glsVertexArrayTests.deArray.OutputType.VEC4, 172 storages[storageNdx], 173 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 174 componentCount, 175 0, 176 stride, 177 false, 178 glsVertexArrayTests.GLValue.getMinValue(this.m_type), 179 glsVertexArrayTests.GLValue.getMaxValue(this.m_type) 180 ); 181 182 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 183 184 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 185 spec.drawCount = counts[countNdx]; 186 spec.first = 0; 187 spec.arrays.push(arraySpec); 188 189 if (!bufferUnaligned) 190 this.addChild( 191 new glsVertexArrayTests.MultiVertexArrayTest( 192 spec, name, name 193 ) 194 ); 195 } 196 } 197 } 198 } 199 }; 200 201 /** 202 * es3fVertexArrayTests.SingleVertexArrayStrideTests 203 * @constructor 204 * @extends {tcuTestCase.DeqpTest} 205 */ 206 es3fVertexArrayTests.SingleVertexArrayStrideTests = function() { 207 tcuTestCase.DeqpTest.call(this, 'single_attribute.strides', 'Single stride vertex atribute'); 208 this.makeExecutable(); 209 }; 210 211 es3fVertexArrayTests.SingleVertexArrayStrideTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 212 es3fVertexArrayTests.SingleVertexArrayStrideTests.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayStrideTests; 213 214 es3fVertexArrayTests.SingleVertexArrayStrideTests.prototype.init = function() { 215 /** @type {Array<glsVertexArrayTests.deArray.InputType>} */ var inputTypes = [ 216 glsVertexArrayTests.deArray.InputType.FLOAT, 217 glsVertexArrayTests.deArray.InputType.SHORT, 218 glsVertexArrayTests.deArray.InputType.BYTE, 219 /*glsVertexArrayTests.deArray.InputType.UNSIGNED_SHORT, 220 glsVertexArrayTests.deArray.InputType.UNSIGNED_BYTE, 221 glsVertexArrayTests.deArray.InputType.FIXED,*/ 222 glsVertexArrayTests.deArray.InputType.INT_2_10_10_10 223 ]; 224 225 for (var inputTypeNdx = 0; inputTypeNdx < inputTypes.length; inputTypeNdx++) 226 this.addChild( 227 new es3fVertexArrayTests.SingleVertexArrayStrideGroup( 228 inputTypes[inputTypeNdx] 229 ) 230 ); 231 }; 232 233 /** 234 * @constructor 235 * @extends {tcuTestCase.DeqpTest} 236 * @param {glsVertexArrayTests.deArray.InputType} type 237 */ 238 es3fVertexArrayTests.SingleVertexArrayFirstGroup = function(type) { 239 tcuTestCase.DeqpTest.call( 240 this, 241 glsVertexArrayTests.deArray.inputTypeToString(type), 242 glsVertexArrayTests.deArray.inputTypeToString(type) 243 ); 244 this.makeExecutable(); 245 246 this.m_type = type; 247 }; 248 249 es3fVertexArrayTests.SingleVertexArrayFirstGroup.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 250 es3fVertexArrayTests.SingleVertexArrayFirstGroup.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayFirstGroup; 251 252 /** 253 * init 254 */ 255 es3fVertexArrayTests.SingleVertexArrayFirstGroup.prototype.init = function() { 256 var counts = [5, 256]; 257 var firsts = [6, 24]; 258 var offsets = [1, 16, 17]; 259 var strides = [/*0,*/ -1, 17, 32]; // Tread negative value as sizeof input. Same as 0, but done outside of GL. 260 261 for (var offsetNdx = 0; offsetNdx < offsets.length; offsetNdx++) { 262 for (var countNdx = 0; countNdx < counts.length; countNdx++) { 263 for (var strideNdx = 0; strideNdx < strides.length; strideNdx++) { 264 for (var firstNdx = 0; firstNdx < firsts.length; firstNdx++) { 265 var packed = this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10 || 266 this.m_type == glsVertexArrayTests.deArray.InputType.INT_2_10_10_10; 267 var componentCount = packed ? 4 : 2; 268 var stride = strides[strideNdx] < 0 ? 269 (packed ? 8 : (glsVertexArrayTests.deArray.inputTypeSize(this.m_type) * componentCount)) : 270 (strides[strideNdx]); 271 var alignment = packed ? 272 (glsVertexArrayTests.deArray.inputTypeSize(this.m_type) * componentCount) : 273 (glsVertexArrayTests.deArray.inputTypeSize(this.m_type)); 274 var aligned = ((stride % alignment) == 0) && 275 ((offsets[offsetNdx] % alignment) == 0); 276 var name = 'first' + firsts[firstNdx] + '_offset' + offsets[offsetNdx] + '_stride' + stride + '_quads' + counts[countNdx]; 277 278 var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 279 this.m_type, 280 glsVertexArrayTests.deArray.OutputType.VEC2, 281 glsVertexArrayTests.deArray.Storage.BUFFER, 282 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 283 componentCount, 284 offsets[offsetNdx], 285 stride, 286 false, 287 glsVertexArrayTests.GLValue.getMinValue(this.m_type), 288 glsVertexArrayTests.GLValue.getMaxValue(this.m_type) 289 ); 290 291 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 292 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 293 spec.drawCount = counts[countNdx]; 294 spec.first = firsts[firstNdx]; 295 spec.arrays.push(arraySpec); 296 297 if (aligned) 298 this.addChild( 299 new glsVertexArrayTests.MultiVertexArrayTest( 300 spec, name, name 301 ) 302 ); 303 } 304 } 305 } 306 } 307 }; 308 309 /** 310 * @constructor 311 * @extends {tcuTestCase.DeqpTest} 312 */ 313 es3fVertexArrayTests.SingleVertexArrayFirstTests = function() { 314 tcuTestCase.DeqpTest.call(this, 'single_attribute.first', 'Single vertex attribute, different first values to drawArrays'); 315 this.makeExecutable(); 316 }; 317 318 es3fVertexArrayTests.SingleVertexArrayFirstTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 319 es3fVertexArrayTests.SingleVertexArrayFirstTests.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayFirstTests; 320 321 /** 322 * init 323 */ 324 es3fVertexArrayTests.SingleVertexArrayFirstTests.prototype.init = function() { 325 // Test offset with different input types, component counts and storage, Usage(?) 326 var inputTypes = [ 327 glsVertexArrayTests.deArray.InputType.FLOAT, 328 glsVertexArrayTests.deArray.InputType.BYTE, 329 glsVertexArrayTests.deArray.InputType.INT_2_10_10_10 330 ]; 331 332 for (var inputTypeNdx = 0; inputTypeNdx < inputTypes.length; inputTypeNdx++) { 333 this.addChild( 334 new es3fVertexArrayTests.SingleVertexArrayFirstGroup( 335 inputTypes[inputTypeNdx] 336 ) 337 ); 338 } 339 }; 340 341 /** 342 * @constructor 343 * @extends {tcuTestCase.DeqpTest} 344 * @param {glsVertexArrayTests.deArray.InputType} type 345 */ 346 es3fVertexArrayTests.SingleVertexArrayOffsetGroup = function(type) { 347 tcuTestCase.DeqpTest.call( 348 this, 349 glsVertexArrayTests.deArray.inputTypeToString(type), 350 glsVertexArrayTests.deArray.inputTypeToString(type) 351 ); 352 this.makeExecutable(); 353 this.m_type = type; 354 }; 355 356 es3fVertexArrayTests.SingleVertexArrayOffsetGroup.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 357 es3fVertexArrayTests.SingleVertexArrayOffsetGroup.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayOffsetGroup; 358 359 /** 360 * init 361 */ 362 es3fVertexArrayTests.SingleVertexArrayOffsetGroup.prototype.init = function() { 363 var counts = [1, 256]; 364 var offsets = [1, 4, 17, 32]; 365 var strides = [/*0,*/ -1, 17, 32]; // Tread negative value as sizeof input. Same as 0, but done outside of GL. 366 367 for (var offsetNdx = 0; offsetNdx < offsets.length; offsetNdx++) { 368 for (var countNdx = 0; countNdx < counts.length; countNdx++) { 369 for (var strideNdx = 0; strideNdx < strides.length; strideNdx++) { 370 var packed = this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10 || 371 this.m_type == glsVertexArrayTests.deArray.InputType.INT_2_10_10_10; 372 var componentCount = packed ? 4 : 2; 373 var stride = ( 374 strides[strideNdx] < 0 ? 375 glsVertexArrayTests.deArray.inputTypeSize( 376 this.m_type 377 ) * componentCount : 378 strides[strideNdx] 379 ); 380 var alignment = packed ? 381 glsVertexArrayTests.deArray.inputTypeSize(this.m_type) * componentCount : 382 glsVertexArrayTests.deArray.inputTypeSize(this.m_type); 383 384 var aligned = ((stride % alignment) == 0) && 385 ((offsets[offsetNdx] % alignment) == 0); 386 var name = 'offset' + offsets[offsetNdx] + 387 '_stride' + stride + '_quads' + 388 counts[countNdx]; 389 390 /** @type {glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec} */ var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 391 this.m_type, 392 glsVertexArrayTests.deArray.OutputType.VEC2, 393 glsVertexArrayTests.deArray.Storage.BUFFER, 394 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 395 componentCount, 396 offsets[offsetNdx], 397 stride, 398 false, 399 glsVertexArrayTests.GLValue.getMinValue(this.m_type), 400 glsVertexArrayTests.GLValue.getMaxValue(this.m_type) 401 ); 402 403 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 404 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 405 spec.drawCount = counts[countNdx]; 406 spec.first = 0; 407 spec.arrays.push(arraySpec); 408 409 if (aligned) 410 this.addChild( 411 new glsVertexArrayTests.MultiVertexArrayTest( 412 spec, name, name 413 ) 414 ); 415 } 416 } 417 } 418 }; 419 420 /** 421 * @constructor 422 * @extends {tcuTestCase.DeqpTest} 423 */ 424 es3fVertexArrayTests.SingleVertexArrayOffsetTests = function() { 425 tcuTestCase.DeqpTest.call(this, 'single_attribute.offset', 'Single vertex atribute offset element'); 426 this.makeExecutable(); 427 }; 428 429 es3fVertexArrayTests.SingleVertexArrayOffsetTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 430 es3fVertexArrayTests.SingleVertexArrayOffsetTests.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayOffsetTests; 431 432 /** 433 * init 434 */ 435 es3fVertexArrayTests.SingleVertexArrayOffsetTests.prototype.init = function() { 436 // Test offset with different input types, component counts and storage, Usage(?) 437 var inputTypes = [ 438 glsVertexArrayTests.deArray.InputType.FLOAT, 439 glsVertexArrayTests.deArray.InputType.BYTE, 440 glsVertexArrayTests.deArray.InputType.INT_2_10_10_10 441 ]; 442 443 for (var inputTypeNdx = 0; inputTypeNdx < inputTypes.length; inputTypeNdx++) { 444 this.addChild( 445 new es3fVertexArrayTests.SingleVertexArrayOffsetGroup( 446 inputTypes[inputTypeNdx] 447 ) 448 ); 449 } 450 }; 451 452 /** 453 * @constructor 454 * @extends {tcuTestCase.DeqpTest} 455 * @param {glsVertexArrayTests.deArray.InputType} type 456 */ 457 es3fVertexArrayTests.SingleVertexArrayNormalizeGroup = function(type) { 458 tcuTestCase.DeqpTest.call( 459 this, 460 glsVertexArrayTests.deArray.inputTypeToString(type), 461 glsVertexArrayTests.deArray.inputTypeToString(type) 462 ); 463 this.makeExecutable(); 464 this.m_type = type; 465 }; 466 467 es3fVertexArrayTests.SingleVertexArrayNormalizeGroup.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 468 es3fVertexArrayTests.SingleVertexArrayNormalizeGroup.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayNormalizeGroup; 469 470 /** 471 * init for SingleVertexArrayNormalizeGroup 472 */ 473 es3fVertexArrayTests.SingleVertexArrayNormalizeGroup.prototype.init = function() { 474 var counts = [1, 256]; 475 476 for (var componentCount = 2; componentCount < 5; componentCount++) { 477 for (var countNdx = 0; countNdx < counts.length; countNdx++) { 478 if ( 479 ( 480 this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10 || 481 this.m_type == glsVertexArrayTests.deArray.InputType.INT_2_10_10_10 482 ) && componentCount != 4 483 ) 484 continue; 485 486 var name = 'components' + componentCount.toString() + '_quads' + counts[countNdx].toString(); 487 488 var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 489 this.m_type, 490 glsVertexArrayTests.deArray.OutputType.VEC4, 491 glsVertexArrayTests.deArray.Storage.BUFFER, //No USER Storage support in WebGL2 492 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 493 componentCount, 494 0, 495 0, 496 true, 497 glsVertexArrayTests.GLValue.getMinValue(this.m_type), 498 glsVertexArrayTests.GLValue.getMaxValue(this.m_type) 499 ); 500 501 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 502 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 503 spec.drawCount = counts[countNdx]; 504 spec.first = 0; 505 spec.arrays.push(arraySpec); 506 507 this.addChild( 508 new glsVertexArrayTests.MultiVertexArrayTest( 509 spec, name, name 510 ) 511 ); 512 } 513 } 514 }; 515 516 /** 517 * @constructor 518 * @extends {tcuTestCase.DeqpTest} 519 */ 520 es3fVertexArrayTests.SingleVertexArrayNormalizeTests = function() { 521 tcuTestCase.DeqpTest.call(this, 'single_attribute.normalize', 'Single normalize vertex atribute'); 522 this.makeExecutable(); 523 }; 524 525 es3fVertexArrayTests.SingleVertexArrayNormalizeTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 526 es3fVertexArrayTests.SingleVertexArrayNormalizeTests.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayNormalizeTests; 527 528 /** 529 * init 530 */ 531 es3fVertexArrayTests.SingleVertexArrayNormalizeTests.prototype.init = function() { 532 // Test normalization with different input types, component counts and storage 533 /** @type {Array<glsVertexArrayTests.deArray.InputType>} */ var inputTypes = [ 534 glsVertexArrayTests.deArray.InputType.FLOAT, 535 glsVertexArrayTests.deArray.InputType.SHORT, 536 glsVertexArrayTests.deArray.InputType.BYTE, 537 glsVertexArrayTests.deArray.InputType.UNSIGNED_SHORT, 538 glsVertexArrayTests.deArray.InputType.UNSIGNED_BYTE, 539 //glsVertexArrayTests.deArray.InputType.FIXED, 540 glsVertexArrayTests.deArray.InputType.UNSIGNED_INT, 541 glsVertexArrayTests.deArray.InputType.INT, 542 glsVertexArrayTests.deArray.InputType.HALF, 543 glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10, 544 glsVertexArrayTests.deArray.InputType.INT_2_10_10_10 545 ]; 546 547 for (var inputTypeNdx = 0; inputTypeNdx < inputTypes.length; inputTypeNdx++) { 548 this.addChild( 549 new es3fVertexArrayTests.SingleVertexArrayNormalizeGroup( 550 inputTypes[inputTypeNdx] 551 ) 552 ); 553 } 554 }; 555 556 /** 557 * @constructor 558 * @extends {tcuTestCase.DeqpTest} 559 * @param {glsVertexArrayTests.deArray.InputType} type 560 */ 561 es3fVertexArrayTests.SingleVertexArrayOutputTypeGroup = function(type) { 562 tcuTestCase.DeqpTest.call( 563 this, 564 "single_attribute.output_types." + glsVertexArrayTests.deArray.inputTypeToString(type), 565 glsVertexArrayTests.deArray.inputTypeToString(type) 566 ); 567 this.makeExecutable(); 568 this.m_type = type; 569 }; 570 571 es3fVertexArrayTests.SingleVertexArrayOutputTypeGroup.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 572 es3fVertexArrayTests.SingleVertexArrayOutputTypeGroup.prototype.constructor = es3fVertexArrayTests.SingleVertexArrayOutputTypeGroup; 573 574 es3fVertexArrayTests.SingleVertexArrayOutputTypeGroup.prototype.init = function() { 575 var outputTypes = [ 576 glsVertexArrayTests.deArray.OutputType.VEC2, 577 glsVertexArrayTests.deArray.OutputType.VEC3, 578 glsVertexArrayTests.deArray.OutputType.VEC4, 579 glsVertexArrayTests.deArray.OutputType.IVEC2, 580 glsVertexArrayTests.deArray.OutputType.IVEC3, 581 glsVertexArrayTests.deArray.OutputType.IVEC4, 582 glsVertexArrayTests.deArray.OutputType.UVEC2, 583 glsVertexArrayTests.deArray.OutputType.UVEC3, 584 glsVertexArrayTests.deArray.OutputType.UVEC4 585 ]; 586 var storages = [glsVertexArrayTests.deArray.Storage.BUFFER]; //No USER storage support in WebGL2 587 var counts = [1, 256]; 588 589 for (var outputTypeNdx = 0; outputTypeNdx < outputTypes.length; outputTypeNdx++) { 590 for (var storageNdx = 0; storageNdx < storages.length; storageNdx++) { 591 for (var componentCount = 2; componentCount < 5; componentCount++) { 592 for (var countNdx = 0; countNdx < counts.length; countNdx++) { 593 var name = 'components' + componentCount + '_' + 594 glsVertexArrayTests.deArray.outputTypeToString( 595 outputTypes[outputTypeNdx] 596 ) + 597 '_quads' + counts[countNdx]; 598 599 var inputIsSignedInteger = 600 this.m_type == glsVertexArrayTests.deArray.InputType.INT || 601 this.m_type == glsVertexArrayTests.deArray.InputType.SHORT || 602 this.m_type == glsVertexArrayTests.deArray.InputType.BYTE; 603 604 var inputIsUnignedInteger = 605 this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_INT || 606 this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_SHORT || 607 this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_BYTE; 608 609 var outputIsSignedInteger = 610 outputTypes[outputTypeNdx] == glsVertexArrayTests.deArray.OutputType.IVEC2 || 611 outputTypes[outputTypeNdx] == glsVertexArrayTests.deArray.OutputType.IVEC3 || 612 outputTypes[outputTypeNdx] == glsVertexArrayTests.deArray.OutputType.IVEC4; 613 614 var outputIsUnsignedInteger = 615 outputTypes[outputTypeNdx] == glsVertexArrayTests.deArray.OutputType.UVEC2 || 616 outputTypes[outputTypeNdx] == glsVertexArrayTests.deArray.OutputType.UVEC3 || 617 outputTypes[outputTypeNdx] == glsVertexArrayTests.deArray.OutputType.UVEC4; 618 619 // If input type is float type and output type is int type skip 620 if ((this.m_type == glsVertexArrayTests.deArray.InputType.FLOAT || 621 this.m_type == glsVertexArrayTests.deArray.InputType.HALF) && 622 (outputTypes[outputTypeNdx] >= glsVertexArrayTests.deArray.OutputType.INT)) 623 continue; 624 625 if ((this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10 || 626 this.m_type == glsVertexArrayTests.deArray.InputType.INT_2_10_10_10) && 627 (outputTypes[outputTypeNdx] >= glsVertexArrayTests.deArray.OutputType.INT)) 628 continue; 629 630 if ((this.m_type == glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10 || 631 this.m_type == glsVertexArrayTests.deArray.InputType.INT_2_10_10_10) && 632 componentCount != 4) 633 continue; 634 635 // Loading signed data as unsigned causes undefined values and vice versa 636 if (inputIsSignedInteger && outputIsUnsignedInteger) 637 continue; 638 if (inputIsUnignedInteger && outputIsSignedInteger) 639 continue; 640 641 var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 642 this.m_type, 643 outputTypes[outputTypeNdx], 644 storages[storageNdx], 645 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 646 componentCount, 647 0, 648 0, 649 false, 650 glsVertexArrayTests.GLValue.getMinValue(this.m_type), 651 glsVertexArrayTests.GLValue.getMaxValue(this.m_type) 652 ); 653 654 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 655 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 656 spec.drawCount = counts[countNdx]; 657 spec.first = 0; 658 spec.arrays.push(arraySpec); 659 660 this.addChild( 661 new glsVertexArrayTests.MultiVertexArrayTest( 662 spec, name, name 663 ) 664 ); 665 } 666 } 667 } 668 } 669 }; 670 671 /** 672 * @constructor 673 * @extends {tcuTestCase.DeqpTest} 674 */ 675 es3fVertexArrayTests.MultiVertexArrayCountTests = function() { 676 tcuTestCase.DeqpTest.call(this, 'multiple_attributes.attribute_count', 'Attribute counts'); 677 this.makeExecutable(); 678 }; 679 680 es3fVertexArrayTests.MultiVertexArrayCountTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 681 es3fVertexArrayTests.MultiVertexArrayCountTests.prototype.constructor = es3fVertexArrayTests.MultiVertexArrayCountTests; 682 683 /** 684 * @param {glsVertexArrayTests.MultiVertexArrayTest.Spec} spec 685 * @return {string} 686 */ 687 es3fVertexArrayTests.MultiVertexArrayCountTests.prototype.getTestName = function(spec) { 688 var name = ''; 689 name += spec.arrays.length; 690 691 return name; 692 }; 693 694 es3fVertexArrayTests.MultiVertexArrayCountTests.prototype.init = function() { 695 // Test attribute counts 696 var arrayCounts = [2, 3, 4, 5, 6, 7, 8]; 697 698 for (var arrayCountNdx = 0; arrayCountNdx < arrayCounts.length; arrayCountNdx++) { 699 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 700 701 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 702 spec.drawCount = 256; 703 spec.first = 0; 704 705 for (var arrayNdx = 0; arrayNdx < arrayCounts[arrayCountNdx]; arrayNdx++) { 706 var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 707 glsVertexArrayTests.deArray.InputType.FLOAT, 708 glsVertexArrayTests.deArray.OutputType.VEC2, 709 glsVertexArrayTests.deArray.Storage.BUFFER, // No USER storage support in WebGL2 710 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 711 2, 712 0, 713 0, 714 false, 715 glsVertexArrayTests.GLValue.getMinValue(glsVertexArrayTests.deArray.InputType.FLOAT), 716 glsVertexArrayTests.GLValue.getMaxValue(glsVertexArrayTests.deArray.InputType.FLOAT) 717 ); 718 spec.arrays.push(arraySpec); 719 } 720 721 var name = this.getTestName(spec); 722 var desc = this.getTestName(spec); 723 724 this.addChild( 725 new glsVertexArrayTests.MultiVertexArrayTest( 726 spec, name, desc 727 ) 728 ); 729 } 730 }; 731 732 /** 733 * @constructor 734 * @extends {tcuTestCase.DeqpTest} 735 */ 736 es3fVertexArrayTests.MultiVertexArrayStorageTests = function() { 737 tcuTestCase.DeqpTest.call(this, 'multiple_attributes.storage', 'Attribute storages'); 738 this.makeExecutable(); 739 }; 740 741 es3fVertexArrayTests.MultiVertexArrayStorageTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 742 es3fVertexArrayTests.MultiVertexArrayStorageTests.prototype.constructor = es3fVertexArrayTests.MultiVertexArrayStorageTests; 743 744 /** 745 * @param {glsVertexArrayTests.MultiVertexArrayTest.Spec} spec 746 * @return {string} 747 */ 748 es3fVertexArrayTests.MultiVertexArrayStorageTests.prototype.getTestName = function(spec) { 749 var name = ''; 750 name += spec.arrays.length; 751 752 for (var arrayNdx = 0; arrayNdx < spec.arrays.length; arrayNdx++) 753 name += '_' + glsVertexArrayTests.deArray.storageToString(spec.arrays[arrayNdx].storage); 754 755 return name; 756 }; 757 758 /** 759 * @param {glsVertexArrayTests.MultiVertexArrayTest.Spec} spec 760 * @param {number} depth 761 */ 762 es3fVertexArrayTests.MultiVertexArrayStorageTests.prototype.addStorageCases = function(spec, depth) { 763 if (depth == 0) { 764 // Skip trivial case, used elsewhere 765 var ok = false; 766 for (var arrayNdx = 0; arrayNdx < spec.arrays.length; arrayNdx++) { 767 if (spec.arrays[arrayNdx].storage != glsVertexArrayTests.deArray.Storage.USER) { 768 ok = true; 769 break; 770 } 771 } 772 773 if (!ok) 774 return; 775 776 var name = this.getTestName(spec); 777 var desc = this.getTestName(spec); 778 779 this.addChild( 780 new glsVertexArrayTests.MultiVertexArrayTest( 781 spec, name, desc 782 ) 783 ); 784 return; 785 } 786 787 var storages = [ 788 //glsVertexArrayTests.deArray.Storage.USER, Not supported in WebGL 2.0 789 glsVertexArrayTests.deArray.Storage.BUFFER 790 ]; 791 792 for (var storageNdx = 0; storageNdx < storages.length; storageNdx++) { 793 var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 794 glsVertexArrayTests.deArray.InputType.FLOAT, 795 glsVertexArrayTests.deArray.OutputType.VEC2, 796 storages[storageNdx], 797 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 798 2, 799 0, 800 0, 801 false, 802 glsVertexArrayTests.GLValue.getMinValue(glsVertexArrayTests.deArray.InputType.FLOAT), 803 glsVertexArrayTests.GLValue.getMaxValue(glsVertexArrayTests.deArray.InputType.FLOAT) 804 ); 805 806 var _spec = spec; 807 _spec.arrays.push(arraySpec); 808 this.addStorageCases(_spec, depth - 1); 809 } 810 }; 811 812 /** 813 * init 814 */ 815 es3fVertexArrayTests.MultiVertexArrayStorageTests.prototype.init = function() { 816 // Test different storages 817 var arrayCounts = [3]; 818 819 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 820 821 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 822 spec.drawCount = 256; 823 spec.first = 0; 824 825 for (var arrayCountNdx = 0; arrayCountNdx < arrayCounts.length; arrayCountNdx++) 826 this.addStorageCases(spec, arrayCounts[arrayCountNdx]); 827 }; 828 829 /** 830 * @constructor 831 * @extends {tcuTestCase.DeqpTest} 832 */ 833 es3fVertexArrayTests.MultiVertexArrayStrideTests = function() { 834 tcuTestCase.DeqpTest.call(this, 'multiple_attributes.stride', 'Strides'); 835 this.makeExecutable(); 836 }; 837 838 es3fVertexArrayTests.MultiVertexArrayStrideTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 839 es3fVertexArrayTests.MultiVertexArrayStrideTests.prototype.constructor = es3fVertexArrayTests.MultiVertexArrayStrideTests; 840 841 /** 842 * @param {glsVertexArrayTests.MultiVertexArrayTest.Spec} spec 843 * @return {string} 844 */ 845 es3fVertexArrayTests.MultiVertexArrayStrideTests.prototype.getTestName = function(spec) { 846 var name = ''; 847 848 name += spec.arrays.length; 849 850 for (var arrayNdx = 0; arrayNdx < spec.arrays.length; arrayNdx++) { 851 name += '_' + 852 glsVertexArrayTests.deArray.inputTypeToString(spec.arrays[arrayNdx].inputType) + 853 spec.arrays[arrayNdx].componentCount + '_' + 854 spec.arrays[arrayNdx].stride; 855 } 856 857 return name; 858 }; 859 860 /** 861 * init 862 */ 863 es3fVertexArrayTests.MultiVertexArrayStrideTests.prototype.init = function() { 864 // Test different strides, with multiple arrays, input types?? 865 var arrayCounts = [3]; 866 867 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 868 869 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 870 spec.drawCount = 256; 871 spec.first = 0; 872 873 for (var arrayCountNdx = 0; arrayCountNdx < arrayCounts.length; arrayCountNdx++) 874 this.addStrideCases(spec, arrayCounts[arrayCountNdx]); 875 }; 876 877 /** 878 * @param {glsVertexArrayTests.MultiVertexArrayTest.Spec} spec 879 * @param {number} depth 880 */ 881 es3fVertexArrayTests.MultiVertexArrayStrideTests.prototype.addStrideCases = function(spec, depth) { 882 if (depth == 0) { 883 var name = this.getTestName(spec); 884 var desc = this.getTestName(spec); 885 this.addChild( 886 new glsVertexArrayTests.MultiVertexArrayTest( 887 spec, name, desc 888 ) 889 ); 890 return; 891 } 892 893 var strides = [0, -1, 17, 32]; 894 var inputType = glsVertexArrayTests.deArray.InputType.FLOAT; 895 896 for (var strideNdx = 0; strideNdx < strides.length; strideNdx++) { 897 var componentCount = 2; 898 var stride = strides[strideNdx] >= 0 ? strides[strideNdx] : componentCount * glsVertexArrayTests.deArray.inputTypeSize(glsVertexArrayTests.deArray.InputType.FLOAT); 899 var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 900 inputType, 901 glsVertexArrayTests.deArray.OutputType.VEC2, 902 glsVertexArrayTests.deArray.Storage.BUFFER, //USER storage not supported in WebGL 2.0 903 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 904 componentCount, 905 0, 906 stride, 907 false, 908 glsVertexArrayTests.GLValue.getMinValue(glsVertexArrayTests.deArray.InputType.FLOAT), 909 glsVertexArrayTests.GLValue.getMaxValue(glsVertexArrayTests.deArray.InputType.FLOAT) 910 ); 911 912 /** @type {boolean} */ var aligned = (stride % glsVertexArrayTests.deArray.inputTypeSize(inputType)) == 0; 913 if (aligned) { 914 var _spec = /** @type {glsVertexArrayTests.MultiVertexArrayTest.Spec} */ (deUtil.clone(spec)); //To assign spec by value; 915 _spec.arrays.push(arraySpec); 916 this.addStrideCases(_spec, depth - 1); 917 } 918 } 919 }; 920 921 /** 922 * @constructor 923 * @extends {tcuTestCase.DeqpTest} 924 */ 925 es3fVertexArrayTests.MultiVertexArrayOutputTests = function() { 926 tcuTestCase.DeqpTest.call(this, 'multiple_attributes.input_types', 'input types'); 927 this.makeExecutable(); 928 }; 929 930 es3fVertexArrayTests.MultiVertexArrayOutputTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 931 es3fVertexArrayTests.MultiVertexArrayOutputTests.prototype.constructor = es3fVertexArrayTests.MultiVertexArrayOutputTests; 932 933 /** 934 * @param {glsVertexArrayTests.MultiVertexArrayTest.Spec} spec 935 * @return {string} 936 */ 937 es3fVertexArrayTests.MultiVertexArrayOutputTests.prototype.getTestName = function(spec) { 938 var name = ''; 939 940 name += spec.arrays.length; 941 942 for (var arrayNdx = 0; arrayNdx < spec.arrays.length; arrayNdx++) { 943 name += '_' + 944 glsVertexArrayTests.deArray.inputTypeToString(spec.arrays[arrayNdx].inputType) + 945 spec.arrays[arrayNdx].componentCount + '_' + 946 glsVertexArrayTests.deArray.outputTypeToString(spec.arrays[arrayNdx].outputType); 947 } 948 949 return name; 950 }; 951 952 /** 953 * init 954 */ 955 es3fVertexArrayTests.MultiVertexArrayOutputTests.prototype.init = function() { 956 // Test different input types, with multiple arrays 957 var arrayCounts = [3]; 958 959 var spec = new glsVertexArrayTests.MultiVertexArrayTest.Spec(); 960 961 spec.primitive = glsVertexArrayTests.deArray.Primitive.TRIANGLES; 962 spec.drawCount = 256; 963 spec.first = 0; 964 965 for (var arrayCountNdx = 0; arrayCountNdx < arrayCounts.length; arrayCountNdx++) 966 this.addInputTypeCases(spec, arrayCounts[arrayCountNdx]); 967 }; 968 969 /** 970 * @param {glsVertexArrayTests.MultiVertexArrayTest.Spec} spec 971 * @param {number} depth 972 */ 973 es3fVertexArrayTests.MultiVertexArrayOutputTests.prototype.addInputTypeCases = function(spec, depth) { 974 if (depth == 0) { 975 var name = this.getTestName(spec); 976 var desc = this.getTestName(spec); 977 this.addChild( 978 new glsVertexArrayTests.MultiVertexArrayTest( 979 spec, name, desc 980 ) 981 ); 982 return; 983 } 984 985 var inputTypes = [ 986 glsVertexArrayTests.deArray.InputType.BYTE, 987 glsVertexArrayTests.deArray.InputType.SHORT, 988 glsVertexArrayTests.deArray.InputType.UNSIGNED_BYTE, 989 glsVertexArrayTests.deArray.InputType.UNSIGNED_SHORT 990 ]; 991 992 for (var inputTypeNdx = 0; inputTypeNdx < inputTypes.length; inputTypeNdx++) { 993 var arraySpec = new glsVertexArrayTests.MultiVertexArrayTest.Spec.ArraySpec( 994 inputTypes[inputTypeNdx], 995 glsVertexArrayTests.deArray.OutputType.VEC2, 996 glsVertexArrayTests.deArray.Storage.BUFFER, //USER storage not supported in WebGL 2.0 997 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 998 2, 999 0, 1000 0, 1001 false, 1002 glsVertexArrayTests.GLValue.getMinValue(inputTypes[inputTypeNdx]), 1003 glsVertexArrayTests.GLValue.getMaxValue(inputTypes[inputTypeNdx]) 1004 ); 1005 1006 var _spec = /** @type {glsVertexArrayTests.MultiVertexArrayTest.Spec} */ (deUtil.clone(spec)); 1007 _spec.arrays.push(arraySpec); 1008 this.addInputTypeCases(_spec, depth - 1); 1009 } 1010 }; 1011 1012 /** 1013 * es3fVertexArrayTests.VertexArrayTestGroup 1014 * @constructor 1015 * @extends {tcuTestCase.DeqpTest} 1016 */ 1017 es3fVertexArrayTests.VertexArrayTestGroup = function() { 1018 tcuTestCase.DeqpTest.call(this, 'vertex_arrays', 'Vertex array and array tests'); 1019 this.makeExecutable(); 1020 }; 1021 1022 es3fVertexArrayTests.VertexArrayTestGroup.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 1023 es3fVertexArrayTests.VertexArrayTestGroup.prototype.constructor = es3fVertexArrayTests.VertexArrayTestGroup; 1024 1025 /** 1026 * init 1027 */ 1028 es3fVertexArrayTests.VertexArrayTestGroup.prototype.init = function() { 1029 this.addChild(new es3fVertexArrayTests.SingleVertexArrayStrideTests()); 1030 this.addChild(new es3fVertexArrayTests.SingleVertexArrayNormalizeTests()); 1031 1032 // Test output types with different input types, component counts and storage, Usage?, Precision?, float? 1033 var inputTypes = [ 1034 glsVertexArrayTests.deArray.InputType.FLOAT, 1035 glsVertexArrayTests.deArray.InputType.SHORT, 1036 glsVertexArrayTests.deArray.InputType.BYTE, 1037 glsVertexArrayTests.deArray.InputType.UNSIGNED_SHORT, 1038 glsVertexArrayTests.deArray.InputType.UNSIGNED_BYTE, 1039 glsVertexArrayTests.deArray.InputType.UNSIGNED_INT, 1040 glsVertexArrayTests.deArray.InputType.INT, 1041 glsVertexArrayTests.deArray.InputType.HALF, 1042 glsVertexArrayTests.deArray.InputType.UNSIGNED_INT_2_10_10_10, 1043 glsVertexArrayTests.deArray.InputType.INT_2_10_10_10 1044 ]; 1045 for (var inputTypeNdx = 0; inputTypeNdx < inputTypes.length; inputTypeNdx++) { 1046 this.addChild(new es3fVertexArrayTests.SingleVertexArrayOutputTypeGroup(inputTypes[inputTypeNdx])); 1047 } 1048 1049 /** @type {Array<glsVertexArrayTests.deArray.Usage>} */ var usages = [ 1050 glsVertexArrayTests.deArray.Usage.STATIC_DRAW, 1051 glsVertexArrayTests.deArray.Usage.STREAM_DRAW, 1052 glsVertexArrayTests.deArray.Usage.DYNAMIC_DRAW, 1053 glsVertexArrayTests.deArray.Usage.STATIC_COPY, 1054 glsVertexArrayTests.deArray.Usage.STREAM_COPY, 1055 glsVertexArrayTests.deArray.Usage.DYNAMIC_COPY, 1056 glsVertexArrayTests.deArray.Usage.STATIC_READ, 1057 glsVertexArrayTests.deArray.Usage.STREAM_READ, 1058 glsVertexArrayTests.deArray.Usage.DYNAMIC_READ 1059 ]; 1060 for (var usageNdx = 0; usageNdx < usages.length; usageNdx++) { 1061 this.addChild(new es3fVertexArrayTests.SingleVertexArrayUsageGroup(usages[usageNdx])); 1062 } 1063 1064 this.addChild(new es3fVertexArrayTests.SingleVertexArrayOffsetTests()); 1065 this.addChild(new es3fVertexArrayTests.SingleVertexArrayFirstTests()); 1066 1067 this.addChild(new es3fVertexArrayTests.MultiVertexArrayCountTests()); 1068 this.addChild(new es3fVertexArrayTests.MultiVertexArrayStorageTests()); 1069 this.addChild(new es3fVertexArrayTests.MultiVertexArrayStrideTests()); 1070 this.addChild(new es3fVertexArrayTests.MultiVertexArrayOutputTests()); 1071 }; 1072 1073 /** 1074 * Create and execute the test cases 1075 * @param {WebGL2RenderingContext} context 1076 */ 1077 es3fVertexArrayTests.run = function(context, range) { 1078 gl = context; 1079 //Set up root Test 1080 var state = tcuTestCase.runner; 1081 1082 var test = new es3fVertexArrayTests.VertexArrayTestGroup(); 1083 var testName = test.fullName(); 1084 var testDescription = test.getDescription(); 1085 state.testCases = test; 1086 state.testName = testName; 1087 1088 //Set up name and description of this test series. 1089 setCurrentTestName(testName); 1090 description(testDescription); 1091 1092 try { 1093 if (range) 1094 state.setRange(range); 1095 //Run test cases 1096 tcuTestCase.runTestCases(); 1097 } catch (err) { 1098 testFailedOptions('Failed to es3fVertexArrayTests.run tests', false); 1099 tcuTestCase.runner.terminate(); 1100 } 1101 }; 1102 1103 });