⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 179859 in webkit


Ignore:
Timestamp:
Feb 9, 2015, 5:02:28 PM (12 years ago)
Author:
roger_fong@apple.com
Message:

WebGL: Update 1.0.2 conformance layout tests and address new failure.
https://bugs.webkit.org/show_bug.cgi?id=141408.
<rdar://problem/19773236>

Reviewed by Dean Jackson.

Tests covered by updated 1.0.2 conformance tests.

  • html/canvas/WebGLRenderingContextBase.cpp:

Return null string instead of empty string if parameter validation fails.
(WebCore::WebGLRenderingContextBase::getProgramInfoLog):
(WebCore::WebGLRenderingContextBase::getShaderInfoLog):
(WebCore::WebGLRenderingContextBase::getShaderSource):

  • fast/canvas/webgl/bad-arguments-test-expected.txt: Removed.
  • fast/canvas/webgl/bad-arguments-test.html: Removed. Redundant test case.
  • webgl/1.0.2/resources/webgl_test_files/README.md:
  • webgl/1.0.2/resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/context/context-creation-and-destruction.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-compressed-texture-s3tc.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-debug-shaders.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-depth-texture.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/misc/bad-arguments-test.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/misc/webgl-specific.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/more/functions/uniformMatrixBadArgs.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/more/unit.js:
  • webgl/1.0.2/resources/webgl_test_files/conformance/more/util.js:

(VBO.prototype.use):

  • webgl/1.0.2/resources/webgl_test_files/conformance/rendering/multisample-corruption.html:
  • webgl/1.0.2/resources/webgl_test_files/conformance/resources/fragmentShader.frag:
  • webgl/1.0.2/resources/webgl_test_files/conformance/resources/glsl-generator.js:
  • webgl/1.0.2/resources/webgl_test_files/conformance/resources/vertexShader.vert:
  • webgl/1.0.2/resources/webgl_test_files/conformance/resources/webgl-test-utils.js:

(WebGLTestUtils):

  • webgl/1.0.2/resources/webgl_test_files/test-guidelines.md:
  • webgl/1.0.2/resources/webgl_test_files/webgl-conformance-tests.html:
Location:
trunk
Files:
2 deleted
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r179838 r179859  
     12015-02-09  Roger Fong  <roger_fong@apple.com>
     2
     3        WebGL: Update 1.0.2 conformance layout tests and address new failure.
     4        https://bugs.webkit.org/show_bug.cgi?id=141408.
     5        <rdar://problem/19773236>
     6
     7        Reviewed by Dean Jackson.
     8
     9        * fast/canvas/webgl/bad-arguments-test-expected.txt: Removed.
     10        * fast/canvas/webgl/bad-arguments-test.html: Removed. Redundant test case.
     11        * webgl/1.0.2/resources/webgl_test_files/README.md:
     12        * webgl/1.0.2/resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html:
     13        * webgl/1.0.2/resources/webgl_test_files/conformance/context/context-creation-and-destruction.html:
     14        * webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-compressed-texture-s3tc.html:
     15        * webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-debug-shaders.html:
     16        * webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-depth-texture.html:
     17        * webgl/1.0.2/resources/webgl_test_files/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html:
     18        * webgl/1.0.2/resources/webgl_test_files/conformance/misc/bad-arguments-test.html:
     19        * webgl/1.0.2/resources/webgl_test_files/conformance/misc/webgl-specific.html:
     20        * webgl/1.0.2/resources/webgl_test_files/conformance/more/functions/uniformMatrixBadArgs.html:
     21        * webgl/1.0.2/resources/webgl_test_files/conformance/more/unit.js:
     22        * webgl/1.0.2/resources/webgl_test_files/conformance/more/util.js:
     23        (VBO.prototype.use):
     24        * webgl/1.0.2/resources/webgl_test_files/conformance/rendering/multisample-corruption.html:
     25        * webgl/1.0.2/resources/webgl_test_files/conformance/resources/fragmentShader.frag:
     26        * webgl/1.0.2/resources/webgl_test_files/conformance/resources/glsl-generator.js:
     27        * webgl/1.0.2/resources/webgl_test_files/conformance/resources/vertexShader.vert:
     28        * webgl/1.0.2/resources/webgl_test_files/conformance/resources/webgl-test-utils.js:
     29        (WebGLTestUtils):
     30        * webgl/1.0.2/resources/webgl_test_files/test-guidelines.md:
     31        * webgl/1.0.2/resources/webgl_test_files/webgl-conformance-tests.html:
     32
    1332015-02-09  Jer Noble  <jer.noble@apple.com>
    234
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/README.md

    r157888 r179859  
    4444
    4545    minVersion:  Set to the minimum version of each test to include. Only tests
    46                  at this version or above will be inlcuded.
     46                 at this version or above will be included.
    4747
    4848                 Example: webgl-conformance-tests.html?minVersion=1.3.2
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/attribs/gl-disabled-vertex-attrib.html

    r157888 r179859  
    4545attribute vec4 a_color;
    4646varying vec4 v_color;
     47bool isCorrectColor(vec4 v) {
     48  return v.x == 0.0 && v.y == 0.0 && v.z == 0.0 && v.w == 1.0;
     49}
    4750void main() {
    4851  gl_Position = a_position;
    49   v_color = a_color;
     52  v_color = isCorrectColor(a_color) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
    5053}
    5154</script>
     
    5457precision mediump float;
    5558varying vec4 v_color;
    56 bool isCorrectColor(vec4 v) {
    57   return v.x == 0.0 && v.y == 0.0 && v.z == 0.0 && v.w == 1.0;
    58 }
    5959void main() {
    60   gl_FragColor = isCorrectColor(v_color) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
     60  gl_FragColor = v_color;
    6161}
    6262</script>
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/context/context-creation-and-destruction.html

    r157888 r179859  
    3333<link rel="stylesheet" href="../../resources/js-test-style.css"/>
    3434<script src="../../resources/js-test-pre.js"></script>
    35 <script src="../resources/webgl-test.js"> </script>
    3635<script src="../resources/webgl-test-utils.js"> </script>
     36<script src="../resources/iterable-test.js"> </script>
    3737</head>
    3838<body>
     
    4141<script>
    4242"use strict";
     43description();
     44
    4345var wtu = WebGLTestUtils;
    44 var target = 500;
    45 var count = 0;
    4646
    47 description();
    48 doNextTest();
    49 
    50 // Creates a canvas and a texture then exits. There are
    51 // no references to either so both should be garbage collected.
    52 function test() {
    53   var canvas = document.createElement("canvas");
    54   // This is safe for any device. See drawingBufferWidth in spec.
    55   canvas.width = 2048;
    56   canvas.height = 2048;
    57   var gl = wtu.create3DContext(canvas);
    58   var maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
    59   var size = Math.min(1024, maxTextureSize);
    60   var tex = gl.createTexture();
    61   gl.bindTexture(gl.TEXTURE_2D, tex);
    62   gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE,
    63                 new Uint8Array(size * size * 4));
    64   gl.clear(gl.COLOR_BUFFER_BIT);
    65   glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors");
    66 }
    67 
    68 function doNextTest() {
    69   ++count;
    70   debug("test " + count + " of " + target);
    71   test();
    72   if (count < target) {
    73     setTimeout(doNextTest, 100);
    74   } else {
    75     finishTest();
    76   }
    77 }
     47var test = IterableTest.createContextCreationAndDestructionTest();
     48var iterations = parseInt(wtu.getUrlOptions().iterations, 10) || 50;
     49IterableTest.run(test, iterations);
    7850
    7951var successfullyParsed = true;
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-compressed-texture-s3tc.html

    r157888 r179859  
    610610                    failed = true;
    611611                    var was = actual[actualOffset + 0].toString();
    612                     for (j = 1; j < 4; ++j) {
     612                    for (var j = 1; j < 4; ++j) {
    613613                        was += "," + actual[actualOffset + j];
    614614                    }
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-debug-shaders.html

    r157888 r179859  
    5656var info = null;
    5757var translatedSource;
     58var newTranslatedSource;
    5859
    5960if (!gl) {
     
    118119            // if no source has been defined or compileShader() has not been called,
    119120            // getTranslatedShaderSource() should return an empty string.
    120             shouldBeNull("ext.getTranslatedShaderSource(shader)");
     121            shouldBe("ext.getTranslatedShaderSource(shader)", '""');
    121122            gl.shaderSource(shader, info.source);
    122             shouldBeNull("ext.getTranslatedShaderSource(shader)");
     123            shouldBe("ext.getTranslatedShaderSource(shader)", '""');
    123124            gl.compileShader(shader);
    124125            shouldBeTrue("gl.getShaderParameter(shader, gl.COMPILE_STATUS)");
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/extensions/webgl-depth-texture.html

    r157888 r179859  
    274274        dumpIt(gl, res, "--depth--");
    275275
    276         // Check that each pixel's RGB are the same and that it's value is less
    277         // than the previous pixel in either direction. Basically verify we have a
    278         // gradient.
     276        // Check that each pixel's R value is less than that of the previous pixel
     277        // in either direction. Basically verify we have a gradient.
    279278        var success = true;
    280279        for (var yy = 0; yy < res; ++yy) {
     
    283282            var left = actual - 4;
    284283            var down = actual - res * 4;
    285 
    286             if (actualPixels[actual + 0] != actualPixels[actual + 1]) {
    287                 testFailed('R != G');
    288                 success = false;
    289             }
    290             if (actualPixels[actual + 0] != actualPixels[actual + 2]) {
    291                 testFailed('R != B');
    292                 success = false;
    293             }
    294             // ALPHA is implementation dependent
    295             if (actualPixels[actual + 3] != 0xFF && actualPixels[actual + 3] != actualPixels[actual + 0]) {
    296                 testFailed('A != 255 && A != R');
    297                 success = false;
    298             }
    299284
    300285            if (xx > 0) {
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/glsl/misc/shader-with-array-of-structs-containing-arrays.html

    r161247 r179859  
    110110var program = wtu.setupProgram(gl, ["vshader", "fshader-with-one-element-arrays"], ["a_position"]);
    111111var green_loc = gl.getUniformLocation(program, "u_colors[0].color[0]");
    112 var zeroth_color = gl.getUniformLocation(program, "u_colors[0].color");
    113 shouldBeTrue("zeroth_color != undefined");
    114112gl.uniform4fv(green_loc, [0, 1, 0, 1]);
    115113wtu.clearAndDrawUnitQuad(gl);
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/misc/bad-arguments-test.html

    r157888 r179859  
    7373
    7474for (var i = 0; i < testArguments.length; ++i) {
    75   var func, func2, func3;
     75  var func, func2;
    7676  if (testArguments[i].throws) {
    7777    func = shouldThrow;
    7878    func2 = shouldThrow;
    79     func3 = shouldThrow;
    8079  } else {
    8180    func = shouldBeUndefined;
    8281    func2 = shouldBeNull;
    83     func3 = shouldBeEmptyString;
    8482  }
    8583  argument = testArguments[i].value;
     
    103101  func("context.uniformMatrix2fv(argument, false, new Float32Array([0.0, 0.0, 0.0, 0.0]))");
    104102
     103  func2("context.getProgramInfoLog(argument)");
    105104  func2("context.getProgramParameter(argument, 0)");
     105  func2("context.getShaderInfoLog(argument)");
    106106  func2("context.getShaderParameter(argument, 0)");
     107  func2("context.getShaderSource(argument)");
    107108  func2("context.getUniform(argument, loc)");
    108109  func2("context.getUniform(program, argument)");
    109110  func2("context.getUniformLocation(argument, 'u_modelViewProjMatrix')");
    110111
    111   func3("context.getProgramInfoLog(argument)");
    112   func3("context.getShaderInfoLog(argument)");
    113   func3("context.getShaderSource(argument)");
    114112}
    115113
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/misc/webgl-specific.html

    r179482 r179859  
    9797shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
    9898
     99// Added in 1.0.3 version of spec.
     100// debug("");
     101// debug("Verify that IMPLEMENTATION_COLOR_READ_FORMAT and IMPLEMENTATION_COLOR_READ_TYPE are undefined");
     102// shouldBeUndefined(gl.IMPLEMENTATION_COLOR_READ_FORMAT);
     103// shouldBeUndefined(gl.IMPLEMENTATION_COLOR_READ_TYPE);
     104
    99105debug("");
    100106debug("Verify that *LENGTH are undefined");
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/more/functions/uniformMatrixBadArgs.html

    r157888 r179859  
    121121  var d = new Uint8Array(4);
    122122  gl.readPixels(0,0,1,1,gl.RGBA, gl.UNSIGNED_BYTE, d);
    123   assertArrayEquals([1,2,3,8], d);
     123  assertArrayEqualsWithEpsilon([1,2,3,8], d, [1,1,1,1]);
    124124  sh.destroy();
    125125}
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/more/unit.js

    r157888 r179859  
    389389  testPassed("assertArrayEquals", name, v, p);
    390390  return true;
     391}
     392
     393function assertArrayEqualsWithEpsilon(name, v, p, l) {
     394if (l == null) { l = p; p = v; v = name; name = null; }
     395if (!v) {
     396testFailed("assertArrayEqualsWithEpsilon: first array undefined", name, v, p);
     397return false;
     398}
     399if (!p) {
     400testFailed("assertArrayEqualsWithEpsilon: second array undefined", name, v, p);
     401return false;
     402}
     403if (!l) {
     404testFailed("assertArrayEqualsWithEpsilon: limit array undefined", name, v, p);
     405return false;
     406}
     407if (v.length != p.length) {
     408testFailed("assertArrayEqualsWithEpsilon", name, v, p, l);
     409return false;
     410}
     411if (v.length != l.length) {
     412testFailed("assertArrayEqualsWithEpsilon", name, v, p, l);
     413return false;
     414}
     415for (var ii = 0; ii < v.length; ++ii) {
     416if (Math.abs(v[ii]- p[ii])>l[ii]) {
     417testFailed("assertArrayEqualsWithEpsilon", name, v, p, l);
     418return false;
     419}
     420}
     421testPassed("assertArrayEqualsWithEpsilon", name, v, p, l);
     422return true;
    391423}
    392424
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/more/util.js

    r157888 r179859  
    842842    var gl = this.gl;
    843843    for (var i=0; i<arguments.length; i++) {
    844       if (arguments[i] == null) continue;
     844          if (arguments[i] == null || arguments[i] == -1) continue;
    845845      gl.bindBuffer(gl.ARRAY_BUFFER, this.vbos[i]);
    846846      gl.vertexAttribPointer(arguments[i], this.data[i].size, gl.FLOAT, false, 0, 0);
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/rendering/multisample-corruption.html

    r157888 r179859  
    3333    <link rel="stylesheet" href="../../resources/js-test-style.css"/>
    3434    <script src="../../resources/js-test-pre.js"></script>
    35     <script src="../resources/webgl-test.js"> </script>
    3635    <script src="../resources/webgl-test-utils.js"> </script>
     36    <script src="../resources/iterable-test.js"> </script>
    3737</head>
    3838<body>
     
    4040<div id="description"></div>
    4141<div id="console"></div>
    42     <script id="vshader" type="x-shader/x-vertex">
    43         attribute vec4 vPosition;
    44         void main()
    45         {
    46             gl_Position = vPosition;
    47         }
    48     </script>
    49 
    50     <script id="fshader" type="x-shader/x-fragment">
    51         void main()
    52         {
    53             gl_FragColor = vec4(0.0,0.0,0.0,0.0);
    54         }
    55     </script>
    56 
    5742    <script>
    5843        "use strict";
    59         function init()
    60         {
    61             description(document.title);
    6244
    63             var lastContext = null;
    64             var cycleCount = 0;
    65             var maxCycles = 100;
    66             var failed = false;
    67             var wtu = WebGLTestUtils;
    68             var gl = wtu.create3DContext("example", {antialias: true, preserveDrawingBuffer: true});
     45        description(document.title);
    6946
    70             gl.clearColor(1.0, 0.0, 0.0, 1.0);
    71             gl.clear(gl.COLOR_BUFFER_BIT);
     47        var wtu = WebGLTestUtils;
    7248
    73             var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["vPosition"]);
    74             var vertexObject = gl.createBuffer();
    75             gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
    76             gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,2.5,0, 1.5,1.5,0, 2.5,1.5,0 ]), gl.STATIC_DRAW);
    77             gl.enableVertexAttribArray(0);
    78             gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
     49        var gl = wtu.create3DContext("example", {antialias: true, preserveDrawingBuffer: true});
     50        var test = IterableTest.createMultisampleCorruptionTest(gl);
     51        var iterations = parseInt(wtu.getUrlOptions().iterations, 10) || 25;
     52        IterableTest.run(test, iterations);
    7953
    80             function cycleAndTest() {
    81                 var gl2 = wtu.create3DContext(null, {antialias: true});
    82 
    83                 gl2.canvas.width = gl2.canvas.height = 1024;
    84                 gl2.canvas.style.width = gl2.canvas.style.height = "1px";
    85                 document.body.appendChild(gl2.canvas);
    86 
    87                 gl2.clearColor(1.0, 0.0, 0.0, 1.0);
    88                 gl2.clear(gl2.COLOR_BUFFER_BIT);
    89 
    90                 if(lastContext) {
    91                     gl.drawArrays(gl.TRIANGLES, 0, 3);
    92                     var msg = "Should be red after loop " + cycleCount;
    93                     wtu.checkCanvasRectColor(gl,
    94                         0, 0, gl.canvas.width, gl.canvas.height,
    95                         [255, 0, 0, 255], null,
    96                         function() {
    97                             testPassed(msg);
    98                         },
    99                         function() {
    100                             testFailed(msg);
    101                             failed = true;
    102                         },
    103                     debug);
    104                     document.body.removeChild(lastContext.canvas);
    105                 }
    106 
    107                 lastContext = gl2;
    108                 cycleCount++;
    109 
    110                 if(cycleCount <= maxCycles && !failed) {
    111                     wtu.waitForComposite(gl2, cycleAndTest);
    112                 } else {
    113                     finishTest();
    114                 }
    115             }
    116 
    117             cycleAndTest();
    118        }
    119 
    120        init();
    121        var successfullyParsed = true;
     54        var successfullyParsed = true;
    12255    </script>
    12356
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/resources/fragmentShader.frag

    r165676 r179859  
    11/*
    2 Copyright (C) 2009 Apple Inc.  All rights reserved.
     2Copyright (C) 2009 Apple Computer, Inc.  All rights reserved.
    33
    44Redistribution and use in source and binary forms, with or without
     
    1111   documentation and/or other materials provided with the distribution.
    1212
    13 THIS SOFTWARE IS PROVIDED BY APPLE INC. AS IS AND ANY
     13THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. AS IS AND ANY
    1414EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1515IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16 PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
     16PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    1717CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1818EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/resources/glsl-generator.js

    r157888 r179859  
    253253  var gridRes = params.gridRes;
    254254  var vertexTolerance = params.tolerance || 0;
    255   var fragmentTolerance = vertexTolerance;
     255  var fragmentTolerance = params.tolerance || 1;
    256256  if ('fragmentTolerance' in params)
    257     fragmentTolerance = params.fragmentTolerance || 0;
     257    fragmentTolerance = params.fragmentTolerance;
    258258
    259259  description("Testing GLSL feature: " + params.feature);
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/resources/vertexShader.vert

    r165676 r179859  
    11/*
    2 Copyright (C) 2009 Apple Inc.  All rights reserved.
     2Copyright (C) 2009 Apple Computer, Inc.  All rights reserved.
    33
    44Redistribution and use in source and binary forms, with or without
     
    1111   documentation and/or other materials provided with the distribution.
    1212
    13 THIS SOFTWARE IS PROVIDED BY APPLE INC. AS IS AND ANY
     13THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. AS IS AND ANY
    1414EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1515IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16 PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
     16PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    1717CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1818EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/resources/webgl-test-utils.js

    r161383 r179859  
    2929 */
    3030var log = function(msg) {
     31  if (window.console && window.console.log) {
     32    window.console.log(msg);
     33  }
    3134};
    3235
     
    3639 */
    3740var error = function(msg) {
     41  if (window.console) {
     42    if (window.console.error) {
     43      window.console.error(msg);
     44    }
     45    else if (window.console.log) {
     46      window.console.log(msg);
     47    }
     48  }
    3849};
    3950
     
    840851 *        is different than color
    841852 * @param {!function()} logFn Function to call for logging.
    842  */
    843 var checkCanvasRectColor = function(gl, x, y, width, height, color, opt_errorRange, sameFn, differentFn, logFn) {
     853 * @param {Uint8Array} opt_readBackBuf typically passed to reuse existing
     854 *        buffer while reading back pixels.
     855 */
     856var checkCanvasRectColor = function(gl, x, y, width, height, color, opt_errorRange, sameFn, differentFn, logFn, opt_readBackBuf) {
    844857  var errorRange = opt_errorRange || 0;
    845858  if (!errorRange.length) {
     
    848861  var buf;
    849862  if (gl instanceof WebGLRenderingContext) {
    850     buf = new Uint8Array(width * height * 4);
     863    buf = opt_readBackBuf ? opt_readBackBuf : new Uint8Array(width * height * 4);
    851864    gl.readPixels(x, y, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    852865  } else {
     
    967980    }
    968981  }
     982};
     983
     984/**
     985 * Returns a map of URL querystring options
     986 * @return {Object?} Object containing all the values in the URL querystring
     987 */
     988var getUrlOptions = function() {
     989  var options = {};
     990  var s = window.location.href;
     991  var q = s.indexOf("?");
     992  var e = s.indexOf("#");
     993  if (e < 0) {
     994    e = s.length;
     995  }
     996  var query = s.substring(q + 1, e);
     997  var pairs = query.split("&");
     998  for (var ii = 0; ii < pairs.length; ++ii) {
     999    var keyValue = pairs[ii].split("=");
     1000    var key = keyValue[0];
     1001    var value = decodeURIComponent(keyValue[1]);
     1002    options[key] = value;
     1003  }
     1004
     1005  return options;
    9691006};
    9701007
     
    19892026  getSupportedExtensionWithKnownPrefixes: getSupportedExtensionWithKnownPrefixes,
    19902027  getUrlArguments: getUrlArguments,
     2028  getUrlOptions: getUrlOptions,
    19912029  getAttribMap: getAttribMap,
    19922030  getUniformMap: getUniformMap,
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/test-guidelines.md

    r157888 r179859  
    22===============================================
    33
    4 Thank you for contibuting to the WebGL conformance tests.
     4Thank you for contributing to the WebGL conformance tests.
    55Please try to follow these guidelines when submitting a test.
    66
     
    4444
    4545    Ideally, copy an existing test and modify it for your new test. Try not to duplicate
    46     code that already exists where approriate. In particular
     46    code that already exists where appropriate. In particular
    4747
    4848    *   use the functions in WebGLTestUtils rather than duplicating functionality.
     
    9292
    9393        *    If you need to wait for a composite call `WebGLTestUtils.waitForComposite`.
    94              As compositing is a browser specfic thing this provides a central place to
     94             As compositing is a browser specific thing this provides a central place to
    9595             update all tests that rely on compositing to function.
    9696
     
    134134
    135135            Remember the tests need to run without timing out even and slow mobile devices.
    136             The harness resets the timeout timer everytime a test reports success or failure
     136            The harness resets the timeout timer every time a test reports success or failure
    137137            so as long as some part of your test calls `testPassed` or `testFailed` or one of the
    138138            many wrappers (`shouldXXX`, `glErrorShouldBe`, `WebGLTestUtils.checkCanvasXXX`, etc..)
    139139            every so often the harness will not timeout your test.
    140140
    141         *   The test harness requries the global variable `successfullyParse` to be set to true.
     141        *   The test harness requires the global variable `successfullyParse` to be set to true.
    142142            This usually appears at the end of a file.
    143143
    144144                var successfullyParsed = true;
    145145
    146     *   Do not use browser specfic code.
     146    *   Do not use browser specific code.
    147147
    148148        *   Do not check the browser version. Use feature detection.
     
    152152            to one place.
    153153
    154         *   Vendors may place test harness specific code in the testing infrustructure.
     154        *   Vendors may place test harness specific code in the testing infrastructure.
    155155
    156156                resources/js-test-pre.js
     
    165165    *   All JavaScript must start with "use strict";
    166166
    167 *   If adding a new test edit the approriate 00_test_list.txt file
     167*   If adding a new test edit the appropriate 00_test_list.txt file
    168168
    169169    Each folder has a 00_test_list.txt file that lists the test in that folder.
    170170    Each new test should be prefixed with the option `--min-version <version>` where
    171     version is 1 more than the newest official verison. At the time of this writing
     171    version is 1 more than the newest official version. At the time of this writing
    172172    all new tests should be prefixed with `--min-version 1.0.2`
    173173
  • trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/webgl-conformance-tests.html

    r157888 r179859  
    145145  var pageCount = 0;
    146146  var folderCount = 0;
    147   var autoScroll = true;
     147  var autoScrollEnabled = true; // Whether the user prefers to auto scroll
     148  var autoScroll = true; // Whether auto scroll is actually performed
    148149
    149150  var Page = function(reporter, folder, testIndex, url) {
     
    298299    button.value = 'run';
    299300    button.onclick = function() {
    300       autoScroll = true;
     301      autoScroll = autoScrollEnabled;
    301302      that.run();
    302303    };
     
    772773  button.disabled = true;
    773774  button.onclick = function() {
    774     autoScroll = true;
     775    autoScroll = autoScrollEnabled;
    775776    reporter.postTestStartToServer();
    776777    testHarness.runTests();
     778  };
     779  var autoScrollCheckbox = document.getElementById("autoScrollCheckbox");
     780  autoScrollCheckbox.checked = autoScrollEnabled;
     781  autoScrollCheckbox.onclick = function() {
     782    autoScrollEnabled = autoScrollCheckbox.checked;
     783    autoScroll = autoScrollEnabled;
    777784  };
    778785  var textbutton = document.getElementById("showTextSummary");
     
    830837              <br/>
    831838              <input type="button" value="run tests" id="runTestsButton"/>
     839              <br/>
     840              <input type="checkbox" id="autoScrollCheckbox"/>
     841              <label for="autoScrollCheckbox">auto scroll</label>
    832842              <br/>
    833843              <input type="button" style="visibility: hidden;" value="display text summary" id="showTextSummary"/>
  • trunk/Source/WebCore/ChangeLog

    r179850 r179859  
     12015-02-09  Roger Fong  <roger_fong@apple.com>
     2
     3        WebGL: Update 1.0.2 conformance layout tests and address new failure.
     4        https://bugs.webkit.org/show_bug.cgi?id=141408.
     5        <rdar://problem/19773236>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Tests covered by updated 1.0.2 conformance tests.
     10
     11        * html/canvas/WebGLRenderingContextBase.cpp:
     12        Return null string instead of empty string if parameter validation fails.
     13        (WebCore::WebGLRenderingContextBase::getProgramInfoLog):
     14        (WebCore::WebGLRenderingContextBase::getShaderInfoLog):
     15        (WebCore::WebGLRenderingContextBase::getShaderSource):
     16
    1172015-02-09  Timothy Horton  <timothy_horton@apple.com>
    218
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r179842 r179859  
    26182618{
    26192619    UNUSED_PARAM(ec);
    2620     if (isContextLostOrPending())
     2620    if (isContextLostOrPending() || !validateWebGLObject("getProgramInfoLog", program))
    26212621        return String();
    2622     if (!validateWebGLObject("getProgramInfoLog", program))
    2623         return "";
    26242622    return ensureNotNull(m_context->getProgramInfoLog(objectOrZero(program)));
    26252623}
     
    27152713{
    27162714    UNUSED_PARAM(ec);
    2717     if (isContextLostOrPending())
     2715    if (isContextLostOrPending() || !validateWebGLObject("getShaderInfoLog", shader))
    27182716        return String();
    2719     if (!validateWebGLObject("getShaderInfoLog", shader))
    2720         return "";
    27212717    return ensureNotNull(m_context->getShaderInfoLog(objectOrZero(shader)));
    27222718}
     
    27572753{
    27582754    UNUSED_PARAM(ec);
    2759     if (isContextLostOrPending())
     2755    if (isContextLostOrPending() || !validateWebGLObject("getShaderSource", shader))
    27602756        return String();
    2761     if (!validateWebGLObject("getShaderSource", shader))
    2762         return "";
    27632757    return ensureNotNull(shader->getSource());
    27642758}
Note: See TracChangeset for help on using the changeset viewer.