Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp

Issue 12843018: Merge 145856 "Check to ensure MultisampleRenderbuffer creation s..." (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « Source/WebCore/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698