| Index: Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
|
| ===================================================================
|
| --- Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp (revision 146669)
|
| +++ Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp (working copy)
|
| @@ -189,6 +189,33 @@
|
| }
|
| }
|
|
|
| +// Only way to ensure that we're not getting a bad framebuffer on some AMD/OSX devices.
|
| +// FIXME: This can be removed once renderbufferStorageMultisample starts reporting GL_OUT_OF_MEMORY properly.
|
| +bool DrawingBuffer::checkBufferIntegrity()
|
| +{
|
| + if (!m_multisampleFBO)
|
| + return true;
|
| +
|
| + if (m_scissorEnabled)
|
| + m_context->disable(GraphicsContext3D::SCISSOR_TEST);
|
| +
|
| + m_context->colorMask(true, true, true, true);
|
| +
|
| + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
|
| + m_context->clearColor(1.0f, 0.0f, 1.0f, 1.0f);
|
| + m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
|
| +
|
| + commit(0, 0, 1, 1);
|
| +
|
| + unsigned char pixel[4] = {0, 0, 0, 0};
|
| + m_context->readPixels(0, 0, 1, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, &pixel);
|
| +
|
| + if (m_scissorEnabled)
|
| + m_context->enable(GraphicsContext3D::SCISSOR_TEST);
|
| +
|
| + return (pixel[0] == 0xFF && pixel[1] == 0x00 && pixel[2] == 0xFF && pixel[3] == 0xFF);
|
| +}
|
| +
|
| bool DrawingBuffer::reset(const IntSize& newSize)
|
| {
|
| if (!m_context)
|
| @@ -238,7 +265,6 @@
|
| internalRenderbufferFormat = Extensions3D::RGB8_OES;
|
| }
|
|
|
| -
|
| do {
|
| m_size = adjustedSize;
|
| // resize multisample FBO
|
| @@ -252,6 +278,12 @@
|
|
|
| m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer);
|
| m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalRenderbufferFormat, m_size.width(), m_size.height());
|
| +
|
| + if (m_context->getError() == GraphicsContext3D::OUT_OF_MEMORY) {
|
| + adjustedSize.scale(s_resourceAdjustedRatio);
|
| + continue;
|
| + }
|
| +
|
| m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer);
|
| resizeDepthStencil(sampleCount);
|
| if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
|
| @@ -278,10 +310,21 @@
|
|
|
| if (!multisample())
|
| resizeDepthStencil(0);
|
| - if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE)
|
| - break;
|
| - adjustedSize.scale(s_resourceAdjustedRatio);
|
| + if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
|
| + adjustedSize.scale(s_resourceAdjustedRatio);
|
| + continue;
|
| + }
|
|
|
| +#if OS(DARWIN)
|
| + // FIXME: This can be removed once renderbufferStorageMultisample starts reporting GL_OUT_OF_MEMORY properly on OSX.
|
| + if (!checkBufferIntegrity()) {
|
| + adjustedSize.scale(s_resourceAdjustedRatio);
|
| + continue;
|
| + }
|
| +#endif
|
| +
|
| + break;
|
| +
|
| } while (!adjustedSize.isEmpty());
|
|
|
| pixelDelta = m_size.width() * m_size.height();
|
|
|