Changeset 75570 in webkit


Ignore:
Timestamp:
Jan 11, 2011 4:39:20 PM (13 years ago)
Author:
enne@google.com
Message:

2011-01-11 Adrienne Walker <enne@google.com>

Reviewed by Kenneth Russell.

Sync WebGL texImage2D video test from Khronos and re-enable it.
https://bugs.webkit.org/show_bug.cgi?id=44459

  • fast/canvas/webgl/resources/quadrants.mp4: Removed.
  • fast/canvas/webgl/resources/quadrants.ogv: Removed.
  • fast/canvas/webgl/resources/red-green.mp4: Added.
  • fast/canvas/webgl/resources/red-green.theora.ogv: Added.
  • fast/canvas/webgl/resources/red-green.webmvp8.webm: Added.
  • fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt:
  • fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html:
  • platform/chromium-gpu/test_expectations.txt:
  • platform/chromium/test_expectations.txt:
  • platform/mac-snowleopard/Skipped:
Location:
trunk/LayoutTests
Files:
3 added
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r75569 r75570  
     12011-01-11  Adrienne Walker  <enne@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Sync WebGL texImage2D video test from Khronos and re-enable it.
     6        https://bugs.webkit.org/show_bug.cgi?id=44459
     7
     8        * fast/canvas/webgl/resources/quadrants.mp4: Removed.
     9        * fast/canvas/webgl/resources/quadrants.ogv: Removed.
     10        * fast/canvas/webgl/resources/red-green.mp4: Added.
     11        * fast/canvas/webgl/resources/red-green.theora.ogv: Added.
     12        * fast/canvas/webgl/resources/red-green.webmvp8.webm: Added.
     13        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt:
     14        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html:
     15        * platform/chromium-gpu/test_expectations.txt:
     16        * platform/chromium/test_expectations.txt:
     17        * platform/mac-snowleopard/Skipped:
     18
    1192011-01-11  Mihai Parparita  <mihaip@chromium.org>
    220
  • trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt

    r65756 r75570  
    1  
    2 Verify texImage2D and texSubImage2D code paths taking Videos
     1Verify texImage2D and texSubImage2D code paths taking Video Elements
    32
    43On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    54
     5Testing texImage2D with flipY=true
     6Checking lower left corner
     7PASS shouldBe 0,255,0
     8Checking upper left corner
     9PASS shouldBe 255,0,0
    610Testing texImage2D with flipY=false
    7 PASS pixelAt(0, 0) is red
    8 PASS pixelAt(bufWidth-1, 0) is green
    9 PASS pixelAt(0, bufHeight-1) is yellow
    10 PASS pixelAt(bufWidth-1, bufHeight-1) is blue
    11 Testing texImage2D with flipY=true
    12 PASS pixelAt(0, 0) is yellow
    13 PASS pixelAt(bufWidth-1, 0) is blue
    14 PASS pixelAt(0, bufHeight-1) is red
    15 PASS pixelAt(bufWidth-1, bufHeight-1) is green
    16 Testing TexSubImage2D with flipY=false, scale=2, ox=0, oy=0
    17 PASS pixelAt(0, 0) is red
    18 PASS pixelAt(bufWidth-1, 0) is black
    19 PASS pixelAt(0, bufHeight-1) is black
    20 PASS pixelAt(bufWidth-1, bufHeight-1) is black
    21 Testing TexSubImage2D with flipY=true, scale=2, ox=0, oy=0
    22 PASS pixelAt(0, 0) is yellow
    23 PASS pixelAt(bufWidth-1, 0) is black
    24 PASS pixelAt(0, bufHeight-1) is black
    25 PASS pixelAt(bufWidth-1, bufHeight-1) is black
    26 Testing TexSubImage2D with flipY=false, scale=2, ox=0.5, oy=0.5
    27 PASS pixelAt(0, 0) is black
    28 PASS pixelAt(bufWidth-1, 0) is black
    29 PASS pixelAt(0, bufHeight-1) is black
    30 PASS pixelAt(bufWidth-1, bufHeight-1) is blue
    31 Testing TexSubImage2D with flipY=true, scale=2, ox=0.5, oy=0.5
    32 PASS pixelAt(0, 0) is black
    33 PASS pixelAt(bufWidth-1, 0) is black
    34 PASS pixelAt(0, bufHeight-1) is black
    35 PASS pixelAt(bufWidth-1, bufHeight-1) is green
     11Checking lower left corner
     12PASS shouldBe 255,0,0
     13Checking upper left corner
     14PASS shouldBe 0,255,0
     15Testing texSubImage2D with flipY=true
     16Checking lower left corner
     17PASS shouldBe 0,255,0
     18Checking upper left corner
     19PASS shouldBe 255,0,0
     20Testing texSubImage2D with flipY=false
     21Checking lower left corner
     22PASS shouldBe 255,0,0
     23Checking upper left corner
     24PASS shouldBe 0,255,0
    3625PASS successfullyParsed is true
    3726
    3827TEST COMPLETE
    39 
     28 
  • trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html

    r65756 r75570  
    55<script src="resources/webgl-test.js"></script>
    66<script src="resources/webgl-test-utils.js"></script>
    7 <script src="../../../media/media-file.js"></script>
    87<script>
    98var wtu = WebGLTestUtils;
     
    1211var successfullyParsed = false;
    1312
     13if (window.initNonKhronosFramework) {
     14    window.initNonKhronosFramework(true);
     15}
     16
    1417function init()
    1518{
    16     if (window.initNonKhronosFramework) {
    17         window.initNonKhronosFramework(true);
    18     }
    19 
    20     description('Verify texImage2D and texSubImage2D code paths taking Videos');
     19    description('Verify texImage2D and texSubImage2D code paths taking Video Elements');
    2120
    2221    var canvas = document.getElementById("example");
     
    2928    textureLoc = gl.getUniformLocation(gl.program, "tex");
    3029
    31     var mediaFile = findMediaFile("video", "resources/quadrants");
    32     loadVideo(mediaFile);
     30    var video = document.getElementById("vid");
     31    video.addEventListener(
     32        "playing", function() { runTest(video); }, true);
     33    video.play();
    3334}
    3435
    35 function loadVideo(src) {
    36     var video = document.getElementsByTagName('video')[0];
     36// These two declarations need to be global for "shouldBe" to see them
     37var buf = null;
     38var idx = 0;
     39var pixel = [0, 0, 0];
     40var correctColor = null;
    3741
    38     function startVideo() {
    39         // Resize canvas to fit video.
    40         var canvas = document.getElementsByTagName('canvas')[0];
    41         canvas.width = video.videoWidth;
    42         canvas.height = video.videoHeight;
    43 
    44         runTest(video);
    45     };
    46     video.addEventListener("canplay", startVideo);
    47     video.src = src;
    48 }
    49 
    50 // These declarations need to be global for "shouldBe" to see them
    51 var buf = null;
    52 var bufWidth;
    53 var bufHeight;
    54 var red = [255, 0, 0, 255];
    55 var green = [0, 255, 0, 255];
    56 var blue = [0, 0, 255, 255];
    57 var yellow = [255, 255, 0, 255];
    58 var black = [0, 0, 0, 255];
    59 var clear = [127, 127, 127, 255];
    60 function pixelAt(x, y) {
    61     var index = y * bufWidth * 4 + x * 4;
    62     return [buf[index], buf[index+1], buf[index+2], buf[index+3]];
    63 }
    64 
    65 function runOneIteration(video, flipY, useTexSubImage2D, ulColor, urColor, blColor, brColor, ox, oy, scale) {
    66     var canvas = document.getElementsByTagName('canvas')[0];
    67     gl.viewport(0, 0, canvas.width, canvas.height);
    68 
     42function runOneIteration(videoElement, useTexSubImage2D, flipY, topColor, bottomColor)
     43{
     44    debug('Testing ' + (useTexSubImage2D ? 'texSubImage2D' : 'texImage2D') +
     45          ' with flipY=' + flipY);
    6946    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
    7047    // Disable any writes to the alpha channel
    7148    gl.colorMask(1, 1, 1, 0);
    72 
    7349    var texture = gl.createTexture();
    7450    // Bind the texture to texture unit 0
     
    7753    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
    7854    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
     55    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
     56    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
    7957    // Set up pixel store parameters
    8058    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
    8159    gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
    82     // Upload the image into the texture
     60    // Upload the videoElement into the texture
    8361    if (useTexSubImage2D) {
    84         // Fill initial texture with black.
    85         var texWidth = scale * canvas.width;
    86         var texHeight = scale * canvas.height;
    87         gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, texWidth, texHeight, 0,
     62        // Initialize the texture to black first
     63        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA,
     64                      videoElement.videoWidth, videoElement.videoHeight, 0,
    8865                      gl.RGBA, gl.UNSIGNED_BYTE, null);
     66        gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, videoElement);
     67    } else {
     68        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, videoElement);
     69    }
    8970
    90         gl.texSubImage2D(gl.TEXTURE_2D, 0, ox * texWidth, oy * texHeight, gl.RGBA, gl.UNSIGNED_BYTE, video);
    91         debug('Testing TexSubImage2D with flipY=' + flipY +', scale=' + scale + ', ox=' + ox + ', oy=' + oy);
    92     } else {
    93         debug('Testing texImage2D with flipY=' + flipY);
    94         gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);
    95     }
     71    var c = document.createElement("canvas");
     72    c.width = 16;
     73    c.height = 16;
     74    c.style.border = "1px solid black";
     75    var ctx = c.getContext("2d");
     76    ctx.drawImage(videoElement, 0, 0, 16, 16);
     77    document.body.appendChild(c);
    9678
    9779    // Point the uniform sampler to texture unit 0
    9880    gl.uniform1i(textureLoc, 0);
    9981    // Draw the triangles
    100     wtu.drawQuad(gl, clear);
    101     // Read back the rendering results
    102     bufWidth = canvas.width;
    103     bufHeight = canvas.height;
    104     buf = new Uint8Array(bufWidth * bufHeight * 4);
    105     gl.readPixels(0, 0, bufWidth, bufHeight, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    106 
    107     shouldBe("pixelAt(0, 0)", ulColor);
    108     shouldBe("pixelAt(bufWidth-1, 0)", urColor);
    109     shouldBe("pixelAt(0, bufHeight-1)", blColor);
    110     shouldBe("pixelAt(bufWidth-1, bufHeight-1)", brColor);
     82    wtu.drawQuad(gl, [0, 0, 0, 255]);
     83    // Check a few pixels near the top and bottom and make sure they have
     84    // the right color.
     85    debug("Checking lower left corner");
     86    wtu.checkCanvasRect(gl, 4, 4, 2, 2, bottomColor,
     87                        "shouldBe " + bottomColor);
     88    debug("Checking upper left corner");
     89    wtu.checkCanvasRect(gl, 4, gl.canvas.height - 8, 2, 2, topColor,
     90                        "shouldBe " + topColor);
    11191}
    11292
    113 function runTest(video)
     93function runTest(videoElement)
    11494{
    115     // Original square should have red, green, yellow, blue quadrants,
    116     // with a cross in the middle:
    117     //
    118     // R|G
    119     // -+-
    120     // Y|B
     95    var red = [255, 0, 0];
     96    var green = [0, 255, 0];
     97    runOneIteration(videoElement, false, true, red, green);
     98    runOneIteration(videoElement, false, false, green, red);
     99    runOneIteration(videoElement, true, true, red, green);
     100    runOneIteration(videoElement, true, false, green, red);
    121101
    122     // texImage2D the whole texture
    123     runOneIteration(video, false, false, "red", "green", "yellow", "blue");
    124     runOneIteration(video, true, false, "yellow", "blue", "red", "green");
    125 
    126     // texSubImage2D upper left
    127     runOneIteration(video, false, true, "red", "black", "black", "black", 0, 0, 2);
    128     runOneIteration(video, true, true, "yellow", "black", "black", "black", 0, 0, 2);
    129 
    130     // texSubImage2D lower right
    131     runOneIteration(video, false, true, "black", "black", "black", "blue", 0.5, 0.5, 2);
    132     runOneIteration(video, true, true, "black", "black", "black", "green", 0.5, 0.5, 2);
    133 
    134     successfullyParsed = true;
    135     var epilogue = document.createElement("script");
    136     epilogue.onload = finish;
    137     epilogue.src = "../../js/resources/js-test-post.js";
    138     document.body.appendChild(epilogue);
    139 }
    140 
    141 function finish() {
    142     if (window.nonKhronosFrameworkNotifyDone) {
    143         window.nonKhronosFrameworkNotifyDone();
    144     }
     102    finishTest();
    145103}
    146104</script>
    147105</head>
    148106<body onload="init()">
    149 <video id="sourcevideo"></video>
    150 <canvas id="example"></canvas>
     107<canvas id="example" width="32px" height="32px"></canvas>
    151108<div id="description"></div>
    152109<div id="console"></div>
     110<video width="640" height="228" id="vid" controls>
     111  <source src="resources/red-green.mp4"  type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
     112  <source src="resources/red-green.webmvp8.webm" type='video/webm; codecs="vp8, vorbis"' />
     113  <source src="resources/red-green.theora.ogv"  type='video/ogg; codecs="theora, vorbis"' />
     114</video>
    153115</body>
    154116</html>
  • trunk/LayoutTests/platform/chromium-gpu/test_expectations.txt

    r75530 r75570  
    201201BUGWEBGL : fast/canvas/webgl/css-webkit-canvas-repaint.html = IMAGE
    202202BUGWEBGL : fast/canvas/webgl/css-webkit-canvas.html = IMAGE
    203 BUGWEBGL WIN MAC : fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html = TEXT PASS
    204203BUGWEBGL WIN : fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view.html = CRASH PASS
    205204BUGWEBGL : fast/canvas/webgl/gl-uniform-arrays.html = TEXT
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r75569 r75570  
    25442544BUGWEBGL : fast/canvas/webgl/css-webkit-canvas-repaint.html = IMAGE
    25452545BUGWEBGL : fast/canvas/webgl/css-webkit-canvas.html = IMAGE
    2546 BUGWEBGL WIN MAC : fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html = TEXT PASS
    25472546BUGWEBGL WIN : fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view.html = CRASH PASS
    25482547BUGWEBGL WIN DEBUG : fast/canvas/webgl/texture-complete.html = PASS TEXT
  • trunk/LayoutTests/platform/mac-snowleopard/Skipped

    r75534 r75570  
    110110# https://bugs.webkit.org/show_bug.cgi?id=36925
    111111fast/canvas/webgl/framebuffer-object-attachment.html
    112 # The video upload test is failing on the bots for some currently unknown reason.
    113 # https://bugs.webkit.org/show_bug.cgi?id=44459
    114 fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html
    115112
    116113# https://bugs.webkit.org/show_bug.cgi?id=52237
Note: See TracChangeset for help on using the changeset viewer.