[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:37:17 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit f120f7ae3ccd859ed928a9256cb0b07db270ef50
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 15 19:08:14 2009 +0000

    2009-12-15  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Darin Fisher.
    
            Don't allow default framebuffer to be mutated
            https://bugs.webkit.org/show_bug.cgi?id=32391
    
            * fast/canvas/webgl/error-reporting-expected.txt:
            * fast/canvas/webgl/null-object-behaviour-expected.txt:
            * fast/canvas/webgl/script-tests/error-reporting.js:
            * fast/canvas/webgl/script-tests/null-object-behaviour.js:
    2009-12-15  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Darin Fisher.
    
            Don't allow default framebuffer to be mutated
            https://bugs.webkit.org/show_bug.cgi?id=32391
    
            * html/canvas/WebGLRenderingContext.cpp:
            (WebCore::WebGLRenderingContext::framebufferRenderbuffer):
            (WebCore::WebGLRenderingContext::framebufferTexture2D):
            * platform/graphics/mac/GraphicsContext3DMac.cpp:
            (WebCore::GraphicsContext3D::bindFramebuffer):
    2009-12-15  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Darin Fisher.
    
            Don't allow default framebuffer to be mutated
            https://bugs.webkit.org/show_bug.cgi?id=32391
    
            * src/GraphicsContext3D.cpp:
            (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
            (WebCore::GraphicsContext3DInternal::reshape):
            (WebCore::GraphicsContext3DInternal::beginPaint):
            (WebCore::GraphicsContext3DInternal::bindFramebuffer):
            (WebCore::GraphicsContext3D::bindFramebuffer):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52164 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7397b68..8bb4ecc 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2009-12-15  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Darin Fisher.
+
+        Don't allow default framebuffer to be mutated
+        https://bugs.webkit.org/show_bug.cgi?id=32391
+
+        * fast/canvas/webgl/error-reporting-expected.txt:
+        * fast/canvas/webgl/null-object-behaviour-expected.txt:
+        * fast/canvas/webgl/script-tests/error-reporting.js:
+        * fast/canvas/webgl/script-tests/null-object-behaviour.js:
+
 2009-12-15  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/canvas/webgl/error-reporting-expected.txt b/LayoutTests/fast/canvas/webgl/error-reporting-expected.txt
index b1b2914..c1a47b8 100644
--- a/LayoutTests/fast/canvas/webgl/error-reporting-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/error-reporting-expected.txt
@@ -17,6 +17,15 @@ PASS context.getError() is context.NO_ERROR
 PASS context.getActiveUniform(program, 50) is null
 PASS context.getError() is context.INVALID_VALUE
 PASS context.getError() is context.NO_ERROR
+Testing attempts to manipulate the default framebuffer
+PASS context.bindFramebuffer(context.FRAMEBUFFER, 0) is undefined.
+PASS context.getError() is context.NO_ERROR
+PASS context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0) is undefined.
+PASS context.getError() is context.INVALID_OPERATION
+PASS context.getError() is context.NO_ERROR
+PASS context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0) is undefined.
+PASS context.getError() is context.INVALID_OPERATION
+PASS context.getError() is context.NO_ERROR
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt b/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt
index 8731e75..c9fb3d4 100644
--- a/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt
@@ -16,6 +16,8 @@ PASS context.bindBuffer(context.ARRAY_BUFFER, 0) is undefined.
 PASS context.bindFramebuffer(context.FRAMEBUFFER, 0) is undefined.
 PASS context.bindRenderbuffer(context.RENDERBUFFER, 0) is undefined.
 PASS context.bindTexture(context.TEXTURE_2D, 0) is undefined.
+PASS context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0) threw exception GL error 1282 in framebufferRenderbuffer.
+PASS context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0) threw exception GL error 1282 in framebufferTexture2D.
 PASS context.getProgramParameter(undefined, 0) threw exception GL error 1282 in getProgramParameter.
 PASS context.getProgramInfoLog(undefined, 0) threw exception GL error 1282 in getProgramInfoLog.
 PASS context.getShaderParameter(undefined, 0) threw exception GL error 1282 in getShaderParameter.
diff --git a/LayoutTests/fast/canvas/webgl/script-tests/error-reporting.js b/LayoutTests/fast/canvas/webgl/script-tests/error-reporting.js
index 694204b..5b01c98 100644
--- a/LayoutTests/fast/canvas/webgl/script-tests/error-reporting.js
+++ b/LayoutTests/fast/canvas/webgl/script-tests/error-reporting.js
@@ -36,20 +36,18 @@ shouldBe("context.getError()", "context.INVALID_VALUE");
 // Error state should be clear by this point
 shouldBe("context.getError()", "context.NO_ERROR");
 
-// FIXME: the following tests don't work properly yet
-// https://bugs.webkit.org/show_bug.cgi?id=32391
-// debug("Testing attempts to manipulate the default framebuffer");
-// shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, 0)");
-// shouldBe("context.getError()", "context.NO_ERROR");
-// shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)");
-// // Synthetic OpenGL error
-// shouldBe("context.getError()", "context.INVALID_OPERATION");
-// // Error state should be clear by this point
-// shouldBe("context.getError()", "context.NO_ERROR");
-// shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)");
-// // Synthetic OpenGL error
-// shouldBe("context.getError()", "context.INVALID_OPERATION");
-// // Error state should be clear by this point
-// shouldBe("context.getError()", "context.NO_ERROR");
+debug("Testing attempts to manipulate the default framebuffer");
+shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, 0)");
+shouldBe("context.getError()", "context.NO_ERROR");
+shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)");
+// Synthetic OpenGL error
+shouldBe("context.getError()", "context.INVALID_OPERATION");
+// Error state should be clear by this point
+shouldBe("context.getError()", "context.NO_ERROR");
+shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)");
+// Synthetic OpenGL error
+shouldBe("context.getError()", "context.INVALID_OPERATION");
+// Error state should be clear by this point
+shouldBe("context.getError()", "context.NO_ERROR");
 
 successfullyParsed = true;
diff --git a/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js b/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js
index 68c69ac..6cd4481 100644
--- a/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js
+++ b/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js
@@ -18,10 +18,12 @@ shouldBeUndefined("context.bindBuffer(context.ARRAY_BUFFER, 0)");
 shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, 0)");
 shouldBeUndefined("context.bindRenderbuffer(context.RENDERBUFFER, 0)");
 shouldBeUndefined("context.bindTexture(context.TEXTURE_2D, 0)");
-// FIXME: the following two tests should state shouldThrow, not shouldBeUndefined
-// https://bugs.webkit.org/show_bug.cgi?id=32391
-// shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)");
-// shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)");
+// The following two throw exceptions because conceptually no
+// framebuffer is bound at this point. In reality the WebGL
+// implementation's internal framebuffer is bound, but we can't allow
+// user code to manipulate it.
+shouldThrow("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)");
+shouldThrow("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)");
 shouldThrow("context.getProgramParameter(undefined, 0)");
 shouldThrow("context.getProgramInfoLog(undefined, 0)");
 shouldThrow("context.getShaderParameter(undefined, 0)");
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f278083..b3452f8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-12-15  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Darin Fisher.
+
+        Don't allow default framebuffer to be mutated
+        https://bugs.webkit.org/show_bug.cgi?id=32391
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::framebufferRenderbuffer):
+        (WebCore::WebGLRenderingContext::framebufferTexture2D):
+        * platform/graphics/mac/GraphicsContext3DMac.cpp:
+        (WebCore::GraphicsContext3D::bindFramebuffer):
+
 2009-12-15  Zoltan Horvath  <zoltan at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index 7a7215d..a8952c5 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -710,6 +710,13 @@ void WebGLRenderingContext::framebufferRenderbuffer(unsigned long target, unsign
         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
         return;
     }       
+    // Don't allow the default framebuffer to be mutated; all current
+    // implementations use an FBO internally in place of the default
+    // FBO.
+    if (!m_framebufferBinding || !m_framebufferBinding->object()) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+        return;
+    }
     m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer);
     cleanupAfterGraphicsCall(false);
 }
@@ -721,6 +728,13 @@ void WebGLRenderingContext::framebufferTexture2D(unsigned long target, unsigned
         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
         return;
     }
+    // Don't allow the default framebuffer to be mutated; all current
+    // implementations use an FBO internally in place of the default
+    // FBO.
+    if (!m_framebufferBinding || !m_framebufferBinding->object()) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+        return;
+    }
     m_context->framebufferTexture2D(target, attachment, textarget, texture, level);
     cleanupAfterGraphicsCall(false);
 }
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index 41f63a9..98fd806 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -262,7 +262,7 @@ void GraphicsContext3D::bindBuffer(unsigned long target, WebGLBuffer* buffer)
 void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer* buffer)
 {
     ensureContext(m_contextObj);
-    ::glBindFramebufferEXT(target, buffer ? (GLuint) buffer->object() : m_fbo);
+    ::glBindFramebufferEXT(target, (buffer && buffer->object()) ? (GLuint) buffer->object() : m_fbo);
 }
 
 void GraphicsContext3D::bindRenderbuffer(unsigned long target, WebGLRenderbuffer* renderbuffer)
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 4fff364..5c86e8f 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,17 @@
+2009-12-15  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Darin Fisher.
+
+        Don't allow default framebuffer to be mutated
+        https://bugs.webkit.org/show_bug.cgi?id=32391
+
+        * src/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
+        (WebCore::GraphicsContext3DInternal::reshape):
+        (WebCore::GraphicsContext3DInternal::beginPaint):
+        (WebCore::GraphicsContext3DInternal::bindFramebuffer):
+        (WebCore::GraphicsContext3D::bindFramebuffer):
+
 2009-12-15  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Unreviewed, build fix.
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index c9ba5a1..dbaabe5 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -116,6 +116,8 @@ public:
     void activeTexture(unsigned long texture);
     void bindBuffer(unsigned long target,
                     WebGLBuffer* buffer);
+    void bindFramebuffer(unsigned long target,
+                         WebGLFramebuffer* framebuffer);
     void bindTexture(unsigned long target,
                      WebGLTexture* texture);
     void bufferDataImpl(unsigned long target, int size, const void* data, unsigned long usage);
@@ -134,6 +136,9 @@ private:
     unsigned int m_depthBuffer;
     unsigned int m_cachedWidth, m_cachedHeight;
 
+    // For tracking which FBO is bound
+    unsigned int m_boundFBO;
+
 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
     unsigned char* m_scanline;
     void flipVertically(unsigned char* framebuffer,
@@ -234,6 +239,7 @@ GraphicsContext3DInternal::GraphicsContext3DInternal()
     : m_texture(0)
     , m_fbo(0)
     , m_depthBuffer(0)
+    , m_boundFBO(0)
 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
     , m_scanline(0)
 #endif
@@ -594,6 +600,7 @@ void GraphicsContext3DInternal::reshape(int width, int height)
     glBindTexture(target, 0);
 
     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
+    m_boundFBO = m_fbo;
     glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthBuffer);
     glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height);
     glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
@@ -681,6 +688,9 @@ void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context)
     HTMLCanvasElement* canvas = context->canvas();
     ImageBuffer* imageBuffer = canvas->buffer();
     unsigned char* pixels = 0;
+    bool mustRestoreFBO = (m_boundFBO != m_fbo);
+    if (mustRestoreFBO)
+        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
 #if PLATFORM(SKIA)
     const SkBitmap* canvasBitmap = imageBuffer->context()->platformContext()->bitmap();
     const SkBitmap* readbackBitmap = 0;
@@ -730,6 +740,9 @@ void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context)
 #error Must port to your platform
 #endif
 
+    if (mustRestoreFBO)
+        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO);
+
 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
     if (pixels)
         flipVertically(pixels, m_cachedWidth, m_cachedHeight);
@@ -788,6 +801,17 @@ void GraphicsContext3DInternal::bindBuffer(unsigned long target,
     glBindBuffer(target, bufID);
 }
 
+void GraphicsContext3DInternal::bindFramebuffer(unsigned long target,
+                                                WebGLFramebuffer* framebuffer)
+{
+    makeContextCurrent();
+    GLuint id = EXTRACT(framebuffer);
+    if (!id)
+        id = m_fbo;
+    glBindFramebufferEXT(target, id);
+    m_boundFBO = id;
+}
+
 // If we didn't have to hack GL_TEXTURE_WRAP_R for cube maps,
 // we could just use:
 // GL_SAME_METHOD_2_X2(BindTexture, bindTexture, unsigned long, WebGLTexture*)
@@ -1190,7 +1214,10 @@ void GraphicsContext3D::bindBuffer(unsigned long target,
     m_internal->bindBuffer(target, buffer);
 }
 
-GL_SAME_METHOD_2_X2(BindFramebufferEXT, bindFramebuffer, unsigned long, WebGLFramebuffer*)
+void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer* framebuffer)
+{
+    m_internal->bindFramebuffer(target, framebuffer);
+}
 
 GL_SAME_METHOD_2_X2(BindRenderbufferEXT, bindRenderbuffer, unsigned long, WebGLRenderbuffer*)
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list