Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html

Issue 10441002: Merge 117918 - Must set/reset pixel unpack alignment to 1 during texSubImage2D (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html
===================================================================
--- LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html (revision 118258)
+++ LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html (working copy)
@@ -1,105 +1,21 @@
+<!DOCTYPE html>
<html>
<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
+<script src="resources/tex-image-and-sub-image-2d-with-image.js"></script>
<script>
-var wtu = WebGLTestUtils;
-var gl = null;
-var textureLoc = null;
-
-function init()
-{
- if (window.initNonKhronosFramework) {
- window.initNonKhronosFramework(true);
- }
-
- description('Verify texImage2D and texSubImage2D code paths taking Images');
-
- var canvas = document.getElementById("example");
- gl = wtu.create3DContext(canvas);
- var program = wtu.setupTexturedQuad(gl);
-
- gl.clearColor(0,0,0,1);
- gl.clearDepth(1);
-
- textureLoc = gl.getUniformLocation(gl.program, "tex");
-
- wtu.loadTexture(gl, "resources/red-green.png", runTest);
+function testPrologue(gl) {
+ return true;
}
-
-// These two declarations need to be global for "shouldBe" to see them
-var buf = null;
-var idx = 0;
-var pixel = [0, 0, 0];
-var correctColor = null;
-
-function runOneIteration(image, useTexSubImage2D, flipY, topColor, bottomColor)
-{
- debug('Testing ' + (useTexSubImage2D ? 'texSubImage2D' : 'texImage2D') +
- ' with flipY=' + flipY);
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
- // Disable any writes to the alpha channel
- gl.colorMask(1, 1, 1, 0);
- var texture = gl.createTexture();
- // Bind the texture to texture unit 0
- gl.bindTexture(gl.TEXTURE_2D, texture);
- // Set up texture parameters
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
- // Set up pixel store parameters
- gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
- gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
- // Upload the image into the texture
- if (useTexSubImage2D) {
- // Initialize the texture to black first
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, image.width, image.height, 0,
- gl.RGBA, gl.UNSIGNED_BYTE, null);
- gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, image);
- } else {
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
- }
-
- // Point the uniform sampler to texture unit 0
- gl.uniform1i(textureLoc, 0);
- // Draw the triangles
- wtu.drawQuad(gl, [0, 0, 0, 255]);
- // Check a few pixels near the top and bottom and make sure they have
- // the right color.
- debug("Checking lower left corner");
- wtu.checkCanvasRect(gl, 4, 4, 2, 2, bottomColor,
- "shouldBe " + bottomColor);
- debug("Checking upper left corner");
- wtu.checkCanvasRect(gl, 4, gl.canvas.height - 8, 2, 2, topColor,
- "shouldBe " + topColor);
-}
-
-function runTest(image)
-{
- var red = [255, 0, 0];
- var green = [0, 255, 0];
- runOneIteration(image, false, true, red, green);
- runOneIteration(image, false, false, green, red);
- runOneIteration(image, true, true, red, green);
- runOneIteration(image, true, false, green, red);
- var epilogue = document.createElement("script");
- epilogue.onload = finish;
- epilogue.src = "../../js/resources/js-test-post.js";
- document.body.appendChild(epilogue);
-}
-
-function finish() {
- if (window.nonKhronosFrameworkNotifyDone) {
- window.nonKhronosFrameworkNotifyDone();
- }
-}
</script>
</head>
-<body onload="init()">
+<body onload='generateTest("RGBA", "UNSIGNED_BYTE", ".", testPrologue)()'>
<canvas id="example" width="32px" height="32px"></canvas>
<div id="description"></div>
<div id="console"></div>
</body>
</html>
-
-

Powered by Google App Engine
This is Rietveld 408576698