Changeset 145280 in webkit
- Timestamp:
- Mar 8, 2013 3:47:16 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r145279 r145280 1 2013-03-08 Brandon Jones <bajones@google.com> 2 3 Check to ensure MultisampleRenderbuffer creation succeeds 4 https://bugs.webkit.org/show_bug.cgi?id=111780 5 6 Reviewed by Dean Jackson. 7 8 On OSX systems using AMD graphics chips the allocation of large 9 Multisample Renderbuffers in Chromium would fail without any indication 10 of failure. Attempting to draw to the buffer resulted in garbage being 11 rendered onscreen. This could be reproduced by opening a full-page 12 WebGL app and pressing (Command + "-") several times. This patch adds an 13 additional check during DrawingBuffer resize to verify that the resized 14 buffer is valid. 15 16 * platform/graphics/gpu/DrawingBuffer.cpp: 17 (WebCore): 18 (WebCore::DrawingBuffer::checkBufferIntegrity): 19 (WebCore::DrawingBuffer::reset): 20 * platform/graphics/gpu/DrawingBuffer.h: 21 (DrawingBuffer): 22 1 23 2013-03-08 Harald Alvestrand <hta@chromium.org> 2 24 -
trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
r139142 r145280 190 190 } 191 191 192 // Only way to ensure that we're not getting a bad framebuffer on some AMD/OSX devices. 193 // FIXME: This can be removed once renderbufferStorageMultisample starts reporting GL_OUT_OF_MEMORY properly. 194 bool DrawingBuffer::checkBufferIntegrity() 195 { 196 if (!m_multisampleFBO) 197 return true; 198 199 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO); 200 m_context->clearColor(1.0f, 0.0f, 1.0f, 1.0f); 201 m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); 202 203 commit(0, 0, 1, 1); 204 205 unsigned char pixel[4] = {0, 0, 0, 0}; 206 m_context->readPixels(0, 0, 1, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, &pixel); 207 208 return (pixel[0] == 0xFF && pixel[1] == 0x00 && pixel[2] == 0xFF && pixel[3] == 0xFF); 209 } 210 192 211 bool DrawingBuffer::reset(const IntSize& newSize) 193 212 { … … 239 258 } 240 259 241 242 260 do { 243 261 m_size = adjustedSize; … … 253 271 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); 254 272 m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalRenderbufferFormat, m_size.width(), m_size.height()); 273 274 if (m_context->getError() == GraphicsContext3D::OUT_OF_MEMORY) { 275 adjustedSize.scale(s_resourceAdjustedRatio); 276 continue; 277 } 278 255 279 m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); 256 280 resizeDepthStencil(sampleCount); … … 279 303 if (!multisample()) 280 304 resizeDepthStencil(0); 281 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE) 282 break; 283 adjustedSize.scale(s_resourceAdjustedRatio); 305 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { 306 adjustedSize.scale(s_resourceAdjustedRatio); 307 continue; 308 } 309 310 #if OS(DARWIN) 311 // FIXME: This can be removed once renderbufferStorageMultisample starts reporting GL_OUT_OF_MEMORY properly on OSX. 312 if (!checkBufferIntegrity()) { 313 adjustedSize.scale(s_resourceAdjustedRatio); 314 continue; 315 } 316 #endif 317 318 break; 284 319 285 320 } while (!adjustedSize.isEmpty()); -
trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
r139142 r145280 141 141 void initialize(const IntSize&); 142 142 143 bool checkBufferIntegrity(); 144 143 145 PreserveDrawingBuffer m_preserveDrawingBuffer; 144 146 AlphaRequirement m_alpha;
Note: See TracChangeset
for help on using the changeset viewer.