[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

senorblanco at chromium.org senorblanco at chromium.org
Sun Feb 20 22:52:36 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit fa37eed3b44145aec1231aaeb6885c544f59cf5e
Author: senorblanco at chromium.org <senorblanco at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 12 21:58:12 2011 +0000

    2011-01-12  Stephen White  <senorblanco at chromium.org>
    
            Reviewed by James Robinson.
    
            Fix DrawingBuffer issues for depth/stencil, extensions, etc.
            https://bugs.webkit.org/show_bug.cgi?id=52310
    
            1)  GL_TEXTURE is not a valid argument to glFramebufferTexture2D()
            (should be GL_TEXTURE_2D).
            2)  Support for the multisampling extension was being checked after
            the DrawingBuffer constructor was called, which calls multisample()
            to check for the extension.
            3)  If depth or stencil is set, the corresponding framebuffers must
            be created in the DrawingBuffer constructor.
            4)  GL_DEPTH_STENCIL is not a valid framebuffer internal type in
            GLES2.  Must use GL_OES_DEPTH24_STENCIL8, and check for the
            OES_packed_depth_stencil extension.
    
            * platform/graphics/chromium/DrawingBufferChromium.cpp:
            (WebCore::DrawingBuffer::DrawingBuffer):
            Record the extension support in the constructor.  Create all the
            secondary drawing buffers (for multisampling, depth/stencil).
            * platform/graphics/gpu/DrawingBuffer.cpp:
            (WebCore::DrawingBuffer::create):
            Check for the extensions before calling the DrawingBuffer constructor.
            (WebCore::DrawingBuffer::createSecondaryBuffers):
            Refactor creation of the secondary buffers from DrawingBufferMac.mm to
            here.
            (WebCore::DrawingBuffer::reset):
            Use DEPTH24_STENCIL8 format, not DEPTH_STENCIL.  Use
            DEPTH_COMPONENT16, not DEPTH_COMPONENT.
            Use GL_TEXTURE_2D, not GL_TEXTURE (for glFramebufferTexture2D).
            * platform/graphics/gpu/DrawingBuffer.h:
            Refactor createSecondaryBuffers().  Add extension support arguments to
            constructor.  Add support for packed_depth_stencil extension.
            * platform/graphics/gpu/mac/DrawingBufferMac.mm:
            (WebCore::DrawingBuffer::DrawingBuffer):
            Record extension support in constructor.  Refactor out creation of
            secondary buffers.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75637 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5c5da7a..b23c4ad 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,43 @@
+2011-01-12  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Fix DrawingBuffer issues for depth/stencil, extensions, etc.
+        https://bugs.webkit.org/show_bug.cgi?id=52310
+
+        1)  GL_TEXTURE is not a valid argument to glFramebufferTexture2D()
+        (should be GL_TEXTURE_2D).
+        2)  Support for the multisampling extension was being checked after
+        the DrawingBuffer constructor was called, which calls multisample()
+        to check for the extension.
+        3)  If depth or stencil is set, the corresponding framebuffers must
+        be created in the DrawingBuffer constructor.
+        4)  GL_DEPTH_STENCIL is not a valid framebuffer internal type in
+        GLES2.  Must use GL_OES_DEPTH24_STENCIL8, and check for the
+        OES_packed_depth_stencil extension.
+
+        * platform/graphics/chromium/DrawingBufferChromium.cpp:
+        (WebCore::DrawingBuffer::DrawingBuffer):
+        Record the extension support in the constructor.  Create all the
+        secondary drawing buffers (for multisampling, depth/stencil).
+        * platform/graphics/gpu/DrawingBuffer.cpp:
+        (WebCore::DrawingBuffer::create):
+        Check for the extensions before calling the DrawingBuffer constructor.
+        (WebCore::DrawingBuffer::createSecondaryBuffers):
+        Refactor creation of the secondary buffers from DrawingBufferMac.mm to
+        here.
+        (WebCore::DrawingBuffer::reset):
+        Use DEPTH24_STENCIL8 format, not DEPTH_STENCIL.  Use
+        DEPTH_COMPONENT16, not DEPTH_COMPONENT.
+        Use GL_TEXTURE_2D, not GL_TEXTURE (for glFramebufferTexture2D).
+        * platform/graphics/gpu/DrawingBuffer.h:
+        Refactor createSecondaryBuffers().  Add extension support arguments to
+        constructor.  Add support for packed_depth_stencil extension.
+        * platform/graphics/gpu/mac/DrawingBufferMac.mm:
+        (WebCore::DrawingBuffer::DrawingBuffer):
+        Record extension support in constructor.  Refactor out creation of
+        secondary buffers.
+
 2011-01-12  Beth Dakin  <bdakin at apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
index 507c227..569dff4 100644
--- a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
@@ -67,9 +67,14 @@ static unsigned generateColorTexture(GraphicsContext3D* context, const IntSize&
 }
 
 
-DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size)
+DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
+                             const IntSize& size,
+                             bool multisampleExtensionSupported,
+                             bool packedDepthStencilExtensionSupported)
     : m_context(context)
     , m_size(size)
+    , m_multisampleExtensionSupported(multisampleExtensionSupported)
+    , m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupported)
     , m_fbo(0)
     , m_colorBuffer(0)
     , m_depthStencilBuffer(0)
@@ -85,6 +90,7 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size)
     m_fbo = context->createFramebuffer();
     context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     m_colorBuffer = generateColorTexture(context, size);
+    createSecondaryBuffers();
 }
 
 DrawingBuffer::~DrawingBuffer()
diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
index d2415ca..c283068 100644
--- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
@@ -40,14 +40,16 @@ namespace WebCore {
 
 PassRefPtr<DrawingBuffer> DrawingBuffer::create(GraphicsContext3D* context, const IntSize& size)
 {
-    RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(context, size));
     Extensions3D* extensions = context->getExtensions();
     bool multisampleSupported = extensions->supports("GL_ANGLE_framebuffer_blit") && extensions->supports("GL_ANGLE_framebuffer_multisample");
     if (multisampleSupported) {
         extensions->ensureEnabled("GL_ANGLE_framebuffer_blit");
         extensions->ensureEnabled("GL_ANGLE_framebuffer_multisample");
     }
-    drawingBuffer->m_multisampleExtensionSupported = multisampleSupported;
+    bool packedDepthStencilSupported = extensions->supports("GL_OES_packed_depth_stencil");
+    if (packedDepthStencilSupported)
+        extensions->ensureEnabled("GL_OES_packed_depth_stencil");
+    RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(context, size, multisampleSupported, packedDepthStencilSupported));
     return (drawingBuffer->m_context) ? drawingBuffer.release() : 0;
 }
 
@@ -88,6 +90,24 @@ void DrawingBuffer::clear()
     m_context.clear();
 }
 
+void DrawingBuffer::createSecondaryBuffers()
+{
+    const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes();
+
+    // Create the stencil and depth buffer if needed
+    if (!multisample() && (attributes.stencil || attributes.depth))
+        m_depthStencilBuffer = m_context->createRenderbuffer();
+
+    // create a multisample FBO
+    if (multisample()) {
+        m_multisampleFBO = m_context->createFramebuffer();
+        m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
+        m_multisampleColorBuffer = m_context->createRenderbuffer();
+        if (attributes.stencil || attributes.depth)
+            m_multisampleDepthStencilBuffer = m_context->createRenderbuffer();
+    }
+}
+
 void DrawingBuffer::reset(const IntSize& newSize)
 {
     if (m_size == newSize)
@@ -111,10 +131,13 @@ void DrawingBuffer::reset(const IntSize& newSize)
     if (attributes.stencil || attributes.depth) {
         // We don't allow the logic where stencil is required and depth is not.
         // See GraphicsContext3D constructor.
-        if (attributes.stencil && attributes.depth)
-            internalDepthStencilFormat = GraphicsContext3D::DEPTH_STENCIL;
+
+        // FIXME:  If packed depth/stencil is not supported, we should
+        // create separate renderbuffers for depth and stencil.
+        if (attributes.stencil && attributes.depth && m_packedDepthStencilExtensionSupported)
+            internalDepthStencilFormat = Extensions3D::DEPTH24_STENCIL8;
         else
-            internalDepthStencilFormat = GraphicsContext3D::DEPTH_COMPONENT;
+            internalDepthStencilFormat = GraphicsContext3D::DEPTH_COMPONENT16;
     }
 
     // resize multisample FBO
@@ -150,7 +173,7 @@ void DrawingBuffer::reset(const IntSize& newSize)
 
     m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer);
     m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE);
-    m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE, m_colorBuffer, 0);
+    m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0);
     m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
     if (!multisample() && (attributes.stencil || attributes.depth)) {
         m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
index 9f79889..e0e0ee1 100644
--- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
+++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
@@ -63,6 +63,9 @@ public:
     // Clear all resources from this object, as well as context. Called when context is destroyed
     // to prevent invalid accesses to the resources.
     void clear();
+
+    // Create the depth/stencil and multisample buffers, if needed.
+    void createSecondaryBuffers();
     
     // Copies the multisample color buffer to the normal color buffer and leaves m_fbo bound
     void commit(long x = 0, long y = 0, long width = -1, long height = -1);
@@ -92,7 +95,7 @@ public:
 private:
     static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&);
     
-    DrawingBuffer(GraphicsContext3D*, const IntSize&);
+    DrawingBuffer(GraphicsContext3D*, const IntSize&, bool multisampleExtensionSupported, bool packedDepthStencilExtensionSupported);
     
     // Platform specific function called after reset() so each platform can do extra work if needed
     void didReset();
@@ -100,6 +103,7 @@ private:
     RefPtr<GraphicsContext3D> m_context;
     IntSize m_size;
     bool m_multisampleExtensionSupported;
+    bool m_packedDepthStencilExtensionSupported;
     Platform3DObject m_fbo;
     Platform3DObject m_colorBuffer;
     Platform3DObject m_depthStencilBuffer;
diff --git a/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm b/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
index 89dcb9c..601454e 100644
--- a/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
+++ b/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
@@ -36,9 +36,14 @@
 
 namespace WebCore {
 
-DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size)
+DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
+                             const IntSize& size,
+                             bool multisampleExtensionSupported,
+                             bool packedDepthStencilExtensionSupported)
     : m_context(context)
     , m_size(size)
+    , m_multisampleExtensionSupported(multisampleExtensionSupported)
+    , m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupported)
     , m_fbo(context->createFramebuffer())
     , m_colorBuffer(0)
     , m_depthStencilBuffer(0)
@@ -77,21 +82,7 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size)
         return;
     }
         
-    const GraphicsContext3D::Attributes& attributes = context->getContextAttributes();
-    
-    // Create the stencil and depth buffer if needed
-    if (!multisample() && (attributes.stencil || attributes.depth))
-        m_depthStencilBuffer = context->createRenderbuffer();
-
-    // create a multisample FBO
-    if (multisample()) {
-        m_multisampleFBO = context->createFramebuffer();
-        context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
-        m_multisampleColorBuffer = context->createRenderbuffer();
-        if (attributes.stencil || attributes.depth)
-            m_multisampleDepthStencilBuffer = context->createRenderbuffer();
-    }
-    
+    createSecondaryBuffers();
     reset(size);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list