Changeset 65001 in webkit


Ignore:
Timestamp:
Aug 9, 2010 1:54:14 PM (14 years ago)
Author:
jamesr@google.com
Message:

2010-08-09 James Robinson <jamesr@chromium.org>

Reviewed by Dimitri Glazkov.

[chromium] Add a PrepareTextureCallback to the chromium canvas layer compositor to upload mixed-mode results before compositing
https://bugs.webkit.org/show_bug.cgi?id=43656

When compositing an accelerated canvas that is using both hardware and software drawing,
we need a callback before compositing the layer to make sure that we upload any software
drawn results to the texture. This will go away as soon as implement all draw calls
in hardware.

To test, run any canvas demo that runs in mixed mode and verifies that the software results
always show up.

  • platform/graphics/chromium/CanvasLayerChromium.cpp: (WebCore::CanvasLayerChromium::updateTextureContents):
  • platform/graphics/chromium/CanvasLayerChromium.h: (WebCore::CanvasLayerChromium::setPrepareTextureCallback):
  • platform/graphics/skia/PlatformContextSkia.cpp: (WebCore::PrepareTextureCallbackImpl::create): (WebCore::PrepareTextureCallbackImpl::willPrepareTexture): (WebCore::PrepareTextureCallbackImpl::PrepareTextureCallbackImpl): (WebCore::PlatformContextSkia::setGraphicsContext3D):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64998 r65001  
     12010-08-09  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [chromium] Add a PrepareTextureCallback to the chromium canvas layer compositor to upload mixed-mode results before compositing
     6        https://bugs.webkit.org/show_bug.cgi?id=43656
     7
     8        When compositing an accelerated canvas that is using both hardware and software drawing,
     9        we need a callback before compositing the layer to make sure that we upload any software
     10        drawn results to the texture.  This will go away as soon as implement all draw calls
     11        in hardware.
     12
     13        To test, run any canvas demo that runs in mixed mode and verifies that the software results
     14        always show up.
     15
     16        * platform/graphics/chromium/CanvasLayerChromium.cpp:
     17        (WebCore::CanvasLayerChromium::updateTextureContents):
     18        * platform/graphics/chromium/CanvasLayerChromium.h:
     19        (WebCore::CanvasLayerChromium::setPrepareTextureCallback):
     20        * platform/graphics/skia/PlatformContextSkia.cpp:
     21        (WebCore::PrepareTextureCallbackImpl::create):
     22        (WebCore::PrepareTextureCallbackImpl::willPrepareTexture):
     23        (WebCore::PrepareTextureCallbackImpl::PrepareTextureCallbackImpl):
     24        (WebCore::PlatformContextSkia::setGraphicsContext3D):
     25
    1262010-08-09  Zhenyao Mo  <zmo@google.com>
    227
  • trunk/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp

    r64994 r65001  
    7676    // Update the contents of the texture used by the compositor.
    7777    if (m_contentsDirty) {
     78        if (m_prepareTextureCallback)
     79            m_prepareTextureCallback->willPrepareTexture();
    7880        m_context->prepareTexture();
    7981        m_contentsDirty = false;
  • trunk/WebCore/platform/graphics/chromium/CanvasLayerChromium.h

    r64994 r65001  
    5555    static void setShaderProgramId(unsigned shaderProgramId) { m_shaderProgramId = shaderProgramId; }
    5656
     57    class PrepareTextureCallback : public Noncopyable {
     58    public:
     59        virtual void willPrepareTexture() = 0;
     60    };
     61    void setPrepareTextureCallback(PassOwnPtr<PrepareTextureCallback> callback) { m_prepareTextureCallback = callback; }
     62
    5763private:
    5864    explicit CanvasLayerChromium(GraphicsLayerChromium* owner);
     
    6066    unsigned m_textureId;
    6167    bool m_textureChanged;
     68    OwnPtr<PrepareTextureCallback> m_prepareTextureCallback;
    6269
    6370    static unsigned m_shaderProgramId;
  • trunk/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

    r64994 r65001  
    3434
    3535#include "AffineTransform.h"
     36#include "CanvasLayerChromium.h"
    3637#include "GraphicsContext.h"
    3738#include "ImageBuffer.h"
     
    221222PlatformContextSkia::~PlatformContextSkia()
    222223{
     224#if USE(GLES2_RENDERING)
     225    if (m_gpuCanvas) {
     226        CanvasLayerChromium* layer = static_cast<CanvasLayerChromium*>(m_gpuCanvas->context()->platformLayer());
     227        layer->setPrepareTextureCallback(0);
     228    }
     229#endif
    223230}
    224231
     
    679686#if USE(GLES2_RENDERING)
    680687
     688class PrepareTextureCallbackImpl : public CanvasLayerChromium::PrepareTextureCallback {
     689public:
     690    static PassOwnPtr<PrepareTextureCallbackImpl> create(PlatformContextSkia* pcs)
     691    {
     692        return new PrepareTextureCallbackImpl(pcs);
     693    }
     694
     695    virtual void willPrepareTexture()
     696    {
     697        m_pcs->prepareForHardwareDraw();
     698    }
     699private:
     700    explicit PrepareTextureCallbackImpl(PlatformContextSkia* pcs) : m_pcs(pcs) {}
     701    PlatformContextSkia* m_pcs;
     702};
     703
    681704void PlatformContextSkia::setGraphicsContext3D(GraphicsContext3D* context, const WebCore::IntSize& size)
    682705{
    683706    m_useGPU = true;
    684707    m_gpuCanvas = new GLES2Canvas(context, size);
     708    CanvasLayerChromium* layer = static_cast<CanvasLayerChromium*>(context->platformLayer());
     709    layer->setPrepareTextureCallback(PrepareTextureCallbackImpl::create(this));
    685710}
    686711
Note: See TracChangeset for help on using the changeset viewer.