tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

es3fDefaultVertexAttributeTests.js (20949B)


      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.es3fDefaultVertexAttributeTests');
     23 goog.require('framework.common.tcuLogImage');
     24 goog.require('framework.common.tcuSurface');
     25 goog.require('framework.common.tcuTestCase');
     26 goog.require('framework.delibs.debase.deMath');
     27 goog.require('framework.opengl.gluShaderProgram');
     28 goog.require('framework.opengl.gluShaderUtil');
     29 
     30 goog.scope(function() {
     31 var es3fDefaultVertexAttributeTests = functional.gles3.es3fDefaultVertexAttributeTests;
     32 var tcuTestCase = framework.common.tcuTestCase;
     33 var tcuSurface = framework.common.tcuSurface;
     34 var deMath = framework.delibs.debase.deMath;
     35 var gluShaderProgram = framework.opengl.gluShaderProgram;
     36 var gluShaderUtil = framework.opengl.gluShaderUtil;
     37 var tcuLogImage = framework.common.tcuLogImage;
     38 
     39 var setParentClass = function(child, parent) {
     40    child.prototype = Object.create(parent.prototype);
     41    child.prototype.constructor = child;
     42 };
     43 
     44 /**
     45 * @constructor
     46 */
     47 es3fDefaultVertexAttributeTests.LoaderVertexAttrib1f = function() {
     48    this.caseName = 'vertex_attrib_1f';
     49    this.name = 'VertexAttrib1f';
     50    this.signed = true;
     51    this.load = function(index, value) {
     52        gl.vertexAttrib1f(index, value[0]);
     53        return [value[0], 0, 0, 1];
     54    };
     55 };
     56 
     57 /**
     58 * @constructor
     59 */
     60 es3fDefaultVertexAttributeTests.LoaderVertexAttrib2f = function() {
     61    this.caseName = 'vertex_attrib_2f';
     62    this.name = 'VertexAttrib2f';
     63    this.signed = true;
     64    this.load = function(index, value) {
     65        gl.vertexAttrib2f(index, value[0], value[1]);
     66        return [value[0], value[1], 0, 1];
     67    };
     68 };
     69 
     70 /**
     71 * @constructor
     72 */
     73 es3fDefaultVertexAttributeTests.LoaderVertexAttrib3f = function() {
     74    this.caseName = 'vertex_attrib_3f';
     75    this.name = 'VertexAttrib3f';
     76    this.signed = true;
     77    this.load = function(index, value) {
     78        gl.vertexAttrib3f(index, value[0], value[1], value[2]);
     79        return [value[0], value[1], value[2], 1];
     80    };
     81 };
     82 
     83 /**
     84 * @constructor
     85 */
     86 es3fDefaultVertexAttributeTests.LoaderVertexAttrib4f = function() {
     87    this.caseName = 'vertex_attrib_4f';
     88    this.name = 'VertexAttrib4f';
     89    this.signed = true;
     90    this.load = function(index, value) {
     91        gl.vertexAttrib4f(index, value[0], value[1], value[2], value[3]);
     92        return [value[0], value[1], value[2], value[3]];
     93    };
     94 };
     95 
     96 /**
     97 * @constructor
     98 */
     99 es3fDefaultVertexAttributeTests.LoaderVertexAttrib1fv = function() {
    100    this.caseName = 'vertex_attrib_1fv';
    101    this.name = 'VertexAttrib1fv';
    102    this.signed = true;
    103    this.load = function(index, value) {
    104        gl.vertexAttrib1fv(index, value.slice(0, 1));
    105        return [value[0], 0, 0, 1];
    106    };
    107 };
    108 
    109 /**
    110 * @constructor
    111 */
    112 es3fDefaultVertexAttributeTests.LoaderVertexAttrib2fv = function() {
    113    this.caseName = 'vertex_attrib_2fv';
    114    this.name = 'VertexAttrib2fv';
    115    this.signed = true;
    116    this.load = function(index, value) {
    117        gl.vertexAttrib2fv(index, value.slice(0, 2));
    118        return [value[0], value[1], 0, 1];
    119    };
    120 };
    121 
    122 /**
    123 * @constructor
    124 */
    125 es3fDefaultVertexAttributeTests.LoaderVertexAttrib3fv = function() {
    126    this.caseName = 'vertex_attrib_3fv';
    127    this.name = 'VertexAttrib3fv';
    128    this.signed = true;
    129    this.load = function(index, value) {
    130        gl.vertexAttrib3fv(index, value.slice(0, 3));
    131        return [value[0], value[1], value[2], 1];
    132    };
    133 };
    134 
    135 /**
    136 * @constructor
    137 */
    138 es3fDefaultVertexAttributeTests.LoaderVertexAttrib4fv = function() {
    139    this.caseName = 'vertex_attrib_4fv';
    140    this.name = 'VertexAttrib4fv';
    141    this.signed = true;
    142    this.load = function(index, value) {
    143        gl.vertexAttrib4fv(index, value.slice(0, 4));
    144        return [value[0], value[1], value[2], value[3]];
    145    };
    146 };
    147 
    148 /**
    149 * @constructor
    150 */
    151 es3fDefaultVertexAttributeTests.LoaderVertexAttribI4i = function() {
    152    this.caseName = 'vertex_attrib_4i';
    153    this.name = 'VertexAttribI4i';
    154    this.signed = true;
    155    this.load = function(index, value) {
    156        var v = new Int32Array(value);
    157        gl.vertexAttribI4i(index, v[0], v[1], v[2], v[3]);
    158        return [v[0], v[1], v[2], v[3]];
    159    };
    160 };
    161 
    162 /**
    163 * @constructor
    164 */
    165 es3fDefaultVertexAttributeTests.LoaderVertexAttribI4iv = function() {
    166    this.caseName = 'vertex_attrib_4iv';
    167    this.name = 'VertexAttribI4iv';
    168    this.signed = true;
    169    this.load = function(index, value) {
    170        var v = new Int32Array(value);
    171        gl.vertexAttribI4iv(index, v);
    172        return [v[0], v[1], v[2], v[3]];
    173    };
    174 };
    175 
    176 /**
    177 * @constructor
    178 */
    179 es3fDefaultVertexAttributeTests.LoaderVertexAttribI4ui = function() {
    180    this.caseName = 'vertex_attrib_4ui';
    181    this.name = 'VertexAttribI4ui';
    182    this.signed = false;
    183    this.load = function(index, value) {
    184        var v = new Uint32Array(value);
    185        gl.vertexAttribI4ui(index, v[0], v[1], v[2], v[3]);
    186        return [v[0], v[1], v[2], v[3]];
    187    };
    188 };
    189 
    190 /**
    191 * @constructor
    192 */
    193 es3fDefaultVertexAttributeTests.LoaderVertexAttribI4uiv = function() {
    194    this.caseName = 'vertex_attrib_4uiv';
    195    this.name = 'VertexAttribI4uiv';
    196    this.signed = false;
    197    this.load = function(index, value) {
    198        var v = new Uint32Array(value);
    199        gl.vertexAttribI4uiv(index, v);
    200        return [v[0], v[1], v[2], v[3]];
    201    };
    202 };
    203 
    204 /** @const */ var RENDER_SIZE = 32;
    205 /** @const */ var s_valueRange = 10;
    206 /** @const */ var s_passThroughFragmentShaderSource = '#version 300 es\n' +
    207                                                        'layout(location = 0) out mediump vec4 fragColor;\n' +
    208                                                        'in mediump vec4 v_color;\n' +
    209                                                        'void main (void)\n' +
    210                                                        '{\n' +
    211                                                        ' fragColor = v_color;\n' +
    212                                                        '}\n';
    213 
    214 /**
    215 * @constructor
    216 * @extends {tcuTestCase.DeqpTest}
    217 */
    218 es3fDefaultVertexAttributeTests.AttributeCase = function(loaderType, dataType) {
    219    var loader = new loaderType();
    220    var name = loader.caseName;
    221    var description = 'Test ' + loader.name;
    222    tcuTestCase.DeqpTest.call(this, name, description);
    223    this.m_funcName = loader.name;
    224    this.m_useNegativeValues = loader.signed;
    225    this.m_dataType = dataType;
    226    this.m_allIterationsPassed = true;
    227    this.m_loader = loader;
    228    this.m_iteration = 0;
    229 };
    230 
    231 setParentClass(es3fDefaultVertexAttributeTests.AttributeCase, tcuTestCase.DeqpTest);
    232 
    233 es3fDefaultVertexAttributeTests.AttributeCase.prototype.init = function() {
    234    // log test info
    235 
    236    var maxRange = s_valueRange;
    237    var minRange = (this.m_useNegativeValues) ? (-maxRange) : (0.0);
    238 
    239    bufferedLogToConsole(
    240        'Loading attribute values using ' + this.m_funcName + '\n' +
    241        'Attribute type: ' + gluShaderUtil.getDataTypeName(this.m_dataType) + '\n' +
    242        'Attribute value range: [' + minRange + ', ' + maxRange + ']');
    243 
    244    // gen shader and base quad
    245 
    246    this.m_program = new gluShaderProgram.ShaderProgram(gl, gluShaderProgram.makeVtxFragSources(this.genVertexSource(), s_passThroughFragmentShaderSource));
    247    if (!this.m_program.isOk())
    248        testFailedOptions('could not build program', true);
    249 
    250    var fullscreenQuad = [
    251         1.0, 1.0, 0.0, 1.0,
    252         1.0, -1.0, 0.0, 1.0,
    253        -1.0, 1.0, 0.0, 1.0,
    254        -1.0, -1.0, 0.0, 1.0
    255    ];
    256 
    257    this.m_bufID = gl.createBuffer();
    258    gl.bindBuffer(gl.ARRAY_BUFFER, this.m_bufID);
    259    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(fullscreenQuad), gl.STATIC_DRAW);
    260 };
    261 
    262 es3fDefaultVertexAttributeTests.AttributeCase.prototype.deinit = function() {
    263    this.m_loader = null;
    264 
    265    gl.useProgram(null);
    266    this.m_program = null;
    267 
    268    if (this.m_bufID) {
    269        gl.deleteBuffer(this.m_bufID);
    270        this.m_bufID = null;
    271    }
    272 };
    273 
    274 es3fDefaultVertexAttributeTests.AttributeCase.prototype.iterate = function() {
    275    var testValues = [
    276        [0.0, 0.5, 0.2, 1.0],
    277        [0.1, 0.7, 1.0, 0.6],
    278        [0.4, 0.2, 0.0, 0.5],
    279        [0.5, 0.0, 0.9, 0.1],
    280        [0.6, 0.2, 0.2, 0.9],
    281        [0.9, 1.0, 0.0, 0.0],
    282        [1.0, 0.5, 0.3, 0.8]
    283    ];
    284 
    285    bufferedLogToConsole('Iteration ' + (this.m_iteration + 1) + '/' + testValues.length);
    286 
    287    var testValue = this.m_useNegativeValues ?
    288        deMath.subScalar(deMath.scale(testValues[this.m_iteration], 2), 1) :
    289        deMath.scale(testValues[this.m_iteration], s_valueRange);
    290 
    291    if (!this.renderWithValue(testValue))
    292        this.m_allIterationsPassed = false;
    293 
    294    // continue
    295 
    296    if (++this.m_iteration < testValues.length)
    297        return tcuTestCase.IterateResult.CONTINUE;
    298 
    299    if (this.m_allIterationsPassed)
    300        testPassed();
    301    else
    302        testFailed('Got unexpected values');
    303 
    304    return tcuTestCase.IterateResult.STOP;
    305 };
    306 
    307 es3fDefaultVertexAttributeTests.AttributeCase.prototype.genVertexSource = function() {
    308    var vectorSize = (gluShaderUtil.isDataTypeMatrix(this.m_dataType)) ? (gluShaderUtil.getDataTypeMatrixNumRows(this.m_dataType)) : (gluShaderUtil.isDataTypeVector(this.m_dataType)) ? (gluShaderUtil.getDataTypeScalarSize(this.m_dataType)) : (-1);
    309    var vectorType = gluShaderUtil.getDataTypeName((gluShaderUtil.isDataTypeMatrix(this.m_dataType)) ? (gluShaderUtil.getDataTypeVector(gluShaderUtil.DataType.FLOAT, vectorSize)) : (gluShaderUtil.isDataTypeVector(this.m_dataType)) ? (gluShaderUtil.getDataTypeVector(gluShaderUtil.DataType.FLOAT, vectorSize)) : (gluShaderUtil.DataType.FLOAT));
    310    var components = (gluShaderUtil.isDataTypeMatrix(this.m_dataType)) ? (gluShaderUtil.getDataTypeMatrixNumRows(this.m_dataType)) : (gluShaderUtil.getDataTypeScalarSize(this.m_dataType));
    311 
    312    var buf = '#version 300 es\n' +
    313            'in highp vec4 a_position;\n' +
    314            'in highp ' + gluShaderUtil.getDataTypeName(this.m_dataType) + ' a_value;\n' +
    315            'out highp vec4 v_color;\n' +
    316            'void main (void)\n' +
    317            '{\n' +
    318            ' gl_Position = a_position;\n' +
    319            '\n';
    320 
    321    buf += ' highp ' + vectorType + ' normalizedValue = ' + ((gluShaderUtil.getDataTypeScalarType(this.m_dataType) == gluShaderUtil.DataType.FLOAT) ? ('') : (vectorType)) + '(a_value' + ((gluShaderUtil.isDataTypeMatrix(this.m_dataType)) ? ('[1]') : ('')) + ') / float(' + s_valueRange + ');\n';
    322 
    323    if (this.m_useNegativeValues)
    324        buf += ' highp ' + vectorType + ' positiveNormalizedValue = (normalizedValue + ' + vectorType + '(1.0)) / 2.0;\n';
    325    else
    326        buf += ' highp ' + vectorType + ' positiveNormalizedValue = normalizedValue;\n';
    327 
    328    if (components == 1)
    329        buf += ' v_color = vec4(positiveNormalizedValue, 0.0, 0.0, 1.0);\n';
    330    else if (components == 2)
    331        buf += ' v_color = vec4(positiveNormalizedValue.xy, 0.0, 1.0);\n';
    332    else if (components == 3)
    333        buf += ' v_color = vec4(positiveNormalizedValue.xyz, 1.0);\n';
    334    else if (components == 4)
    335        buf += ' v_color = vec4((positiveNormalizedValue.xy + positiveNormalizedValue.zz) / 2.0, positiveNormalizedValue.w, 1.0);\n';
    336    else
    337       throw new Error('Wrong component size: ' + components);
    338 
    339    buf += '}\n';
    340 
    341    return buf;
    342 };
    343 
    344 es3fDefaultVertexAttributeTests.AttributeCase.prototype.renderWithValue = function(v) {
    345    var positionIndex = gl.getAttribLocation(this.m_program.getProgram(), 'a_position');
    346    var valueIndex = gl.getAttribLocation(this.m_program.getProgram(), 'a_value');
    347    var dest = new tcuSurface.Surface(RENDER_SIZE, RENDER_SIZE);
    348 
    349    gl.clearColor(0.0, 0.0, 0.0, 0.0);
    350    gl.clear(gl.COLOR_BUFFER_BIT);
    351    gl.viewport(0, 0, RENDER_SIZE, RENDER_SIZE);
    352 
    353    gl.bindBuffer(gl.ARRAY_BUFFER, this.m_bufID);
    354    gl.vertexAttribPointer(positionIndex, 4, gl.FLOAT, false, 0, 0);
    355    gl.enableVertexAttribArray(positionIndex);
    356 
    357    // transfer test value. Load to the second column in the matrix case
    358    var loadedValue = this.m_loader.load((gluShaderUtil.isDataTypeMatrix(this.m_dataType)) ? (valueIndex + 1) : (valueIndex), v);
    359 
    360    gl.useProgram(this.m_program.getProgram());
    361    gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
    362    gl.useProgram(null);
    363    // The original c++ test does not disable vertex attrib array, which is wrong.
    364    // On most drivers all tests pass because a_position is assigned location 0.
    365    // On MacOSX some tests fail because a_value is assigned location 0 and vertex
    366    // attrib array is left enabled and affects later tests.
    367    gl.disableVertexAttribArray(positionIndex);
    368    dest.readViewport(gl);
    369 
    370    // check whole result is colored correctly
    371    return this.verifyUnicoloredBuffer(dest, this.computeColor(loadedValue));
    372 };
    373 
    374 es3fDefaultVertexAttributeTests.AttributeCase.prototype.computeColor = function(value) {
    375    var normalizedValue = deMath.scale(value, 1 / s_valueRange);
    376    var positiveNormalizedValue = this.m_useNegativeValues ?
    377        deMath.scale(deMath.addScalar(normalizedValue, 1), 0.5) :
    378        normalizedValue;
    379    var components = (gluShaderUtil.isDataTypeMatrix(this.m_dataType)) ? (gluShaderUtil.getDataTypeMatrixNumRows(this.m_dataType)) : (gluShaderUtil.getDataTypeScalarSize(this.m_dataType));
    380 
    381    if (components == 1)
    382        return [positiveNormalizedValue[0], 0.0, 0.0, 1.0];
    383    else if (components == 2)
    384        return [positiveNormalizedValue[0], positiveNormalizedValue[1], 0.0, 1.0];
    385    else if (components == 3)
    386        return [positiveNormalizedValue[0], positiveNormalizedValue[1], positiveNormalizedValue[2], 1.0];
    387    else if (components == 4)
    388        return [(positiveNormalizedValue[0] + positiveNormalizedValue[2]) / 2.0, (positiveNormalizedValue[1] + positiveNormalizedValue[2]) / 2.0, positiveNormalizedValue[3], 1.0];
    389    else
    390       throw new Error('Wrong component size: ' + components);
    391 };
    392 
    393 /**
    394 * @param {tcuSurface.Surface} scene
    395 * @param {Array<number>} refColor
    396 * @return {boolean}
    397 */
    398 es3fDefaultVertexAttributeTests.AttributeCase.prototype.verifyUnicoloredBuffer = function(scene, refColor) {
    399    var access = scene.getAccess();
    400    var errorMask = new tcuSurface.Surface(RENDER_SIZE, RENDER_SIZE);
    401    var colorThreshold = [6, 6, 6, 6];
    402    var error = false;
    403 
    404    errorMask.getAccess().clear([0, 1, 0, 1]);
    405 
    406    bufferedLogToConsole('Verifying rendered image. Expecting color ' + refColor + ', threshold ' + colorThreshold);
    407 
    408    for (var y = 0; y < RENDER_SIZE; ++y)
    409    for (var x = 0; x < RENDER_SIZE; ++x) {
    410        var color = access.getPixel(x, y);
    411 
    412        if (Math.abs(color[0] - refColor[0]) > colorThreshold[0] ||
    413            Math.abs(color[1] - refColor[1]) > colorThreshold[1] ||
    414            Math.abs(color[2] - refColor[2]) > colorThreshold[2]) {
    415 
    416            // first error
    417            if (!error)
    418                debug('Found invalid pixel(s). Pixel at (' + x + ', ' + y + ') color: ' + color);
    419 
    420            error = true;
    421            errorMask.setPixel(x, y, [1, 0, 0, 1]);
    422        }
    423    }
    424 
    425    if (!error)
    426        bufferedLogToConsole('Rendered image is valid.');
    427    else {
    428        tcuLogImage.logImage('Result', '', access);
    429        tcuLogImage.logImage('Error mask', '', errorMask.getAccess());
    430    }
    431 
    432    return !error;
    433 };
    434 
    435 /**
    436 * @constructor
    437 * @extends {tcuTestCase.DeqpTest}
    438 */
    439 es3fDefaultVertexAttributeTests.DefaultVertexAttributeTests = function() {
    440    tcuTestCase.DeqpTest.call(this, 'default_vertex_attrib', 'Test default vertex attributes');
    441 };
    442 
    443 es3fDefaultVertexAttributeTests.DefaultVertexAttributeTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype);
    444 es3fDefaultVertexAttributeTests.DefaultVertexAttributeTests.prototype.constructor = es3fDefaultVertexAttributeTests.DefaultVertexAttributeTests;
    445 
    446 es3fDefaultVertexAttributeTests.DefaultVertexAttributeTests.prototype.init = function() {
    447    var tests = this;
    448    var floatTargets = [
    449        ['float', gluShaderUtil.DataType.FLOAT, false],
    450        ['vec2', gluShaderUtil.DataType.FLOAT_VEC2, true],
    451        ['vec3', gluShaderUtil.DataType.FLOAT_VEC3, true],
    452        ['vec4', gluShaderUtil.DataType.FLOAT_VEC4, false],
    453        ['mat2', gluShaderUtil.DataType.FLOAT_MAT2, true],
    454        ['mat2x3', gluShaderUtil.DataType.FLOAT_MAT2X3, true],
    455        ['mat2x4', gluShaderUtil.DataType.FLOAT_MAT2X4, true],
    456        ['mat3', gluShaderUtil.DataType.FLOAT_MAT3, true],
    457        ['mat3x2', gluShaderUtil.DataType.FLOAT_MAT3X2, true],
    458        ['mat3x4', gluShaderUtil.DataType.FLOAT_MAT3X4, true],
    459        ['mat4', gluShaderUtil.DataType.FLOAT_MAT4, false],
    460        ['mat4x2', gluShaderUtil.DataType.FLOAT_MAT4X2, true],
    461        ['mat4x3', gluShaderUtil.DataType.FLOAT_MAT4X3, true]
    462    ];
    463 
    464    floatTargets.forEach(function(elem) {
    465        var name = elem[0];
    466        var dataType = elem[1];
    467        var reduced = elem[2];
    468        var group = new tcuTestCase.DeqpTest(name, 'test with ' + name);
    469        tests.addChild(group);
    470        group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttrib1f, dataType));
    471        if (!reduced) {
    472            group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttrib2f, dataType));
    473            group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttrib3f, dataType));
    474        }
    475        group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttrib4f, dataType));
    476 
    477        group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttrib1fv, dataType));
    478        if (!reduced) {
    479            group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttrib2fv, dataType));
    480            group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttrib3fv, dataType));
    481        }
    482        group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttrib4fv, dataType));
    483 
    484    });
    485 
    486    var intTargets = [
    487        ['int', gluShaderUtil.DataType.INT, false],
    488        ['ivec2', gluShaderUtil.DataType.INT_VEC2, true],
    489        ['ivec3', gluShaderUtil.DataType.INT_VEC3, true],
    490        ['ivec4', gluShaderUtil.DataType.INT_VEC4, false]
    491    ];
    492 
    493   intTargets.forEach(function(elem) {
    494        var name = elem[0];
    495        var dataType = elem[1];
    496        var reduced = elem[2];
    497        var group = new tcuTestCase.DeqpTest(name, 'test with ' + name);
    498        tests.addChild(group);
    499        group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttribI4i, dataType));
    500        group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttribI4iv, dataType));
    501    });
    502 
    503    var uintTargets = [
    504        ['uint', gluShaderUtil.DataType.UINT, false],
    505        ['uvec2', gluShaderUtil.DataType.UINT_VEC2, true],
    506        ['uvec3', gluShaderUtil.DataType.UINT_VEC3, true],
    507        ['uvec4', gluShaderUtil.DataType.UINT_VEC4, false]
    508    ];
    509 
    510   uintTargets.forEach(function(elem) {
    511        var name = elem[0];
    512        var dataType = elem[1];
    513        var reduced = elem[2];
    514        var group = new tcuTestCase.DeqpTest(name, 'test with ' + name);
    515        tests.addChild(group);
    516        group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttribI4ui, dataType));
    517        group.addChild(new es3fDefaultVertexAttributeTests.AttributeCase(es3fDefaultVertexAttributeTests.LoaderVertexAttribI4uiv, dataType));
    518    });
    519 
    520 };
    521 
    522 /**
    523 * Run test
    524 * @param {WebGL2RenderingContext} context
    525 */
    526 es3fDefaultVertexAttributeTests.run = function(context) {
    527    gl = context;
    528    //Set up Test Root parameters
    529    var state = tcuTestCase.runner;
    530    state.setRoot(new es3fDefaultVertexAttributeTests.DefaultVertexAttributeTests());
    531 
    532    //Set up name and description of this test series.
    533    setCurrentTestName(state.testCases.fullName());
    534    description(state.testCases.getDescription());
    535 
    536    try {
    537        //Run test cases
    538        tcuTestCase.runTestCases();
    539    }
    540    catch (err) {
    541        testFailedOptions('Failed to es3fDefaultVertexAttributeTests.run tests', false);
    542        tcuTestCase.runner.terminate();
    543    }
    544 };
    545 
    546 });