Changeset 76717 in webkit


Ignore:
Timestamp:
Jan 26, 2011 2:06:45 PM (13 years ago)
Author:
kbr@google.com
Message:

2011-01-26 Kenneth Russell <kbr@google.com>

Reviewed by James Robinson.

Fix multisampling support in DrawingBuffer
https://bugs.webkit.org/show_bug.cgi?id=53154

Plumbed GL_ANGLE_framebuffer_multisample and
GL_ANGLE_framebuffer_blit (exposed as the unified extension
GL_CHROMIUM_framebuffer_multisample) through WebGraphicsContext3D.

  • public/WebGraphicsContext3D.h:
  • src/Extensions3DChromium.cpp: (WebCore::Extensions3DChromium::blitFramebuffer): (WebCore::Extensions3DChromium::renderbufferStorageMultisample):
  • src/GraphicsContext3DChromium.cpp: (WebCore::GraphicsContext3DInternal::supportsExtension): (WebCore::GraphicsContext3DInternal::ensureExtensionEnabled):
  • src/GraphicsContext3DInternal.h:

2011-01-26 Kenneth Russell <kbr@google.com>

Reviewed by James Robinson.

Fix multisampling support in DrawingBuffer
https://bugs.webkit.org/show_bug.cgi?id=53154

In DrawingBuffer's multisampling code path, fixed enum usage and a
bug where it would incorrectly redefine the depth and stencil
buffers. Hooked up multisampling code path in Chromium port.

Tested manually with some accelerated 2D canvas content.
Multisampling isn't being switched on for the accelerated 2D
canvas at the current time because it will increase fill rate
requirements and cause a large number of rebaselines.

  • platform/graphics/Extensions3D.h:
  • platform/graphics/chromium/DrawingBufferChromium.cpp: (WebCore::DrawingBuffer::publishToPlatformLayer):
  • platform/graphics/chromium/Extensions3DChromium.h:
  • platform/graphics/gpu/DrawingBuffer.cpp: (WebCore::DrawingBuffer::create): (WebCore::DrawingBuffer::reset):
  • platform/graphics/opengl/Extensions3DOpenGL.cpp: (WebCore::Extensions3DOpenGL::supports):
Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76713 r76717  
     12011-01-26  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by James Robinson.
     4
     5        Fix multisampling support in DrawingBuffer
     6        https://bugs.webkit.org/show_bug.cgi?id=53154
     7
     8        In DrawingBuffer's multisampling code path, fixed enum usage and a
     9        bug where it would incorrectly redefine the depth and stencil
     10        buffers. Hooked up multisampling code path in Chromium port.
     11
     12        Tested manually with some accelerated 2D canvas content.
     13        Multisampling isn't being switched on for the accelerated 2D
     14        canvas at the current time because it will increase fill rate
     15        requirements and cause a large number of rebaselines.
     16
     17        * platform/graphics/Extensions3D.h:
     18        * platform/graphics/chromium/DrawingBufferChromium.cpp:
     19        (WebCore::DrawingBuffer::publishToPlatformLayer):
     20        * platform/graphics/chromium/Extensions3DChromium.h:
     21        * platform/graphics/gpu/DrawingBuffer.cpp:
     22        (WebCore::DrawingBuffer::create):
     23        (WebCore::DrawingBuffer::reset):
     24        * platform/graphics/opengl/Extensions3DOpenGL.cpp:
     25        (WebCore::Extensions3DOpenGL::supports):
     26
    1272011-01-26  Tony Chang  <tony@chromium.org>
    228
  • trunk/Source/WebCore/platform/graphics/Extensions3D.h

    r76324 r76717  
    5353    //   GL_OES_texture_float
    5454    //   GL_OES_standard_derivatives
     55    //   GL_OES_rgb8_rgba8
    5556
    5657    // Takes full name of extension; for example,
     
    8889        // GL_OES_standard_derivatives names
    8990        FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B,
     91
     92        // GL_OES_rgb8_rgba8 names
     93        RGB8_OES = 0x8051,
     94        RGBA8_OES = 0x8058,
    9095    };
    9196
  • trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp

    r76658 r76717  
    120120    if (m_callback)
    121121        m_callback->willPublish();
     122    if (multisample())
     123        commit();
    122124    unsigned parentTexture = m_internal->platformLayer->textureId();
    123125    // FIXME: We do the copy in the canvas' (child) context so that it executes in the correct order relative to
  • trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h

    r73806 r76717  
    4545    virtual void ensureEnabled(const String&);
    4646    virtual int getGraphicsResetStatusARB();
    47     virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) { }
    48     virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) { }
     47    virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter);
     48    virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height);
    4949
    5050    enum {
  • trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp

    r76658 r76717  
    4242{
    4343    Extensions3D* extensions = context->getExtensions();
    44     bool multisampleSupported = extensions->supports("GL_ANGLE_framebuffer_blit") && extensions->supports("GL_ANGLE_framebuffer_multisample");
     44    bool multisampleSupported = extensions->supports("GL_ANGLE_framebuffer_blit") && extensions->supports("GL_ANGLE_framebuffer_multisample") && extensions->supports("GL_OES_rgb8_rgba8");
    4545    if (multisampleSupported) {
    4646        extensions->ensureEnabled("GL_ANGLE_framebuffer_blit");
    4747        extensions->ensureEnabled("GL_ANGLE_framebuffer_multisample");
     48        extensions->ensureEnabled("GL_OES_rgb8_rgba8");
    4849    }
    4950    bool packedDepthStencilSupported = extensions->supports("GL_OES_packed_depth_stencil");
     
    154155   
    155156    const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes();
    156     unsigned long internalColorFormat, colorFormat;
     157    unsigned long internalColorFormat, colorFormat, internalRenderbufferFormat;
    157158    if (attributes.alpha) {
    158159        internalColorFormat = GraphicsContext3D::RGBA;
    159160        colorFormat = GraphicsContext3D::RGBA;
     161        internalRenderbufferFormat = Extensions3D::RGBA8_OES;
    160162    } else {
    161163        internalColorFormat = GraphicsContext3D::RGB;
    162164        colorFormat = GraphicsContext3D::RGB;
     165        internalRenderbufferFormat = Extensions3D::RGB8_OES;
    163166    }
    164167
     
    174177
    175178        m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer);
    176         m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalColorFormat, m_size.width(), m_size.height());
     179        m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalRenderbufferFormat, m_size.width(), m_size.height());
    177180        m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer);
    178181        resizeDepthStencil(sampleCount);
     
    191194    m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0);
    192195    m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
    193     resizeDepthStencil(0);
     196    if (!multisample())
     197        resizeDepthStencil(0);
    194198    if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
    195199        // Cleanup
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp

    r76600 r76717  
    8080        return m_availableExtensions.contains("GL_EXT_framebuffer_multisample");
    8181
     82    // Desktop GL always supports GL_OES_rgb8_rgba8.
     83    if (name == "GL_OES_rgb8_rgba8")
     84        return true;
     85
    8286    // If GL_ARB_texture_float is available then we report GL_OES_texture_float and
    8387    // GL_OES_texture_half_float as available.
  • trunk/Source/WebKit/chromium/ChangeLog

    r76713 r76717  
     12011-01-26  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by James Robinson.
     4
     5        Fix multisampling support in DrawingBuffer
     6        https://bugs.webkit.org/show_bug.cgi?id=53154
     7
     8        Plumbed GL_ANGLE_framebuffer_multisample and
     9        GL_ANGLE_framebuffer_blit (exposed as the unified extension
     10        GL_CHROMIUM_framebuffer_multisample) through WebGraphicsContext3D.
     11
     12        * public/WebGraphicsContext3D.h:
     13        * src/Extensions3DChromium.cpp:
     14        (WebCore::Extensions3DChromium::blitFramebuffer):
     15        (WebCore::Extensions3DChromium::renderbufferStorageMultisample):
     16        * src/GraphicsContext3DChromium.cpp:
     17        (WebCore::GraphicsContext3DInternal::supportsExtension):
     18        (WebCore::GraphicsContext3DInternal::ensureExtensionEnabled):
     19        * src/GraphicsContext3DInternal.h:
     20
    1212011-01-26  Tony Chang  <tony@chromium.org>
    222
  • trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h

    r75553 r76717  
    141141    virtual void requestExtensionCHROMIUM(const char*) = 0;
    142142
     143    // GL_CHROMIUM_framebuffer_multisample
     144    virtual void blitFramebufferCHROMIUM(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, unsigned mask, unsigned filter) = 0;
     145    virtual void renderbufferStorageMultisampleCHROMIUM(unsigned long target, int samples, unsigned internalformat, unsigned width, unsigned height) = 0;
     146
    143147    // The entry points below map directly to the OpenGL ES 2.0 API.
    144148    // See: http://www.khronos.org/registry/gles/
  • trunk/Source/WebKit/chromium/src/Extensions3DChromium.cpp

    r76600 r76717  
    6363}
    6464
     65void Extensions3DChromium::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
     66{
     67    m_internal->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
     68}
     69
     70void Extensions3DChromium::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
     71{
     72    m_internal->renderbufferStorageMultisampleCHROMIUM(target, samples, internalformat, width, height);
     73}
     74
    6575void* Extensions3DChromium::mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access)
    6676{
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp

    r76600 r76717  
    365365}
    366366
     367#define DELEGATE_TO_IMPL_10(name, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) \
     368void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8, t9 a9, t10 a10) \
     369{ \
     370    m_impl->name(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); \
     371}
     372
    367373DELEGATE_TO_IMPL_R(makeContextCurrent, bool)
    368374
     
    692698}
    693699
     700String mapExtensionName(const String& name)
     701{
     702    if (name == "GL_ANGLE_framebuffer_blit"
     703        || name == "GL_ANGLE_framebuffer_multisample")
     704        return "GL_CHROMIUM_framebuffer_multisample";
     705    return name;
     706}
     707
    694708} // anonymous namespace
    695709
     
    711725{
    712726    initializeExtensions();
    713     return m_enabledExtensions.contains(name) || m_requestableExtensions.contains(name);
     727    String mappedName = mapExtensionName(name);
     728    return m_enabledExtensions.contains(mappedName) || m_requestableExtensions.contains(mappedName);
    714729}
    715730
     
    718733    initializeExtensions();
    719734
    720     if (m_enabledExtensions.contains(name))
     735    String mappedName = mapExtensionName(name);
     736    if (m_enabledExtensions.contains(mappedName))
    721737        return true;
    722738
    723     if (m_requestableExtensions.contains(name)) {
    724         m_impl->requestExtensionCHROMIUM(name.ascii().data());
     739    if (m_requestableExtensions.contains(mappedName)) {
     740        m_impl->requestExtensionCHROMIUM(mappedName.ascii().data());
    725741        m_enabledExtensions.clear();
    726742        m_requestableExtensions.clear();
     
    729745
    730746    initializeExtensions();
    731     return m_enabledExtensions.contains(name);
     747    return m_enabledExtensions.contains(mappedName);
    732748}
    733749
     
    737753DELEGATE_TO_IMPL_1(unmapTexSubImage2DCHROMIUM, const void*)
    738754DELEGATE_TO_IMPL_2(copyTextureToParentTextureCHROMIUM, Platform3DObject, Platform3DObject)
     755DELEGATE_TO_IMPL_10(blitFramebufferCHROMIUM, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dbitfield, GC3Denum)
     756DELEGATE_TO_IMPL_5(renderbufferStorageMultisampleCHROMIUM, GC3Denum, GC3Dsizei, GC3Denum, GC3Dsizei, GC3Dsizei)
    739757
    740758//----------------------------------------------------------------------
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DInternal.h

    r76549 r76717  
    259259    void copyTextureToParentTextureCHROMIUM(Platform3DObject texture, Platform3DObject parentTexture);
    260260
     261    // GL_CHROMIUM_framebuffer_multisample
     262    void blitFramebufferCHROMIUM(GC3Dint srcX0, GC3Dint srcY0, GC3Dint srcX1, GC3Dint srcY1, GC3Dint dstX0, GC3Dint dstY0, GC3Dint dstX1, GC3Dint dstY1, GC3Dbitfield mask, GC3Denum filter);
     263    void renderbufferStorageMultisampleCHROMIUM(GC3Denum target, GC3Dsizei samples, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height);
     264
    261265private:
    262266    OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
Note: See TracChangeset for help on using the changeset viewer.