Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #include <algorithm> | 35 #include <algorithm> |
| 36 #include "platform/TraceEvent.h" | 36 #include "platform/TraceEvent.h" |
| 37 #include "platform/graphics/GraphicsLayer.h" | 37 #include "platform/graphics/GraphicsLayer.h" |
| 38 #include "platform/graphics/gpu/Extensions3DUtil.h" | 38 #include "platform/graphics/gpu/Extensions3DUtil.h" |
| 39 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
| 40 #include "public/platform/WebCompositorSupport.h" | 40 #include "public/platform/WebCompositorSupport.h" |
| 41 #include "public/platform/WebExternalBitmap.h" | 41 #include "public/platform/WebExternalBitmap.h" |
| 42 #include "public/platform/WebExternalTextureLayer.h" | 42 #include "public/platform/WebExternalTextureLayer.h" |
| 43 #include "public/platform/WebGraphicsContext3D.h" | 43 #include "public/platform/WebGraphicsContext3D.h" |
| 44 #include "public/platform/WebGraphicsContext3DProvider.h" | 44 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 45 #ifndef NDEBUG | |
| 46 #include "wtf/RefCountedLeakCounter.h" | |
| 47 #endif | |
| 45 | 48 |
| 46 using namespace std; | 49 using namespace std; |
| 47 | 50 |
| 48 namespace WebCore { | 51 namespace WebCore { |
| 49 | 52 |
| 53 namespace { | |
| 50 // Global resource ceiling (expressed in terms of pixels) for DrawingBuffer crea tion and resize. | 54 // Global resource ceiling (expressed in terms of pixels) for DrawingBuffer crea tion and resize. |
| 51 // When this limit is set, DrawingBuffer::create() and DrawingBuffer::reset() ca lls that would | 55 // When this limit is set, DrawingBuffer::create() and DrawingBuffer::reset() ca lls that would |
| 52 // exceed the global cap will instead clear the buffer. | 56 // exceed the global cap will instead clear the buffer. |
| 53 static const int s_maximumResourceUsePixels = 16 * 1024 * 1024; | 57 const int s_maximumResourceUsePixels = 16 * 1024 * 1024; |
| 54 static int s_currentResourceUsePixels = 0; | 58 int s_currentResourceUsePixels = 0; |
| 55 static const float s_resourceAdjustedRatio = 0.5; | 59 const float s_resourceAdjustedRatio = 0.5; |
| 56 | 60 |
| 57 static const bool s_allowContextEvictionOnCreate = true; | 61 const bool s_allowContextEvictionOnCreate = true; |
| 58 static const int s_maxScaleAttempts = 3; | 62 const int s_maxScaleAttempts = 3; |
| 63 | |
| 64 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, drawingBufferCounter, ("Dra wingBuffer")); | |
| 59 | 65 |
| 60 class ScopedTextureUnit0BindingRestorer { | 66 class ScopedTextureUnit0BindingRestorer { |
| 61 public: | 67 public: |
| 62 ScopedTextureUnit0BindingRestorer(blink::WebGraphicsContext3D* context, GLen um activeTextureUnit, Platform3DObject textureUnitZeroId) | 68 ScopedTextureUnit0BindingRestorer(blink::WebGraphicsContext3D* context, GLen um activeTextureUnit, Platform3DObject textureUnitZeroId) |
| 63 : m_context(context) | 69 : m_context(context) |
| 64 , m_oldActiveTextureUnit(activeTextureUnit) | 70 , m_oldActiveTextureUnit(activeTextureUnit) |
| 65 , m_oldTextureUnitZeroId(textureUnitZeroId) | 71 , m_oldTextureUnitZeroId(textureUnitZeroId) |
| 66 { | 72 { |
| 67 m_context->activeTexture(GL_TEXTURE0); | 73 m_context->activeTexture(GL_TEXTURE0); |
| 68 } | 74 } |
| 69 ~ScopedTextureUnit0BindingRestorer() | 75 ~ScopedTextureUnit0BindingRestorer() |
| 70 { | 76 { |
| 71 m_context->bindTexture(GL_TEXTURE_2D, m_oldTextureUnitZeroId); | 77 m_context->bindTexture(GL_TEXTURE_2D, m_oldTextureUnitZeroId); |
| 72 m_context->activeTexture(m_oldActiveTextureUnit); | 78 m_context->activeTexture(m_oldActiveTextureUnit); |
| 73 } | 79 } |
| 74 | 80 |
| 75 private: | 81 private: |
| 76 blink::WebGraphicsContext3D* m_context; | 82 blink::WebGraphicsContext3D* m_context; |
| 77 GLenum m_oldActiveTextureUnit; | 83 GLenum m_oldActiveTextureUnit; |
| 78 Platform3DObject m_oldTextureUnitZeroId; | 84 Platform3DObject m_oldTextureUnitZeroId; |
| 79 }; | 85 }; |
| 86 } // namespace | |
| 80 | 87 |
| 81 PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<blink::WebGraphicsCon text3D> context, const IntSize& size, PreserveDrawingBuffer preserve, PassRefPtr <ContextEvictionManager> contextEvictionManager) | 88 PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<blink::WebGraphicsCon text3D> context, const IntSize& size, PreserveDrawingBuffer preserve, PassRefPtr <ContextEvictionManager> contextEvictionManager) |
| 82 { | 89 { |
| 83 ASSERT(context); | 90 ASSERT(context); |
| 84 Extensions3DUtil extensionsUtil(context.get()); | 91 Extensions3DUtil extensionsUtil(context.get()); |
| 85 bool multisampleSupported = extensionsUtil.supportsExtension("GL_CHROMIUM_fr amebuffer_multisample") | 92 bool multisampleSupported = extensionsUtil.supportsExtension("GL_CHROMIUM_fr amebuffer_multisample") |
| 86 && extensionsUtil.supportsExtension("GL_OES_rgb8_rgba8"); | 93 && extensionsUtil.supportsExtension("GL_OES_rgb8_rgba8"); |
| 87 if (multisampleSupported) { | 94 if (multisampleSupported) { |
| 88 extensionsUtil.ensureExtensionEnabled("GL_CHROMIUM_framebuffer_multisamp le"); | 95 extensionsUtil.ensureExtensionEnabled("GL_CHROMIUM_framebuffer_multisamp le"); |
| 89 extensionsUtil.ensureExtensionEnabled("GL_OES_rgb8_rgba8"); | 96 extensionsUtil.ensureExtensionEnabled("GL_OES_rgb8_rgba8"); |
| 90 } | 97 } |
| 91 bool packedDepthStencilSupported = extensionsUtil.supportsExtension("GL_OES_ packed_depth_stencil"); | 98 bool packedDepthStencilSupported = extensionsUtil.supportsExtension("GL_OES_ packed_depth_stencil"); |
| 92 if (packedDepthStencilSupported) | 99 if (packedDepthStencilSupported) |
| 93 extensionsUtil.ensureExtensionEnabled("GL_OES_packed_depth_stencil"); | 100 extensionsUtil.ensureExtensionEnabled("GL_OES_packed_depth_stencil"); |
| 94 | 101 |
| 95 RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(context, mu ltisampleSupported, packedDepthStencilSupported, preserve, contextEvictionManage r)); | 102 RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(context, mu ltisampleSupported, packedDepthStencilSupported, preserve, contextEvictionManage r)); |
| 96 if (!drawingBuffer->initialize(size)) | 103 if (!drawingBuffer->initialize(size)) { |
| 104 drawingBuffer->beginDestruction(); | |
| 97 return PassRefPtr<DrawingBuffer>(); | 105 return PassRefPtr<DrawingBuffer>(); |
| 106 } | |
| 98 return drawingBuffer.release(); | 107 return drawingBuffer.release(); |
| 99 } | 108 } |
| 100 | 109 |
| 101 DrawingBuffer::DrawingBuffer(PassOwnPtr<blink::WebGraphicsContext3D> context, | 110 DrawingBuffer::DrawingBuffer(PassOwnPtr<blink::WebGraphicsContext3D> context, |
| 102 bool multisampleExtensionSupported, | 111 bool multisampleExtensionSupported, |
| 103 bool packedDepthStencilExtensionSupported, | 112 bool packedDepthStencilExtensionSupported, |
| 104 PreserveDrawingBuffer preserve, | 113 PreserveDrawingBuffer preserve, |
| 105 PassRefPtr<ContextEvictionManager> contextEvictionManager) | 114 PassRefPtr<ContextEvictionManager> contextEvictionManager) |
| 106 : m_preserveDrawingBuffer(preserve) | 115 : m_preserveDrawingBuffer(preserve) |
| 107 , m_scissorEnabled(false) | 116 , m_scissorEnabled(false) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 123 , m_contentsChanged(true) | 132 , m_contentsChanged(true) |
| 124 , m_contentsChangeCommitted(false) | 133 , m_contentsChangeCommitted(false) |
| 125 , m_layerComposited(false) | 134 , m_layerComposited(false) |
| 126 , m_multisampleMode(None) | 135 , m_multisampleMode(None) |
| 127 , m_internalColorFormat(0) | 136 , m_internalColorFormat(0) |
| 128 , m_colorFormat(0) | 137 , m_colorFormat(0) |
| 129 , m_internalRenderbufferFormat(0) | 138 , m_internalRenderbufferFormat(0) |
| 130 , m_maxTextureSize(0) | 139 , m_maxTextureSize(0) |
| 131 , m_sampleCount(0) | 140 , m_sampleCount(0) |
| 132 , m_packAlignment(4) | 141 , m_packAlignment(4) |
| 142 , m_destructionInProgress(false) | |
| 133 , m_contextEvictionManager(contextEvictionManager) | 143 , m_contextEvictionManager(contextEvictionManager) |
| 134 { | 144 { |
| 135 // Used by browser tests to detect the use of a DrawingBuffer. | 145 // Used by browser tests to detect the use of a DrawingBuffer. |
| 136 TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation"); | 146 TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation"); |
| 147 #ifndef NDEBUG | |
| 148 drawingBufferCounter.increment(); | |
| 149 #endif | |
| 137 } | 150 } |
| 138 | 151 |
| 139 DrawingBuffer::~DrawingBuffer() | 152 DrawingBuffer::~DrawingBuffer() |
| 140 { | 153 { |
| 141 releaseResources(); | 154 ASSERT(m_destructionInProgress); |
| 155 ASSERT(m_textureMailboxes.isEmpty()); | |
| 156 m_context.clear(); | |
| 157 m_layer.clear(); | |
| 158 #ifndef NDEBUG | |
| 159 drawingBufferCounter.decrement(); | |
| 160 #endif | |
| 142 } | 161 } |
| 143 | 162 |
| 144 void DrawingBuffer::markContentsChanged() | 163 void DrawingBuffer::markContentsChanged() |
| 145 { | 164 { |
| 146 m_contentsChanged = true; | 165 m_contentsChanged = true; |
| 147 m_contentsChangeCommitted = false; | 166 m_contentsChangeCommitted = false; |
| 148 m_layerComposited = false; | 167 m_layerComposited = false; |
| 149 } | 168 } |
| 150 | 169 |
| 151 bool DrawingBuffer::layerComposited() const | 170 bool DrawingBuffer::layerComposited() const |
| 152 { | 171 { |
| 153 return m_layerComposited; | 172 return m_layerComposited; |
| 154 } | 173 } |
| 155 | 174 |
| 156 void DrawingBuffer::markLayerComposited() | 175 void DrawingBuffer::markLayerComposited() |
| 157 { | 176 { |
| 158 m_layerComposited = true; | 177 m_layerComposited = true; |
| 159 } | 178 } |
| 160 | 179 |
| 161 blink::WebGraphicsContext3D* DrawingBuffer::context() | 180 blink::WebGraphicsContext3D* DrawingBuffer::context() |
| 162 { | 181 { |
| 163 return m_context.get(); | 182 return m_context.get(); |
| 164 } | 183 } |
| 165 | 184 |
| 166 bool DrawingBuffer::prepareMailbox(blink::WebExternalTextureMailbox* outMailbox, blink::WebExternalBitmap* bitmap) | 185 bool DrawingBuffer::prepareMailbox(blink::WebExternalTextureMailbox* outMailbox, blink::WebExternalBitmap* bitmap) |
| 167 { | 186 { |
| 187 // prepareMailbox() is always called after layout. | |
| 188 ASSERT(!m_destructionInProgress); | |
| 189 | |
| 168 if (!m_contentsChanged) | 190 if (!m_contentsChanged) |
| 169 return false; | 191 return false; |
| 170 | 192 |
| 171 m_context->makeContextCurrent(); | 193 m_context->makeContextCurrent(); |
| 172 | 194 |
| 173 // Resolve the multisampled buffer into m_colorBuffer texture. | 195 // Resolve the multisampled buffer into m_colorBuffer texture. |
| 174 if (m_multisampleMode != None) | 196 if (m_multisampleMode != None) |
| 175 commit(); | 197 commit(); |
| 176 | 198 |
| 177 if (bitmap) { | 199 if (bitmap) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 restoreFramebufferBinding(); | 244 restoreFramebufferBinding(); |
| 223 | 245 |
| 224 m_contentsChanged = false; | 246 m_contentsChanged = false; |
| 225 | 247 |
| 226 m_context->bindTexture(GL_TEXTURE_2D, frontColorBufferMailbox->textureId); | 248 m_context->bindTexture(GL_TEXTURE_2D, frontColorBufferMailbox->textureId); |
| 227 m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, frontColorBufferMailbox->ma ilbox.name); | 249 m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, frontColorBufferMailbox->ma ilbox.name); |
| 228 m_context->flush(); | 250 m_context->flush(); |
| 229 frontColorBufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); | 251 frontColorBufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); |
| 230 markLayerComposited(); | 252 markLayerComposited(); |
| 231 | 253 |
| 254 // set m_parentDrawingBuffer to make sure 'this' stays alive as long as it h as live mailboxes | |
| 255 ASSERT(!frontColorBufferMailbox->m_parentDrawingBuffer); | |
| 256 frontColorBufferMailbox->m_parentDrawingBuffer = this; | |
| 232 *outMailbox = frontColorBufferMailbox->mailbox; | 257 *outMailbox = frontColorBufferMailbox->mailbox; |
| 233 m_frontColorBuffer = frontColorBufferMailbox->textureId; | 258 m_frontColorBuffer = frontColorBufferMailbox->textureId; |
| 234 return true; | 259 return true; |
| 235 } | 260 } |
| 236 | 261 |
| 237 void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mail box) | 262 void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mail box) |
| 238 { | 263 { |
| 264 if (m_destructionInProgress) { | |
| 265 mailboxReleasedInDestructionInProgress(mailbox); | |
| 266 return; | |
| 267 } | |
| 268 | |
| 239 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { | 269 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { |
| 240 RefPtr<MailboxInfo> mailboxInfo = m_textureMailboxes[i]; | 270 RefPtr<MailboxInfo> mailboxInfo = m_textureMailboxes[i]; |
| 241 if (!memcmp(mailboxInfo->mailbox.name, mailbox.name, sizeof(mailbox.name ))) { | 271 if (!memcmp(mailboxInfo->mailbox.name, mailbox.name, sizeof(mailbox.name ))) { |
| 242 mailboxInfo->mailbox.syncPoint = mailbox.syncPoint; | 272 mailboxInfo->mailbox.syncPoint = mailbox.syncPoint; |
| 273 ASSERT(mailboxInfo->m_parentDrawingBuffer.get() == this); | |
| 274 mailboxInfo->m_parentDrawingBuffer.clear(); | |
| 243 m_recycledMailboxes.prepend(mailboxInfo.release()); | 275 m_recycledMailboxes.prepend(mailboxInfo.release()); |
| 244 return; | 276 return; |
| 245 } | 277 } |
| 246 } | 278 } |
| 247 ASSERT_NOT_REACHED(); | 279 ASSERT_NOT_REACHED(); |
| 248 } | 280 } |
| 249 | 281 |
| 282 void DrawingBuffer::mailboxReleasedInDestructionInProgress(const blink::WebExter nalTextureMailbox& mailbox) | |
| 283 { | |
| 284 ASSERT(!m_textureMailboxes.isEmpty()); | |
| 285 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { | |
| 286 RefPtr<MailboxInfo> mailboxInfo = m_textureMailboxes[i]; | |
| 287 if (!memcmp(mailboxInfo->mailbox.name, mailbox.name, sizeof(mailboxInfo- >mailbox.name))) { | |
| 288 m_context->makeContextCurrent(); | |
| 289 m_context->deleteTexture(mailboxInfo->textureId); | |
| 290 m_textureMailboxes.remove(i); | |
| 291 ASSERT(mailboxInfo->m_parentDrawingBuffer.get() == this); | |
| 292 mailboxInfo->m_parentDrawingBuffer.clear(); | |
| 293 return; | |
| 294 } | |
| 295 } | |
| 296 ASSERT_NOT_REACHED(); | |
| 297 } | |
| 298 | |
| 250 PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::recycledMailbox() | 299 PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::recycledMailbox() |
| 251 { | 300 { |
| 252 if (m_recycledMailboxes.isEmpty()) | 301 if (m_recycledMailboxes.isEmpty()) |
| 253 return PassRefPtr<MailboxInfo>(); | 302 return PassRefPtr<MailboxInfo>(); |
| 254 | 303 |
| 255 RefPtr<MailboxInfo> mailboxInfo = m_recycledMailboxes.last().release(); | 304 RefPtr<MailboxInfo> mailboxInfo = m_recycledMailboxes.last().release(); |
| 256 m_recycledMailboxes.removeLast(); | 305 m_recycledMailboxes.removeLast(); |
| 257 | 306 |
| 258 if (mailboxInfo->mailbox.syncPoint) { | 307 if (mailboxInfo->mailbox.syncPoint) { |
| 259 m_context->waitSyncPoint(mailboxInfo->mailbox.syncPoint); | 308 m_context->waitSyncPoint(mailboxInfo->mailbox.syncPoint); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 } | 515 } |
| 467 | 516 |
| 468 void DrawingBuffer::clearPlatformLayer() | 517 void DrawingBuffer::clearPlatformLayer() |
| 469 { | 518 { |
| 470 if (m_layer) | 519 if (m_layer) |
| 471 m_layer->clearTexture(); | 520 m_layer->clearTexture(); |
| 472 | 521 |
| 473 m_context->flush(); | 522 m_context->flush(); |
| 474 } | 523 } |
| 475 | 524 |
| 476 void DrawingBuffer::releaseResources() | 525 void DrawingBuffer::beginDestruction() |
| 477 { | 526 { |
| 527 ASSERT(!m_destructionInProgress); | |
| 528 m_destructionInProgress = true; | |
| 529 | |
| 478 m_context->makeContextCurrent(); | 530 m_context->makeContextCurrent(); |
| 479 | 531 |
| 480 clearPlatformLayer(); | 532 clearPlatformLayer(); |
| 481 | 533 |
| 482 for (size_t i = 0; i < m_textureMailboxes.size(); i++) | 534 for (size_t i = 0; i < m_recycledMailboxes.size(); i++) { |
| 483 m_context->deleteTexture(m_textureMailboxes[i]->textureId); | 535 m_context->deleteTexture(m_recycledMailboxes[i]->textureId); |
| 536 | |
| 537 for (size_t j = 0; j < m_textureMailboxes.size(); j++) { | |
| 538 RefPtr<MailboxInfo> mailboxInfo = m_textureMailboxes[j]; | |
| 539 if (mailboxInfo->textureId == m_recycledMailboxes[i]->textureId) { | |
| 540 ASSERT(!memcmp(mailboxInfo->mailbox.name, m_recycledMailboxes[i] ->mailbox.name, sizeof(mailboxInfo->mailbox.name))); | |
| 541 m_textureMailboxes.remove(j); | |
|
Justin Novosad
2014/04/09 15:34:35
I think this is unnecessary complexity. Wouldn't i
dshwang
2014/04/09 18:05:50
Thank you for review.
As you mentioned, "nested f
Ken Russell (switch to Gerrit)
2014/04/15 02:24:02
I think keeping this code is a good idea only to e
| |
| 542 break; | |
| 543 } | |
| 544 } | |
| 545 } | |
| 484 | 546 |
| 485 if (m_multisampleFBO) | 547 if (m_multisampleFBO) |
| 486 m_context->deleteFramebuffer(m_multisampleFBO); | 548 m_context->deleteFramebuffer(m_multisampleFBO); |
| 487 | 549 |
| 488 if (m_fbo) | 550 if (m_fbo) |
| 489 m_context->deleteFramebuffer(m_fbo); | 551 m_context->deleteFramebuffer(m_fbo); |
| 490 | 552 |
| 491 if (m_multisampleColorBuffer) | 553 if (m_multisampleColorBuffer) |
| 492 m_context->deleteRenderbuffer(m_multisampleColorBuffer); | 554 m_context->deleteRenderbuffer(m_multisampleColorBuffer); |
| 493 | 555 |
| 494 if (m_depthStencilBuffer) | 556 if (m_depthStencilBuffer) |
| 495 m_context->deleteRenderbuffer(m_depthStencilBuffer); | 557 m_context->deleteRenderbuffer(m_depthStencilBuffer); |
| 496 | 558 |
| 497 if (m_depthBuffer) | 559 if (m_depthBuffer) |
| 498 m_context->deleteRenderbuffer(m_depthBuffer); | 560 m_context->deleteRenderbuffer(m_depthBuffer); |
| 499 | 561 |
| 500 if (m_stencilBuffer) | 562 if (m_stencilBuffer) |
| 501 m_context->deleteRenderbuffer(m_stencilBuffer); | 563 m_context->deleteRenderbuffer(m_stencilBuffer); |
| 502 | 564 |
| 503 if (m_colorBuffer) | 565 if (m_colorBuffer) |
| 504 m_context->deleteTexture(m_colorBuffer); | 566 m_context->deleteTexture(m_colorBuffer); |
| 505 | 567 |
| 506 m_context.clear(); | |
| 507 | |
| 508 setSize(IntSize()); | 568 setSize(IntSize()); |
| 509 | 569 |
| 510 m_colorBuffer = 0; | 570 m_colorBuffer = 0; |
| 511 m_frontColorBuffer = 0; | 571 m_frontColorBuffer = 0; |
| 512 m_multisampleColorBuffer = 0; | 572 m_multisampleColorBuffer = 0; |
| 513 m_depthStencilBuffer = 0; | 573 m_depthStencilBuffer = 0; |
| 514 m_depthBuffer = 0; | 574 m_depthBuffer = 0; |
| 515 m_stencilBuffer = 0; | 575 m_stencilBuffer = 0; |
| 516 m_multisampleFBO = 0; | 576 m_multisampleFBO = 0; |
| 517 m_fbo = 0; | 577 m_fbo = 0; |
| 518 m_contextEvictionManager.clear(); | 578 m_contextEvictionManager.clear(); |
| 519 | 579 |
| 520 m_recycledMailboxes.clear(); | 580 m_recycledMailboxes.clear(); |
| 521 m_textureMailboxes.clear(); | |
| 522 | 581 |
| 523 if (m_layer) { | 582 if (m_layer) |
| 524 GraphicsLayer::unregisterContentsLayer(m_layer->layer()); | 583 GraphicsLayer::unregisterContentsLayer(m_layer->layer()); |
| 584 | |
| 585 if (m_textureMailboxes.isEmpty()) { | |
| 586 m_context.clear(); | |
| 525 m_layer.clear(); | 587 m_layer.clear(); |
|
Ken Russell (switch to Gerrit)
2014/04/15 02:24:02
This eager clearing of m_context and m_layer adds
| |
| 526 } | 588 } |
| 527 } | 589 } |
| 528 | 590 |
| 529 unsigned DrawingBuffer::createColorTexture(const IntSize& size) | 591 unsigned DrawingBuffer::createColorTexture(const IntSize& size) |
| 530 { | 592 { |
| 531 unsigned offscreenColorTexture = m_context->createTexture(); | 593 unsigned offscreenColorTexture = m_context->createTexture(); |
| 532 if (!offscreenColorTexture) | 594 if (!offscreenColorTexture) |
| 533 return 0; | 595 return 0; |
| 534 | 596 |
| 535 m_context->bindTexture(GL_TEXTURE_2D, offscreenColorTexture); | 597 m_context->bindTexture(GL_TEXTURE_2D, offscreenColorTexture); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 929 } | 991 } |
| 930 } | 992 } |
| 931 | 993 |
| 932 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint unpackAlignment) | 994 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint unpackAlignment) |
| 933 { | 995 { |
| 934 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); | 996 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); |
| 935 m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0); | 997 m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0); |
| 936 } | 998 } |
| 937 | 999 |
| 938 } // namespace WebCore | 1000 } // namespace WebCore |
| OLD | NEW |