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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/uninitialized-test.html

Issue 1586053002: Reland of Untouch out of bound pixels for CopyTexSubImage2D (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix layout tests Created 4 years, 11 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: third_party/WebKit/LayoutTests/fast/canvas/webgl/uninitialized-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/uninitialized-test.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/uninitialized-test.html
index e3947751691d0dce4173a2b37a571e71d9554126..021c98ea73d157adea032587f7729dd4774ddf3c 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/uninitialized-test.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/uninitialized-test.html
@@ -44,7 +44,7 @@ function setupTexture(texWidth, texHeight) {
return texture;
}
-function checkNonZeroPixels(texture, texWidth, texHeight, skipX, skipY, skipWidth, skipHeight, skipR, skipG, skipB, skipA) {
+function checkPixels(texture, texWidth, texHeight, skipX, skipY, skipWidth, skipHeight, skipR, skipG, skipB, skipA, expectedValue) {
gl.bindTexture(gl.TEXTURE_2D, null);
var fb = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
@@ -65,16 +65,16 @@ function checkNonZeroPixels(texture, texWidth, texHeight, skipX, skipY, skipWidt
}
} else {
for (var i = 0; i < 4; ++i) {
- if (data[index + i] != 0)
+ if (data[index + i] != expectedValue)
k++;
}
}
}
}
if (k) {
- testFailed("Found " + k + " non-zero bytes");
+ testFailed("Found " + k + " unexpected bytes");
} else {
- testPassed("All data initialized");
+ testPassed("All data is expected");
}
}
@@ -86,7 +86,7 @@ debug("Reading an uninitialized texture (texImage2D) should succeed with all byt
var tex = setupTexture(width, height);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
-checkNonZeroPixels(tex, width, height, 0, 0, 0, 0, 0, 0, 0, 0);
+checkPixels(tex, width, height, 0, 0, 0, 0, 0, 0, 0, 0, 0);
gl.deleteTexture(tex);
gl.finish();
glErrorShouldBe(gl, gl.NO_ERROR);
@@ -108,7 +108,7 @@ gl.clearColor(1.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
glErrorShouldBe(gl, gl.NO_ERROR);
gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, width, height, 0);
-checkNonZeroPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255);
+checkPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255, 0);
gl.deleteTexture(tex);
gl.finish();
glErrorShouldBe(gl, gl.NO_ERROR);
@@ -132,7 +132,7 @@ glErrorShouldBe(gl, gl.NO_ERROR);
var x = -8;
var y = -8;
gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, x, y, width, height, 0);
-checkNonZeroPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 255);
+checkPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 255, 0);
gl.deleteTexture(tex);
gl.finish();
glErrorShouldBe(gl, gl.NO_ERROR);
@@ -146,13 +146,13 @@ gl.clearColor(0.0, 1.0, 0.0, 0.0);
gl.clear(gl.COLOR_BUFFER_BIT);
glErrorShouldBe(gl, gl.NO_ERROR);
gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, width, height, 0);
-checkNonZeroPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255, 0, 0);
+checkPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255, 0, 0, 0);
gl.deleteTexture(tex);
gl.finish();
glErrorShouldBe(gl, gl.NO_ERROR);
debug("");
-debug("Reading an uninitialized portion of a texture (copyTexSubImage2D) should succeed with all bytes set to 0.");
+debug("Reading an uninitialized portion of a texture (copyTexSubImage2D) should succeed with all bytes untouched.");
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
@@ -174,13 +174,13 @@ gl.clearColor(1.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
glErrorShouldBe(gl, gl.NO_ERROR);
gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, width, height);
-checkNonZeroPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255);
+checkPixels(tex, width, height, 0, 0, fboWidth, fboHeight, 255, 0, 0, 255, 255);
gl.deleteTexture(tex);
gl.finish();
glErrorShouldBe(gl, gl.NO_ERROR);
debug("");
-debug("Reading an uninitialized portion of a texture (copyTexSubImage2D with negative x and y) should succeed with all bytes set to 0.");
+debug("Reading an uninitialized portion of a texture (copyTexSubImage2D with negative x and y) should succeed with all bytes untouched.");
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
@@ -204,13 +204,13 @@ glErrorShouldBe(gl, gl.NO_ERROR);
var x = -8;
var y = -8;
gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x, y, width, height);
-checkNonZeroPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 255);
+checkPixels(tex, width, height, -x, -y, fboWidth, fboHeight, 255, 0, 0, 255, 255);
gl.deleteTexture(tex);
gl.finish();
glErrorShouldBe(gl, gl.NO_ERROR);
debug("");
-debug("Reading an uninitialized portion of a texture (copyTexSubImage2D from WebGL internal fbo) should succeed with all bytes set to 0.");
+debug("Reading an uninitialized portion of a texture (copyTexSubImage2D from WebGL internal fbo) should succeed with all bytes untouched.");
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
@@ -224,7 +224,7 @@ gl.clearColor(0.0, 1.0, 0.0, 0.0);
gl.clear(gl.COLOR_BUFFER_BIT);
glErrorShouldBe(gl, gl.NO_ERROR);
gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, width, height);
-checkNonZeroPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255, 0, 0);
+checkPixels(tex, width, height, 0, 0, canvas.width, canvas.height, 0, 255, 0, 0, 255);
gl.deleteTexture(tex);
gl.finish();
glErrorShouldBe(gl, gl.NO_ERROR);

Powered by Google App Engine
This is Rietveld 408576698