Diff
Modified: trunk/LayoutTests/ChangeLog (110525 => 110526)
--- trunk/LayoutTests/ChangeLog 2012-03-13 01:38:54 UTC (rev 110525)
+++ trunk/LayoutTests/ChangeLog 2012-03-13 01:52:59 UTC (rev 110526)
@@ -1,3 +1,13 @@
+2012-03-12 Zhenyao Mo <z...@google.com>
+
+ After webgl canvas resize, bindings might be lost
+ https://bugs.webkit.org/show_bug.cgi?id=80895
+
+ Reviewed by Stephen White.
+
+ * fast/canvas/webgl/texture-bindings-uneffected-on-resize-expected.txt: Added.
+ * fast/canvas/webgl/texture-bindings-uneffected-on-resize.html: Added.
+
2012-03-12 Erik Arvidsson <a...@chromium.org>
[V8] Use v8::V8::AddHiddenReferences instead of SetHiddenValue
Added: trunk/LayoutTests/fast/canvas/webgl/texture-bindings-uneffected-on-resize-expected.txt (0 => 110526)
--- trunk/LayoutTests/fast/canvas/webgl/texture-bindings-uneffected-on-resize-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/texture-bindings-uneffected-on-resize-expected.txt 2012-03-13 01:52:59 UTC (rev 110526)
@@ -0,0 +1,11 @@
+Verifies that GL texture bindings do not change when canvas is resized
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+test before resizing canvas
+PASS should be blue
+PASS should be green
+test after resizing canvas
+PASS should be blue
+PASS should be green
+
Property changes on: trunk/LayoutTests/fast/canvas/webgl/texture-bindings-uneffected-on-resize-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/fast/canvas/webgl/texture-bindings-uneffected-on-resize.html (0 => 110526)
--- trunk/LayoutTests/fast/canvas/webgl/texture-bindings-uneffected-on-resize.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/texture-bindings-uneffected-on-resize.html 2012-03-13 01:52:59 UTC (rev 110526)
@@ -0,0 +1,51 @@
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<canvas id="example" width="4px" height="4px"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description('Verifies that GL texture bindings do not change when canvas is resized');
+
+var err;
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("example");
+var gl = wtu.create3DContext(canvas);
+var program = wtu.setupTexturedQuad(gl);
+
+var green = [0, 255, 0, 255];
+var blue = [0, 0, 255, 255];
+var tex0 = gl.createTexture();
+wtu.fillTexture(gl, tex0, 1, 1, blue, 0);
+gl.activeTexture(gl.TEXTURE1)
+var tex1 = gl.createTexture();
+wtu.fillTexture(gl, tex1, 1, 1, green, 0);
+
+var loc = gl.getUniformLocation(program, "tex");
+
+function test() {
+ gl.viewport(0, 0, canvas.width, canvas.height);
+ gl.uniform1i(loc, 0);
+ wtu.drawQuad(gl);
+ wtu.checkCanvas(gl, blue, "should be blue");
+ gl.uniform1i(loc, 1);
+ wtu.drawQuad(gl);
+ wtu.checkCanvas(gl, green, "should be green");
+}
+
+debug("test before resizing canvas");
+test();
+debug("test after resizing canvas");
+canvas.width = 8;
+test();
+
+successfullyParsed = true;
+</script>
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/fast/canvas/webgl/texture-bindings-uneffected-on-resize.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (110525 => 110526)
--- trunk/Source/WebCore/ChangeLog 2012-03-13 01:38:54 UTC (rev 110525)
+++ trunk/Source/WebCore/ChangeLog 2012-03-13 01:52:59 UTC (rev 110526)
@@ -1,3 +1,16 @@
+2012-03-12 Zhenyao Mo <z...@google.com>
+
+ After webgl canvas resize, bindings might be lost
+ https://bugs.webkit.org/show_bug.cgi?id=80895
+
+ Reviewed by Stephen White.
+
+ Test: fast/canvas/webgl/texture-bindings-uneffected-on-resize.html
+
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore):
+ (WebCore::WebGLRenderingContext::reshape): recover bindings after reshape.
+
2012-03-12 Kentaro Hara <hara...@chromium.org>
[V8][Refactoring] Remove getWrapper() and getWrapperSlow()
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (110525 => 110526)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-03-13 01:38:54 UTC (rev 110525)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-03-13 01:52:59 UTC (rev 110526)
@@ -752,6 +752,11 @@
m_drawingBuffer->reset(IntSize(width, height));
else
m_context->reshape(width, height);
+
+ m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, objectOrZero(m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get()));
+ m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, objectOrZero(m_renderbufferBinding.get()));
+ if (m_framebufferBinding)
+ m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
}
int WebGLRenderingContext::drawingBufferWidth() const