es3fIntegerStateQueryTests.js (112272B)
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.es3fIntegerStateQueryTests'); 23 goog.require('framework.common.tcuTestCase'); 24 goog.require('framework.delibs.debase.deRandom'); 25 goog.require('framework.opengl.gluTextureUtil'); 26 goog.require('functional.gles3.es3fApiCase'); 27 goog.require('modules.shared.glsStateQuery'); 28 29 goog.scope(function() { 30 var es3fIntegerStateQueryTests = functional.gles3.es3fIntegerStateQueryTests; 31 var tcuTestCase = framework.common.tcuTestCase; 32 var deRandom = framework.delibs.debase.deRandom; 33 var es3fApiCase = functional.gles3.es3fApiCase; 34 var glsStateQuery = modules.shared.glsStateQuery; 35 36 /** @type {string} */ var transformFeedbackTestVertSource = '' + 37 '#version 300 es\n' + 38 'void main (void)\n' + 39 '{\n' + 40 ' gl_Position = vec4(0.0);\n' + 41 '}\n'; 42 43 /** @type {string} */ var transformFeedbackTestFragSource = '' + 44 '#version 300 es\n' + 45 'layout(location = 0) out mediump vec4 fragColor;' + 46 'void main (void)\n' + 47 '{\n' + 48 ' fragColor = vec4(0.0);\n' + 49 '}\n'; 50 51 /** @type {string} */ var testVertSource = '' + 52 '#version 300 es\n' + 53 'void main (void)\n' + 54 '{\n' + 55 ' gl_Position = vec4(0.0);\n' + 56 '}\n'; 57 58 /** @type {string} */ var testFragSource = '' + 59 '#version 300 es\n' + 60 'layout(location = 0) out mediump vec4 fragColor;' + 61 'void main (void)\n' + 62 '{\n' + 63 ' fragColor = vec4(0.0);\n' + 64 '}\n'; 65 66 /** 67 * @constructor 68 * @extends {es3fApiCase.ApiCase} 69 * @param {string} name 70 * @param {string} description 71 */ 72 es3fIntegerStateQueryTests.TransformFeedbackTestCase = function(name, description) { 73 es3fApiCase.ApiCase.call(this, name, description, gl); 74 /** @type {WebGLTransformFeedback} */ this.m_transformfeedback; 75 }; 76 77 es3fIntegerStateQueryTests.TransformFeedbackTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 78 es3fIntegerStateQueryTests.TransformFeedbackTestCase.prototype.constructor = es3fIntegerStateQueryTests.TransformFeedbackTestCase; 79 80 es3fIntegerStateQueryTests.TransformFeedbackTestCase.prototype.testTransformFeedback = function() { 81 throw new Error('This method should be implemented by child classes.'); 82 }; 83 84 es3fIntegerStateQueryTests.TransformFeedbackTestCase.prototype.test = function() { 85 this.beforeTransformFeedbackTest(); // [dag] added this as there is no other way this method would be called. 86 87 this.m_transformfeedback = gl.createTransformFeedback(); 88 89 /** @type {WebGLShader} */ var shaderVert = gl.createShader(gl.VERTEX_SHADER); 90 gl.shaderSource(shaderVert, transformFeedbackTestVertSource); 91 gl.compileShader(shaderVert); 92 93 var compileStatus = /** @type {boolean} */ (gl.getShaderParameter(shaderVert, gl.COMPILE_STATUS)); 94 glsStateQuery.compare(compileStatus, true); 95 96 /** @type {WebGLShader} */ var shaderFrag = gl.createShader(gl.FRAGMENT_SHADER); 97 gl.shaderSource(shaderFrag, transformFeedbackTestFragSource); 98 gl.compileShader(shaderFrag); 99 100 compileStatus = /** @type {boolean} */ (gl.getShaderParameter(shaderFrag, gl.COMPILE_STATUS)); 101 glsStateQuery.compare(compileStatus, true); 102 103 /** @type {WebGLProgram} */ var shaderProg = gl.createProgram(); 104 gl.attachShader(shaderProg, shaderVert); 105 gl.attachShader(shaderProg, shaderFrag); 106 /** @type {Array<string>} */ var transform_feedback_outputs = ['gl_Position']; 107 gl.transformFeedbackVaryings(shaderProg, transform_feedback_outputs, gl.INTERLEAVED_ATTRIBS); 108 gl.linkProgram(shaderProg); 109 110 var linkStatus = /** @type {boolean} */ (gl.getProgramParameter(shaderProg, gl.LINK_STATUS)); 111 glsStateQuery.compare(linkStatus, true); 112 113 gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, this.m_transformfeedback); 114 115 116 /** @type {WebGLBuffer} */ var feedbackBufferId = gl.createBuffer(); 117 gl.bindBuffer(gl.TRANSFORM_FEEDBACK_BUFFER, feedbackBufferId); 118 gl.bufferData(gl.TRANSFORM_FEEDBACK_BUFFER, new Float32Array(16), gl.DYNAMIC_READ); 119 gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, 0, feedbackBufferId); 120 121 gl.useProgram(shaderProg); 122 123 this.testTransformFeedback(); 124 125 gl.useProgram(null); 126 gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null); 127 gl.deleteTransformFeedback(this.m_transformfeedback); 128 gl.deleteBuffer(feedbackBufferId); 129 gl.deleteShader(shaderVert); 130 gl.deleteShader(shaderFrag); 131 gl.deleteProgram(shaderProg); 132 133 this.afterTransformFeedbackTest(); // [dag] added this as there is no other way this method would be called. 134 }; 135 136 /** 137 * @constructor 138 * @extends {es3fIntegerStateQueryTests.TransformFeedbackTestCase} 139 * @param {string} name 140 */ 141 es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase = function(name) { 142 es3fIntegerStateQueryTests.TransformFeedbackTestCase.call(this, name, 'GL_TRANSFORM_FEEDBACK_BINDING'); 143 }; 144 145 es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase.prototype = Object.create(es3fIntegerStateQueryTests.TransformFeedbackTestCase.prototype); 146 es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase; 147 148 149 es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase.prototype.beforeTransformFeedbackTest = function() { 150 this.check(glsStateQuery.verify(gl.TRANSFORM_FEEDBACK_BINDING, null), 'beforeTransformFeedbackTest'); 151 }; 152 153 es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase.prototype.testTransformFeedback = function() { 154 this.check(glsStateQuery.verify(gl.TRANSFORM_FEEDBACK_BINDING, this.m_transformfeedback), 'testTransformFeedback'); 155 }; 156 157 es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase.prototype.afterTransformFeedbackTest = function() { 158 this.check(glsStateQuery.verify(gl.TRANSFORM_FEEDBACK_BINDING, null), 'afterTransformFeedbackTest'); 159 }; 160 161 /** 162 * @constructor 163 * @extends {es3fApiCase.ApiCase} 164 * @param {string} name 165 * @param {string} description 166 * @param {number} targetName 167 * @param {number} minValue 168 */ 169 es3fIntegerStateQueryTests.ConstantMinimumValueTestCase = function(name, description, targetName, minValue) { 170 es3fApiCase.ApiCase.call(this, name, description, gl); 171 /** @type {number} */ this.m_targetName = targetName; 172 /** @type {number} */ this.m_minValue = minValue; 173 }; 174 175 es3fIntegerStateQueryTests.ConstantMinimumValueTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 176 es3fIntegerStateQueryTests.ConstantMinimumValueTestCase.prototype.constructor = es3fIntegerStateQueryTests.ConstantMinimumValueTestCase; 177 178 es3fIntegerStateQueryTests.ConstantMinimumValueTestCase.prototype.test = function() { 179 this.check(glsStateQuery.verifyGreaterOrEqual(this.m_targetName, this.m_minValue), 'Fail'); 180 }; 181 182 /** 183 * @constructor 184 * @extends {es3fApiCase.ApiCase} 185 * @param {string} name 186 * @param {string} description 187 * @param {number} targetName 188 * @param {number} minValue 189 */ 190 es3fIntegerStateQueryTests.ConstantMaximumValueTestCase = function(name, description, targetName, minValue) { 191 es3fApiCase.ApiCase.call(this, name, description, gl); 192 /** @type {number} */ this.m_targetName = targetName; 193 /** @type {number} */ this.m_minValue = minValue; 194 }; 195 196 es3fIntegerStateQueryTests.ConstantMaximumValueTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 197 es3fIntegerStateQueryTests.ConstantMaximumValueTestCase.prototype.constructor = es3fIntegerStateQueryTests.ConstantMaximumValueTestCase; 198 199 es3fIntegerStateQueryTests.ConstantMaximumValueTestCase.prototype.test = function() { 200 this.check(glsStateQuery.verifyLessOrEqual(this.m_targetName, this.m_minValue), 'Fail'); 201 }; 202 203 /** 204 * @constructor 205 * @extends {es3fApiCase.ApiCase} 206 * @param {string} name 207 * @param {string} description 208 */ 209 es3fIntegerStateQueryTests.SampleBuffersTestCase = function(name, description) { 210 es3fApiCase.ApiCase.call(this, name, description, gl); 211 }; 212 213 es3fIntegerStateQueryTests.SampleBuffersTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 214 es3fIntegerStateQueryTests.SampleBuffersTestCase.prototype.constructor = es3fIntegerStateQueryTests.SampleBuffersTestCase; 215 216 es3fIntegerStateQueryTests.SampleBuffersTestCase.prototype.test = function() { 217 /** @type {number} */ var expectedSampleBuffers = (/** @type {number} */ (gl.getParameter(gl.SAMPLES)) > 1) ? 1 : 0; 218 219 bufferedLogToConsole('Sample count is ' + expectedSampleBuffers + ', expecting GL_SAMPLE_BUFFERS to be ' + expectedSampleBuffers); 220 221 this.check(glsStateQuery.verify(gl.SAMPLE_BUFFERS, expectedSampleBuffers)); 222 }; 223 224 /** 225 * @constructor 226 * @extends {es3fApiCase.ApiCase} 227 * @param {string} name 228 * @param {string} description 229 */ 230 es3fIntegerStateQueryTests.SamplesTestCase = function(name, description) { 231 es3fApiCase.ApiCase.call(this, name, description, gl); 232 }; 233 234 es3fIntegerStateQueryTests.SamplesTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 235 es3fIntegerStateQueryTests.SamplesTestCase.prototype.constructor = es3fIntegerStateQueryTests.SamplesTestCase; 236 237 es3fIntegerStateQueryTests.SamplesTestCase.prototype.test = function() { 238 var numSamples = /** @type {number} */ (gl.getParameter(gl.SAMPLES)); 239 // MSAA? 240 if (numSamples > 1) { 241 bufferedLogToConsole('Sample count is ' + numSamples); 242 243 this.check(glsStateQuery.verify(gl.SAMPLES, numSamples)); 244 } else { 245 /** @type {Array<number>} */ var validSamples = [0, 1]; 246 247 bufferedLogToConsole('Expecting GL_SAMPLES to be 0 or 1'); 248 249 this.check(glsStateQuery.verifyAnyOf(gl.SAMPLES, validSamples)); 250 } 251 }; 252 253 /** 254 * @constructor 255 * @extends {es3fApiCase.ApiCase} 256 * @param {string} name 257 * @param {string} description 258 * @param {number} targetName 259 */ 260 es3fIntegerStateQueryTests.HintTestCase = function(name, description, targetName) { 261 es3fApiCase.ApiCase.call(this, name, description, gl); 262 /** @type {number} */ this.m_targetName = targetName; 263 }; 264 265 es3fIntegerStateQueryTests.HintTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 266 es3fIntegerStateQueryTests.HintTestCase.prototype.constructor = es3fIntegerStateQueryTests.HintTestCase; 267 268 es3fIntegerStateQueryTests.HintTestCase.prototype.test = function() { 269 this.check(glsStateQuery.verify(this.m_targetName, gl.DONT_CARE)); 270 271 gl.hint(this.m_targetName, gl.NICEST); 272 this.check(glsStateQuery.verify(this.m_targetName, gl.NICEST)); 273 274 gl.hint(this.m_targetName, gl.FASTEST); 275 this.check(glsStateQuery.verify(this.m_targetName, gl.FASTEST)); 276 277 gl.hint(this.m_targetName, gl.DONT_CARE); 278 this.check(glsStateQuery.verify(this.m_targetName, gl.DONT_CARE)); 279 }; 280 281 /** 282 * @constructor 283 * @extends {es3fApiCase.ApiCase} 284 * @param {string} name 285 * @param {string} description 286 */ 287 es3fIntegerStateQueryTests.DepthFuncTestCase = function(name, description) { 288 es3fApiCase.ApiCase.call(this, name, description, gl); 289 }; 290 291 es3fIntegerStateQueryTests.DepthFuncTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 292 es3fIntegerStateQueryTests.DepthFuncTestCase.prototype.constructor = es3fIntegerStateQueryTests.DepthFuncTestCase; 293 294 es3fIntegerStateQueryTests.DepthFuncTestCase.prototype.test = function() { 295 this.check(glsStateQuery.verify(gl.DEPTH_FUNC, gl.LESS)); 296 297 /** @type {Array<number>} */ var depthFunctions = [gl.NEVER, gl.ALWAYS, gl.LESS, gl.LEQUAL, gl.EQUAL, gl.GREATER, gl.GEQUAL, gl.NOTEQUAL]; 298 for (var ndx = 0; ndx < depthFunctions.length; ndx++) { 299 gl.depthFunc(depthFunctions[ndx]); 300 301 this.check(glsStateQuery.verify(gl.DEPTH_FUNC, depthFunctions[ndx])); 302 } 303 }; 304 305 /** 306 * @constructor 307 * @extends {es3fApiCase.ApiCase} 308 * @param {string} name 309 * @param {string} description 310 */ 311 es3fIntegerStateQueryTests.CullFaceTestCase = function(name, description) { 312 es3fApiCase.ApiCase.call(this, name, description, gl); 313 }; 314 315 es3fIntegerStateQueryTests.CullFaceTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 316 es3fIntegerStateQueryTests.CullFaceTestCase.prototype.constructor = es3fIntegerStateQueryTests.CullFaceTestCase; 317 318 es3fIntegerStateQueryTests.CullFaceTestCase.prototype.test = function() { 319 this.check(glsStateQuery.verify(gl.CULL_FACE_MODE, gl.BACK)); 320 321 /** @type {Array<number>} */ var cullFaces = [gl.FRONT, gl.BACK, gl.FRONT_AND_BACK]; 322 for (var ndx = 0; ndx < cullFaces.length; ndx++) { 323 gl.cullFace(cullFaces[ndx]); 324 325 this.check(glsStateQuery.verify(gl.CULL_FACE_MODE, cullFaces[ndx])); 326 } 327 }; 328 329 /** 330 * @constructor 331 * @extends {es3fApiCase.ApiCase} 332 * @param {string} name 333 * @param {string} description 334 */ 335 es3fIntegerStateQueryTests.FrontFaceTestCase = function(name, description) { 336 es3fApiCase.ApiCase.call(this, name, description, gl); 337 }; 338 339 es3fIntegerStateQueryTests.FrontFaceTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 340 es3fIntegerStateQueryTests.FrontFaceTestCase.prototype.constructor = es3fIntegerStateQueryTests.FrontFaceTestCase; 341 342 es3fIntegerStateQueryTests.FrontFaceTestCase.prototype.test = function() { 343 this.check(glsStateQuery.verify(gl.FRONT_FACE, gl.CCW)); 344 345 /** @type {Array<number>} */ var frontFaces = [gl.CW, gl.CCW]; 346 for (var ndx = 0; ndx < frontFaces.length; ndx++) { 347 gl.frontFace(frontFaces[ndx]); 348 349 this.check(glsStateQuery.verify(gl.FRONT_FACE, frontFaces[ndx])); 350 } 351 }; 352 353 /** 354 * @constructor 355 * @extends {es3fApiCase.ApiCase} 356 * @param {string} name 357 * @param {string} description 358 */ 359 es3fIntegerStateQueryTests.ViewPortTestCase = function(name, description) { 360 es3fApiCase.ApiCase.call(this, name, description, gl); 361 }; 362 363 es3fIntegerStateQueryTests.ViewPortTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 364 es3fIntegerStateQueryTests.ViewPortTestCase.prototype.constructor = es3fIntegerStateQueryTests.ViewPortTestCase; 365 366 es3fIntegerStateQueryTests.ViewPortTestCase.prototype.test = function() { 367 /** @type {deRandom.Random} */ var rnd = new deRandom.Random(0xabcdef); 368 369 var maxViewportDimensions = /** @type {Array<number>} */ (gl.getParameter(gl.MAX_VIEWPORT_DIMS)); 370 371 // verify initial value of first two values 372 this.check(glsStateQuery.verify(gl.VIEWPORT, new Int32Array([0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight]))); 373 374 /** @type {number} */ var numIterations = 120; 375 for (var i = 0; i < numIterations; ++i) { 376 /** @type {number} */ var x = rnd.getInt(-64000, 64000); 377 /** @type {number} */ var y = rnd.getInt(-64000, 64000); 378 /** @type {number} */ var width = rnd.getInt(0, maxViewportDimensions[0]); 379 /** @type {number} */ var height = rnd.getInt(0, maxViewportDimensions[1]); 380 381 gl.viewport(x, y, width, height); 382 this.check(glsStateQuery.verify(gl.VIEWPORT, new Int32Array([x, y, width, height]))); 383 } 384 }; 385 386 /** 387 * @constructor 388 * @extends {es3fApiCase.ApiCase} 389 * @param {string} name 390 * @param {string} description 391 */ 392 es3fIntegerStateQueryTests.ScissorBoxTestCase = function(name, description) { 393 es3fApiCase.ApiCase.call(this, name, description, gl); 394 }; 395 396 es3fIntegerStateQueryTests.ScissorBoxTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 397 es3fIntegerStateQueryTests.ScissorBoxTestCase.prototype.constructor = es3fIntegerStateQueryTests.ScissorBoxTestCase; 398 399 es3fIntegerStateQueryTests.ScissorBoxTestCase.prototype.test = function() { 400 /** @type {deRandom.Random} */ var rnd = new deRandom.Random(0xabcdef); 401 402 // verify initial value of first two values 403 this.check(glsStateQuery.verifyMask(gl.SCISSOR_BOX, [0, 0, 0, 0], [true, true, false, false])); 404 405 /** @type {number} */ var numIterations = 120; 406 for (var i = 0; i < numIterations; ++i) { 407 /** @type {number} */ var left = rnd.getInt(-64000, 64000); 408 /** @type {number} */ var bottom = rnd.getInt(-64000, 64000); 409 /** @type {number} */ var width = rnd.getInt(0, 64000); 410 /** @type {number} */ var height = rnd.getInt(0, 64000); 411 412 gl.scissor(left, bottom, width, height); 413 this.check(glsStateQuery.verify(gl.SCISSOR_BOX, new Int32Array([left, bottom, width, height]))); 414 } 415 }; 416 417 /** 418 * @constructor 419 * @extends {es3fApiCase.ApiCase} 420 * @param {string} name 421 * @param {string} description 422 */ 423 es3fIntegerStateQueryTests.MaxViewportDimsTestCase = function(name, description) { 424 es3fApiCase.ApiCase.call(this, name, description, gl); 425 }; 426 427 es3fIntegerStateQueryTests.MaxViewportDimsTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 428 es3fIntegerStateQueryTests.MaxViewportDimsTestCase.prototype.constructor = es3fIntegerStateQueryTests.MaxViewportDimsTestCase; 429 430 es3fIntegerStateQueryTests.MaxViewportDimsTestCase.prototype.test = function() { 431 this.check(glsStateQuery.verifyGreaterOrEqual(gl.MAX_VIEWPORT_DIMS, [gl.drawingBufferWidth, gl.drawingBufferHeight])); 432 }; 433 434 /** 435 * @constructor 436 * @extends {es3fApiCase.ApiCase} 437 * @param {string} name 438 * @param {string} description 439 * @param {number} testTargetName 440 */ 441 es3fIntegerStateQueryTests.StencilRefTestCase = function(name, description, testTargetName) { 442 es3fApiCase.ApiCase.call(this, name, description, gl); 443 /** @type {number} */ this.m_testTargetName = testTargetName; 444 }; 445 446 es3fIntegerStateQueryTests.StencilRefTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 447 es3fIntegerStateQueryTests.StencilRefTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilRefTestCase; 448 449 es3fIntegerStateQueryTests.StencilRefTestCase.prototype.test = function() { 450 this.check(glsStateQuery.verify(this.m_testTargetName, 0)); 451 452 var stencilBits = /** @type {number} */ (gl.getParameter(gl.STENCIL_BITS)); 453 454 for (var stencilBit = 0; stencilBit < stencilBits; ++stencilBit) { 455 /** @type {number} */ var ref = 1 << stencilBit; 456 457 gl.stencilFunc(gl.ALWAYS, ref, 0); // mask should not affect the REF 458 459 this.check(glsStateQuery.verify(this.m_testTargetName, ref)); 460 461 gl.stencilFunc(gl.ALWAYS, ref, ref); 462 463 this.check(glsStateQuery.verify(this.m_testTargetName, ref)); 464 } 465 }; 466 467 /** 468 * @constructor 469 * @extends {es3fApiCase.ApiCase} 470 * @param {string} name 471 * @param {string} description 472 * @param {number} testTargetName 473 * @param {number} stencilFuncTargetFace 474 */ 475 es3fIntegerStateQueryTests.StencilRefSeparateTestCase = function(name, description, testTargetName, stencilFuncTargetFace) { 476 es3fApiCase.ApiCase.call(this, name, description, gl); 477 /** @type {number} */ this.m_testTargetName = testTargetName; 478 /** @type {number} */ this.m_stencilFuncTargetFace = stencilFuncTargetFace; 479 }; 480 481 es3fIntegerStateQueryTests.StencilRefSeparateTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 482 es3fIntegerStateQueryTests.StencilRefSeparateTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilRefSeparateTestCase; 483 484 es3fIntegerStateQueryTests.StencilRefSeparateTestCase.prototype.test = function() { 485 this.check(glsStateQuery.verify(this.m_testTargetName, 0)); 486 487 var stencilBits = /** @type {number} */ (gl.getParameter(gl.STENCIL_BITS)); 488 489 for (var stencilBit = 0; stencilBit < stencilBits; ++stencilBit) { 490 /** @type {number} */ var ref = 1 << stencilBit; 491 492 gl.stencilFuncSeparate(this.m_stencilFuncTargetFace, gl.ALWAYS, ref, 0); 493 494 this.check(glsStateQuery.verify(this.m_testTargetName, ref)); 495 496 gl.stencilFuncSeparate(this.m_stencilFuncTargetFace, gl.ALWAYS, ref, ref); 497 498 this.check(glsStateQuery.verify(this.m_testTargetName, ref)); 499 } 500 }; 501 502 /** 503 * @constructor 504 * @extends {es3fApiCase.ApiCase} 505 * @param {string} name 506 * @param {string} description 507 * @param {number} stencilOpName 508 */ 509 es3fIntegerStateQueryTests.StencilOpTestCase = function(name, description, stencilOpName) { 510 es3fApiCase.ApiCase.call(this, name, description, gl); 511 /** @type {number} */ this.m_stencilOpName = stencilOpName; 512 }; 513 514 es3fIntegerStateQueryTests.StencilOpTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 515 es3fIntegerStateQueryTests.StencilOpTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilOpTestCase; 516 517 es3fIntegerStateQueryTests.StencilOpTestCase.prototype.test = function() { 518 this.check(glsStateQuery.verify(this.m_stencilOpName, gl.KEEP)); 519 520 /** @type {Array<number>} */ var stencilOpValues = [gl.KEEP, gl.ZERO, gl.REPLACE, gl.INCR, gl.DECR, gl.INVERT, gl.INCR_WRAP, gl.DECR_WRAP]; 521 for (var ndx = 0; ndx < stencilOpValues.length; ++ndx) { 522 this.setStencilOp(stencilOpValues[ndx]); 523 524 this.check(glsStateQuery.verify(this.m_stencilOpName, stencilOpValues[ndx])); 525 } 526 }; 527 528 es3fIntegerStateQueryTests.StencilOpTestCase.prototype.deinit = function() { 529 // [dag] need to reset everything once the test is done, otherwise related tests fail 530 gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); 531 }; 532 533 /** 534 * @param {number} stencilOpValue 535 */ 536 es3fIntegerStateQueryTests.StencilOpTestCase.prototype.setStencilOp = function(stencilOpValue) { 537 switch (this.m_stencilOpName) { 538 case gl.STENCIL_FAIL: 539 case gl.STENCIL_BACK_FAIL: 540 gl.stencilOp(stencilOpValue, gl.KEEP, gl.KEEP); 541 break; 542 543 case gl.STENCIL_PASS_DEPTH_FAIL: 544 case gl.STENCIL_BACK_PASS_DEPTH_FAIL: 545 gl.stencilOp(gl.KEEP, stencilOpValue, gl.KEEP); 546 break; 547 548 case gl.STENCIL_PASS_DEPTH_PASS: 549 case gl.STENCIL_BACK_PASS_DEPTH_PASS: 550 gl.stencilOp(gl.KEEP, gl.KEEP, stencilOpValue); 551 break; 552 553 default: 554 throw new Error('should not happen'); 555 } 556 }; 557 558 /** 559 * @constructor 560 * @extends {es3fIntegerStateQueryTests.StencilOpTestCase} 561 * @param {string} name 562 * @param {string} description 563 * @param {number} stencilOpName 564 * @param {number} stencilOpFace 565 */ 566 es3fIntegerStateQueryTests.StencilOpSeparateTestCase = function(name, description, stencilOpName, stencilOpFace) { 567 es3fIntegerStateQueryTests.StencilOpTestCase.call(this, name, description, stencilOpName); 568 /** @type {number} */ this.m_stencilOpName = stencilOpName; 569 /** @type {number} */ this.m_stencilOpFace = stencilOpFace; 570 }; 571 572 es3fIntegerStateQueryTests.StencilOpSeparateTestCase.prototype = Object.create(es3fIntegerStateQueryTests.StencilOpTestCase.prototype); 573 es3fIntegerStateQueryTests.StencilOpSeparateTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilOpSeparateTestCase; 574 575 es3fIntegerStateQueryTests.StencilOpSeparateTestCase.prototype.test = function() {}; 576 577 /** 578 * @param {number} stencilOpValue 579 */ 580 es3fIntegerStateQueryTests.StencilOpSeparateTestCase.prototype.setStencilOp = function(stencilOpValue) { 581 switch (this.m_stencilOpName) { 582 case gl.STENCIL_FAIL: 583 case gl.STENCIL_BACK_FAIL: 584 gl.stencilOpSeparate(this.m_stencilOpFace, stencilOpValue, gl.KEEP, gl.KEEP); 585 break; 586 587 case gl.STENCIL_PASS_DEPTH_FAIL: 588 case gl.STENCIL_BACK_PASS_DEPTH_FAIL: 589 gl.stencilOpSeparate(this.m_stencilOpFace, gl.KEEP, stencilOpValue, gl.KEEP); 590 break; 591 592 case gl.STENCIL_PASS_DEPTH_PASS: 593 case gl.STENCIL_BACK_PASS_DEPTH_PASS: 594 gl.stencilOpSeparate(this.m_stencilOpFace, gl.KEEP, gl.KEEP, stencilOpValue); 595 break; 596 597 default: 598 throw new Error('should not happen'); 599 } 600 }; 601 602 /** 603 * @constructor 604 * @extends {es3fApiCase.ApiCase} 605 * @param {string} name 606 * @param {string} description 607 */ 608 es3fIntegerStateQueryTests.StencilFuncTestCase = function(name, description) { 609 es3fApiCase.ApiCase.call(this, name, description, gl); 610 }; 611 612 es3fIntegerStateQueryTests.StencilFuncTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 613 es3fIntegerStateQueryTests.StencilFuncTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilFuncTestCase; 614 615 es3fIntegerStateQueryTests.StencilFuncTestCase.prototype.test = function() { 616 this.check(glsStateQuery.verify(gl.STENCIL_FUNC, gl.ALWAYS)); 617 618 /** @type {Array<number>} */ var stencilfuncValues = [gl.NEVER, gl.ALWAYS, gl.LESS, gl.LEQUAL, gl.EQUAL, gl.GEQUAL, gl.GREATER, gl.NOTEQUAL]; 619 620 for (var ndx = 0; ndx < stencilfuncValues.length; ++ndx) { 621 gl.stencilFunc(stencilfuncValues[ndx], 0, 0); 622 623 this.check(glsStateQuery.verify(gl.STENCIL_FUNC, stencilfuncValues[ndx])); 624 625 this.check(glsStateQuery.verify(gl.STENCIL_BACK_FUNC, stencilfuncValues[ndx])); 626 } 627 }; 628 629 es3fIntegerStateQueryTests.StencilFuncTestCase.prototype.deinit = function() { 630 // [dag] reset stencilFunc to ALWAYS 631 gl.stencilFunc(gl.ALWAYS, 0, 0); 632 }; 633 634 /** 635 * @constructor 636 * @extends {es3fApiCase.ApiCase} 637 * @param {string} name 638 * @param {string} description 639 * @param {number} stencilFuncName 640 * @param {number} stencilFuncFace 641 */ 642 es3fIntegerStateQueryTests.StencilFuncSeparateTestCase = function(name, description, stencilFuncName, stencilFuncFace) { 643 es3fApiCase.ApiCase.call(this, name, description, gl); 644 /** @type {number} */ this.m_stencilFuncName = stencilFuncName; 645 /** @type {number} */ this.m_stencilFuncFace = stencilFuncFace; 646 }; 647 648 es3fIntegerStateQueryTests.StencilFuncSeparateTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 649 es3fIntegerStateQueryTests.StencilFuncSeparateTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilFuncSeparateTestCase; 650 651 es3fIntegerStateQueryTests.StencilFuncSeparateTestCase.prototype.test = function() { 652 this.check(glsStateQuery.verify(this.m_stencilFuncName, gl.ALWAYS)); 653 654 /** @type {Array<number>} */ var stencilfuncValues = [gl.NEVER, gl.ALWAYS, gl.LESS, gl.LEQUAL, gl.EQUAL, gl.GEQUAL, gl.GREATER, gl.NOTEQUAL]; 655 656 for (var ndx = 0; ndx < stencilfuncValues.length; ++ndx) { 657 gl.stencilFuncSeparate(this.m_stencilFuncFace, stencilfuncValues[ndx], 0, 0); 658 659 this.check(glsStateQuery.verify(this.m_stencilFuncName, stencilfuncValues[ndx])); 660 } 661 }; 662 663 es3fIntegerStateQueryTests.StencilFuncSeparateTestCase.prototype.deinit = function() { 664 // [dag] reset the stencil func 665 gl.stencilFuncSeparate(this.m_stencilFuncFace, gl.ALWAYS, 0, 0); 666 }; 667 668 /** 669 * @constructor 670 * @extends {es3fApiCase.ApiCase} 671 * @param {string} name 672 * @param {string} description 673 * @param {number} testTargetName 674 */ 675 es3fIntegerStateQueryTests.StencilMaskTestCase = function(name, description, testTargetName) { 676 es3fApiCase.ApiCase.call(this, name, description, gl); 677 /** @type {number} */ this.m_testTargetName = testTargetName; 678 }; 679 680 es3fIntegerStateQueryTests.StencilMaskTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 681 es3fIntegerStateQueryTests.StencilMaskTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilMaskTestCase; 682 683 es3fIntegerStateQueryTests.StencilMaskTestCase.prototype.test = function() { 684 var stencilBits = /** @type {number} */ (gl.getParameter(gl.STENCIL_BITS)); 685 686 this.check(glsStateQuery.verify(this.m_testTargetName, stencilBits)); 687 688 for (var stencilBit = 0; stencilBit < stencilBits; ++stencilBit) { 689 /** @type {number} */ var mask = 1 << stencilBit; 690 691 gl.stencilFunc(gl.ALWAYS, 0, mask); 692 693 this.check(glsStateQuery.verify(this.m_testTargetName, mask)); 694 } 695 }; 696 697 /** 698 * @constructor 699 * @extends {es3fApiCase.ApiCase} 700 * @param {string} name 701 * @param {string} description 702 * @param {number} testTargetName 703 * @param {number} stencilFuncTargetFace 704 */ 705 es3fIntegerStateQueryTests.StencilMaskSeparateTestCase = function(name, description, testTargetName, stencilFuncTargetFace) { 706 es3fApiCase.ApiCase.call(this, name, description, gl); 707 /** @type {number} */ this.m_testTargetName = testTargetName; 708 /** @type {number} */ this.m_stencilFuncTargetFace = stencilFuncTargetFace; 709 }; 710 711 es3fIntegerStateQueryTests.StencilMaskSeparateTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 712 es3fIntegerStateQueryTests.StencilMaskSeparateTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilMaskSeparateTestCase; 713 714 es3fIntegerStateQueryTests.StencilMaskSeparateTestCase.prototype.test = function() { 715 var stencilBits = /** @type {number} */ (gl.getParameter(gl.STENCIL_BITS)); 716 717 this.check(glsStateQuery.verify(this.m_testTargetName, stencilBits)); 718 719 for (var stencilBit = 0; stencilBit < stencilBits; ++stencilBit) { 720 /** @type {number} */ var mask = 1 << stencilBit; 721 722 gl.stencilFuncSeparate(this.m_stencilFuncTargetFace, gl.ALWAYS, 0, mask); 723 724 this.check(glsStateQuery.verify(this.m_testTargetName, mask)); 725 } 726 }; 727 728 /** 729 * @constructor 730 * @extends {es3fApiCase.ApiCase} 731 * @param {string} name 732 * @param {string} description 733 * @param {number} testTargetName 734 */ 735 es3fIntegerStateQueryTests.StencilWriteMaskTestCase = function(name, description, testTargetName) { 736 /** @type {number} */ this.m_testTargetName = testTargetName; 737 es3fApiCase.ApiCase.call(this, name, description, gl); 738 }; 739 740 es3fIntegerStateQueryTests.StencilWriteMaskTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 741 es3fIntegerStateQueryTests.StencilWriteMaskTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilWriteMaskTestCase; 742 743 es3fIntegerStateQueryTests.StencilWriteMaskTestCase.prototype.test = function() { 744 var stencilBits = /** @type {number} */ (gl.getParameter(gl.STENCIL_BITS)); 745 746 for (var stencilBit = 0; stencilBit < stencilBits; ++stencilBit) { 747 /** @type {number} */ var mask = 1 << stencilBit; 748 749 gl.stencilMask(mask); 750 751 this.check(glsStateQuery.verify(this.m_testTargetName, mask)); 752 } 753 }; 754 755 /** 756 * @constructor 757 * @extends {es3fApiCase.ApiCase} 758 * @param {string} name 759 * @param {string} description 760 * @param {number} testTargetName 761 * @param {number} stencilTargetFace 762 */ 763 es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase = function(name, description, testTargetName, stencilTargetFace) { 764 es3fApiCase.ApiCase.call(this, name, description, gl); 765 /** @type {number} */ this.m_testTargetName = testTargetName; 766 /** @type {number} */ this.m_stencilTargetFace = stencilTargetFace; 767 }; 768 769 es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 770 es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase; 771 772 es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase.prototype.test = function() { 773 var stencilBits = /** @type {number} */ (gl.getParameter(gl.STENCIL_BITS)); 774 775 for (var stencilBit = 0; stencilBit < stencilBits; ++stencilBit) { 776 /** @type {number} */ var mask = 1 << stencilBit; 777 778 gl.stencilMaskSeparate(this.m_stencilTargetFace, mask); 779 780 this.check(glsStateQuery.verify(this.m_testTargetName, mask)); 781 } 782 }; 783 784 /** 785 * @constructor 786 * @extends {es3fApiCase.ApiCase} 787 * @param {string} name 788 * @param {string} description 789 * @param {number} testTargetName 790 * @param {number} initialValue 791 */ 792 es3fIntegerStateQueryTests.PixelStoreTestCase = function(name, description, testTargetName, initialValue) { 793 es3fApiCase.ApiCase.call(this, name, description, gl); 794 /** @type {number} */ this.m_testTargetName = testTargetName; 795 /** @type {number} */ this.m_initialValue = initialValue; 796 }; 797 798 es3fIntegerStateQueryTests.PixelStoreTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 799 es3fIntegerStateQueryTests.PixelStoreTestCase.prototype.constructor = es3fIntegerStateQueryTests.PixelStoreTestCase; 800 801 es3fIntegerStateQueryTests.PixelStoreTestCase.prototype.test = function() { 802 /** @type {deRandom.Random} */ var rnd = new deRandom.Random(0xabcdef); 803 804 this.check(glsStateQuery.verify(this.m_testTargetName, this.m_initialValue)); 805 806 /** @type {number} */ var numIterations = 120; 807 for (var i = 0; i < numIterations; ++i) { 808 /** @type {number} */ var referenceValue = rnd.getInt(0, 64000); 809 810 gl.pixelStorei(this.m_testTargetName, referenceValue); 811 812 this.check(glsStateQuery.verify(this.m_testTargetName, referenceValue)); 813 } 814 }; 815 816 /** 817 * @constructor 818 * @extends {es3fApiCase.ApiCase} 819 * @param {string} name 820 * @param {string} description 821 * @param {number} testTargetName 822 */ 823 es3fIntegerStateQueryTests.PixelStoreAlignTestCase = function(name, description, testTargetName) { 824 es3fApiCase.ApiCase.call(this, name, description, gl); 825 /** @type {number} */ this.m_testTargetName = testTargetName; 826 }; 827 828 es3fIntegerStateQueryTests.PixelStoreAlignTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 829 es3fIntegerStateQueryTests.PixelStoreAlignTestCase.prototype.constructor = es3fIntegerStateQueryTests.PixelStoreAlignTestCase; 830 831 es3fIntegerStateQueryTests.PixelStoreAlignTestCase.prototype.test = function() { 832 this.check(glsStateQuery.verify(this.m_testTargetName, 4)); 833 834 /** @type {Array<number>} */ var alignments = [1, 2, 4, 8]; 835 836 for (var ndx = 0; ndx < alignments.length; ++ndx) { 837 /** @type {number} */ var referenceValue = alignments[ndx]; 838 839 gl.pixelStorei(this.m_testTargetName, referenceValue); 840 841 this.check(glsStateQuery.verify(this.m_testTargetName, referenceValue)); 842 } 843 }; 844 845 /** 846 * @constructor 847 * @extends {es3fApiCase.ApiCase} 848 * @param {string} name 849 * @param {string} description 850 * @param {number} testTargetName 851 * @param {number} initialValue 852 */ 853 es3fIntegerStateQueryTests.BlendFuncTestCase = function(name, description, testTargetName) { 854 es3fApiCase.ApiCase.call(this, name, description, gl); 855 /** @type {number} */ this.m_testTargetName = testTargetName; 856 }; 857 858 es3fIntegerStateQueryTests.BlendFuncTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 859 es3fIntegerStateQueryTests.BlendFuncTestCase.prototype.constructor = es3fIntegerStateQueryTests.BlendFuncTestCase; 860 861 es3fIntegerStateQueryTests.BlendFuncTestCase.prototype.test = function() { 862 /** @type {Array<number>} */ var blendFuncValues = [ 863 gl.ZERO, gl.ONE, gl.SRC_COLOR, gl.ONE_MINUS_SRC_COLOR, gl.DST_COLOR, gl.ONE_MINUS_DST_COLOR, 864 gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.DST_ALPHA, gl.ONE_MINUS_DST_ALPHA, gl.CONSTANT_COLOR, 865 gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_ALPHA, 866 gl.SRC_ALPHA_SATURATE 867 ]; 868 869 for (var ndx = 0; ndx < blendFuncValues.length; ++ndx) { 870 /** @type {number} */ var referenceValue = blendFuncValues[ndx]; 871 872 this.setBlendFunc(referenceValue); 873 874 this.check(glsStateQuery.verify(this.m_testTargetName, referenceValue)); 875 }}; 876 877 /** 878 * @param {number} func 879 */ 880 es3fIntegerStateQueryTests.BlendFuncTestCase.prototype.setBlendFunc = function(func) { 881 switch (this.m_testTargetName) { 882 case gl.BLEND_SRC_RGB: 883 case gl.BLEND_SRC_ALPHA: 884 gl.blendFunc(func, gl.ZERO); 885 break; 886 887 case gl.BLEND_DST_RGB: 888 case gl.BLEND_DST_ALPHA: 889 gl.blendFunc(gl.ZERO, func); 890 break; 891 892 default: 893 throw new Error('should not happen'); 894 } 895 }; 896 897 es3fIntegerStateQueryTests.BlendFuncTestCase.prototype.deinit = function() { 898 gl.blendFunc(gl.ONE, gl.ZERO); 899 }; 900 901 /** 902 * @constructor 903 * @extends {es3fIntegerStateQueryTests.BlendFuncTestCase} 904 * @param {string} name 905 * @param {string} description 906 * @param {number} testTargetName 907 * @param {number} initialValue 908 */ 909 es3fIntegerStateQueryTests.BlendFuncSeparateTestCase = function(name, description, testTargetName) { 910 es3fIntegerStateQueryTests.BlendFuncTestCase.call(this, name, description, testTargetName); 911 /** @type {number} */ this.m_testTargetName = testTargetName; 912 }; 913 914 es3fIntegerStateQueryTests.BlendFuncSeparateTestCase.prototype = Object.create(es3fIntegerStateQueryTests.BlendFuncTestCase.prototype); 915 es3fIntegerStateQueryTests.BlendFuncSeparateTestCase.prototype.constructor = es3fIntegerStateQueryTests.BlendFuncSeparateTestCase; 916 917 /** 918 * @param {number} func 919 */ 920 es3fIntegerStateQueryTests.BlendFuncSeparateTestCase.prototype.setBlendFunc = function(func) { 921 switch (this.m_testTargetName) { 922 case gl.BLEND_SRC_RGB: 923 gl.blendFuncSeparate(func, gl.ZERO, gl.ZERO, gl.ZERO); 924 break; 925 926 case gl.BLEND_DST_RGB: 927 gl.blendFuncSeparate(gl.ZERO, func, gl.ZERO, gl.ZERO); 928 break; 929 930 case gl.BLEND_SRC_ALPHA: 931 gl.blendFuncSeparate(gl.ZERO, gl.ZERO, func, gl.ZERO); 932 break; 933 934 case gl.BLEND_DST_ALPHA: 935 gl.blendFuncSeparate(gl.ZERO, gl.ZERO, gl.ZERO, func); 936 break; 937 938 default: 939 throw new Error('should not happen'); 940 } 941 }; 942 943 es3fIntegerStateQueryTests.BlendFuncSeparateTestCase.prototype.deinit = function() { 944 gl.blendFuncSeparate(gl.ONE, gl.ZERO, gl.ONE, gl.ZERO); 945 }; 946 947 /** 948 * @constructor 949 * @extends {es3fApiCase.ApiCase} 950 * @param {string} name 951 * @param {string} description 952 * @param {number} testTargetName 953 * @param {number} initialValue 954 */ 955 es3fIntegerStateQueryTests.BlendEquationTestCase = function(name, description, testTargetName, initialValue) { 956 es3fApiCase.ApiCase.call(this, name, description, gl); 957 /** @type {number} */ this.m_testTargetName = testTargetName; 958 /** @type {number} */ this.m_initialValue = initialValue; 959 }; 960 961 es3fIntegerStateQueryTests.BlendEquationTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 962 es3fIntegerStateQueryTests.BlendEquationTestCase.prototype.constructor = es3fIntegerStateQueryTests.BlendEquationTestCase; 963 964 es3fIntegerStateQueryTests.BlendEquationTestCase.prototype.test = function() { 965 this.check(glsStateQuery.verify(this.m_testTargetName, this.m_initialValue)); 966 967 /** @type {Array<number>} */ var blendFuncValues = [gl.FUNC_ADD, gl.FUNC_SUBTRACT, gl.FUNC_REVERSE_SUBTRACT, gl.MIN, gl.MAX]; 968 969 for (var ndx = 0; ndx < blendFuncValues.length; ++ndx) { 970 /** @type {number} */ var referenceValue = blendFuncValues[ndx]; 971 972 this.setBlendEquation(referenceValue); 973 974 this.check(glsStateQuery.verify(this.m_testTargetName, referenceValue)); 975 } 976 }; 977 978 /** 979 * @param {number} equation 980 */ 981 es3fIntegerStateQueryTests.BlendEquationTestCase.prototype.setBlendEquation = function(equation) { 982 gl.blendEquation(equation); 983 }; 984 985 es3fIntegerStateQueryTests.BlendEquationTestCase.prototype.deinit = function() { 986 gl.blendEquation(this.m_initialValue); 987 }; 988 989 /** 990 * @constructor 991 * @extends {es3fIntegerStateQueryTests.BlendEquationTestCase} 992 * @param {string} name 993 * @param {string} description 994 * @param {number} testTargetName 995 * @param {number} initialValue 996 */ 997 es3fIntegerStateQueryTests.BlendEquationSeparateTestCase = function(name, description, testTargetName, initialValue) { 998 es3fIntegerStateQueryTests.BlendEquationTestCase.call(this, name, description, testTargetName, initialValue); 999 /** @type {number} */ this.m_testTargetName = testTargetName; 1000 /** @type {number} */ this.m_initialValue = initialValue; 1001 }; 1002 1003 es3fIntegerStateQueryTests.BlendEquationSeparateTestCase.prototype = Object.create(es3fIntegerStateQueryTests.BlendEquationTestCase.prototype); 1004 es3fIntegerStateQueryTests.BlendEquationSeparateTestCase.prototype.constructor = es3fIntegerStateQueryTests.BlendEquationSeparateTestCase; 1005 1006 /** 1007 * @param {number} equation 1008 */ 1009 es3fIntegerStateQueryTests.BlendEquationSeparateTestCase.prototype.setBlendEquation = function(equation) { 1010 switch (this.m_testTargetName) { 1011 case gl.BLEND_EQUATION_RGB: 1012 gl.blendEquationSeparate(equation, gl.FUNC_ADD); 1013 break; 1014 1015 case gl.BLEND_EQUATION_ALPHA: 1016 gl.blendEquationSeparate(gl.FUNC_ADD, equation); 1017 break; 1018 1019 default: 1020 throw new Error('should not happen'); 1021 } 1022 }; 1023 1024 /** 1025 * @constructor 1026 * @extends {es3fApiCase.ApiCase} 1027 * @param {string} name 1028 * @param {string} description 1029 * @param {number} testTargetName 1030 * @param {number} minValue 1031 */ 1032 es3fIntegerStateQueryTests.ImplementationArrayTestCase = function(name, description, testTargetName, minValue) { 1033 es3fApiCase.ApiCase.call(this, name, description, gl); 1034 /** @type {number} */ this.m_testTargetName = testTargetName; 1035 /** @type {number} */ this.m_minValue = minValue; 1036 }; 1037 1038 es3fIntegerStateQueryTests.ImplementationArrayTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1039 es3fIntegerStateQueryTests.ImplementationArrayTestCase.prototype.constructor = es3fIntegerStateQueryTests.ImplementationArrayTestCase; 1040 1041 es3fIntegerStateQueryTests.ImplementationArrayTestCase.prototype.test = function() { 1042 if (!framework.opengl.gluTextureUtil.enableCompressedTextureETC()) { 1043 debug('Skipping ETC2 texture format tests: no support for WEBGL_compressed_texture_etc'); 1044 return; 1045 } 1046 1047 var queryResult = /** @type {Array<number>} */ (gl.getParameter(this.m_testTargetName)); 1048 this.check(glsStateQuery.compare(queryResult.length, this.m_minValue)); 1049 1050 /** @type {Array<number>} */ var textureFormats = [ 1051 gl.COMPRESSED_R11_EAC, gl.COMPRESSED_SIGNED_R11_EAC, gl.COMPRESSED_RG11_EAC, gl.COMPRESSED_SIGNED_RG11_EAC, gl.COMPRESSED_RGB8_ETC2, gl.COMPRESSED_SRGB8_ETC2, 1052 gl.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, gl.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, gl.COMPRESSED_RGBA8_ETC2_EAC, gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 1053 ]; 1054 1055 for (var ndx = 0; ndx < textureFormats.length; ndx++) { 1056 /** @type {number} */ var format = textureFormats[ndx]; 1057 /** @type {boolean} */ var isInArray = queryResult.indexOf(format) !== -1; 1058 this.check(glsStateQuery.compare(isInArray, true)); 1059 } 1060 1061 }; 1062 1063 /** 1064 * @constructor 1065 * @extends {es3fApiCase.ApiCase} 1066 * @param {string} name 1067 * @param {string} description 1068 */ 1069 es3fIntegerStateQueryTests.CurrentProgramBindingTestCase = function(name, description) { 1070 es3fApiCase.ApiCase.call(this, name, description, gl); 1071 }; 1072 1073 es3fIntegerStateQueryTests.CurrentProgramBindingTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1074 es3fIntegerStateQueryTests.CurrentProgramBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.CurrentProgramBindingTestCase; 1075 1076 es3fIntegerStateQueryTests.CurrentProgramBindingTestCase.prototype.test = function() { 1077 this.check(glsStateQuery.verify(gl.CURRENT_PROGRAM, null)); 1078 1079 /** @type {WebGLShader} */ var shaderVert = gl.createShader(gl.VERTEX_SHADER); 1080 gl.shaderSource(shaderVert, testVertSource); 1081 gl.compileShader(shaderVert); 1082 var compileStatus = /** @type {boolean} */ (gl.getShaderParameter(shaderVert, gl.COMPILE_STATUS)); 1083 this.check(glsStateQuery.compare(compileStatus, true)); 1084 1085 /** @type {WebGLShader} */ var shaderFrag = gl.createShader(gl.FRAGMENT_SHADER); 1086 gl.shaderSource(shaderFrag, testFragSource); 1087 gl.compileShader(shaderFrag); 1088 compileStatus = /** @type {boolean} */ (gl.getShaderParameter(shaderFrag, gl.COMPILE_STATUS)); 1089 this.check(glsStateQuery.compare(compileStatus, true)); 1090 1091 /** @type {WebGLProgram} */ var shaderProg = gl.createProgram(); 1092 gl.attachShader(shaderProg, shaderVert); 1093 gl.attachShader(shaderProg, shaderFrag); 1094 gl.linkProgram(shaderProg); 1095 var linkStatus = /** @type {boolean} */ (gl.getProgramParameter(shaderProg, gl.LINK_STATUS)); 1096 this.check(glsStateQuery.compare(linkStatus, true)); 1097 1098 gl.useProgram(shaderProg); 1099 1100 this.check(glsStateQuery.verify(gl.CURRENT_PROGRAM, shaderProg)); 1101 1102 gl.deleteShader(shaderVert); 1103 gl.deleteShader(shaderFrag); 1104 gl.deleteProgram(shaderProg); 1105 1106 this.check(glsStateQuery.verify(gl.CURRENT_PROGRAM, shaderProg)); 1107 1108 gl.useProgram(null); 1109 this.check(glsStateQuery.verify(gl.CURRENT_PROGRAM, null)); 1110 }; 1111 1112 /** 1113 * @constructor 1114 * @extends {es3fApiCase.ApiCase} 1115 * @param {string} name 1116 * @param {string} description 1117 */ 1118 es3fIntegerStateQueryTests.VertexArrayBindingTestCase = function(name, description) { 1119 es3fApiCase.ApiCase.call(this, name, description, gl); 1120 }; 1121 1122 es3fIntegerStateQueryTests.VertexArrayBindingTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1123 es3fIntegerStateQueryTests.VertexArrayBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.VertexArrayBindingTestCase; 1124 1125 es3fIntegerStateQueryTests.VertexArrayBindingTestCase.prototype.test = function() { 1126 this.check(glsStateQuery.verify(gl.VERTEX_ARRAY_BINDING, null)); 1127 1128 /** @type {WebGLVertexArrayObject} */ var vertexArrayObject = gl.createVertexArray(); 1129 1130 gl.bindVertexArray(vertexArrayObject); 1131 this.check(glsStateQuery.verify(gl.VERTEX_ARRAY_BINDING, vertexArrayObject)); 1132 1133 gl.deleteVertexArray(vertexArrayObject); 1134 this.check(glsStateQuery.verify(gl.VERTEX_ARRAY_BINDING, null)); 1135 }; 1136 1137 /** 1138 * @constructor 1139 * @extends {es3fApiCase.ApiCase} 1140 * @param {string} name 1141 * @param {string} description 1142 * @param {number} bufferBindingName 1143 * @param {number} bufferType 1144 */ 1145 es3fIntegerStateQueryTests.BufferBindingTestCase = function(name, description, bufferBindingName, bufferType) { 1146 es3fApiCase.ApiCase.call(this, name, description, gl); 1147 /** @type {number} */ this.m_bufferBindingName = bufferBindingName; 1148 /** @type {number} */ this.m_bufferType = bufferType; 1149 }; 1150 1151 es3fIntegerStateQueryTests.BufferBindingTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1152 es3fIntegerStateQueryTests.BufferBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.BufferBindingTestCase; 1153 1154 es3fIntegerStateQueryTests.BufferBindingTestCase.prototype.test = function() { 1155 this.check(glsStateQuery.verify(this.m_bufferBindingName, null)); 1156 1157 /** @type {WebGLBuffer} */ var bufferObject = gl.createBuffer(); 1158 1159 gl.bindBuffer(this.m_bufferType, bufferObject); 1160 this.check(glsStateQuery.verify(this.m_bufferBindingName, bufferObject)); 1161 1162 gl.deleteBuffer(bufferObject); 1163 this.check(glsStateQuery.verify(this.m_bufferBindingName, null)); 1164 }; 1165 1166 /** 1167 * @constructor 1168 * @extends {es3fApiCase.ApiCase} 1169 * @param {string} name 1170 */ 1171 es3fIntegerStateQueryTests.ElementArrayBufferBindingTestCase = function(name) { 1172 es3fApiCase.ApiCase.call(this, name, 'GL_ELEMENT_ARRAY_BUFFER_BINDING', gl); 1173 }; 1174 1175 es3fIntegerStateQueryTests.ElementArrayBufferBindingTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1176 es3fIntegerStateQueryTests.ElementArrayBufferBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.ElementArrayBufferBindingTestCase; 1177 1178 es3fIntegerStateQueryTests.ElementArrayBufferBindingTestCase.prototype.test = function() { 1179 // Test with default VAO 1180 bufferedLogToConsole('DefaultVAO: Test with default VAO'); 1181 1182 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, null)); 1183 1184 /** @type {WebGLBuffer} */ var bufferObject = gl.createBuffer(); 1185 1186 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferObject); 1187 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, bufferObject)); 1188 1189 gl.deleteBuffer(bufferObject); 1190 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, null)); 1191 1192 // Test with multiple VAOs 1193 bufferedLogToConsole('WithVAO: Test with VAO'); 1194 1195 /** @type {Array<WebGLVertexArrayObject>} */ var vaos = []; 1196 /** @type {Array<WebGLBuffer>} */ var buffers = []; 1197 1198 for (var ndx = 0; ndx < 2; ndx++) { 1199 vaos[ndx] = gl.createVertexArray(); 1200 buffers[ndx] = gl.createBuffer(); 1201 } 1202 1203 // initial 1204 gl.bindVertexArray(vaos[0]); 1205 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, null)); 1206 1207 // after setting 1208 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffers[0]); 1209 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, buffers[0])); 1210 1211 // initial of vao 2 1212 gl.bindVertexArray(vaos[1]); 1213 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, null)); 1214 1215 // after setting to 2 1216 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffers[1]); 1217 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, buffers[1])); 1218 1219 // vao 1 still has buffer 1 bound? 1220 gl.bindVertexArray(vaos[0]); 1221 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, buffers[0])); 1222 1223 // deleting clears from bound vaos ... 1224 for (var ndx = 0; ndx < 2; ndx++) 1225 gl.deleteBuffer(buffers[ndx]); 1226 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, null)); 1227 1228 // ... but does not from non-bound vaos? 1229 gl.bindVertexArray(vaos[1]); 1230 this.check(glsStateQuery.verify(gl.ELEMENT_ARRAY_BUFFER_BINDING, buffers[1])); 1231 1232 for (var ndx = 0; ndx < 2; ndx++) 1233 gl.deleteVertexArray(vaos[ndx]); 1234 }; 1235 1236 /** 1237 * @constructor 1238 * @extends {es3fApiCase.ApiCase} 1239 * @param {string} name 1240 * @param {string} description 1241 */ 1242 es3fIntegerStateQueryTests.StencilClearValueTestCase = function(name, description) { 1243 es3fApiCase.ApiCase.call(this, name, description, gl); 1244 }; 1245 1246 es3fIntegerStateQueryTests.StencilClearValueTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1247 es3fIntegerStateQueryTests.StencilClearValueTestCase.prototype.constructor = es3fIntegerStateQueryTests.StencilClearValueTestCase; 1248 1249 es3fIntegerStateQueryTests.StencilClearValueTestCase.prototype.test = function() { 1250 this.check(glsStateQuery.verify(gl.STENCIL_CLEAR_VALUE, 0)); 1251 1252 var stencilBits = /** @type {number} */ (gl.getParameter(gl.STENCIL_BITS)); 1253 1254 for (var stencilBit = 0; stencilBit < stencilBits; ++stencilBit) { 1255 /** @type {number} */ var ref = 1 << stencilBit; 1256 1257 gl.clearStencil(ref); // mask should not affect the REF 1258 1259 this.check(glsStateQuery.verify(gl.STENCIL_CLEAR_VALUE, ref)); 1260 } 1261 }; 1262 1263 /** 1264 * @constructor 1265 * @extends {es3fApiCase.ApiCase} 1266 * @param {string} name 1267 * @param {string} description 1268 */ 1269 es3fIntegerStateQueryTests.ActiveTextureTestCase = function(name, description) { 1270 es3fApiCase.ApiCase.call(this, name, description, gl); 1271 }; 1272 1273 es3fIntegerStateQueryTests.ActiveTextureTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1274 es3fIntegerStateQueryTests.ActiveTextureTestCase.prototype.constructor = es3fIntegerStateQueryTests.ActiveTextureTestCase; 1275 1276 es3fIntegerStateQueryTests.ActiveTextureTestCase.prototype.test = function() { 1277 this.check(glsStateQuery.verify(gl.ACTIVE_TEXTURE, gl.TEXTURE0)); 1278 1279 var textureUnits = /** @type {number} */ (gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)); 1280 1281 for (var ndx = 0; ndx < textureUnits; ++ndx) { 1282 gl.activeTexture(gl.TEXTURE0 + ndx); 1283 1284 this.check(glsStateQuery.verify(gl.ACTIVE_TEXTURE, gl.TEXTURE0 + ndx)); 1285 } 1286 }; 1287 1288 es3fIntegerStateQueryTests.ActiveTextureTestCase.prototype.deinit = function() { 1289 // [dag] reset the state of the context 1290 gl.activeTexture(gl.TEXTURE0); 1291 }; 1292 1293 /** 1294 * @constructor 1295 * @extends {es3fApiCase.ApiCase} 1296 * @param {string} name 1297 * @param {string} description 1298 */ 1299 es3fIntegerStateQueryTests.RenderbufferBindingTestCase = function(name, description) { 1300 es3fApiCase.ApiCase.call(this, name, description, gl); 1301 }; 1302 1303 es3fIntegerStateQueryTests.RenderbufferBindingTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1304 es3fIntegerStateQueryTests.RenderbufferBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.RenderbufferBindingTestCase; 1305 1306 es3fIntegerStateQueryTests.RenderbufferBindingTestCase.prototype.test = function() { 1307 this.check(glsStateQuery.verify(gl.RENDERBUFFER_BINDING, null)); 1308 1309 /** @type {WebGLRenderbuffer} */ var renderBuffer = gl.createRenderbuffer(); 1310 1311 gl.bindRenderbuffer(gl.RENDERBUFFER, renderBuffer); 1312 1313 this.check(glsStateQuery.verify(gl.RENDERBUFFER_BINDING, renderBuffer)); 1314 1315 gl.deleteRenderbuffer(renderBuffer); 1316 this.check(glsStateQuery.verify(gl.RENDERBUFFER_BINDING, null)); 1317 }; 1318 1319 /** 1320 * @constructor 1321 * @extends {es3fApiCase.ApiCase} 1322 * @param {string} name 1323 * @param {string} description 1324 */ 1325 es3fIntegerStateQueryTests.SamplerObjectBindingTestCase = function(name, description) { 1326 es3fApiCase.ApiCase.call(this, name, description, gl); 1327 }; 1328 1329 es3fIntegerStateQueryTests.SamplerObjectBindingTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1330 es3fIntegerStateQueryTests.SamplerObjectBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.SamplerObjectBindingTestCase; 1331 1332 es3fIntegerStateQueryTests.SamplerObjectBindingTestCase.prototype.test = function() { 1333 this.check(glsStateQuery.verify(gl.SAMPLER_BINDING, null)); 1334 1335 bufferedLogToConsole('SingleUnit: Single unit'); 1336 /** @type {WebGLSampler} */ var sampler = gl.createSampler(); 1337 1338 gl.bindSampler(0, sampler); 1339 1340 this.check(glsStateQuery.verify(gl.SAMPLER_BINDING, sampler)); 1341 1342 gl.deleteSampler(sampler); 1343 this.check(glsStateQuery.verify(gl.SAMPLER_BINDING, null)); 1344 1345 bufferedLogToConsole('MultipleUnits: Multiple units'); 1346 1347 /** @type {WebGLSampler} */ var samplerA = gl.createSampler(); 1348 /** @type {WebGLSampler} */ var samplerB = gl.createSampler(); 1349 1350 gl.bindSampler(1, samplerA); 1351 gl.bindSampler(2, samplerB); 1352 1353 this.check(glsStateQuery.verify(gl.SAMPLER_BINDING, null)); 1354 1355 gl.activeTexture(gl.TEXTURE1); 1356 this.check(glsStateQuery.verify(gl.SAMPLER_BINDING, samplerA)); 1357 1358 gl.activeTexture(gl.TEXTURE2); 1359 this.check(glsStateQuery.verify(gl.SAMPLER_BINDING, samplerB)); 1360 1361 gl.deleteSampler(samplerB); 1362 gl.deleteSampler(samplerA); 1363 }; 1364 1365 es3fIntegerStateQueryTests.SamplerObjectBindingTestCase.prototype.deinit = function() { 1366 gl.activeTexture(gl.TEXTURE0); 1367 }; 1368 1369 /** 1370 * @constructor 1371 * @extends {es3fApiCase.ApiCase} 1372 * @param {string} name 1373 * @param {string} description 1374 * @param {number} testBindingName 1375 * @param {number} textureType 1376 */ 1377 es3fIntegerStateQueryTests.TextureBindingTestCase = function(name, description, testBindingName, textureType) { 1378 es3fApiCase.ApiCase.call(this, name, description, gl); 1379 /** @type {number} */ this.m_testBindingName = testBindingName; 1380 /** @type {number} */ this.m_textureType = textureType; 1381 }; 1382 1383 es3fIntegerStateQueryTests.TextureBindingTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1384 es3fIntegerStateQueryTests.TextureBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.TextureBindingTestCase; 1385 1386 es3fIntegerStateQueryTests.TextureBindingTestCase.prototype.test = function() { 1387 this.check(glsStateQuery.verify(this.m_testBindingName, null)); 1388 1389 /** @type {WebGLTexture} */ var texture = gl.createTexture(); 1390 1391 gl.bindTexture(this.m_textureType, texture); 1392 this.check(glsStateQuery.verify(this.m_testBindingName, texture)); 1393 1394 gl.deleteTexture(texture); 1395 1396 this.check(glsStateQuery.verify(this.m_testBindingName, null)); 1397 }; 1398 1399 /** 1400 * @constructor 1401 * @extends {es3fApiCase.ApiCase} 1402 * @param {string} name 1403 * @param {string} description 1404 */ 1405 es3fIntegerStateQueryTests.FrameBufferBindingTestCase = function(name, description) { 1406 es3fApiCase.ApiCase.call(this, name, description, gl); 1407 }; 1408 1409 es3fIntegerStateQueryTests.FrameBufferBindingTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1410 es3fIntegerStateQueryTests.FrameBufferBindingTestCase.prototype.constructor = es3fIntegerStateQueryTests.FrameBufferBindingTestCase; 1411 1412 es3fIntegerStateQueryTests.FrameBufferBindingTestCase.prototype.test = function() { 1413 this.check(glsStateQuery.verify(gl.DRAW_FRAMEBUFFER_BINDING, null)); 1414 this.check(glsStateQuery.verify(gl.FRAMEBUFFER_BINDING, null)); 1415 this.check(glsStateQuery.verify(gl.READ_FRAMEBUFFER_BINDING, null)); 1416 1417 /** @type {WebGLFramebuffer} */ var framebufferId = gl.createFramebuffer(); 1418 1419 gl.bindFramebuffer(gl.FRAMEBUFFER, framebufferId); 1420 1421 this.check(glsStateQuery.verify(gl.DRAW_FRAMEBUFFER_BINDING, framebufferId)); 1422 this.check(glsStateQuery.verify(gl.FRAMEBUFFER_BINDING, framebufferId)); 1423 this.check(glsStateQuery.verify(gl.READ_FRAMEBUFFER_BINDING, framebufferId)); 1424 1425 gl.bindFramebuffer(gl.FRAMEBUFFER, null); 1426 1427 this.check(glsStateQuery.verify(gl.DRAW_FRAMEBUFFER_BINDING, null)); 1428 this.check(glsStateQuery.verify(gl.FRAMEBUFFER_BINDING, null)); 1429 this.check(glsStateQuery.verify(gl.READ_FRAMEBUFFER_BINDING, null)); 1430 1431 gl.bindFramebuffer(gl.READ_FRAMEBUFFER, framebufferId); 1432 1433 this.check(glsStateQuery.verify(gl.DRAW_FRAMEBUFFER_BINDING, null)); 1434 this.check(glsStateQuery.verify(gl.FRAMEBUFFER_BINDING, null)); 1435 this.check(glsStateQuery.verify(gl.READ_FRAMEBUFFER_BINDING, framebufferId)); 1436 1437 gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebufferId); 1438 1439 this.check(glsStateQuery.verify(gl.DRAW_FRAMEBUFFER_BINDING, framebufferId)); 1440 this.check(glsStateQuery.verify(gl.FRAMEBUFFER_BINDING, framebufferId)); 1441 this.check(glsStateQuery.verify(gl.READ_FRAMEBUFFER_BINDING, framebufferId)); 1442 1443 gl.deleteFramebuffer(framebufferId); 1444 1445 this.check(glsStateQuery.verify(gl.DRAW_FRAMEBUFFER_BINDING, null)); 1446 this.check(glsStateQuery.verify(gl.FRAMEBUFFER_BINDING, null)); 1447 this.check(glsStateQuery.verify(gl.READ_FRAMEBUFFER_BINDING, null)); 1448 }; 1449 1450 /** 1451 * @constructor 1452 * @extends {es3fApiCase.ApiCase} 1453 * @param {string} name 1454 * @param {string} description 1455 */ 1456 es3fIntegerStateQueryTests.ImplementationColorReadTestCase = function(name, description) { 1457 es3fApiCase.ApiCase.call(this, name, description, gl); 1458 }; 1459 1460 es3fIntegerStateQueryTests.ImplementationColorReadTestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1461 es3fIntegerStateQueryTests.ImplementationColorReadTestCase.prototype.constructor = es3fIntegerStateQueryTests.ImplementationColorReadTestCase; 1462 1463 es3fIntegerStateQueryTests.ImplementationColorReadTestCase.prototype.test = function() { 1464 /** @type {Array<number>} */ var defaultColorTypes = [ 1465 gl.UNSIGNED_BYTE, gl.BYTE, gl.UNSIGNED_SHORT, gl.SHORT, 1466 gl.UNSIGNED_INT, gl.INT, gl.HALF_FLOAT, gl.FLOAT, gl.UNSIGNED_SHORT_5_6_5, 1467 gl.UNSIGNED_SHORT_4_4_4_4, gl.UNSIGNED_SHORT_5_5_5_1, 1468 gl.UNSIGNED_INT_2_10_10_10_REV, gl.UNSIGNED_INT_10F_11F_11F_REV 1469 ]; 1470 1471 /** @type {Array<number>} */ var defaultColorFormats = [ 1472 gl.RGBA, gl.RGBA_INTEGER, gl.RGB, gl.RGB_INTEGER, 1473 gl.RG, gl.RG_INTEGER, gl.RED, gl.RED_INTEGER 1474 ]; 1475 1476 /** @type {Array<number>} */ var validColorTypes = []; 1477 /** @type {Array<number>} */ var validColorFormats = []; 1478 1479 // Defined by the spec 1480 1481 for (var ndx = 0; ndx < defaultColorTypes.length; ++ndx) 1482 validColorTypes.push(defaultColorTypes[ndx]); 1483 for (var ndx = 0; ndx < defaultColorFormats.length; ++ndx) 1484 validColorFormats.push(defaultColorFormats[ndx]); 1485 1486 // Extensions 1487 1488 // if (this.m_context.getContextInfo().isExtensionSupported("gl.EXT_texture_format_BGRA8888") || 1489 // this.m_context.getContextInfo().isExtensionSupported("gl.APPLE_texture_format_BGRA8888")) 1490 // validColorFormats.push(gl.BGRA); 1491 // 1492 // if (this.m_context.getContextInfo().isExtensionSupported("gl.EXT_read_format_bgra")) { 1493 // validColorFormats.push(gl.BGRA); 1494 // validColorTypes.push(gl.UNSIGNED_SHORT_4_4_4_4_REV); 1495 // validColorTypes.push(gl.UNSIGNED_SHORT_1_5_5_5_REV); 1496 // } 1497 // 1498 // if (this.m_context.getContextInfo().isExtensionSupported("gl.IMG_read_format")) { 1499 // validColorFormats.push(gl.BGRA); 1500 // validColorTypes.push(gl.UNSIGNED_SHORT_4_4_4_4_REV); 1501 // } 1502 // 1503 // if (this.m_context.getContextInfo().isExtensionSupported("gl.NV_sRGB_formats")) { 1504 // validColorFormats.push(gl.SLUMINANCE_NV); 1505 // validColorFormats.push(gl.SLUMINANCE_ALPHA_NV); 1506 // } 1507 // 1508 // if (this.m_context.getContextInfo().isExtensionSupported("gl.NV_bgr")) { 1509 // validColorFormats.push(gl.BGR_NV); 1510 // } 1511 1512 this.check(glsStateQuery.verifyAnyOf(gl.IMPLEMENTATION_COLOR_READ_TYPE, validColorTypes)); 1513 this.check(glsStateQuery.verifyAnyOf(gl.IMPLEMENTATION_COLOR_READ_FORMAT, validColorFormats)); 1514 }; 1515 1516 /** 1517 * @constructor 1518 * @extends {es3fApiCase.ApiCase} 1519 * @param {string} name 1520 * @param {string} description 1521 */ 1522 es3fIntegerStateQueryTests.ReadBufferCase = function(name, description) { 1523 es3fApiCase.ApiCase.call(this, name, description, gl); 1524 }; 1525 1526 es3fIntegerStateQueryTests.ReadBufferCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1527 es3fIntegerStateQueryTests.ReadBufferCase.prototype.constructor = es3fIntegerStateQueryTests.ReadBufferCase; 1528 1529 es3fIntegerStateQueryTests.ReadBufferCase.prototype.test = function() { 1530 /** @type {Array<number>} */ var validInitialValues = [gl.BACK, gl.NONE]; 1531 this.check(glsStateQuery.verifyAnyOf(gl.READ_BUFFER, validInitialValues)); 1532 1533 gl.readBuffer(gl.NONE); 1534 this.check(glsStateQuery.verify(gl.READ_BUFFER, gl.NONE)); 1535 1536 gl.readBuffer(gl.BACK); 1537 this.check(glsStateQuery.verify(gl.READ_BUFFER, gl.BACK)); 1538 1539 // test gl.READ_BUFFER with framebuffers 1540 1541 /** @type {WebGLFramebuffer} */ var framebufferId = gl.createFramebuffer(); 1542 1543 /** @type {WebGLRenderbuffer} */ var renderbuffer_id = gl.createRenderbuffer(); 1544 1545 gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer_id); 1546 1547 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA8, 128, 128); 1548 1549 gl.bindFramebuffer(gl.READ_FRAMEBUFFER, framebufferId); 1550 1551 gl.framebufferRenderbuffer(gl.READ_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, renderbuffer_id); 1552 1553 this.check(glsStateQuery.verify(gl.READ_BUFFER, gl.COLOR_ATTACHMENT0)); 1554 1555 gl.deleteFramebuffer(framebufferId); 1556 gl.deleteRenderbuffer(renderbuffer_id); 1557 1558 this.check(glsStateQuery.verify(gl.READ_BUFFER, gl.BACK)); 1559 }; 1560 1561 /** 1562 * @constructor 1563 * @extends {es3fApiCase.ApiCase} 1564 * @param {string} name 1565 * @param {string} description 1566 */ 1567 es3fIntegerStateQueryTests.DrawBufferCase = function(name, description) { 1568 es3fApiCase.ApiCase.call(this, name, description, gl); 1569 }; 1570 1571 es3fIntegerStateQueryTests.DrawBufferCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1572 es3fIntegerStateQueryTests.DrawBufferCase.prototype.constructor = es3fIntegerStateQueryTests.DrawBufferCase; 1573 1574 es3fIntegerStateQueryTests.DrawBufferCase.prototype.test = function() { 1575 /** @type {Array<number>} */ var validInitialValues = [gl.BACK, gl.NONE]; 1576 this.check(glsStateQuery.verifyAnyOf(gl.DRAW_BUFFER0, validInitialValues)); 1577 1578 /** @type {number} */ var bufs = gl.NONE; 1579 gl.drawBuffers([bufs]); 1580 this.check(glsStateQuery.verify(gl.DRAW_BUFFER0, gl.NONE)); 1581 1582 bufs = gl.BACK; 1583 gl.drawBuffers([bufs]); 1584 this.check(glsStateQuery.verify(gl.DRAW_BUFFER0, gl.BACK)); 1585 1586 // test gl.DRAW_BUFFER with framebuffers 1587 1588 /** @type {WebGLFramebuffer} */ var framebufferId = gl.createFramebuffer(); 1589 1590 /** @type {Array<WebGLRenderbuffer>} */ var renderbuffer_ids = []; 1591 1592 for (var ndx = 0; ndx < 2; ndx++) 1593 renderbuffer_ids[ndx] = gl.createRenderbuffer(); 1594 1595 gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer_ids[0]); 1596 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA8, 128, 128); 1597 1598 gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer_ids[1]); 1599 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA8, 128, 128); 1600 1601 gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebufferId); 1602 1603 gl.framebufferRenderbuffer(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, renderbuffer_ids[0]); 1604 gl.framebufferRenderbuffer(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT1, gl.RENDERBUFFER, renderbuffer_ids[1]); 1605 1606 // only the initial state the draw buffer for fragment color zero is defined 1607 this.check(glsStateQuery.verify(gl.DRAW_BUFFER0, gl.COLOR_ATTACHMENT0)); 1608 1609 /** @type {Array<number>} */ var bufTargets = [gl.NONE, gl.COLOR_ATTACHMENT1]; 1610 gl.drawBuffers(bufTargets); 1611 this.check(glsStateQuery.verify(gl.DRAW_BUFFER0, gl.NONE)); 1612 this.check(glsStateQuery.verify(gl.DRAW_BUFFER1, gl.COLOR_ATTACHMENT1)); 1613 1614 gl.deleteFramebuffer(framebufferId); 1615 gl.deleteRenderbuffer(renderbuffer_ids[0]); 1616 gl.deleteRenderbuffer(renderbuffer_ids[1]); 1617 1618 this.check(glsStateQuery.verify(gl.DRAW_BUFFER0, gl.BACK)); 1619 }; 1620 1621 // Integer64 1622 /** 1623 * @constructor 1624 * @extends {es3fApiCase.ApiCase} 1625 * @param {string} name 1626 * @param {string} description 1627 * @param {number} targetName 1628 * @param {number} minValue 1629 */ 1630 es3fIntegerStateQueryTests.ConstantMinimumValue64TestCase = function(name, description, targetName, minValue) { 1631 es3fApiCase.ApiCase.call(this, name, description, gl); 1632 /** @type {number} */ this.m_targetName = targetName; 1633 /** @type {number} */ this.m_minValue = minValue; 1634 }; 1635 1636 es3fIntegerStateQueryTests.ConstantMinimumValue64TestCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1637 es3fIntegerStateQueryTests.ConstantMinimumValue64TestCase.prototype.constructor = es3fIntegerStateQueryTests.ConstantMinimumValue64TestCase; 1638 1639 es3fIntegerStateQueryTests.ConstantMinimumValue64TestCase.prototype.test = function() { 1640 this.check(glsStateQuery.verifyGreaterOrEqual(this.m_targetName, this.m_minValue), 'Fail'); 1641 }; 1642 1643 /** 1644 * @constructor 1645 * @extends {es3fApiCase.ApiCase} 1646 * @param {string} name 1647 * @param {string} description 1648 * @param {number} targetName 1649 * @param {number} targetMaxUniformBlocksName 1650 * @param {number} targetMaxUniformComponentsName 1651 */ 1652 es3fIntegerStateQueryTests.MaxCombinedStageUniformComponentsCase = function(name, description, targetName, targetMaxUniformBlocksName, targetMaxUniformComponentsName) { 1653 es3fApiCase.ApiCase.call(this, name, description, gl); 1654 /** @type {number} */ this.m_targetName = targetName; 1655 /** @type {number} */ this.m_targetMaxUniformBlocksName = targetMaxUniformBlocksName; 1656 /** @type {number} */ this.m_targetMaxUniformComponentsName = targetMaxUniformComponentsName; 1657 }; 1658 1659 es3fIntegerStateQueryTests.MaxCombinedStageUniformComponentsCase.prototype = Object.create(es3fApiCase.ApiCase.prototype); 1660 es3fIntegerStateQueryTests.MaxCombinedStageUniformComponentsCase.prototype.constructor = es3fIntegerStateQueryTests.MaxCombinedStageUniformComponentsCase; 1661 1662 es3fIntegerStateQueryTests.MaxCombinedStageUniformComponentsCase.prototype.test = function() { 1663 var uniformBlockSize = /** @type {number} */ (gl.getParameter(gl.MAX_UNIFORM_BLOCK_SIZE)); 1664 var maxUniformBlocks = /** @type {number} */ (gl.getParameter(this.m_targetMaxUniformBlocksName)); 1665 var maxUniformComponents = /** @type {number} */ (gl.getParameter(this.m_targetMaxUniformComponentsName)); 1666 1667 // MAX_stage_UNIFORM_BLOCKS * MAX_UNIFORM_BLOCK_SIZE / 4 + MAX_stage_UNIFORM_COMPONENTS 1668 /** @type {number} */ var minCombinedUniformComponents = maxUniformBlocks * uniformBlockSize / 4 + maxUniformComponents; 1669 1670 this.check(glsStateQuery.verifyGreaterOrEqual(this.m_targetName, minCombinedUniformComponents)); 1671 }; 1672 1673 /** 1674 * @constructor 1675 * @extends {tcuTestCase.DeqpTest} 1676 */ 1677 es3fIntegerStateQueryTests.IntegerStateQueryTests = function() { 1678 tcuTestCase.DeqpTest.call(this, 'integers', 'Integer Values'); 1679 }; 1680 1681 es3fIntegerStateQueryTests.IntegerStateQueryTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype); 1682 es3fIntegerStateQueryTests.IntegerStateQueryTests.prototype.constructor = es3fIntegerStateQueryTests.IntegerStateQueryTests; 1683 1684 es3fIntegerStateQueryTests.IntegerStateQueryTests.prototype.init = function() { 1685 /** 1686 * @struct 1687 * @constructor 1688 * @param {string} name 1689 * @param {string} description 1690 * @param {number} targetName 1691 * @param {number} value 1692 */ 1693 var LimitedStateInteger = function(name, description, targetName, value) { 1694 /** @type {string} */ this.name = name; 1695 /** @type {string} */ this.description = description; 1696 /** @type {number} */ this.targetName = targetName; 1697 /** @type {number} */ this.value = value; 1698 }; 1699 1700 /** @type {Array<LimitedStateInteger>} */ var implementationMinLimits = [ 1701 new LimitedStateInteger('subpixel_bits', 'SUBPIXEL_BITS has minimum value of 4', gl.SUBPIXEL_BITS, 4), 1702 new LimitedStateInteger('max_3d_texture_size', 'MAX_3D_TEXTURE_SIZE has minimum value of 256', gl.MAX_3D_TEXTURE_SIZE, 256), 1703 new LimitedStateInteger('max_texture_size', 'MAX_TEXTURE_SIZE has minimum value of 2048', gl.MAX_TEXTURE_SIZE, 2048), 1704 new LimitedStateInteger('max_array_texture_layers', 'MAX_ARRAY_TEXTURE_LAYERS has minimum value of 256', gl.MAX_ARRAY_TEXTURE_LAYERS, 256), 1705 new LimitedStateInteger('max_cube_map_texture_size', 'MAX_CUBE_MAP_TEXTURE_SIZE has minimum value of 2048', gl.MAX_CUBE_MAP_TEXTURE_SIZE, 2048), 1706 new LimitedStateInteger('max_renderbuffer_size', 'MAX_RENDERBUFFER_SIZE has minimum value of 2048', gl.MAX_RENDERBUFFER_SIZE, 2048), 1707 new LimitedStateInteger('max_draw_buffers', 'MAX_DRAW_BUFFERS has minimum value of 4', gl.MAX_DRAW_BUFFERS, 4), 1708 new LimitedStateInteger('max_color_attachments', 'MAX_COLOR_ATTACHMENTS has minimum value of 4', gl.MAX_COLOR_ATTACHMENTS, 4), 1709 new LimitedStateInteger('max_elements_indices', 'MAX_ELEMENTS_INDICES has minimum value of 0', gl.MAX_ELEMENTS_INDICES, 0), 1710 new LimitedStateInteger('max_elements_vertices', 'MAX_ELEMENTS_VERTICES has minimum value of 0', gl.MAX_ELEMENTS_VERTICES, 0), 1711 new LimitedStateInteger('max_vertex_attribs', 'MAX_VERTEX_ATTRIBS has minimum value of 16', gl.MAX_VERTEX_ATTRIBS, 16), 1712 new LimitedStateInteger('max_vertex_uniform_components', 'MAX_VERTEX_UNIFORM_COMPONENTS has minimum value of 1024', gl.MAX_VERTEX_UNIFORM_COMPONENTS, 1024), 1713 new LimitedStateInteger('max_vertex_uniform_vectors', 'MAX_VERTEX_UNIFORM_VECTORS has minimum value of 256', gl.MAX_VERTEX_UNIFORM_VECTORS, 256), 1714 new LimitedStateInteger('max_vertex_uniform_blocks', 'MAX_VERTEX_UNIFORM_BLOCKS has minimum value of 12', gl.MAX_VERTEX_UNIFORM_BLOCKS, 12), 1715 new LimitedStateInteger('max_vertex_output_components', 'MAX_VERTEX_OUTPUT_COMPONENTS has minimum value of 64', gl.MAX_VERTEX_OUTPUT_COMPONENTS, 64), 1716 new LimitedStateInteger('max_vertex_texture_image_units', 'MAX_VERTEX_TEXTURE_IMAGE_UNITS has minimum value of 16', gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS, 16), 1717 new LimitedStateInteger('max_fragment_uniform_components', 'MAX_FRAGMENT_UNIFORM_COMPONENTS has minimum value of 896', gl.MAX_FRAGMENT_UNIFORM_COMPONENTS, 896), 1718 new LimitedStateInteger('max_fragment_uniform_vectors', 'MAX_FRAGMENT_UNIFORM_VECTORS has minimum value of 224', gl.MAX_FRAGMENT_UNIFORM_VECTORS, 224), 1719 new LimitedStateInteger('max_fragment_uniform_blocks', 'MAX_FRAGMENT_UNIFORM_BLOCKS has minimum value of 12', gl.MAX_FRAGMENT_UNIFORM_BLOCKS, 12), 1720 new LimitedStateInteger('max_fragment_input_components', 'MAX_FRAGMENT_INPUT_COMPONENTS has minimum value of 60', gl.MAX_FRAGMENT_INPUT_COMPONENTS, 60), 1721 new LimitedStateInteger('max_texture_image_units', 'MAX_TEXTURE_IMAGE_UNITS has minimum value of 16', gl.MAX_TEXTURE_IMAGE_UNITS, 16), 1722 new LimitedStateInteger('max_program_texel_offset', 'MAX_PROGRAM_TEXEL_OFFSET has minimum value of 7', gl.MAX_PROGRAM_TEXEL_OFFSET, 7), 1723 new LimitedStateInteger('max_uniform_buffer_bindings', 'MAX_UNIFORM_BUFFER_BINDINGS has minimum value of 24', gl.MAX_UNIFORM_BUFFER_BINDINGS, 24), 1724 new LimitedStateInteger('max_combined_uniform_blocks', 'MAX_COMBINED_UNIFORM_BLOCKS has minimum value of 24', gl.MAX_COMBINED_UNIFORM_BLOCKS, 24), 1725 new LimitedStateInteger('max_varying_components', 'MAX_VARYING_COMPONENTS has minimum value of 60', gl.MAX_VARYING_COMPONENTS, 60), 1726 new LimitedStateInteger('max_varying_vectors', 'MAX_VARYING_VECTORS has minimum value of 15', gl.MAX_VARYING_VECTORS, 15), 1727 new LimitedStateInteger('max_combined_texture_image_units', 'MAX_COMBINED_TEXTURE_IMAGE_UNITS has minimum value of 32', gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS, 32), 1728 new LimitedStateInteger('max_transform_feedback_interleaved_components', 'MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS has minimum value of 64', gl.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, 64), 1729 new LimitedStateInteger('max_transform_feedback_separate_attribs', 'MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS has minimum value of 4', gl.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, 4), 1730 new LimitedStateInteger('max_transform_feedback_separate_components', 'MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS has minimum value of 4', gl.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, 4), 1731 new LimitedStateInteger('max_samples', 'MAX_SAMPLES has minimum value of 4', gl.MAX_SAMPLES, 4), 1732 new LimitedStateInteger('red_bits', 'RED_BITS has minimum value of 0', gl.RED_BITS, 0), 1733 new LimitedStateInteger('green_bits', 'GREEN_BITS has minimum value of 0', gl.GREEN_BITS, 0), 1734 new LimitedStateInteger('blue_bits', 'BLUE_BITS has minimum value of 0', gl.BLUE_BITS, 0), 1735 new LimitedStateInteger('alpha_bits', 'ALPHA_BITS has minimum value of 0', gl.ALPHA_BITS, 0), 1736 new LimitedStateInteger('depth_bits', 'DEPTH_BITS has minimum value of 0', gl.DEPTH_BITS, 0), 1737 new LimitedStateInteger('stencil_bits', 'STENCIL_BITS has minimum value of 0', gl.STENCIL_BITS, 0) 1738 ]; 1739 1740 /** @type {Array<LimitedStateInteger>} */ var implementationMaxLimits = [ 1741 new LimitedStateInteger('min_program_texel_offset', 'MIN_PROGRAM_TEXEL_OFFSET has maximum value of -8', gl.MIN_PROGRAM_TEXEL_OFFSET, -8), 1742 new LimitedStateInteger('uniform_buffer_offset_alignment', 'UNIFORM_BUFFER_OFFSET_ALIGNMENT has minimum value of 1', gl.UNIFORM_BUFFER_OFFSET_ALIGNMENT, 256) 1743 ]; 1744 1745 var testCtx = this; 1746 1747 for (var testNdx = 0; testNdx < implementationMinLimits.length; testNdx++) 1748 testCtx.addChild(new es3fIntegerStateQueryTests.ConstantMinimumValueTestCase(implementationMinLimits[testNdx].name, implementationMinLimits[testNdx].description, implementationMinLimits[testNdx].targetName, implementationMinLimits[testNdx].value)); 1749 1750 for (var testNdx = 0; testNdx < implementationMaxLimits.length; testNdx++) 1751 testCtx.addChild(new es3fIntegerStateQueryTests.ConstantMaximumValueTestCase(implementationMaxLimits[testNdx].name, implementationMaxLimits[testNdx].description, implementationMaxLimits[testNdx].targetName, implementationMaxLimits[testNdx].value)); 1752 1753 testCtx.addChild(new es3fIntegerStateQueryTests.SampleBuffersTestCase('sample_buffers', 'SAMPLE_BUFFERS')); 1754 testCtx.addChild(new es3fIntegerStateQueryTests.SamplesTestCase('samples' , 'SAMPLES')); 1755 testCtx.addChild(new es3fIntegerStateQueryTests.HintTestCase('generate_mipmap_hint', 'GENERATE_MIPMAP_HINT', gl.GENERATE_MIPMAP_HINT)); 1756 testCtx.addChild(new es3fIntegerStateQueryTests.HintTestCase('fragment_shader_derivative_hint', 'FRAGMENT_SHADER_DERIVATIVE_HINT', gl.FRAGMENT_SHADER_DERIVATIVE_HINT)); 1757 testCtx.addChild(new es3fIntegerStateQueryTests.DepthFuncTestCase('depth_func', 'DEPTH_FUNC')); 1758 testCtx.addChild(new es3fIntegerStateQueryTests.CullFaceTestCase('cull_face_mode', 'CULL_FACE_MODE')); 1759 testCtx.addChild(new es3fIntegerStateQueryTests.FrontFaceTestCase('front_face_mode', 'FRONT_FACE')); 1760 testCtx.addChild(new es3fIntegerStateQueryTests.ViewPortTestCase('viewport', 'VIEWPORT')); 1761 testCtx.addChild(new es3fIntegerStateQueryTests.ScissorBoxTestCase('scissor_box', 'SCISSOR_BOX')); 1762 testCtx.addChild(new es3fIntegerStateQueryTests.MaxViewportDimsTestCase('max_viewport_dims', 'MAX_VIEWPORT_DIMS')); 1763 testCtx.addChild(new es3fIntegerStateQueryTests.StencilRefTestCase('stencil_ref', 'STENCIL_REF', gl.STENCIL_REF)); 1764 testCtx.addChild(new es3fIntegerStateQueryTests.StencilRefTestCase('stencil_back_ref', 'STENCIL_BACK_REF', gl.STENCIL_BACK_REF)); 1765 testCtx.addChild(new es3fIntegerStateQueryTests.StencilRefSeparateTestCase('stencil_ref_separate', 'STENCIL_REF (separate)', gl.STENCIL_REF, gl.FRONT)); 1766 testCtx.addChild(new es3fIntegerStateQueryTests.StencilRefSeparateTestCase('stencil_ref_separate_both', 'STENCIL_REF (separate)', gl.STENCIL_REF, gl.FRONT_AND_BACK)); 1767 testCtx.addChild(new es3fIntegerStateQueryTests.StencilRefSeparateTestCase('stencil_back_ref_separate', 'STENCIL_BACK_REF (separate)', gl.STENCIL_BACK_REF, gl.BACK)); 1768 testCtx.addChild(new es3fIntegerStateQueryTests.StencilRefSeparateTestCase('stencil_back_ref_separate_both', 'STENCIL_BACK_REF (separate)', gl.STENCIL_BACK_REF, gl.FRONT_AND_BACK)); 1769 1770 /** 1771 * @struct 1772 * @constructor 1773 * @param {string} name 1774 * @param {string} frontDescription 1775 * @param {number} frontTarget 1776 * @param {string} backDescription 1777 * @param {number} backTarget 1778 */ 1779 var NamedStencilOp = function(name, frontDescription, frontTarget, backDescription, backTarget) { 1780 /** @type {string} */ this.name = name; 1781 /** @type {string} */ this.frontDescription = frontDescription; 1782 /** @type {number} */ this.frontTarget = frontTarget; 1783 /** @type {string} */ this.backDescription = backDescription; 1784 /** @type {number} */ this.backTarget = backTarget; 1785 }; 1786 1787 /** @type {Array<NamedStencilOp>} */ var stencilOps = [ 1788 new NamedStencilOp('fail', 'STENCIL_FAIL', gl.STENCIL_FAIL, 'STENCIL_BACK_FAIL', gl.STENCIL_BACK_FAIL), 1789 new NamedStencilOp('depth_fail', 'STENCIL_PASS_DEPTH_FAIL', gl.STENCIL_PASS_DEPTH_FAIL, 'STENCIL_BACK_PASS_DEPTH_FAIL', gl.STENCIL_BACK_PASS_DEPTH_FAIL), 1790 new NamedStencilOp('depth_pass', 'STENCIL_PASS_DEPTH_PASS', gl.STENCIL_PASS_DEPTH_PASS, 'STENCIL_BACK_PASS_DEPTH_PASS', gl.STENCIL_BACK_PASS_DEPTH_PASS) 1791 ]; 1792 1793 for (var testNdx = 0; testNdx < stencilOps.length; testNdx++) { 1794 testCtx.addChild(new es3fIntegerStateQueryTests.StencilOpTestCase('stencil_' + stencilOps[testNdx].name, stencilOps[testNdx].frontDescription, stencilOps[testNdx].frontTarget)); 1795 testCtx.addChild(new es3fIntegerStateQueryTests.StencilOpTestCase('stencil_back_' + stencilOps[testNdx].name, stencilOps[testNdx].backDescription, stencilOps[testNdx].backTarget)); 1796 1797 testCtx.addChild(new es3fIntegerStateQueryTests.StencilOpSeparateTestCase('stencil_' + stencilOps[testNdx].name + '_separate_both', stencilOps[testNdx].frontDescription, stencilOps[testNdx].frontTarget, gl.FRONT_AND_BACK)); 1798 testCtx.addChild(new es3fIntegerStateQueryTests.StencilOpSeparateTestCase('stencil_back_' + stencilOps[testNdx].name + '_separate_both', stencilOps[testNdx].backDescription, stencilOps[testNdx].backTarget, gl.FRONT_AND_BACK)); 1799 1800 testCtx.addChild(new es3fIntegerStateQueryTests.StencilOpSeparateTestCase('stencil_' + stencilOps[testNdx].name + '_separate', stencilOps[testNdx].frontDescription, stencilOps[testNdx].frontTarget, gl.FRONT)); 1801 testCtx.addChild(new es3fIntegerStateQueryTests.StencilOpSeparateTestCase('stencil_back_' + stencilOps[testNdx].name + '_separate', stencilOps[testNdx].backDescription, stencilOps[testNdx].backTarget, gl.BACK)); 1802 } 1803 1804 testCtx.addChild(new es3fIntegerStateQueryTests.StencilFuncTestCase('stencil_func', 'STENCIL_FUNC')); 1805 testCtx.addChild(new es3fIntegerStateQueryTests.StencilFuncSeparateTestCase('stencil_func_separate', 'STENCIL_FUNC (separate)', gl.STENCIL_FUNC, gl.FRONT)); 1806 testCtx.addChild(new es3fIntegerStateQueryTests.StencilFuncSeparateTestCase('stencil_func_separate_both', 'STENCIL_FUNC (separate)', gl.STENCIL_FUNC, gl.FRONT_AND_BACK)); 1807 testCtx.addChild(new es3fIntegerStateQueryTests.StencilFuncSeparateTestCase('stencil_back_func_separate', 'STENCIL_FUNC (separate)', gl.STENCIL_BACK_FUNC, gl.BACK)); 1808 testCtx.addChild(new es3fIntegerStateQueryTests.StencilFuncSeparateTestCase('stencil_back_func_separate_both', 'STENCIL_FUNC (separate)', gl.STENCIL_BACK_FUNC, gl.FRONT_AND_BACK)); 1809 testCtx.addChild(new es3fIntegerStateQueryTests.StencilMaskTestCase('stencil_value_mask', 'STENCIL_VALUE_MASK', gl.STENCIL_VALUE_MASK)); 1810 testCtx.addChild(new es3fIntegerStateQueryTests.StencilMaskTestCase('stencil_back_value_mask', 'STENCIL_BACK_VALUE_MASK', gl.STENCIL_BACK_VALUE_MASK)); 1811 testCtx.addChild(new es3fIntegerStateQueryTests.StencilMaskSeparateTestCase('stencil_value_mask_separate', 'STENCIL_VALUE_MASK (separate)', gl.STENCIL_VALUE_MASK, gl.FRONT)); 1812 testCtx.addChild(new es3fIntegerStateQueryTests.StencilMaskSeparateTestCase('stencil_value_mask_separate_both', 'STENCIL_VALUE_MASK (separate)', gl.STENCIL_VALUE_MASK, gl.FRONT_AND_BACK)); 1813 testCtx.addChild(new es3fIntegerStateQueryTests.StencilMaskSeparateTestCase('stencil_back_value_mask_separate', 'STENCIL_BACK_VALUE_MASK (separate)', gl.STENCIL_BACK_VALUE_MASK, gl.BACK)); 1814 testCtx.addChild(new es3fIntegerStateQueryTests.StencilMaskSeparateTestCase('stencil_back_value_mask_separate_both', 'STENCIL_BACK_VALUE_MASK (separate)', gl.STENCIL_BACK_VALUE_MASK, gl.FRONT_AND_BACK)); 1815 testCtx.addChild(new es3fIntegerStateQueryTests.StencilWriteMaskTestCase('stencil_writemask', 'STENCIL_WRITEMASK', gl.STENCIL_WRITEMASK)); 1816 testCtx.addChild(new es3fIntegerStateQueryTests.StencilWriteMaskTestCase('stencil_back_writemask', 'STENCIL_BACK_WRITEMASK', gl.STENCIL_BACK_WRITEMASK)); 1817 testCtx.addChild(new es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase('stencil_writemask_separate', 'STENCIL_WRITEMASK (separate)', gl.STENCIL_WRITEMASK, gl.FRONT)); 1818 testCtx.addChild(new es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase('stencil_writemask_separate_both', 'STENCIL_WRITEMASK (separate)', gl.STENCIL_WRITEMASK, gl.FRONT_AND_BACK)); 1819 testCtx.addChild(new es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase('stencil_back_writemask_separate', 'STENCIL_BACK_WRITEMASK (separate)', gl.STENCIL_BACK_WRITEMASK, gl.BACK)); 1820 testCtx.addChild(new es3fIntegerStateQueryTests.StencilWriteMaskSeparateTestCase('stencil_back_writemask_separate_both', 'STENCIL_BACK_WRITEMASK (separate)', gl.STENCIL_BACK_WRITEMASK, gl.FRONT_AND_BACK)); 1821 1822 /** 1823 * @struct 1824 * @constructor 1825 * @param {string} name 1826 * @param {string} description 1827 * @param {number} target 1828 * @param {number} initialValue 1829 */ 1830 var PixelStoreState = function(name, description, target, initialValue) { 1831 /** @type {string} */ this.name = name; 1832 /** @type {string} */ this.description = description; 1833 /** @type {number} */ this.target = target; 1834 /** @type {number} */ this.initialValue = initialValue; 1835 }; 1836 1837 /** @type {Array<PixelStoreState>} */ var pixelStoreStates = [ 1838 new PixelStoreState('unpack_image_height', 'UNPACK_IMAGE_HEIGHT', gl.UNPACK_IMAGE_HEIGHT, 0), 1839 new PixelStoreState('unpack_skip_images', 'UNPACK_SKIP_IMAGES', gl.UNPACK_SKIP_IMAGES, 0), 1840 new PixelStoreState('unpack_row_length', 'UNPACK_ROW_LENGTH', gl.UNPACK_ROW_LENGTH, 0), 1841 new PixelStoreState('unpack_skip_rows', 'UNPACK_SKIP_ROWS', gl.UNPACK_SKIP_ROWS, 0), 1842 new PixelStoreState('unpack_skip_pixels', 'UNPACK_SKIP_PIXELS', gl.UNPACK_SKIP_PIXELS, 0), 1843 new PixelStoreState('pack_row_length', 'PACK_ROW_LENGTH', gl.PACK_ROW_LENGTH, 0), 1844 new PixelStoreState('pack_skip_rows', 'PACK_SKIP_ROWS', gl.PACK_SKIP_ROWS, 0), 1845 new PixelStoreState('pack_skip_pixels', 'PACK_SKIP_PIXELS', gl.PACK_SKIP_PIXELS, 0) 1846 ]; 1847 1848 for (var testNdx = 0; testNdx < pixelStoreStates.length; testNdx++) 1849 testCtx.addChild(new es3fIntegerStateQueryTests.PixelStoreTestCase(pixelStoreStates[testNdx].name, pixelStoreStates[testNdx].description, pixelStoreStates[testNdx].target, pixelStoreStates[testNdx].initialValue)); 1850 1851 testCtx.addChild(new es3fIntegerStateQueryTests.PixelStoreAlignTestCase('unpack_alignment', 'UNPACK_ALIGNMENT', gl.UNPACK_ALIGNMENT)); 1852 testCtx.addChild(new es3fIntegerStateQueryTests.PixelStoreAlignTestCase('pack_alignment', 'PACK_ALIGNMENT', gl.PACK_ALIGNMENT)); 1853 1854 /** 1855 * @struct 1856 * @constructor 1857 * @param {string} name 1858 * @param {string} description 1859 * @param {number} target 1860 * @param {number} initialValue 1861 */ 1862 var BlendColorState = function(name, description, target, initialValue) { 1863 /** @type {string} */ this.name = name; 1864 /** @type {string} */ this.description = description; 1865 /** @type {number} */ this.target = target; 1866 /** @type {number} */ this.initialValue = initialValue; 1867 }; 1868 1869 /** @type {Array<PixelStoreState>} */ var blendColorStates = [ 1870 new BlendColorState('blend_src_rgb', 'BLEND_SRC_RGB', gl.BLEND_SRC_RGB), 1871 new BlendColorState('blend_src_alpha', 'BLEND_SRC_ALPHA', gl.BLEND_SRC_ALPHA), 1872 new BlendColorState('blend_dst_rgb', 'BLEND_DST_RGB', gl.BLEND_DST_RGB), 1873 new BlendColorState('blend_dst_alpha', 'BLEND_DST_ALPHA', gl.BLEND_DST_ALPHA) 1874 ]; 1875 1876 for (var testNdx = 0; testNdx < blendColorStates.length; testNdx++) { 1877 testCtx.addChild(new es3fIntegerStateQueryTests.BlendFuncTestCase(blendColorStates[testNdx].name, blendColorStates[testNdx].description, blendColorStates[testNdx].target)); 1878 testCtx.addChild(new es3fIntegerStateQueryTests.BlendFuncSeparateTestCase(blendColorStates[testNdx].name + '_separate', blendColorStates[testNdx].description, blendColorStates[testNdx].target)); 1879 } 1880 1881 /** 1882 * @struct 1883 * @constructor 1884 * @param {string} name 1885 * @param {string} description 1886 * @param {number} target 1887 * @param {number} initialValue 1888 */ 1889 var BlendEquationState = function(name, description, target, initialValue) { 1890 /** @type {string} */ this.name = name; 1891 /** @type {string} */ this.description = description; 1892 /** @type {number} */ this.target = target; 1893 /** @type {number} */ this.initialValue = initialValue; 1894 }; 1895 1896 /** @type {Array<PixelStoreState>} */ var blendEquationStates = [ 1897 new BlendEquationState('blend_equation_rgb', 'BLEND_EQUATION_RGB', gl.BLEND_EQUATION_RGB, gl.FUNC_ADD), 1898 new BlendEquationState('blend_equation_alpha', 'BLEND_EQUATION_ALPHA', gl.BLEND_EQUATION_ALPHA, gl.FUNC_ADD) 1899 ]; 1900 1901 for (var testNdx = 0; testNdx < blendEquationStates.length; testNdx++) { 1902 testCtx.addChild(new es3fIntegerStateQueryTests.BlendEquationTestCase(blendEquationStates[testNdx].name, blendEquationStates[testNdx].description, blendEquationStates[testNdx].target, blendEquationStates[testNdx].initialValue)); 1903 testCtx.addChild(new es3fIntegerStateQueryTests.BlendEquationSeparateTestCase(blendEquationStates[testNdx].name + '_separate', blendEquationStates[testNdx].description, blendEquationStates[testNdx].target, blendEquationStates[testNdx].initialValue)); 1904 } 1905 1906 /** 1907 * @struct 1908 * @constructor 1909 * @param {string} name 1910 * @param {string} description 1911 * @param {number} target 1912 * @param {number} minValue 1913 */ 1914 var ImplementationArrayReturningState = function(name, description, target, minValue) { 1915 /** @type {string} */ this.name = name; 1916 /** @type {string} */ this.description = description; 1917 /** @type {number} */ this.target = target; 1918 /** @type {number} */ this.minValue = minValue; 1919 }; 1920 1921 /** @type {ImplementationArrayReturningState} */ var implementationArrayReturningStates = new ImplementationArrayReturningState('compressed_texture_formats', 'COMPRESSED_TEXTURE_FORMATS', gl.COMPRESSED_TEXTURE_FORMATS, 10); 1922 1923 testCtx.addChild(new es3fIntegerStateQueryTests.ImplementationArrayTestCase(implementationArrayReturningStates.name, implementationArrayReturningStates.description, implementationArrayReturningStates.target, implementationArrayReturningStates.minValue)); 1924 1925 /** 1926 * @struct 1927 * @constructor 1928 * @param {string} name 1929 * @param {string} description 1930 * @param {number} target 1931 * @param {number} type 1932 */ 1933 var BufferBindingState = function(name, description, target, type) { 1934 /** @type {string} */ this.name = name; 1935 /** @type {string} */ this.description = description; 1936 /** @type {number} */ this.target = target; 1937 /** @type {number} */ this.type = type; 1938 }; 1939 1940 /** @type {Array<BufferBindingState>} */ var bufferBindingStates = [ 1941 new BufferBindingState('array_buffer_binding', 'ARRAY_BUFFER_BINDING', gl.ARRAY_BUFFER_BINDING, gl.ARRAY_BUFFER), 1942 new BufferBindingState('uniform_buffer_binding', 'UNIFORM_BUFFER_BINDING', gl.UNIFORM_BUFFER_BINDING, gl.UNIFORM_BUFFER), 1943 new BufferBindingState('pixel_pack_buffer_binding', 'PIXEL_PACK_BUFFER_BINDING', gl.PIXEL_PACK_BUFFER_BINDING, gl.PIXEL_PACK_BUFFER), 1944 new BufferBindingState('pixel_unpack_buffer_binding', 'PIXEL_UNPACK_BUFFER_BINDING', gl.PIXEL_UNPACK_BUFFER_BINDING, gl.PIXEL_UNPACK_BUFFER), 1945 new BufferBindingState('transform_feedback_buffer_binding', 'TRANSFORM_FEEDBACK_BUFFER_BINDING', gl.TRANSFORM_FEEDBACK_BUFFER_BINDING, gl.TRANSFORM_FEEDBACK_BUFFER), 1946 new BufferBindingState('copy_read_buffer_binding', 'COPY_READ_BUFFER_BINDING', gl.COPY_READ_BUFFER_BINDING, gl.COPY_READ_BUFFER), 1947 new BufferBindingState('copy_write_buffer_binding', 'COPY_WRITE_BUFFER_BINDING', gl.COPY_WRITE_BUFFER_BINDING, gl.COPY_WRITE_BUFFER) 1948 ]; 1949 1950 for (var testNdx = 0; testNdx < bufferBindingStates.length; testNdx++) 1951 testCtx.addChild(new es3fIntegerStateQueryTests.BufferBindingTestCase(bufferBindingStates[testNdx].name, bufferBindingStates[testNdx].description, bufferBindingStates[testNdx].target, bufferBindingStates[testNdx].type)); 1952 1953 testCtx.addChild(new es3fIntegerStateQueryTests.ElementArrayBufferBindingTestCase('element_array_buffer_binding')); 1954 testCtx.addChild(new es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase('transform_feedback_binding')); 1955 testCtx.addChild(new es3fIntegerStateQueryTests.TransformFeedbackBindingTestCase('transform_feedback_binding')); 1956 testCtx.addChild(new es3fIntegerStateQueryTests.CurrentProgramBindingTestCase('current_program_binding', 'CURRENT_PROGRAM')); 1957 testCtx.addChild(new es3fIntegerStateQueryTests.VertexArrayBindingTestCase('vertex_array_binding', 'VERTEX_ARRAY_BINDING')); 1958 testCtx.addChild(new es3fIntegerStateQueryTests.StencilClearValueTestCase('stencil_clear_value', 'STENCIL_CLEAR_VALUE')); 1959 testCtx.addChild(new es3fIntegerStateQueryTests.ActiveTextureTestCase('active_texture', 'ACTIVE_TEXTURE')); 1960 testCtx.addChild(new es3fIntegerStateQueryTests.RenderbufferBindingTestCase('renderbuffer_binding', 'RENDERBUFFER_BINDING')); 1961 testCtx.addChild(new es3fIntegerStateQueryTests.SamplerObjectBindingTestCase('sampler_binding', 'SAMPLER_BINDING')); 1962 1963 /** 1964 * @struct 1965 * @constructor 1966 * @param {string} name 1967 * @param {string} description 1968 * @param {number} target 1969 * @param {number} type 1970 */ 1971 var TextureBinding = function(name, description, target, type) { 1972 /** @type {string} */ this.name = name; 1973 /** @type {string} */ this.description = description; 1974 /** @type {number} */ this.target = target; 1975 /** @type {number} */ this.type = type; 1976 }; 1977 1978 /** @type {Array<TextureBinding>} */ var textureBindings = [ 1979 new TextureBinding('texture_binding_2d', 'TEXTURE_BINDING_2D', gl.TEXTURE_BINDING_2D, gl.TEXTURE_2D), 1980 new TextureBinding('texture_binding_3d', 'TEXTURE_BINDING_3D', gl.TEXTURE_BINDING_3D, gl.TEXTURE_3D), 1981 new TextureBinding('texture_binding_2d_array', 'TEXTURE_BINDING_2D_ARRAY', gl.TEXTURE_BINDING_2D_ARRAY, gl.TEXTURE_2D_ARRAY), 1982 new TextureBinding('texture_binding_cube_map', 'TEXTURE_BINDING_CUBE_MAP', gl.TEXTURE_BINDING_CUBE_MAP, gl.TEXTURE_CUBE_MAP) 1983 ]; 1984 1985 for (var testNdx = 0; testNdx < textureBindings.length; testNdx++) 1986 testCtx.addChild(new es3fIntegerStateQueryTests.TextureBindingTestCase(textureBindings[testNdx].name, textureBindings[testNdx].description, textureBindings[testNdx].target, textureBindings[testNdx].type)); 1987 1988 testCtx.addChild(new es3fIntegerStateQueryTests.FrameBufferBindingTestCase('framebuffer_binding', 'DRAW_FRAMEBUFFER_BINDING and READ_FRAMEBUFFER_BINDING')); 1989 testCtx.addChild(new es3fIntegerStateQueryTests.ImplementationColorReadTestCase('implementation_color_read', 'IMPLEMENTATION_COLOR_READ_TYPE and IMPLEMENTATION_COLOR_READ_FORMAT')); 1990 testCtx.addChild(new es3fIntegerStateQueryTests.ReadBufferCase('read_buffer', 'READ_BUFFER')); 1991 testCtx.addChild(new es3fIntegerStateQueryTests.DrawBufferCase('draw_buffer', 'DRAW_BUFFER')); 1992 1993 1994 // Integer64 1995 /** 1996 * @struct 1997 * @constructor 1998 * @param {string} name 1999 * @param {string} description 2000 * @param {number} targetName 2001 * @param {number} minValue 2002 */ 2003 var LimitedStateInteger64 = function(name, description, targetName, minValue) { 2004 /** @type {string} */ this.name = name; 2005 /** @type {string} */ this.description = description; 2006 /** @type {number} */ this.targetName = targetName; 2007 /** @type {number} */ this.minValue = minValue; 2008 2009 }; 2010 2011 /** @type {Array<LimitedStateInteger64>} */ var implementationLimits = [ 2012 new LimitedStateInteger64('max_element_index', 'MAX_ELEMENT_INDEX', gl.MAX_ELEMENT_INDEX, 0x00FFFFFF), 2013 new LimitedStateInteger64('max_server_wait_timeout', 'MAX_SERVER_WAIT_TIMEOUT', gl.MAX_SERVER_WAIT_TIMEOUT, 0), 2014 new LimitedStateInteger64('max_uniform_block_size', 'MAX_UNIFORM_BLOCK_SIZE', gl.MAX_UNIFORM_BLOCK_SIZE, 16384) 2015 ]; 2016 2017 for (var testNdx = 0; testNdx < implementationLimits.length; testNdx++) 2018 this.addChild(new es3fIntegerStateQueryTests.ConstantMinimumValue64TestCase(implementationLimits[testNdx].name, implementationLimits[testNdx].description, implementationLimits[testNdx].targetName, implementationLimits[testNdx].minValue)); 2019 2020 this.addChild(new es3fIntegerStateQueryTests.MaxCombinedStageUniformComponentsCase('max_combined_vertex_uniform_components', 'MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS', gl.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, gl.MAX_VERTEX_UNIFORM_BLOCKS, gl.MAX_VERTEX_UNIFORM_COMPONENTS)); 2021 this.addChild(new es3fIntegerStateQueryTests.MaxCombinedStageUniformComponentsCase('max_combined_fragment_uniform_components', 'MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS', gl.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, gl.MAX_FRAGMENT_UNIFORM_BLOCKS, gl.MAX_FRAGMENT_UNIFORM_COMPONENTS)); 2022 2023 }; 2024 2025 /** 2026 * Run test 2027 * @param {WebGL2RenderingContext} context 2028 */ 2029 es3fIntegerStateQueryTests.run = function(context) { 2030 gl = context; 2031 //Set up Test Root parameters 2032 var state = tcuTestCase.runner; 2033 state.setRoot(new es3fIntegerStateQueryTests.IntegerStateQueryTests()); 2034 2035 //Set up name and description of this test series. 2036 setCurrentTestName(state.testCases.fullName()); 2037 description(state.testCases.getDescription()); 2038 2039 try { 2040 //Run test cases 2041 tcuTestCase.runTestCases(); 2042 } 2043 catch (err) { 2044 testFailedOptions('Failed to es3fIntegerStateQueryTests.run tests', false); 2045 tcuTestCase.runner.terminate(); 2046 } 2047 }; 2048 2049 });