Changeset 106376 in webkit
- Timestamp:
- Jan 31, 2012 12:00:09 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/platform/chromium/test_expectations.txt
r106349 r106376 3832 3832 BUGWK76580 : media/media-document-audio-repaint.html = IMAGE PASS 3833 3833 3834 BUGWK76562 : fast/canvas/webgl/drawingbuffer-test.html = TEXT3835 3836 3834 // This test is passing, but it doesn't seem possible to add GPU+Leopard specific baselines. 3837 3835 BUGJAMESR LEOPARD GPU : fast/canvas/quadraticCurveTo.xml = IMAGE -
trunk/Source/WebCore/ChangeLog
r106373 r106376 1 2012-01-31 Yongsheng Zhu <yongsheng.zhu@intel.com> 2 3 WebGL must allocate smaller drawing buffer when the allocation fails. 4 https://bugs.webkit.org/show_bug.cgi?id=76654 5 6 Reviewed by Kenneth Russell. 7 8 Test: fast/canvas/webgl/drawingbuffer-test.html 9 10 * platform/graphics/gpu/DrawingBuffer.cpp: 11 (WebCore): 12 (WebCore::DrawingBuffer::create): 13 (WebCore::DrawingBuffer::reset): 14 1 15 2012-01-25 Eric Seidel <eric@webkit.org> 2 16 -
trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
r105233 r106376 50 50 #endif 51 51 static int s_currentResourceUsePixels = 0; 52 static const float s_resourceAdjustedRatio = 0.5; 52 53 53 54 PassRefPtr<DrawingBuffer> DrawingBuffer::create(GraphicsContext3D* context, const IntSize& size, bool separateBackingTexture) … … 237 238 238 239 int pixelDelta = newSize.width() * newSize.height(); 239 if (!m_size.isEmpty()) 240 pixelDelta -= m_size.width() * m_size.height(); 241 242 if (s_maximumResourceUsePixels && (s_currentResourceUsePixels + pixelDelta) > s_maximumResourceUsePixels) { 243 clear(); 244 return false; 245 } 246 s_currentResourceUsePixels += pixelDelta; 240 int oldSize = 0; 241 if (!m_size.isEmpty()) { 242 oldSize = m_size.width() * m_size.height(); 243 pixelDelta -= oldSize; 244 } 245 246 IntSize adjustedSize = newSize; 247 if (s_maximumResourceUsePixels) { 248 while ((s_currentResourceUsePixels + pixelDelta) > s_maximumResourceUsePixels) { 249 adjustedSize.scale(s_resourceAdjustedRatio); 250 if (adjustedSize.isEmpty()) { 251 clear(); 252 return false; 253 } 254 pixelDelta = adjustedSize.width() * adjustedSize.height(); 255 pixelDelta -= oldSize; 256 } 257 } 247 258 248 259 const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes(); 249 260 250 if (newSize != m_size) { 251 m_size = newSize; 261 if (adjustedSize != m_size) { 252 262 253 263 unsigned internalColorFormat, colorFormat, internalRenderbufferFormat; … … 262 272 } 263 273 264 265 // resize multisample FBO 266 if (multisample()) { 267 int maxSampleCount = 0; 268 269 m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSampleCount); 270 int sampleCount = std::min(4, maxSampleCount); 271 272 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO); 273 274 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); 275 m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalRenderbufferFormat, m_size.width(), m_size.height()); 276 m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); 277 resizeDepthStencil(sampleCount); 278 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { 279 // Cleanup 280 clear(); 281 return false; 274 do { 275 m_size = adjustedSize; 276 277 // resize multisample FBO 278 if (multisample()) { 279 int maxSampleCount = 0; 280 281 m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSampleCount); 282 int sampleCount = std::min(4, maxSampleCount); 283 284 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO); 285 286 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); 287 m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalRenderbufferFormat, m_size.width(), m_size.height()); 288 m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); 289 resizeDepthStencil(sampleCount); 290 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { 291 adjustedSize.scale(s_resourceAdjustedRatio); 292 continue; 293 } 282 294 } 283 } 284 285 // resize regular FBO 286 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); 287 288 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer); 289 m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0); 290 291 m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0); 292 293 // resize the backing color buffer 294 if (m_separateBackingTexture) { 295 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_backingColorBuffer); 295 296 // resize regular FBO 297 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); 298 299 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer); 296 300 m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0); 297 } 298 299 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); 300 301 if (!multisample()) 302 resizeDepthStencil(0); 303 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { 304 // Cleanup 301 302 m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0); 303 304 // resize the backing color buffer 305 if (m_separateBackingTexture) { 306 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_backingColorBuffer); 307 m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0); 308 } 309 310 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); 311 312 if (!multisample()) 313 resizeDepthStencil(0); 314 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE) 315 break; 316 adjustedSize.scale(s_resourceAdjustedRatio); 317 318 } while (!adjustedSize.isEmpty()); 319 320 pixelDelta = m_size.width() * m_size.height(); 321 pixelDelta -= oldSize; 322 s_currentResourceUsePixels += pixelDelta; 323 324 if (adjustedSize.isEmpty()) { 305 325 clear(); 306 326 return false;
Note: See TracChangeset
for help on using the changeset viewer.