Changeset 87365 in webkit


Ignore:
Timestamp:
May 26, 2011 12:01:06 AM (13 years ago)
Author:
alokp@chromium.org
Message:

2011-05-26 Alok Priyadarshi <alokp@chromium.org>

Reviewed by James Robinson.

[chromium] Cannot create stencil render-buffer for accelerated drawing on desktop GL
https://bugs.webkit.org/show_bug.cgi?id=61444

Used DEPTH24_STENCIL8 format for stencil buffer instead of STENCIL_INDEX8.
Packed depth-stencil buffer is the most common format supported by graphics cards.
It is not very robust to rely on just one format being supported,
so long term the task of creating FBO should be delegated to SKIA,
which has necessary code to iterate through all possible formats.

  • platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp: (WebCore::LayerTextureUpdaterSkPicture::deleteFrameBuffer): (WebCore::LayerTextureUpdaterSkPicture::createFrameBuffer):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87363 r87365  
     12011-05-26  Alok Priyadarshi  <alokp@chromium.org>
     2
     3        Reviewed by James Robinson.
     4
     5        [chromium] Cannot create stencil render-buffer for accelerated drawing on desktop GL
     6        https://bugs.webkit.org/show_bug.cgi?id=61444
     7
     8        Used DEPTH24_STENCIL8 format for stencil buffer instead of STENCIL_INDEX8.
     9        Packed depth-stencil buffer is the most common format supported by graphics cards.
     10        It is not very robust to rely on just one format being supported,
     11        so long term the task of creating FBO should be delegated to SKIA,
     12        which has necessary code to iterate through all possible formats.
     13
     14        * platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp:
     15        (WebCore::LayerTextureUpdaterSkPicture::deleteFrameBuffer):
     16        (WebCore::LayerTextureUpdaterSkPicture::createFrameBuffer):
     17
    1182011-05-25  Jer Noble  <jer.noble@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp

    r87167 r87365  
    3131#include "LayerTextureUpdaterCanvas.h"
    3232
     33#include "Extensions3D.h"
    3334#include "GraphicsContext.h"
    3435#include "LayerPainterChromium.h"
     
    9697    , m_createFrameBuffer(false)
    9798    , m_fbo(0)
    98     , m_stencilBuffer(0)
     99    , m_depthStencilBuffer(0)
    99100{
    100101}
     
    160161    m_canvas.clear();
    161162
    162     if (m_stencilBuffer)
    163         context()->deleteRenderbuffer(m_stencilBuffer);
    164     if (m_fbo)
     163    if (m_depthStencilBuffer) {
     164        context()->deleteRenderbuffer(m_depthStencilBuffer);
     165        m_depthStencilBuffer = 0;
     166    }
     167    if (m_fbo) {
    165168        context()->deleteFramebuffer(m_fbo);
     169        m_fbo = 0;
     170    }
    166171}
    167172
     
    177182        return false;
    178183
     184    // SKIA only needs color and stencil buffers, not depth buffer.
     185    // But it is very uncommon for cards to support color + stencil FBO config.
     186    // The most common config is color + packed-depth-stencil.
     187    // Instead of iterating through all possible FBO configs, we only try the
     188    // most common one here.
     189    // FIXME: Delegate the task of creating frame-buffer to SKIA.
     190    // It has all necessary code to iterate through all possible configs
     191    // and choose the one most suitable for its purposes.
     192    Extensions3D* extensions = context()->getExtensions();
     193    if (!extensions->supports("GL_OES_packed_depth_stencil"))
     194        return false;
     195    extensions->ensureEnabled("GL_OES_packed_depth_stencil");
     196
    179197    // Create and bind a frame-buffer-object.
    180198    m_fbo = context()->createFramebuffer();
     
    186204    // The color buffer (texture) will be provided by tiles.
    187205    // SKIA does not need depth buffer.
    188     m_stencilBuffer = context()->createRenderbuffer();
    189     if (!m_stencilBuffer) {
    190         context()->deleteFramebuffer(m_fbo);
    191         m_fbo = 0;
    192         return false;
    193     }
    194     context()->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
    195     context()->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_bufferSize.width(), m_bufferSize.height());
    196     context()->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer);
     206    m_depthStencilBuffer = context()->createRenderbuffer();
     207    if (!m_depthStencilBuffer) {
     208        deleteFrameBuffer();
     209        return false;
     210    }
     211    context()->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
     212    context()->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, Extensions3D::DEPTH24_STENCIL8, m_bufferSize.width(), m_bufferSize.height());
     213    context()->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
     214    context()->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer);
    197215
    198216    // Create a skia gpu canvas.
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.h

    r87167 r87365  
    100100    IntSize m_bufferSize; // Frame buffer size.
    101101    Platform3DObject m_fbo; // Frame buffer id.
    102     Platform3DObject m_stencilBuffer;
     102    Platform3DObject m_depthStencilBuffer;
    103103    OwnPtr<SkCanvas> m_canvas; // GPU accelerated canvas.
    104104};
Note: See TracChangeset for help on using the changeset viewer.