tor-browser

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

es3fReadPixelTests.js (26374B)


      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.es3fReadPixelTests');
     23 goog.require('framework.common.tcuImageCompare');
     24 goog.require('framework.common.tcuRGBA');
     25 goog.require('framework.common.tcuTestCase');
     26 goog.require('framework.common.tcuTexture');
     27 goog.require('framework.common.tcuTextureUtil');
     28 goog.require('framework.delibs.debase.deRandom');
     29 goog.require('framework.delibs.debase.deString');
     30 goog.require('framework.opengl.gluShaderProgram');
     31 goog.require('framework.opengl.gluTextureUtil');
     32 
     33 goog.scope(function() {
     34    var es3fReadPixelTests = functional.gles3.es3fReadPixelTests;
     35    var tcuImageCompare = framework.common.tcuImageCompare;
     36    var tcuRGBA = framework.common.tcuRGBA;
     37    var tcuTestCase = framework.common.tcuTestCase;
     38    var tcuTexture = framework.common.tcuTexture;
     39    var tcuTextureUtil = framework.common.tcuTextureUtil;
     40    var deString = framework.delibs.debase.deString;
     41    var deRandom = framework.delibs.debase.deRandom;
     42    var gluTextureUtil = framework.opengl.gluTextureUtil;
     43    var gluShaderProgram = framework.opengl.gluShaderProgram;
     44 
     45    /**
     46     * @constructor
     47     * @extends {tcuTestCase.DeqpTest}
     48     * @param {string} name
     49     * @param {string} description
     50     * @param {boolean} chooseFormat
     51     * @param {number} alignment
     52     * @param {number} rowLength
     53     * @param {number} skipRows
     54     * @param {number} skipPixels
     55     * @param {number=} format
     56     * @param {number=} type
     57     */
     58    es3fReadPixelTests.ReadPixelsTest = function(name, description, chooseFormat, alignment, rowLength, skipRows, skipPixels, format, type) {
     59        tcuTestCase.DeqpTest.call(this, name, description);
     60 
     61        /** @type {number} */ this.m_seed = deString.deStringHash(name);
     62        /** @type {boolean} */ this.m_chooseFormat = chooseFormat;
     63        /** @type {number} */ this.m_alignment = alignment;
     64        /** @type {number} */ this.m_rowLength = rowLength;
     65        /** @type {number} */ this.m_skipRows = skipRows;
     66        /** @type {number} */ this.m_skipPixels = skipPixels;
     67        /** @type {number} */ this.m_format = format !== undefined ? format : gl.RGBA;
     68        /** @type {number} */ this.m_type = type !== undefined ? type : gl.UNSIGNED_BYTE;
     69 
     70        /** @const {number} */ this.m_width = 13;
     71        /** @const {number} */ this.m_height = 13;
     72    };
     73 
     74    es3fReadPixelTests.ReadPixelsTest.prototype = Object.create(tcuTestCase.DeqpTest.prototype);
     75    es3fReadPixelTests.ReadPixelsTest.prototype.constructor = es3fReadPixelTests.ReadPixelsTest;
     76 
     77    /**
     78     * @param {tcuTexture.Texture2D} reference
     79     */
     80    es3fReadPixelTests.ReadPixelsTest.prototype.render = function(reference) {
     81        var refType = /** @type {tcuTexture.ChannelType} */ (reference.getFormat().type);
     82        /** @type {number} */ var width = reference.getWidth();
     83        /** @type {number} */ var height = reference.getHeight();
     84        /** @return {tcuTexture.PixelBufferAccess} */ var level0 = reference.getLevel(0);
     85 
     86        // Create program
     87        /** @type {string} */ var vertexSource = '#version 300 es\n' +
     88            'in mediump vec2 i_coord;\n' +
     89            'void main (void)\n' +
     90            '{\n' +
     91            '\tgl_Position = vec4(i_coord, 0.0, 1.0);\n' +
     92            '}\n';
     93 
     94        /** @type {string} */ var fragmentSource = '#version 300 es\n';
     95 
     96        if (refType === tcuTexture.ChannelType.SIGNED_INT32)
     97            fragmentSource += 'layout(location = 0) out mediump ivec4 o_color;\n';
     98        else if (refType === tcuTexture.ChannelType.UNSIGNED_INT32)
     99            fragmentSource += 'layout(location = 0) out mediump uvec4 o_color;\n';
    100        else
    101            fragmentSource += 'layout(location = 0) out mediump vec4 o_color;\n';
    102 
    103        fragmentSource += 'void main (void)\n' +
    104            '{\n';
    105 
    106        if (refType === tcuTexture.ChannelType.UNSIGNED_INT32)
    107            fragmentSource += '\to_color = uvec4(0, 0, 0, 1000);\n';
    108        else if (refType === tcuTexture.ChannelType.SIGNED_INT32)
    109            fragmentSource += '\to_color = ivec4(0, 0, 0, 1000);\n';
    110        else
    111            fragmentSource += '\to_color = vec4(0.0, 0.0, 0.0, 1.0);\n';
    112 
    113        fragmentSource += '}\n';
    114 
    115        /** @type {gluShaderProgram.ShaderProgram} */ var program = new gluShaderProgram.ShaderProgram(gl, gluShaderProgram.makeVtxFragSources(vertexSource, fragmentSource));
    116 
    117        assertMsgOptions(program.isOk(), 'Program failed', false, true);
    118 
    119        gl.useProgram(program.getProgram());
    120 
    121        // Render
    122        /** @type {Array<number>} */ var coords = [
    123            -0.5, -0.5,
    124            0.5, -0.5,
    125            0.5, 0.5,
    126 
    127            0.5, 0.5,
    128            -0.5, 0.5,
    129            -0.5, -0.5
    130        ];
    131        /** @type {number} */ var coordLoc;
    132 
    133        coordLoc = gl.getAttribLocation(program.getProgram(), 'i_coord');
    134 
    135        gl.enableVertexAttribArray(coordLoc);
    136 
    137        /** @type {WebGLBuffer} */ var coordsGLBuffer = gl.createBuffer();
    138        gl.bindBuffer(gl.ARRAY_BUFFER, coordsGLBuffer);
    139        gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(coords), gl.STATIC_DRAW);
    140        gl.vertexAttribPointer(coordLoc, 2, gl.FLOAT, false, 0, 0);
    141 
    142        gl.drawArrays(gl.TRIANGLES, 0, 6);
    143        gl.disableVertexAttribArray(coordLoc);
    144 
    145        // Render reference
    146 
    147        /** @type {number} */ var coordX1 = Math.floor((-0.5 * width / 2.0) + width / 2.0);
    148        /** @type {number} */ var coordY1 = Math.floor((-0.5 * height / 2.0) + height / 2.0);
    149        /** @type {number} */ var coordX2 = Math.floor((0.5 * width / 2.0) + width / 2.0);
    150        /** @type {number} */ var coordY2 = Math.floor((0.5 * height / 2.0) + height / 2.0);
    151 
    152        for (var x = 0; x < width; x++) {
    153            if (x < coordX1 || x > coordX2)
    154                continue;
    155 
    156            for (var y = 0; y < height; y++) {
    157                if (y >= coordY1 && y <= coordY2) {
    158                    if (refType === tcuTexture.ChannelType.SIGNED_INT32)
    159                        level0.setPixelInt([0, 0, 0, 1000], x, y);
    160                    else if (refType === tcuTexture.ChannelType.UNSIGNED_INT32)
    161                        level0.setPixelInt([0, 0, 0, 1000], x, y);
    162                    else
    163                        level0.setPixel([0.0, 0.0, 0.0, 1.0], x, y);
    164                }
    165            }
    166        }
    167    };
    168 
    169    /**
    170     * @return {{format: tcuTexture.TextureFormat, pixelSize: number, align: boolean}}
    171     */
    172    es3fReadPixelTests.ReadPixelsTest.prototype.getFormatInfo = function() {
    173        if (this.m_chooseFormat) {
    174            this.m_format = /** @type {number} */ (gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT));
    175            this.m_type = /** @type {number} */ (gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE));
    176        }
    177 
    178        /** @type {tcuTexture.TextureFormat} */ var fmt = gluTextureUtil.mapGLTransferFormat(this.m_format, this.m_type);
    179        /** @type {boolean} */ var align_;
    180        switch (this.m_type) {
    181            case gl.BYTE:
    182            case gl.UNSIGNED_BYTE:
    183            case gl.SHORT:
    184            case gl.UNSIGNED_SHORT:
    185            case gl.INT:
    186            case gl.UNSIGNED_INT:
    187            case gl.FLOAT:
    188            case gl.HALF_FLOAT:
    189                align_ = true;
    190                break;
    191 
    192            case gl.UNSIGNED_SHORT_5_6_5:
    193            case gl.UNSIGNED_SHORT_4_4_4_4:
    194            case gl.UNSIGNED_SHORT_5_5_5_1:
    195            case gl.UNSIGNED_INT_2_10_10_10_REV:
    196            case gl.UNSIGNED_INT_10F_11F_11F_REV:
    197            case gl.UNSIGNED_INT_24_8:
    198            case gl.FLOAT_32_UNSIGNED_INT_24_8_REV:
    199            case gl.UNSIGNED_INT_5_9_9_9_REV:
    200                align_ = false;
    201                break;
    202 
    203            default:
    204                throw new Error('Unsupported format');
    205        }
    206 
    207        /** @type {number} */ var pxSize = fmt.getPixelSize();
    208 
    209        return {format: fmt, pixelSize: pxSize, align: align_};
    210    };
    211 
    212    /**
    213     * @param {tcuTexture.Texture2D} reference
    214     * @param {boolean} align
    215     * @param {number} pixelSize
    216     * @return {goog.TypedArray}
    217     */
    218    es3fReadPixelTests.ReadPixelsTest.prototype.clearColor = function(reference, align, pixelSize) {
    219        /** @type {number} */ var width = reference.getWidth();
    220        /** @type {number} */ var height = reference.getHeight();
    221        /** @return {tcuTexture.PixelBufferAccess} */ var level0 = reference.getLevel(0);
    222 
    223        /** @type {deRandom.Random} */ var rnd = new deRandom.Random(this.m_seed);
    224        /** @type {WebGLFramebuffer} */ var framebuffer;
    225        /** @type {WebGLRenderbuffer} */ var renderbuffer;
    226        /** @type {number} */ var red;
    227        /** @type {number} */ var green;
    228        /** @type {number} */ var blue;
    229        /** @type {number} */ var alpha;
    230        /** @type {Array<number>} */ var color;
    231 
    232        if (this.m_format === gl.RGBA_INTEGER) {
    233            if (this.m_type === gl.UNSIGNED_INT) {
    234                renderbuffer = gl.createRenderbuffer();
    235                gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
    236                gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA32UI, this.m_width, this.m_height);
    237            } else if (this.m_type === gl.INT) {
    238                renderbuffer = gl.createRenderbuffer();
    239                gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
    240                gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA32I, this.m_width, this.m_height);
    241            } else
    242                throw new Error('Type not supported');
    243 
    244            gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
    245            framebuffer = gl.createFramebuffer();
    246            gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
    247            gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, renderbuffer);
    248        } else if (this.m_format === gl.RGBA || /*this.m_format === gl.BGRA ||*/ this.m_format === gl.RGB) {
    249            // Empty
    250        } else
    251            throw new Error('Format not supported');
    252 
    253        gl.viewport(0, 0, width, height);
    254 
    255        // Clear color
    256        if (this.m_format === gl.RGBA || this.m_format === gl.RGB) {
    257            red = rnd.getFloat();
    258            green = rnd.getFloat();
    259            blue = rnd.getFloat();
    260            alpha = rnd.getFloat();
    261 
    262            color = [red, green, blue, alpha];
    263            // Clear target
    264            gl.clearColor(red, green, blue, alpha);
    265            bufferedLogToConsole('ClearColor: (' + red + ', ' + green + ', ' + blue + ')');
    266 
    267            gl.clearBufferfv(gl.COLOR, 0, color);
    268 
    269            // Clear reference
    270            level0.clear(color);
    271        } else if (this.m_format === gl.RGBA_INTEGER) {
    272            if (this.m_type === gl.INT) {
    273                red = Math.abs(rnd.getInt());
    274                green = Math.abs(rnd.getInt());
    275                blue = Math.abs(rnd.getInt());
    276                alpha = Math.abs(rnd.getInt());
    277 
    278                color = [red, green, blue, alpha];
    279                bufferedLogToConsole('ClearColor: (' + red + ', ' + green + ', ' + blue + ')');
    280 
    281                gl.clearBufferiv(gl.COLOR, 0, color);
    282 
    283                // Clear reference
    284                level0.clear([red, green, blue, alpha]);
    285            } else if (this.m_type === gl.UNSIGNED_INT) {
    286                red = Math.abs(rnd.getInt());
    287                green = Math.abs(rnd.getInt());
    288                blue = Math.abs(rnd.getInt());
    289                alpha = Math.abs(rnd.getInt());
    290 
    291                color = [red, green, blue, alpha];
    292                bufferedLogToConsole('ClearColor: (' + red + ', ' + green + ', ' + blue + ')');
    293 
    294                gl.clearBufferuiv(gl.COLOR, 0, color);
    295 
    296                // Clear reference
    297                level0.clear(color);
    298            } else
    299                throw new Error('Type not supported.');
    300        } else
    301            throw new Error('Format not supported.');
    302 
    303        this.render(reference);
    304 
    305        /** @type {number} */ var rowWidth = (this.m_rowLength === 0 ? this.m_width : this.m_rowLength) + this.m_skipPixels;
    306        /** @type {number} */ var rowPitch = (align ? this.m_alignment * Math.ceil(pixelSize * rowWidth / this.m_alignment) : rowWidth * pixelSize);
    307 
    308        var arrayType = tcuTexture.getTypedArray(reference.getFormat().type);
    309        /** @type {goog.TypedArray} */ var pixelData = new arrayType(rowPitch * (this.m_height + this.m_skipRows));
    310        gl.readPixels(0, 0, this.m_width, this.m_height, this.m_format, this.m_type, pixelData);
    311 
    312        if (framebuffer)
    313            gl.deleteFramebuffer(framebuffer);
    314 
    315        if (renderbuffer)
    316            gl.deleteRenderbuffer(renderbuffer);
    317 
    318        return pixelData;
    319    };
    320 
    321    /**
    322     * @return {tcuTestCase.IterateResult}
    323     */
    324    es3fReadPixelTests.ReadPixelsTest.prototype.iterate = function() {
    325        /** @type {tcuTexture.TextureFormat} */ var format = new tcuTexture.TextureFormat(tcuTexture.ChannelOrder.RGBA, tcuTexture.ChannelType.UNORM_INT8);
    326        /** @type {number} */ var pixelSize;
    327        /** @type {boolean} */ var align;
    328 
    329        /** @type {{format: tcuTexture.TextureFormat, pixelSize: number, align: boolean}} */ var formatInfo = this.getFormatInfo();
    330        format = formatInfo.format;
    331        align = formatInfo.align;
    332        pixelSize = formatInfo.pixelSize;
    333 
    334        bufferedLogToConsole('Format: ' + this.m_format + ', Type: ' + this.m_type);
    335 
    336        /** @type {tcuTexture.Texture2D} */ var reference = new tcuTexture.Texture2D(format, this.m_width, this.m_height);
    337        reference.allocLevel(0);
    338        /** @return {tcuTexture.PixelBufferAccess} */ var level0 = reference.getLevel(0);
    339 
    340        this.m_alignment = /** @type {number} */ (gl.getParameter(gl.PACK_ALIGNMENT));
    341        bufferedLogToConsole('gl.PACK_ALIGNMENT: ' + this.m_alignment);
    342 
    343        this.m_rowLength = /** @type {number} */ (gl.getParameter(gl.PACK_ROW_LENGTH));
    344        bufferedLogToConsole('gl.PACK_ROW_LENGTH: ' + this.m_rowLength);
    345 
    346        this.m_skipRows = /** @type {number} */ (gl.getParameter(gl.PACK_SKIP_ROWS));
    347        bufferedLogToConsole('gl.PACK_SKIP_ROWS: ' + this.m_skipRows);
    348 
    349        this.m_skipPixels = /** @type {number} */ (gl.getParameter(gl.PACK_SKIP_PIXELS));
    350        bufferedLogToConsole('gl.PACK_SKIP_PIXELS: ' + this.m_skipPixels);
    351 
    352        gl.viewport(0, 0, this.m_width, this.m_height);
    353 
    354        /** @type {goog.TypedArray} */ var pixelData = this.clearColor(reference, align, pixelSize);
    355 
    356        /** @type {number} */ var rowWidth = (this.m_rowLength === 0 ? this.m_width : this.m_rowLength);
    357        /** @type {number} */ var rowPitch = (align ? this.m_alignment * Math.ceil(pixelSize * rowWidth / this.m_alignment) : rowWidth * pixelSize);
    358        /** @type {Array<number>} */ var formatBitDepths = [];
    359        /** @type {number} */ var redThreshold;
    360        /** @type {number} */ var greenThreshold;
    361        /** @type {number} */ var blueThreshold;
    362        /** @type {number} */ var alphaThreshold;
    363        var redBits = /** @type {number} */ (gl.getParameter(gl.RED_BITS));
    364        var blueBits = /** @type {number} */ (gl.getParameter(gl.BLUE_BITS));
    365        var greenBits = /** @type {number} */ (gl.getParameter(gl.GREEN_BITS));
    366        var alphaBits = /** @type {number} */ (gl.getParameter(gl.ALPHA_BITS));
    367        /** @type {(tcuRGBA.RGBA|Array<number>)} */ var threshold;
    368        /** @type {tcuTexture.PixelBufferAccess} */ var result;
    369        // \note gl.RGBA_INTEGER uses always renderbuffers that are never multisampled. Otherwise default framebuffer is used.
    370        if (this.m_format !== gl.RGBA_INTEGER && /** @type {number} */ (gl.getParameter(gl.SAMPLES)) > 1) {
    371            formatBitDepths = tcuTextureUtil.getTextureFormatBitDepth(format);
    372            redThreshold = Math.ceil(256.0 * (2.0 / (1 << Math.min(redBits, formatBitDepths[0]))));
    373            greenThreshold = Math.ceil(256.0 * (2.0 / (1 << Math.min(greenBits, formatBitDepths[1]))));
    374            blueThreshold = Math.ceil(256.0 * (2.0 / (1 << Math.min(blueBits, formatBitDepths[2]))));
    375            alphaThreshold = Math.ceil(256.0 * (2.0 / (1 << Math.min(alphaBits, formatBitDepths[3]))));
    376 
    377            result = tcuTexture.PixelBufferAccess.newFromTextureFormat(format, this.m_width, this.m_height, 1, rowPitch, 0, pixelData.buffer);
    378            threshold = new tcuRGBA.RGBA([redThreshold, greenThreshold, blueThreshold, alphaThreshold]);
    379            if (tcuImageCompare.bilinearCompare('Result', 'Result', level0, result, threshold))
    380                testPassedOptions('Pass', true);
    381            else
    382                testFailedOptions('Fail', false);
    383        } else {
    384            formatBitDepths = tcuTextureUtil.getTextureFormatBitDepth(format);
    385            redThreshold = 2.0 / (1 << Math.min(redBits, formatBitDepths[0]));
    386            greenThreshold = 2.0 / (1 << Math.min(greenBits, formatBitDepths[1]));
    387            blueThreshold = 2.0 / (1 << Math.min(blueBits, formatBitDepths[2]));
    388            alphaThreshold = 2.0 / (1 << Math.min(alphaBits, formatBitDepths[3]));
    389 
    390            // Compare
    391            result = new tcuTexture.PixelBufferAccess({
    392                format: format,
    393                width: this.m_width,
    394                height: this.m_height,
    395                rowPitch: rowPitch,
    396                data: pixelData.buffer,
    397                offset: pixelSize * this.m_skipPixels + this.m_skipRows * rowPitch
    398            });
    399 
    400            threshold = [redThreshold, greenThreshold, blueThreshold, alphaThreshold];
    401            if (tcuImageCompare.floatThresholdCompare('Result', 'Result', level0, result, threshold))
    402                testPassedOptions('Pass', true);
    403            else
    404                testFailedOptions('Fail', false);
    405        }
    406 
    407        return tcuTestCase.IterateResult.STOP;
    408    };
    409 
    410    /**
    411    * @constructor
    412    * @extends {tcuTestCase.DeqpTest}
    413    */
    414    es3fReadPixelTests.ReadPixelTests = function() {
    415        tcuTestCase.DeqpTest.call(this, 'read_pixels', 'ReadPixel tests');
    416    };
    417 
    418    es3fReadPixelTests.ReadPixelTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype);
    419    es3fReadPixelTests.ReadPixelTests.prototype.constructor = es3fReadPixelTests.ReadPixelTests;
    420 
    421    es3fReadPixelTests.ReadPixelTests.prototype.init = function() {
    422        /** @type {tcuTestCase.DeqpTest} */ var groupAlignment = tcuTestCase.newTest('alignment', 'Read pixels pack alignment parameter tests');
    423 
    424        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_1', '', false, 1, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    425        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_2', '', false, 2, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    426        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_4', '', false, 4, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    427        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_8', '', false, 8, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    428 
    429        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_1', '', false, 1, 0, 0, 0, gl.RGBA_INTEGER, gl.INT));
    430        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_2', '', false, 2, 0, 0, 0, gl.RGBA_INTEGER, gl.INT));
    431        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_4', '', false, 4, 0, 0, 0, gl.RGBA_INTEGER, gl.INT));
    432        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_8', '', false, 8, 0, 0, 0, gl.RGBA_INTEGER, gl.INT));
    433 
    434        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_1', '', false, 1, 0, 0, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    435        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_2', '', false, 2, 0, 0, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    436        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_4', '', false, 4, 0, 0, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    437        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_8', '', false, 8, 0, 0, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    438 
    439        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_1', '', true, 1, 0, 0, 0));
    440        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_2', '', true, 2, 0, 0, 0));
    441        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_4', '', true, 4, 0, 0, 0));
    442        groupAlignment.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_8', '', true, 8, 0, 0, 0));
    443 
    444        this.addChild(groupAlignment);
    445 
    446        /** @type {tcuTestCase.DeqpTest} */ var groupRowLength = tcuTestCase.newTest('rowlength', 'Read pixels rowlength test');
    447        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_17', '', false, 4, 17, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    448        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_19', '', false, 4, 19, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    449        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_23', '', false, 4, 23, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    450        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_29', '', false, 4, 29, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    451 
    452        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_17', '', false, 4, 17, 0, 0, gl.RGBA_INTEGER, gl.INT));
    453        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_19', '', false, 4, 19, 0, 0, gl.RGBA_INTEGER, gl.INT));
    454        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_23', '', false, 4, 23, 0, 0, gl.RGBA_INTEGER, gl.INT));
    455        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_29', '', false, 4, 29, 0, 0, gl.RGBA_INTEGER, gl.INT));
    456 
    457        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_17', '', false, 4, 17, 0, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    458        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_19', '', false, 4, 19, 0, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    459        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_23', '', false, 4, 23, 0, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    460        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_29', '', false, 4, 29, 0, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    461 
    462        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_17', '', true, 4, 17, 0, 0));
    463        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_19', '', true, 4, 19, 0, 0));
    464        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_23', '', true, 4, 23, 0, 0));
    465        groupRowLength.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_29', '', true, 4, 29, 0, 0));
    466 
    467        this.addChild(groupRowLength);
    468 
    469        /** @type {tcuTestCase.DeqpTest} */ var groupSkip = tcuTestCase.newTest('skip', 'Read pixels skip pixels and rows test');
    470        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_0_3', '', false, 4, 17, 0, 3, gl.RGBA, gl.UNSIGNED_BYTE));
    471        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_3_0', '', false, 4, 17, 3, 0, gl.RGBA, gl.UNSIGNED_BYTE));
    472        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_3_3', '', false, 4, 17, 3, 3, gl.RGBA, gl.UNSIGNED_BYTE));
    473        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_ubyte_3_5', '', false, 4, 17, 3, 5, gl.RGBA, gl.UNSIGNED_BYTE));
    474 
    475        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_0_3', '', false, 4, 17, 0, 3, gl.RGBA_INTEGER, gl.INT));
    476        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_3_0', '', false, 4, 17, 3, 0, gl.RGBA_INTEGER, gl.INT));
    477        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_3_3', '', false, 4, 17, 3, 3, gl.RGBA_INTEGER, gl.INT));
    478        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_int_3_5', '', false, 4, 17, 3, 5, gl.RGBA_INTEGER, gl.INT));
    479 
    480        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_0_3', '', false, 4, 17, 0, 3, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    481        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_3_0', '', false, 4, 17, 3, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    482        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_3_3', '', false, 4, 17, 3, 3, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    483        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('rgba_uint_3_5', '', false, 4, 17, 3, 5, gl.RGBA_INTEGER, gl.UNSIGNED_INT));
    484 
    485        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_0_3', '', true, 4, 17, 0, 3));
    486        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_3_0', '', true, 4, 17, 3, 0));
    487        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_3_3', '', true, 4, 17, 3, 3));
    488        groupSkip.addChild(new es3fReadPixelTests.ReadPixelsTest('choose_3_5', '', true, 4, 17, 3, 5));
    489 
    490        this.addChild(groupSkip);
    491    };
    492 
    493    /**
    494    * Run test
    495    * @param {WebGL2RenderingContext} context
    496    */
    497    es3fReadPixelTests.run = function(context) {
    498        gl = context;
    499        //Set up Test Root parameters
    500        var state = tcuTestCase.runner;
    501        state.setRoot(new es3fReadPixelTests.ReadPixelTests());
    502 
    503        //Set up name and description of this test series.
    504        setCurrentTestName(state.testCases.fullName());
    505        description(state.testCases.getDescription());
    506 
    507        try {
    508            //Run test cases
    509            tcuTestCase.runTestCases();
    510        }
    511        catch (err) {
    512            testFailedOptions('Failed to es3fReadPixelTests.run tests', false);
    513            tcuTestCase.runner.terminate();
    514        }
    515    };
    516 
    517 });