[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zmo at google.com zmo at google.com
Wed Dec 22 16:13:46 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 92a1d38e46e3a26f01146c5daf5db36117875ee7
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 19 21:03:50 2010 +0000

    2010-11-18  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            GraphicsContext3D::reshape is clearing using current clear color instead of transparent
            https://bugs.webkit.org/show_bug.cgi?id=44064
    
            * src/WebGraphicsContext3DDefaultImpl.cpp:
            (WebKit::WebGraphicsContext3DDefaultImpl::reshape): Use 0 as clear values.
    2010-11-18  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            GraphicsContext3D::reshape is clearing using current clear color instead of transparent
            https://bugs.webkit.org/show_bug.cgi?id=44064
    
            * platform/graphics/gpu/DrawingBuffer.cpp:
            (WebCore::DrawingBuffer::reset): Use 0 as clear values.
            * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
            (WebCore::GraphicsContext3D::reshape): Ditto.
    2010-11-18  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            GraphicsContext3D::reshape is clearing using current clear color instead of transparent
            https://bugs.webkit.org/show_bug.cgi?id=44064
    
            * fast/canvas/webgl/renderbuffer-initialization-expected.txt:
            * fast/canvas/webgl/renderbuffer-initialization.html: Test that o is used as the clear values instead of the current gl clear values.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72431 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 16886fb..0920197 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-18  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        GraphicsContext3D::reshape is clearing using current clear color instead of transparent
+        https://bugs.webkit.org/show_bug.cgi?id=44064
+
+        * fast/canvas/webgl/renderbuffer-initialization-expected.txt:
+        * fast/canvas/webgl/renderbuffer-initialization.html: Test that o is used as the clear values instead of the current gl clear values.
+
 2010-11-19  Brian Weinstein  <bweinstein at apple.com>
 
         Rebaseline fast/blockflow results for Windows after r72347.
diff --git a/LayoutTests/fast/canvas/webgl/renderbuffer-initialization-expected.txt b/LayoutTests/fast/canvas/webgl/renderbuffer-initialization-expected.txt
index af2fbb0..0d1ba15 100644
--- a/LayoutTests/fast/canvas/webgl/renderbuffer-initialization-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/renderbuffer-initialization-expected.txt
@@ -6,6 +6,11 @@ Test whether the WebGL internal buffers have been initialized to 0.
 PASS Buffers have been initialized to 0.
 Test whether user created buffers have been initialized to 0.
 PASS Buffers have been initialized to 0.
+Test whether the WebGL internal buffers have been initialized to 0.
+PASS Buffers have been initialized to 0.
+Test whether user created buffers have been initialized to 0.
+PASS Buffers have been initialized to 0.
+PASS clearColor is [1, 0, 0, 1]
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html b/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html
index ab2d401..8dd58f6 100644
--- a/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html
+++ b/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html
@@ -4,23 +4,17 @@
 <script src="../../js/resources/js-test-pre.js"></script>
 <script src="resources/webgl-test.js"></script>
 <script>
-function runTest()
+function runTest(gl, width, height)
 {
-    var canvas = document.getElementById("testbed");
-    var gl = canvas.getContext("experimental-webgl");
-    if (!gl) {
-        testFailed('canvas.getContext() failed');
-        return false;
-    }
 
     debug('Test whether the WebGL internal buffers have been initialized to 0.');
-    var buf = new Uint8Array(500 * 500 * 4);
-    gl.readPixels(0, 0, 500, 500, gl.RGBA, gl.UNSIGNED_BYTE, buf);
+    var totalBytes = width * height * 4;
+    var buf = new Uint8Array(totalBytes);
+    gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
     if (gl.getError() != gl.NO_ERROR) {
         testFailed('GL error detected after readPixels().');
         return false;
     }
-    var totalBytes = 500 * 500 * 4;
     for (var i = 0; i < totalBytes; ++i) {
         if (buf[i] != 0) {
             testFailed('WebGL internal buffers are dirty.');
@@ -34,7 +28,7 @@ function runTest()
     gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
     var colorbuffer = gl.createRenderbuffer();
     gl.bindRenderbuffer(gl.RENDERBUFFER, colorbuffer);
-    gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 500, 500);
+    gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, width, height);
     if (gl.getError() != gl.NO_ERROR) {
         testFailed('GL error detected after renderbufferStorage(internalformat = RGBA4).');
         return false;
@@ -44,7 +38,7 @@ function runTest()
         testFailed('Framebuffer incomplete.');
         return false;
     }
-    gl.readPixels(0, 0, 500, 500, gl.RGBA, gl.UNSIGNED_BYTE, buf);
+    gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
     if (gl.getError() != gl.NO_ERROR) {
         testFailed('GL error detected after readPixels().');
         return false;
@@ -62,7 +56,7 @@ function runTest()
 </script>
 </head>
 <body>
-<canvas id="testbed" width="500px" height="500px"></canvas>
+<canvas id="testbed" width="400px" height="400px"></canvas>
 <div id="description"></div>
 <div id="console"></div>
 <script>
@@ -70,7 +64,24 @@ var successfullyParsed = false;
 
 description('Verify renderbuffers are initialized to 0 before being read in WebGL');
 
-runTest();
+var canvas = document.getElementById("testbed");
+var gl = canvas.getContext("experimental-webgl");
+if (!gl) {
+    testFailed('canvas.getContext() failed');
+    return false;
+}
+
+runTest(gl, canvas.width, canvas.height);
+
+// Testing that canvas resizing will clear the buffers with 0 instead of the current clear values.
+gl.clearColor(1, 0, 0, 1);
+canvas.width += 1;
+canvas.height += 1;
+runTest(gl, canvas.width, canvas.height);
+
+// Testing buffer clearing won't change the clear values.
+var clearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE);
+shouldBe("clearColor", "[1, 0, 0, 1]");
 
 successfullyParsed = true;
 </script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 815ef30..aab0fa5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-18  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        GraphicsContext3D::reshape is clearing using current clear color instead of transparent
+        https://bugs.webkit.org/show_bug.cgi?id=44064
+
+        * platform/graphics/gpu/DrawingBuffer.cpp:
+        (WebCore::DrawingBuffer::reset): Use 0 as clear values.
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::reshape): Ditto.
+
 2010-11-19  Chris Rogers  <crogers at google.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/gpu/DrawingBuffer.cpp b/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
index d812e28..8cb6d0c 100644
--- a/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
@@ -167,20 +167,29 @@ void DrawingBuffer::reset(const IntSize& newSize)
         m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
 
     // Initialize renderbuffers to 0.
-    unsigned char colorMask[] = {true, true, true, true}, depthMask = true, stencilMask = true;
+    float clearColor[] = {0, 0, 0, 0}, clearDepth = 0;
+    int clearStencil = 0;
+    unsigned char colorMask[] = {true, true, true, true}, depthMask = true;
+    unsigned int stencilMask = 0xffffffff;
     unsigned char isScissorEnabled = false;
     unsigned char isDitherEnabled = false;
     unsigned long clearMask = GraphicsContext3D::COLOR_BUFFER_BIT;
+    m_context->getFloatv(GraphicsContext3D::COLOR_CLEAR_VALUE, clearColor);
+    m_context->clearColor(0, 0, 0, 0);
     m_context->getBooleanv(GraphicsContext3D::COLOR_WRITEMASK, colorMask);
     m_context->colorMask(true, true, true, true);
     if (attributes.depth) {
+        m_context->getFloatv(GraphicsContext3D::DEPTH_CLEAR_VALUE, &clearDepth);
+        m_context->clearDepth(1);
         m_context->getBooleanv(GraphicsContext3D::DEPTH_WRITEMASK, &depthMask);
         m_context->depthMask(true);
         clearMask |= GraphicsContext3D::DEPTH_BUFFER_BIT;
     }
     if (attributes.stencil) {
-        m_context->getBooleanv(GraphicsContext3D::STENCIL_WRITEMASK, &stencilMask);
-        m_context->stencilMask(true);
+        m_context->getIntegerv(GraphicsContext3D::STENCIL_CLEAR_VALUE, &clearStencil);
+        m_context->clearStencil(0);
+        m_context->getIntegerv(GraphicsContext3D::STENCIL_WRITEMASK, reinterpret_cast<int*>(&stencilMask));
+        m_context->stencilMaskSeparate(GraphicsContext3D::FRONT, 0xffffffff);
         clearMask |= GraphicsContext3D::STENCIL_BUFFER_BIT;
     }
     isScissorEnabled = m_context->isEnabled(GraphicsContext3D::SCISSOR_TEST);
@@ -190,11 +199,16 @@ void DrawingBuffer::reset(const IntSize& newSize)
 
     m_context->clear(clearMask);
 
+    m_context->clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
     m_context->colorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
-    if (attributes.depth)
+    if (attributes.depth) {
+        m_context->clearDepth(clearDepth);
         m_context->depthMask(depthMask);
-    if (attributes.stencil)
-        m_context->stencilMask(stencilMask);
+    }
+    if (attributes.stencil) {
+        m_context->clearStencil(clearStencil);
+        m_context->stencilMaskSeparate(GraphicsContext3D::FRONT, stencilMask);
+    }
     if (isScissorEnabled)
         m_context->enable(GraphicsContext3D::SCISSOR_TEST);
     else
diff --git a/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
index 85089a0..d295abb 100644
--- a/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
+++ b/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
@@ -211,20 +211,29 @@ void GraphicsContext3D::reshape(int width, int height)
     }
 
     // Initialize renderbuffers to 0.
-    GLboolean colorMask[] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}, depthMask = GL_TRUE, stencilMask = GL_TRUE;
+    GLfloat clearColor[] = {0, 0, 0, 0}, clearDepth = 0;
+    GLint clearStencil = 0;
+    GLboolean colorMask[] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}, depthMask = GL_TRUE;
+    GLuint stencilMask = 0xffffffff;
     GLboolean isScissorEnabled = GL_FALSE;
     GLboolean isDitherEnabled = GL_FALSE;
     GLbitfield clearMask = GL_COLOR_BUFFER_BIT;
+    ::glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor);
+    ::glClearColor(0, 0, 0, 0);
     ::glGetBooleanv(GL_COLOR_WRITEMASK, colorMask);
     ::glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
     if (m_attrs.depth) {
+        ::glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth);
+        ::glClearDepth(1);
         ::glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
         ::glDepthMask(GL_TRUE);
         clearMask |= GL_DEPTH_BUFFER_BIT;
     }
     if (m_attrs.stencil) {
-        ::glGetBooleanv(GL_STENCIL_WRITEMASK, &stencilMask);
-        ::glStencilMask(GL_TRUE);
+        ::glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil);
+        ::glClearStencil(0);
+        ::glGetIntegerv(GL_STENCIL_WRITEMASK, reinterpret_cast<GLint*>(&stencilMask));
+        ::glStencilMaskSeparate(GL_FRONT, 0xffffffff);
         clearMask |= GL_STENCIL_BUFFER_BIT;
     }
     isScissorEnabled = ::glIsEnabled(GL_SCISSOR_TEST);
@@ -234,11 +243,16 @@ void GraphicsContext3D::reshape(int width, int height)
 
     ::glClear(clearMask);
 
+    ::glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
     ::glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
-    if (m_attrs.depth)
+    if (m_attrs.depth) {
+        ::glClearDepth(clearDepth);
         ::glDepthMask(depthMask);
-    if (m_attrs.stencil)
-        ::glStencilMask(stencilMask);
+    }
+    if (m_attrs.stencil) {
+        ::glClearStencil(clearStencil);
+        ::glStencilMaskSeparate(GL_FRONT, stencilMask);
+    }
     if (isScissorEnabled)
         ::glEnable(GL_SCISSOR_TEST);
     else
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 49fe4a6..3b2ddf4 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-18  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        GraphicsContext3D::reshape is clearing using current clear color instead of transparent
+        https://bugs.webkit.org/show_bug.cgi?id=44064
+
+        * src/WebGraphicsContext3DDefaultImpl.cpp:
+        (WebKit::WebGraphicsContext3DDefaultImpl::reshape): Use 0 as clear values.
+
 2010-11-19  Tony Chang  <tony at chromium.org>
 
         Unreviewed, updating Chromium DEPS to try and fix the chromium win build.
diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
index bd070c6..e9e483c 100644
--- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
+++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
@@ -439,20 +439,29 @@ void WebGraphicsContext3DDefaultImpl::reshape(int width, int height)
     }
 
     // Initialize renderbuffers to 0.
-    GLboolean colorMask[] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}, depthMask = GL_TRUE, stencilMask = GL_TRUE;
+    GLfloat clearColor[] = {0, 0, 0, 0}, clearDepth = 0;
+    GLint clearStencil = 0;
+    GLboolean colorMask[] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}, depthMask = GL_TRUE;
+    GLuint stencilMask = 0xffffffff;
     GLboolean isScissorEnabled = GL_FALSE;
     GLboolean isDitherEnabled = GL_FALSE;
     GLbitfield clearMask = GL_COLOR_BUFFER_BIT;
+    glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor);
+    glClearColor(0, 0, 0, 0);
     glGetBooleanv(GL_COLOR_WRITEMASK, colorMask);
     glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
     if (m_attributes.depth) {
+        glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth);
+        glClearDepth(1);
         glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
         glDepthMask(GL_TRUE);
         clearMask |= GL_DEPTH_BUFFER_BIT;
     }
     if (m_attributes.stencil) {
-        glGetBooleanv(GL_STENCIL_WRITEMASK, &stencilMask);
-        glStencilMask(GL_TRUE);
+        glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil);
+        glClearStencil(0);
+        glGetIntegerv(GL_STENCIL_WRITEMASK, reinterpret_cast<GLint*>(&stencilMask));
+        glStencilMaskSeparate(GL_FRONT, 0xffffffff);
         clearMask |= GL_STENCIL_BUFFER_BIT;
     }
     isScissorEnabled = glIsEnabled(GL_SCISSOR_TEST);
@@ -462,11 +471,16 @@ void WebGraphicsContext3DDefaultImpl::reshape(int width, int height)
 
     glClear(clearMask);
 
+    glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
     glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
-    if (m_attributes.depth)
+    if (m_attributes.depth) {
+        glClearDepth(clearDepth);
         glDepthMask(depthMask);
-    if (m_attributes.stencil)
-        glStencilMask(stencilMask);
+    }
+    if (m_attributes.stencil) {
+        glClearStencil(clearStencil);
+        glStencilMaskSeparate(GL_FRONT, stencilMask);
+    }
     if (isScissorEnabled)
         glEnable(GL_SCISSOR_TEST);
     else

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list