Title: [139989] trunk
Revision
139989
Author
commit-qu...@webkit.org
Date
2013-01-17 10:33:13 -0800 (Thu, 17 Jan 2013)

Log Message

Fix texImage2D from a WebGL canvas.
https://bugs.webkit.org/show_bug.cgi?id=106941

Patch by John Bauman <jbau...@chromium.org> on 2013-01-17
Reviewed by Kenneth Russell.

Source/WebCore:

Clear the copied image whenever the canvas is modified, even if using
accelerated compositing.

Test: fast/canvas/webgl/tex-image-webgl.html

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::markContextChanged):

LayoutTests:

Add test to ensure doing teximage2d from a webgl canvas works. This
test is the same as a webgl conformance test.

* fast/canvas/webgl/tex-image-webgl-expected.txt: Added.
* fast/canvas/webgl/tex-image-webgl.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139988 => 139989)


--- trunk/LayoutTests/ChangeLog	2013-01-17 18:29:47 UTC (rev 139988)
+++ trunk/LayoutTests/ChangeLog	2013-01-17 18:33:13 UTC (rev 139989)
@@ -1,3 +1,16 @@
+2013-01-17  John Bauman  <jbau...@chromium.org>
+
+        Fix texImage2D from a WebGL canvas.
+        https://bugs.webkit.org/show_bug.cgi?id=106941
+
+        Reviewed by Kenneth Russell.
+
+        Add test to ensure doing teximage2d from a webgl canvas works. This
+        test is the same as a webgl conformance test.
+
+        * fast/canvas/webgl/tex-image-webgl-expected.txt: Added.
+        * fast/canvas/webgl/tex-image-webgl.html: Added.
+
 2013-01-17  Stephen Chenney  <schen...@chromium.org>
 
         [Chromium] Test expectations update after Skia shader changes

Added: trunk/LayoutTests/fast/canvas/webgl/tex-image-webgl-expected.txt (0 => 139989)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-webgl-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-webgl-expected.txt	2013-01-17 18:33:13 UTC (rev 139989)
@@ -0,0 +1,14 @@
+ 
+Test texImage2D from a webgl canvas.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
+PASS Canvas should be red
+PASS Canvas should be green
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/canvas/webgl/tex-image-webgl.html (0 => 139989)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-webgl.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-webgl.html	2013-01-17 18:33:13 UTC (rev 139989)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL texImage2D from WebGL conformance test.</title>
+<script src=""
+<script src="" </script>
+<script src="" </script>
+</head>
+<body>
+<canvas id="example" width="256" height="16" style="width: 256px; height: 48px;"></canvas>
+<canvas id="source" width="256" height="16" style="width: 256px; height: 48px;"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description("Test texImage2D from a webgl canvas.");
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext("example");
+gl.disable(gl.DITHER);
+var program = wtu.setupTexturedQuad(gl);
+var gl1 = wtu.create3DContext("source");
+gl1.disable(gl.DITHER);
+
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
+glErrorShouldBe(gl1, gl1.NO_ERROR, "Should be no errors from setup.");
+
+gl.disable(gl.BLEND);
+gl.disable(gl.DEPTH_TEST);
+
+gl1.clearColor(1.0, 0.0, 0.0, 1.0);
+gl1.clear(gl1.COLOR_BUFFER_BIT);
+
+var tex = gl.createTexture();
+gl.bindTexture(gl.TEXTURE_2D, tex);
+gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, gl1.canvas);
+gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
+wtu.drawQuad(gl);
+
+wtu.checkCanvas(gl, [255, 0, 0, 255], "Canvas should be red");
+
+gl1.clearColor(0.0, 1.0, 0.0, 1.0);
+gl1.clear(gl1.COLOR_BUFFER_BIT);
+
+gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, gl1.canvas);
+wtu.drawQuad(gl);
+
+wtu.checkCanvas(gl, [0, 255, 0, 255], "Canvas should be green");
+
+debug("");
+successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (139988 => 139989)


--- trunk/Source/WebCore/ChangeLog	2013-01-17 18:29:47 UTC (rev 139988)
+++ trunk/Source/WebCore/ChangeLog	2013-01-17 18:33:13 UTC (rev 139989)
@@ -1,3 +1,19 @@
+2013-01-17  John Bauman  <jbau...@chromium.org>
+
+        Fix texImage2D from a WebGL canvas.
+        https://bugs.webkit.org/show_bug.cgi?id=106941
+
+        Reviewed by Kenneth Russell.
+
+        Clear the copied image whenever the canvas is modified, even if using
+        accelerated compositing.
+
+        Test: fast/canvas/webgl/tex-image-webgl.html
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore):
+        (WebCore::WebGLRenderingContext::markContextChanged):
+
 2013-01-17  Sudarsana Nagineni  <sudarsana.nagin...@intel.com>
 
         [AC] Memory leak in GLXConfigSelector::createConfig()

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (139988 => 139989)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2013-01-17 18:29:47 UTC (rev 139988)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2013-01-17 18:33:13 UTC (rev 139989)
@@ -650,6 +650,7 @@
     RenderBox* renderBox = canvas()->renderBox();
     if (renderBox && renderBox->hasAcceleratedCompositing()) {
         m_markedCanvasDirty = true;
+        canvas()->clearCopiedImage();
         renderBox->contentChanged(CanvasChanged);
     } else {
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to