stSize, dstSize, gl.RGBA, gl.UNSIGNED_BYTE, linearPixels1);
    }
    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "readpixels should succeed");

    // Compare
    var expectedSRGBColor = (readbufferFormat == gl.SRGB8_ALPHA8) ? color : wtu.linearToSRGB(color);
    var expectedLinearColor = (readbufferFormat == gl.SRGB8_ALPHA8) ? wtu.sRGBToLinear(color) : color;
    var failed = false;
    for (var ii = 0; ii < dstSize; ++ii) {
        for (var jj = 0; jj < dstSize; ++jj) {
            var index = (ii * dstSize + j