Title: [101181] trunk
Revision
101181
Author
[email protected]
Date
2011-11-25 13:52:58 -0800 (Fri, 25 Nov 2011)

Log Message

[Chromium] The DrawingBuffer::bind method was incorrectly resetting the
GL viewport parameters. This was unnecessary, and resulted in the corruption
of the WebGL context's state.
https://bugs.webkit.org/show_bug.cgi?id=73091

Patch by Jeff Timanus <[email protected]> on 2011-11-25
Reviewed by Stephen White.

Tests: fast/canvas/webgl/webgl-viewport-parameters-preserved.html

Source/WebCore:

* platform/graphics/gpu/DrawingBuffer.cpp:
(WebCore::DrawingBuffer::bind):

LayoutTests:

* fast/canvas/webgl/webgl-viewport-parameters-preserved-expected.txt: Added.
* fast/canvas/webgl/webgl-viewport-parameters-preserved.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101180 => 101181)


--- trunk/LayoutTests/ChangeLog	2011-11-25 20:21:06 UTC (rev 101180)
+++ trunk/LayoutTests/ChangeLog	2011-11-25 21:52:58 UTC (rev 101181)
@@ -1,3 +1,17 @@
+2011-11-25  Jeff Timanus  <[email protected]>
+
+        [Chromium] The DrawingBuffer::bind method was incorrectly resetting the
+        GL viewport parameters. This was unnecessary, and resulted in the corruption
+        of the WebGL context's state.
+        https://bugs.webkit.org/show_bug.cgi?id=73091
+
+        Reviewed by Stephen White.
+
+        Tests: fast/canvas/webgl/webgl-viewport-parameters-preserved.html
+
+        * fast/canvas/webgl/webgl-viewport-parameters-preserved-expected.txt: Added.
+        * fast/canvas/webgl/webgl-viewport-parameters-preserved.html: Added.
+
 2011-11-25  Ryosuke Niwa  <[email protected]>
 
         Crash in BidiRunList<Run>::replaceRunWithRuns with an empty bdi element

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-viewport-parameters-preserved-expected.txt (0 => 101181)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-viewport-parameters-preserved-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-viewport-parameters-preserved-expected.txt	2011-11-25 21:52:58 UTC (rev 101181)
@@ -0,0 +1,9 @@
+Checks that painting WebGL contents doesn't pollute the context's viewport state.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS Viewport not corrupted.
+

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-viewport-parameters-preserved.html (0 => 101181)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-viewport-parameters-preserved.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-viewport-parameters-preserved.html	2011-11-25 21:52:58 UTC (rev 101181)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src="" </script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description("Checks that painting WebGL contents doesn't pollute the context's viewport state.");
+
+var wtu = WebGLTestUtils;
+
+if (window.layoutTestController) {
+  layoutTestController.dumpAsText();
+  layoutTestController.waitUntilDone();
+}
+
+var canvas;
+var context;
+
+function draw() {
+  var viewport = context.getParameter(context.VIEWPORT);
+
+  if (!areArraysEqual(viewport, [20, 20, 10, 10])) {
+    testFailed(viewport + " should be [20, 20, 10, 10]. Was " + viewport);
+  } else {
+    testPassed("Viewport not corrupted.");
+  }
+
+  if (window.layoutTestController)
+    layoutTestController.notifyDone();
+}
+
+window._onload_ = function()
+{
+  if (window.initNonKhronosFramework) {
+    window.initNonKhronosFramework(false);
+  }
+
+  canvas = document.getElementById("webgl-canvas");
+  canvas.width = 50; canvas.height = 50;
+  context = create3DContext(canvas);
+
+  context.viewport(20, 20, 10, 10);
+
+  context.clearColor(255, 0, 0, 255);
+  context.clear(context.COLOR_BUFFER_BIT | context.DEPTH_BUFFER_BIT);
+
+  // We need to ensure that the compositor has run before the drawing
+  // takes place. Setting a timeout of zero causes the compositor to run before
+  // the draw call. Using requestAnimationFrame caused the test to time-out.
+  setTimeout(draw, 0);
+}
+</script>
+<script src=""
+<canvas id="webgl-canvas" width="32px" height="32px"></canvas>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/canvas/webgl/webgl-viewport-parameters-preserved.html
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (101180 => 101181)


--- trunk/Source/WebCore/ChangeLog	2011-11-25 20:21:06 UTC (rev 101180)
+++ trunk/Source/WebCore/ChangeLog	2011-11-25 21:52:58 UTC (rev 101181)
@@ -1,3 +1,17 @@
+2011-11-25  Jeff Timanus  <[email protected]>
+
+        [Chromium] The DrawingBuffer::bind method was incorrectly resetting the
+        GL viewport parameters. This was unnecessary, and resulted in the corruption
+        of the WebGL context's state.
+        https://bugs.webkit.org/show_bug.cgi?id=73091
+
+        Reviewed by Stephen White.
+
+        Tests: fast/canvas/webgl/webgl-viewport-parameters-preserved.html
+
+        * platform/graphics/gpu/DrawingBuffer.cpp:
+        (WebCore::DrawingBuffer::bind):
+
 2011-11-25  Ryosuke Niwa  <[email protected]>
 
         Crash in BidiRunList<Run>::replaceRunWithRuns with an empty bdi element

Modified: trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp (101180 => 101181)


--- trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp	2011-11-25 20:21:06 UTC (rev 101180)
+++ trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp	2011-11-25 21:52:58 UTC (rev 101181)
@@ -368,9 +368,8 @@
 {
     if (!m_context)
         return;
-        
+
     m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo);
-    m_context->viewport(0, 0, m_size.width(), m_size.height());
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to