Changeset 83355 in webkit


Ignore:
Timestamp:
Apr 8, 2011 4:01:29 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-08 Jeff Timanus <twiz@chromium.org>

Reviewed by Kenneth Russell.

Fall back to software rendering for Canvas2D when requesting a DrawingBuffer larger than supported by the GL environment.
https://bugs.webkit.org/show_bug.cgi?id=57768

  • platform/chromium/test_expectations.txt:

2011-04-08 Jeff Timanus <twiz@chromium.org>

Reviewed by Kenneth Russell.

Fall back to software rendering for Canvas2D when requesting a DrawingBuffer larger than supported by the GL environment.
https://bugs.webkit.org/show_bug.cgi?id=57768

  • html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D): (WebCore::CanvasRenderingContext2D::reset):
  • platform/graphics/gpu/DrawingBuffer.cpp: (WebCore::DrawingBuffer::reset):
  • platform/graphics/gpu/DrawingBuffer.h:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83353 r83355  
     12011-04-08  Jeff Timanus  <twiz@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Fall back to software rendering for Canvas2D when requesting a DrawingBuffer larger than supported by the GL environment.
     6        https://bugs.webkit.org/show_bug.cgi?id=57768
     7
     8        * platform/chromium/test_expectations.txt:
     9
    1102011-04-08  Daniel Cheng  <dcheng@chromium.org>
    211
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r83336 r83355  
    29152915BUGNONE SLOW GPU DEBUG WIN : fast/canvas/canvas-getImageData.html = PASS
    29162916
    2917 // Started failing after r75648 on everything except Snow Leopard
    2918 BUGWK52341 GPU : fast/canvas/canvas-large-dimensions.html = TEXT
    2919 
    29202917BUGWK53469 GPU MAC : compositing/scroll-painted-composited-content.html = CRASH
    29212918
  • trunk/Source/WebCore/ChangeLog

    r83353 r83355  
     12011-04-08  Jeff Timanus  <twiz@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Fall back to software rendering for Canvas2D when requesting a DrawingBuffer larger than supported by the GL environment.
     6        https://bugs.webkit.org/show_bug.cgi?id=57768
     7
     8        * html/canvas/CanvasRenderingContext2D.cpp:
     9        (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
     10        (WebCore::CanvasRenderingContext2D::reset):
     11        * platform/graphics/gpu/DrawingBuffer.cpp:
     12        (WebCore::DrawingBuffer::reset):
     13        * platform/graphics/gpu/DrawingBuffer.h:
     14
    1152011-04-08  Daniel Cheng  <dcheng@chromium.org>
    216
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r82860 r83355  
    134134        if (m_context3D) {
    135135            m_drawingBuffer = m_context3D->graphicsContext3D()->createDrawingBuffer(IntSize(canvas->width(), canvas->height()));
    136             c->setSharedGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas->width(), canvas->height()));
     136            if (!m_drawingBuffer) {
     137                c->setSharedGraphicsContext3D(0, 0, IntSize());
     138                m_context3D.clear();
     139            } else
     140                c->setSharedGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas->width(), canvas->height()));
    137141        }
    138142    }
     
    174178    if (GraphicsContext* c = drawingContext()) {
    175179        if (m_context3D && m_drawingBuffer) {
    176             m_drawingBuffer->reset(IntSize(canvas()->width(), canvas()->height()));
    177             c->setSharedGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas()->width(), canvas()->height()));
     180            if (m_drawingBuffer->reset(IntSize(canvas()->width(), canvas()->height()))) {
     181                c->setSharedGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas()->width(), canvas()->height()));
    178182#if USE(ACCELERATED_COMPOSITING)
    179             RenderBox* renderBox = canvas()->renderBox();
    180             if (renderBox && renderBox->hasLayer() && renderBox->layer()->hasAcceleratedCompositing())
    181                 renderBox->layer()->contentChanged(RenderLayer::CanvasChanged);
    182 #endif
     183                RenderBox* renderBox = canvas()->renderBox();
     184                if (renderBox && renderBox->hasLayer() && renderBox->layer()->hasAcceleratedCompositing())
     185                    renderBox->layer()->contentChanged(RenderLayer::CanvasChanged);
     186#endif
     187            } else {
     188                c->setSharedGraphicsContext3D(0, 0, IntSize());
     189                m_drawingBuffer.clear();
     190                m_context3D.clear();
     191            }
    183192        }
    184193    }
  • trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp

    r76717 r83355  
    145145}
    146146
    147 void DrawingBuffer::reset(const IntSize& newSize)
    148 {
     147bool DrawingBuffer::reset(const IntSize& newSize)
     148{
     149    if (!m_context)
     150        return false;
     151
     152    m_context->makeContextCurrent();
     153
     154    int maxTextureSize = 0;
     155    m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &maxTextureSize);
     156    if (newSize.height() > maxTextureSize || newSize.width() > maxTextureSize) {
     157      clear();
     158      return false;
     159    }
     160
    149161    m_size = newSize;
    150162
    151     if (!m_context)
    152         return;
    153        
    154     m_context->makeContextCurrent();
    155    
    156163    const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes();
    157164    unsigned long internalColorFormat, colorFormat, internalRenderbufferFormat;
     
    183190            // Cleanup
    184191            clear();
    185             return;
     192            return false;
    186193        }
    187194    }
     
    191198
    192199    m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer);
     200   
    193201    m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE);
     202
    194203    m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0);
    195204    m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
     205
    196206    if (!multisample())
    197207        resizeDepthStencil(0);
     
    199209        // Cleanup
    200210        clear();
    201         return;
     211        return false;
    202212    }
    203213
     
    251261   
    252262    didReset();
     263
     264    return true;
    253265}
    254266
  • trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h

    r81915 r83355  
    6161    ~DrawingBuffer();
    6262
    63     void reset(const IntSize&);
     63    // Returns true if the buffer was successfully resized.
     64    bool reset(const IntSize&);
    6465    void bind();
    6566    IntSize size() const { return m_size; }
Note: See TracChangeset for help on using the changeset viewer.