Changeset 102698 in webkit


Ignore:
Timestamp:
Dec 13, 2011 1:12:40 PM (12 years ago)
Author:
alokp@chromium.org
Message:

[chromium] compositing/masks layout tests fail with accelerated drawing
https://bugs.webkit.org/show_bug.cgi?id=72760

Reviewed by Stephen White.

Source/WebCore:

Accelerated drawing path used to render bottom-up upright textures, which was opposite of what the software path rendered.
The textures produced by the accelerated path was flipped along Y in the shader to make it upside down as expected by the compositor.
This strategy does not work in case of masks which do not go through a shader and hence do not get flipped,
which results in a case where texture in the render surface is top-down, while that in the mask is bottom-up.
This patch makes accelerated drawing path render textures in the same orientation as the software path.
LayerTextureUpdater::Orientation was added to support the difference in texture orientation between software and accelerated paths.
Now that both paths produce textures in the same orientation, there is no need for it.

No new tests needed. Covered by existing compositing tests.

  • platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h:
  • platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
  • platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:

(WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):

  • platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:
  • platform/graphics/chromium/ImageLayerChromium.cpp:
  • platform/graphics/chromium/LayerTextureUpdater.h:
  • platform/graphics/chromium/TiledLayerChromium.cpp:

(WebCore::TiledLayerChromium::TiledLayerChromium):
(WebCore::TiledLayerChromium::setLayerTreeHost):
(WebCore::TiledLayerChromium::pushPropertiesTo):

  • platform/graphics/chromium/TiledLayerChromium.h:
  • platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:

(WebCore::CCTiledLayerImpl::drawTiles):

  • platform/graphics/chromium/cc/CCTiledLayerImpl.h:

(WebCore::CCTiledLayerImpl::setSkipsDraw):

Source/WebKit/chromium:

  • tests/TiledLayerChromiumTest.cpp:

(WTF::FakeLayerTextureUpdater::createTexture):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r102697 r102698  
     12011-12-13  Alok Priyadarshi  <alokp@chromium.org>
     2
     3        [chromium] compositing/masks layout tests fail with accelerated drawing
     4        https://bugs.webkit.org/show_bug.cgi?id=72760
     5
     6        Reviewed by Stephen White.
     7
     8        Accelerated drawing path used to render bottom-up upright textures, which was opposite of what the software path rendered.
     9        The textures produced by the accelerated path was flipped along Y in the shader to make it upside down as expected by the compositor.
     10        This strategy does not work in case of masks which do not go through a shader and hence do not get flipped,
     11        which results in a case where texture in the render surface is top-down, while that in the mask is bottom-up.
     12        This patch makes accelerated drawing path render textures in the same orientation as the software path.
     13        LayerTextureUpdater::Orientation was added to support the difference in texture orientation between software and accelerated paths.
     14        Now that both paths produce textures in the same orientation, there is no need for it.
     15
     16        No new tests needed. Covered by existing compositing tests.
     17
     18        * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h:
     19        * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
     20        * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
     21        (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
     22        * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:
     23        * platform/graphics/chromium/ImageLayerChromium.cpp:
     24        * platform/graphics/chromium/LayerTextureUpdater.h:
     25        * platform/graphics/chromium/TiledLayerChromium.cpp:
     26        (WebCore::TiledLayerChromium::TiledLayerChromium):
     27        (WebCore::TiledLayerChromium::setLayerTreeHost):
     28        (WebCore::TiledLayerChromium::pushPropertiesTo):
     29        * platform/graphics/chromium/TiledLayerChromium.h:
     30        * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
     31        (WebCore::CCTiledLayerImpl::drawTiles):
     32        * platform/graphics/chromium/cc/CCTiledLayerImpl.h:
     33        (WebCore::CCTiledLayerImpl::setSkipsDraw):
     34
    1352011-12-09  Zhenyao Mo  <zmo@google.com>
    236
  • trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h

    r101600 r102698  
    5858
    5959    virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*);
    60     virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; }
    6160    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
    6261    virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale);
  • trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h

    r102181 r102698  
    5757
    5858    virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*);
    59     virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; }
    6059    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
    6160    virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale);
  • trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp

    r101600 r102698  
    148148
    149149    canvas->clipRect(SkRect(destRect));
     150    // The compositor expects the textures to be upside-down so it can flip
     151    // the final composited image. Ganesh renders the image upright so we
     152    // need to do a y-flip.
     153    canvas->translate(0.0, texture->size().height());
     154    canvas->scale(1.0, -1.0);
    150155    // Translate the origin of contentRect to that of destRect.
    151156    // Note that destRect is defined relative to sourceRect.
  • trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h

    r101600 r102698  
    5454
    5555    virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*);
    56     virtual Orientation orientation() { return LayerTextureUpdater::TopDownOrientation; }
    5756    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
    5857    void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

    r102180 r102698  
    7878    }
    7979
    80     virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; }
    81 
    8280    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat)
    8381    {
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h

    r101600 r102698  
    6161    virtual ~LayerTextureUpdater() { }
    6262
    63     enum Orientation {
    64         BottomUpOrientation,
    65         TopDownOrientation,
    66         InvalidOrientation,
    67     };
    6863    enum SampledTexelFormat {
    6964        SampledTexelFormatRGBA,
     
    7267    };
    7368    virtual PassOwnPtr<Texture> createTexture(TextureManager*) = 0;
    74     // Returns the orientation of the texture uploaded by this interface.
    75     virtual Orientation orientation() = 0;
    7669    // Returns the format of the texel uploaded by this interface.
    7770    // This format should not be confused by texture internal format.
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp

    r102512 r102698  
    7373    , m_textureFormat(GraphicsContext3D::INVALID_ENUM)
    7474    , m_skipsDraw(false)
    75     , m_textureOrientation(LayerTextureUpdater::InvalidOrientation)
    7675    , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid)
    7776    , m_tilingOption(AutoTile)
     
    164163
    165164    setTextureFormat(host->layerRendererCapabilities().bestTextureFormat);
    166     m_textureOrientation = textureUpdater()->orientation();
    167165    m_sampledTexelFormat = textureUpdater()->sampledTexelFormat(m_textureFormat);
    168166}
     
    251249
    252250    tiledLayer->setSkipsDraw(m_skipsDraw);
    253     tiledLayer->setTextureOrientation(m_textureOrientation);
    254251    tiledLayer->setSampledTexelFormat(m_sampledTexelFormat);
    255252    tiledLayer->setTilingData(*m_tiler);
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h

    r101623 r102698  
    102102    GC3Denum m_textureFormat;
    103103    bool m_skipsDraw;
    104     LayerTextureUpdater::Orientation m_textureOrientation;
    105104    LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;
    106105
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp

    r102164 r102698  
    289289            float fragmentTexScaleY = clampRect.height() / tileHeight;
    290290
    291             // OpenGL coordinate system is bottom-up.
    292             // If tile texture is top-down, we need to flip the texture coordinates.
    293             if (m_textureOrientation == LayerTextureUpdater::TopDownOrientation) {
    294                 fragmentTexTranslateY = 1.0 - fragmentTexTranslateY;
    295                 fragmentTexScaleY *= -1.0;
    296             }
    297 
    298291            CCLayerQuad::Edge edgeX = contentQuad.right();
    299292            if (i < (m_tiler->numTilesX() - 1)) {
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h

    r100958 r102698  
    5050
    5151    void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
    52     void setTextureOrientation(LayerTextureUpdater::Orientation textureOrientation) { m_textureOrientation = textureOrientation; }
    5352    void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTexelFormat) { m_sampledTexelFormat = sampledTexelFormat; }
    5453    void setTilingData(const CCLayerTilingData& tiler);
     
    9089
    9190    bool m_skipsDraw;
    92     LayerTextureUpdater::Orientation m_textureOrientation;
    9391    LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;
    9492
  • trunk/Source/WebKit/chromium/ChangeLog

    r102693 r102698  
     12011-12-13  Alok Priyadarshi  <alokp@chromium.org>
     2
     3        [chromium] compositing/masks layout tests fail with accelerated drawing
     4        https://bugs.webkit.org/show_bug.cgi?id=72760
     5
     6        Reviewed by Stephen White.
     7
     8        * tests/TiledLayerChromiumTest.cpp:
     9        (WTF::FakeLayerTextureUpdater::createTexture):
     10
    1112011-12-13  Stephen White  <senorblanco@chromium.org>
    212
  • trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

    r102115 r102698  
    5959
    6060    virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) { return adoptPtr(new Texture(ManagedTexture::create(manager))); }
    61     virtual Orientation orientation() { return BottomUpOrientation; }
    6261    virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; }
    6362    virtual void prepareToUpdate(const IntRect&, const IntSize&, int, float) { }
Note: See TracChangeset for help on using the changeset viewer.