Changeset 122272 in webkit
- Timestamp:
- Jul 10, 2012 3:48:37 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122271 r122272 1 2012-07-09 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Replace use of ManagedTexture with CCScopedTexture for impl thread and remove implTextureManager from LayerRendererChromium 4 https://bugs.webkit.org/show_bug.cgi?id=90841 5 6 Reviewed by Adrienne Walker. 7 8 Remove the TextureManager from LayerRendererChromium, which was the last 9 instance of the class in the compositor. Instead of using ManagedTexture 10 objects for RenderPass textures, use instances of CCScopedTexture, which 11 manage the lifetime of the allocated texture ids. TextureManager will be 12 removed entirely once all callers of memoryUseBytes() have been removed. 13 14 No new tests. No change in behaviour. 15 16 * platform/graphics/chromium/LayerRendererChromium.cpp: 17 (WebCore::LayerRendererChromium::LayerRendererChromium): 18 (WebCore::LayerRendererChromium::releaseRenderPassTextures): 19 (WebCore): 20 (WebCore::LayerRendererChromium::renderPassTextureSize): 21 (WebCore::LayerRendererChromium::renderPassTextureFormat): 22 (WebCore::LayerRendererChromium::decideRenderPassAllocationsForFrame): 23 (WebCore::LayerRendererChromium::haveCachedResourcesForRenderPassId): 24 (WebCore::LayerRendererChromium::drawQuad): 25 (WebCore::applyFilters): 26 (WebCore::LayerRendererChromium::drawBackgroundFilters): 27 (WebCore::LayerRendererChromium::drawRenderPassQuad): 28 (WebCore::LayerRendererChromium::drawHeadsUpDisplay): 29 (WebCore::LayerRendererChromium::getFramebufferTexture): 30 (WebCore::LayerRendererChromium::isCurrentRenderPass): 31 (WebCore::LayerRendererChromium::useRenderPass): 32 (WebCore::LayerRendererChromium::useScopedTexture): 33 (WebCore::LayerRendererChromium::bindFramebufferToTexture): 34 (WebCore::LayerRendererChromium::initializeSharedObjects): 35 * platform/graphics/chromium/LayerRendererChromium.h: 36 (WebCore): 37 (LayerRendererChromium): 38 * platform/graphics/chromium/TrackingTextureAllocator.cpp: 39 (WebCore::TrackingTextureAllocator::TrackingTextureAllocator): 40 (WebCore::TrackingTextureAllocator::createTexture): 41 * platform/graphics/chromium/TrackingTextureAllocator.h: 42 (WebCore::TrackingTextureAllocator::create): 43 (TrackingTextureAllocator): 44 * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: 45 (WebCore::CCHeadsUpDisplay::draw): 46 * platform/graphics/chromium/cc/CCHeadsUpDisplay.h: 47 (WebCore): 48 (CCHeadsUpDisplay): 49 * platform/graphics/chromium/cc/CCRenderer.h: 50 (WebCore): 51 (CCRenderer): 52 1 53 2012-07-10 Dean Jackson <dino@apple.com> 2 54 -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r122252 r122272 39 39 #include "GeometryBinding.h" 40 40 #include "GrTexture.h" 41 #include "ManagedTexture.h"42 41 #include "NotImplemented.h" 43 42 #include "PlatformColor.h" … … 58 57 #include "cc/CCRenderPassDrawQuad.h" 59 58 #include "cc/CCRenderSurfaceFilters.h" 59 #include "cc/CCScopedTexture.h" 60 60 #include "cc/CCSettings.h" 61 61 #include "cc/CCSingleThreadProxy.h" … … 158 158 : CCRenderer(client) 159 159 , m_currentRenderPass(0) 160 , m_current ManagedTexture(0)160 , m_currentTexture(0) 161 161 , m_offscreenFramebufferId(0) 162 162 , m_sharedGeometryQuad(FloatRect(-0.5f, -0.5f, 1.0f, 1.0f)) … … 275 275 void LayerRendererChromium::releaseRenderPassTextures() 276 276 { 277 if (!m_implTextureManager)278 return;279 277 m_renderPassTextures.clear(); 280 m_implTextureManager->deleteEvictedTextures(m_implTextureAllocator.get());281 278 } 282 279 … … 315 312 } 316 313 314 // static 315 IntSize LayerRendererChromium::renderPassTextureSize(const CCRenderPass* pass) 316 { 317 return pass->framebufferOutputRect().size(); 318 } 319 320 // static 321 GC3Denum LayerRendererChromium::renderPassTextureFormat(const CCRenderPass*) 322 { 323 return GraphicsContext3D::RGBA; 324 } 317 325 318 326 void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPassList& renderPassesInDrawOrder) … … 323 331 324 332 Vector<int> passesToDelete; 325 HashMap<int, OwnPtr< ManagedTexture> >::const_iterator passIterator;333 HashMap<int, OwnPtr<CCScopedTexture> >::const_iterator passIterator; 326 334 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPassTextures.end(); ++passIterator) { 327 335 const CCRenderPass* renderPassInFrame = passesInFrame.get(passIterator->first); … … 331 339 } 332 340 333 const IntSize& requiredSize = renderPass InFrame->framebufferOutputRect().size();334 GC3Denum requiredFormat = GraphicsContext3D::RGBA;335 ManagedTexture* texture = passIterator->second.get();336 if (!texture || !texture->isValid(requiredSize, requiredFormat)) {337 passesToDelete.append(passIterator->first); 338 continue;339 }341 const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); 342 GC3Denum requiredFormat = renderPassTextureFormat(renderPassInFrame); 343 CCScopedTexture* texture = passIterator->second.get(); 344 ASSERT(texture); 345 346 if (texture->id() && (texture->size() != requiredSize || texture->format() != requiredFormat)) 347 texture->free(); 340 348 } 341 349 … … 343 351 for (size_t i = 0; i < passesToDelete.size(); ++i) 344 352 m_renderPassTextures.remove(passesToDelete[i]); 345 m_implTextureManager->deleteEvictedTextures(m_implTextureAllocator.get()); 346 347 // All RenderPass textures should be reserved for the current frame. Every RenderPass texture 348 // is kept reserved until it is removed and deleted. 353 349 354 for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) { 350 ManagedTexture* texture = m_renderPassTextures.get(renderPassesInDrawOrder[i]->id()); 351 if (!texture) { 352 OwnPtr<ManagedTexture> ownTexture = ManagedTexture::create(m_implTextureManager.get()); 353 texture = ownTexture.get(); 354 m_renderPassTextures.set(renderPassesInDrawOrder[i]->id(), ownTexture.release()); 355 if (!m_renderPassTextures.contains(renderPassesInDrawOrder[i]->id())) { 356 OwnPtr<CCScopedTexture> texture = CCScopedTexture::create(m_implTextureAllocator.get()); 357 m_renderPassTextures.set(renderPassesInDrawOrder[i]->id(), texture.release()); 355 358 } 356 357 const IntSize& requiredSize = renderPassesInDrawOrder[i]->framebufferOutputRect().size();358 GC3Denum requiredFormat = GraphicsContext3D::RGBA;359 // See https://bugs.webkit.org/show_bug.cgi?id=90848360 // bool reserved = texture->reserve(requiredSize, requiredFormat);361 // ASSERT_UNUSED(reserved, reserved);362 texture->reserve(requiredSize, requiredFormat);363 359 } 364 360 } … … 366 362 bool LayerRendererChromium::haveCachedResourcesForRenderPassId(int id) const 367 363 { 368 ManagedTexture* texture = m_renderPassTextures.get(id);369 return texture && texture-> textureId();364 CCScopedTexture* texture = m_renderPassTextures.get(id); 365 return texture && texture->id(); 370 366 } 371 367 … … 466 462 break; 467 463 } 468 469 m_implTextureManager->deleteEvictedTextures(m_implTextureAllocator.get());470 464 } 471 465 … … 523 517 } 524 518 525 static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const WebKit::WebFilterOperations& filters, ManagedTexture* sourceTexture)519 static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const WebKit::WebFilterOperations& filters, CCScopedTexture* sourceTexture) 526 520 { 527 521 if (filters.isEmpty()) … … 534 528 layerRenderer->context()->flush(); 535 529 536 return CCRenderSurfaceFilters::apply(filters, sourceTexture-> textureId(), sourceTexture->size(), filterContext.get());537 } 538 539 PassOwnPtr< ManagedTexture> LayerRendererChromium::drawBackgroundFilters(const CCRenderPassDrawQuad* quad, const WebTransformationMatrix& contentsDeviceTransform)530 return CCRenderSurfaceFilters::apply(filters, sourceTexture->id(), sourceTexture->size(), filterContext.get()); 531 } 532 533 PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const CCRenderPassDrawQuad* quad, const WebTransformationMatrix& contentsDeviceTransform) 540 534 { 541 535 // This method draws a background filter, which applies a filter to any pixels behind the quad and seen through its background. … … 562 556 if (m_currentRenderPass->hasTransparentBackground()) 563 557 return nullptr; 564 ASSERT(!m_current ManagedTexture);558 ASSERT(!m_currentTexture); 565 559 566 560 // FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused). … … 574 568 deviceRect.intersect(m_currentRenderPass->framebufferOutputRect()); 575 569 576 OwnPtr< ManagedTexture> deviceBackgroundTexture = ManagedTexture::create(m_implTextureManager.get());570 OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_implTextureAllocator.get()); 577 571 if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) 578 572 return nullptr; … … 585 579 int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); 586 580 587 OwnPtr< ManagedTexture> backgroundTexture = ManagedTexture::create(m_implTextureManager.get());588 if (!backgroundTexture-> reserve(quad->quadRect().size(), GraphicsContext3D::RGBA))581 OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_implTextureAllocator.get()); 582 if (!backgroundTexture->allocate(quad->quadRect().size(), GraphicsContext3D::RGBA)) 589 583 return nullptr; 590 584 591 585 const CCRenderPass* targetRenderPass = m_currentRenderPass; 592 bool usingBackgroundTexture = use ManagedTexture(backgroundTexture.get(), quad->quadRect());586 bool usingBackgroundTexture = useScopedTexture(backgroundTexture.get(), quad->quadRect()); 593 587 594 588 if (usingBackgroundTexture) { … … 613 607 void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) 614 608 { 615 ManagedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId());616 if (!contentsTexture || !contentsTexture-> textureId())609 CCScopedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); 610 if (!contentsTexture || !contentsTexture->id()) 617 611 return; 618 612 … … 626 620 return; 627 621 628 OwnPtr< ManagedTexture> backgroundTexture = drawBackgroundFilters(quad, contentsDeviceTransform);622 OwnPtr<CCScopedTexture> backgroundTexture = drawBackgroundFilters(quad, contentsDeviceTransform); 629 623 630 624 // FIXME: Cache this value so that we don't have to do it for both the surface and its replica. 631 625 // Apply filters to the contents texture. 632 626 SkBitmap filterBitmap = applyFilters(this, quad->filters(), contentsTexture); 633 int contentsTextureId = contentsTexture-> textureId();627 int contentsTextureId = contentsTexture->id(); 634 628 if (filterBitmap.getTexture()) { 635 629 GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTexture()); … … 640 634 if (backgroundTexture) { 641 635 ASSERT(backgroundTexture->size() == quad->quadRect().size()); 642 copyTextureToFramebuffer(backgroundTexture-> textureId(), quad->quadRect().size(), quad->layerTransform());636 copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->layerTransform()); 643 637 } 644 638 … … 1097 1091 } 1098 1092 1099 void LayerRendererChromium::drawHeadsUpDisplay(ManagedTexture* hudTexture, const IntSize& hudSize) 1100 { 1093 void LayerRendererChromium::drawHeadsUpDisplay(const CCScopedTexture* hudTexture, const IntSize& hudSize) 1094 { 1095 ASSERT(hudTexture->id()); 1096 1101 1097 GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); 1102 1098 GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); … … 1107 1103 ASSERT(program && program->initialized()); 1108 1104 GLC(m_context, m_context->activeTexture(GraphicsContext3D::TEXTURE0)); 1109 if (!hudTexture->textureId()) 1110 hudTexture->allocate(m_implTextureAllocator.get()); 1111 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, hudTexture->textureId())); 1105 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, hudTexture->id())); 1112 1106 GLC(m_context, m_context->useProgram(program->program())); 1113 1107 GLC(m_context, m_context->uniform1i(program->fragmentShader().samplerLocation(), 0)); … … 1353 1347 } 1354 1348 1355 bool LayerRendererChromium::getFramebufferTexture(ManagedTexture* texture, const IntRect& deviceRect) 1356 { 1357 if (!texture->reserve(deviceRect.size(), GraphicsContext3D::RGB)) 1349 bool LayerRendererChromium::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) 1350 { 1351 ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); 1352 1353 if (!texture->id() && !texture->allocate(deviceRect.size(), GraphicsContext3D::RGB)) 1358 1354 return false; 1359 1355 1360 if (!texture->textureId()) 1361 texture->allocate(m_implTextureAllocator.get()); 1362 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, texture->textureId())); 1356 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, texture->id())); 1363 1357 GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, texture->format(), 1364 1358 deviceRect.x(), deviceRect.y(), deviceRect.width(), deviceRect.height(), 0)); … … 1368 1362 bool LayerRendererChromium::isCurrentRenderPass(const CCRenderPass* renderPass) 1369 1363 { 1370 return m_currentRenderPass == renderPass && !m_current ManagedTexture;1364 return m_currentRenderPass == renderPass && !m_currentTexture; 1371 1365 } 1372 1366 … … 1374 1368 { 1375 1369 m_currentRenderPass = renderPass; 1376 m_current ManagedTexture = 0;1370 m_currentTexture = 0; 1377 1371 1378 1372 if (renderPass == m_defaultRenderPass) { … … 1382 1376 } 1383 1377 1384 ManagedTexture* texture = m_renderPassTextures.get(renderPass->id());1378 CCScopedTexture* texture = m_renderPassTextures.get(renderPass->id()); 1385 1379 ASSERT(texture); 1386 1380 1381 if (!texture->id() && !texture->allocate(renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass))) 1382 return false; 1383 1387 1384 return bindFramebufferToTexture(texture, renderPass->framebufferOutputRect()); 1388 1385 } 1389 1386 1390 bool LayerRendererChromium::useManagedTexture(ManagedTexture* texture, const IntRect& viewportRect) 1391 { 1387 bool LayerRendererChromium::useScopedTexture(const CCScopedTexture* texture, const IntRect& viewportRect) 1388 { 1389 ASSERT(texture->id()); 1390 1392 1391 m_currentRenderPass = 0; 1393 m_current ManagedTexture = texture;1392 m_currentTexture = texture; 1394 1393 1395 1394 return bindFramebufferToTexture(texture, viewportRect); 1396 1395 } 1397 1396 1398 bool LayerRendererChromium::bindFramebufferToTexture(ManagedTexture* texture, const IntRect& framebufferRect) 1399 { 1397 bool LayerRendererChromium::bindFramebufferToTexture(const CCScopedTexture* texture, const IntRect& framebufferRect) 1398 { 1399 ASSERT(texture->id()); 1400 1400 1401 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId)); 1401 1402 if (!texture->textureId()) 1403 texture->allocate(m_implTextureAllocator.get()); 1404 GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, texture->textureId(), 0)); 1402 GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, texture->id(), 0)); 1405 1403 1406 1404 #if !defined ( NDEBUG ) … … 1474 1472 GLC(m_context, m_context->flush()); 1475 1473 1476 m_implTextureManager = TextureManager::create(std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max(), m_capabilities.maxTextureSize);1477 1474 m_textureCopier = AcceleratedTextureCopier::create(m_context, m_isUsingBindUniform); 1478 1475 if (m_textureUploaderSetting == ThrottledUploader) … … 1480 1477 else 1481 1478 m_textureUploader = UnthrottledTextureUploader::create(); 1482 m_contentsTextureAllocator = TrackingTextureAllocator::create(m_context );1483 m_implTextureAllocator = TrackingTextureAllocator::create(m_context );1479 m_contentsTextureAllocator = TrackingTextureAllocator::create(m_context, m_capabilities.maxTextureSize); 1480 m_implTextureAllocator = TrackingTextureAllocator::create(m_context, m_capabilities.maxTextureSize); 1484 1481 if (m_capabilities.usingTextureUsageHint) 1485 1482 m_implTextureAllocator->setTextureUsageHint(TrackingTextureAllocator::FramebufferAttachment); -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
r122160 r122272 52 52 class CCIOSurfaceDrawQuad; 53 53 class CCRenderPassDrawQuad; 54 class CCScopedTexture; 54 55 class CCSolidColorDrawQuad; 55 56 class CCStreamVideoDrawQuad; … … 58 59 class CCYUVVideoDrawQuad; 59 60 class GeometryBinding; 60 class ManagedTexture;61 61 class ScopedEnsureFramebufferAllocation; 62 62 … … 87 87 virtual void finishDrawingFrame() OVERRIDE; 88 88 89 virtual void drawHeadsUpDisplay( ManagedTexture*, const IntSize& hudSize) OVERRIDE;89 virtual void drawHeadsUpDisplay(const CCScopedTexture*, const IntSize& hudSize) OVERRIDE; 90 90 91 91 // waits for rendering to finish … … 101 101 102 102 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; 103 bool getFramebufferTexture(ManagedTexture*, const IntRect& deviceRect); 104 105 virtual TextureManager* implTextureManager() const OVERRIDE { return m_implTextureManager.get(); } 103 bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect); 104 106 105 virtual TextureCopier* textureCopier() const OVERRIDE { return m_textureCopier.get(); } 107 106 virtual TextureUploader* textureUploader() const OVERRIDE { return m_textureUploader.get(); } … … 134 133 void drawCheckerboardQuad(const CCCheckerboardDrawQuad*); 135 134 void drawDebugBorderQuad(const CCDebugBorderDrawQuad*); 136 PassOwnPtr< ManagedTexture> drawBackgroundFilters(const CCRenderPassDrawQuad*, const WebKit::WebTransformationMatrix& deviceTransform);135 PassOwnPtr<CCScopedTexture> drawBackgroundFilters(const CCRenderPassDrawQuad*, const WebKit::WebTransformationMatrix& deviceTransform); 137 136 void drawRenderPassQuad(const CCRenderPassDrawQuad*); 138 137 void drawSolidColorQuad(const CCSolidColorDrawQuad*); … … 145 144 void setDrawFramebufferRect(const IntRect&, bool flipY); 146 145 147 // The current drawing target is either a RenderPass or ManagedTexture. Use these functions to switch to a new drawing target.146 // The current drawing target is either a RenderPass or ScopedTexture. Use these functions to switch to a new drawing target. 148 147 bool useRenderPass(const CCRenderPass*); 149 bool use ManagedTexture(ManagedTexture*, const IntRect& viewportRect);148 bool useScopedTexture(const CCScopedTexture*, const IntRect& viewportRect); 150 149 bool isCurrentRenderPass(const CCRenderPass*); 151 150 152 bool bindFramebufferToTexture( ManagedTexture*, const IntRect& viewportRect);151 bool bindFramebufferToTexture(const CCScopedTexture*, const IntRect& viewportRect); 153 152 154 153 void clearRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect); … … 171 170 virtual void onContextLost() OVERRIDE; 172 171 172 static IntSize renderPassTextureSize(const CCRenderPass*); 173 static GC3Denum renderPassTextureFormat(const CCRenderPass*); 174 173 175 LayerRendererCapabilities m_capabilities; 174 176 175 177 const CCRenderPass* m_currentRenderPass; 176 ManagedTexture* m_currentManagedTexture;178 const CCScopedTexture* m_currentTexture; 177 179 unsigned m_offscreenFramebufferId; 178 180 … … 260 262 OwnPtr<HeadsUpDisplayProgram> m_headsUpDisplayProgram; 261 263 262 OwnPtr<TextureManager> m_implTextureManager;263 264 OwnPtr<AcceleratedTextureCopier> m_textureCopier; 264 265 OwnPtr<TextureUploader> m_textureUploader; … … 266 267 OwnPtr<TrackingTextureAllocator> m_implTextureAllocator; 267 268 268 HashMap<int, OwnPtr< ManagedTexture> > m_renderPassTextures;269 HashMap<int, OwnPtr<CCScopedTexture> > m_renderPassTextures; 269 270 270 271 WebKit::WebGraphicsContext3D* m_context; -
trunk/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp
r121204 r122272 34 34 namespace WebCore { 35 35 36 TrackingTextureAllocator::TrackingTextureAllocator(WebKit::WebGraphicsContext3D* context )36 TrackingTextureAllocator::TrackingTextureAllocator(WebKit::WebGraphicsContext3D* context, int maxTextureSize) 37 37 : m_context(context) 38 , m_maxTextureSize(maxTextureSize) 38 39 , m_currentMemoryUseBytes(0) 39 40 , m_textureUsageHint(Any) … … 72 73 unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum format) 73 74 { 75 if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) 76 return 0; 77 74 78 m_currentMemoryUseBytes += TextureManager::memoryUseBytes(size, format); 75 79 -
trunk/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h
r121204 r122272 39 39 WTF_MAKE_NONCOPYABLE(TrackingTextureAllocator); 40 40 public: 41 static PassOwnPtr<TrackingTextureAllocator> create(WebKit::WebGraphicsContext3D* context )41 static PassOwnPtr<TrackingTextureAllocator> create(WebKit::WebGraphicsContext3D* context, int maxTextureSize) 42 42 { 43 return adoptPtr(new TrackingTextureAllocator(context ));43 return adoptPtr(new TrackingTextureAllocator(context, maxTextureSize)); 44 44 } 45 45 virtual ~TrackingTextureAllocator(); … … 57 57 58 58 protected: 59 explicit TrackingTextureAllocator(WebKit::WebGraphicsContext3D*);59 TrackingTextureAllocator(WebKit::WebGraphicsContext3D*, int maxTextureSize); 60 60 61 61 WebKit::WebGraphicsContext3D* m_context; 62 int m_maxTextureSize; 62 63 size_t m_currentMemoryUseBytes; 63 64 TextureUsageHint m_textureUsageHint; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
r121361 r122272 76 76 } 77 77 if (!m_hudTexture) 78 m_hudTexture = ManagedTexture::create(layerRenderer->implTextureManager());78 m_hudTexture = CCScopedTexture::create(layerRenderer->implTextureAllocator()); 79 79 80 80 const CCLayerTreeSettings& settings = layerTreeHostImpl->settings(); … … 89 89 } 90 90 91 if (!m_hudTexture-> reserve(hudSize, GraphicsContext3D::RGBA))91 if (!m_hudTexture->id() && !m_hudTexture->allocate(hudSize, GraphicsContext3D::RGBA)) 92 92 return; 93 93 … … 105 105 PlatformCanvas::AutoLocker locker(&canvas); 106 106 107 m_hudTexture->bindTexture(layerTreeHostImpl->context(), layerRenderer->implTextureAllocator());107 GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_hudTexture->id())); 108 108 bool uploadedViaMap = false; 109 109 if (layerRenderer->capabilities().usingMapSub) { … … 123 123 124 124 layerRenderer->drawHeadsUpDisplay(m_hudTexture.get(), hudSize); 125 126 m_hudTexture->unreserve();127 125 } 128 126 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h
r120820 r122272 28 28 #if USE(ACCELERATED_COMPOSITING) 29 29 30 #include "ManagedTexture.h"31 30 #include "cc/CCFontAtlas.h" 31 #include "cc/CCScopedTexture.h" 32 32 33 33 namespace WebCore { … … 37 37 class CCLayerTreeHostImpl; 38 38 class GraphicsContext; 39 class TexureAllocator; 39 40 40 41 struct CCLayerTreeSettings; … … 67 68 bool showDebugRects(const CCLayerTreeSettings&) const; 68 69 69 OwnPtr< ManagedTexture> m_hudTexture;70 OwnPtr<CCScopedTexture> m_hudTexture; 70 71 OwnPtr<CCFontAtlas> m_fontAtlas; 71 72 }; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h
r122160 r122272 36 36 namespace WebCore { 37 37 38 class CCScopedTexture; 38 39 class TextureAllocator; 39 40 class TextureCopier; … … 79 80 virtual void finishDrawingFrame() = 0; 80 81 81 virtual void drawHeadsUpDisplay( ManagedTexture*, const IntSize& hudSize) = 0;82 virtual void drawHeadsUpDisplay(const CCScopedTexture*, const IntSize& hudSize) = 0; 82 83 83 84 // waits for rendering to finish … … 90 91 virtual void getFramebufferPixels(void *pixels, const IntRect&) = 0; 91 92 92 virtual TextureManager* implTextureManager() const = 0;93 93 virtual TextureCopier* textureCopier() const = 0; 94 94 virtual TextureUploader* textureUploader() const = 0; -
trunk/Source/WebKit/chromium/ChangeLog
r122255 r122272 1 2012-07-09 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Replace use of ManagedTexture with CCScopedTexture for impl thread and remove implTextureManager from LayerRendererChromium 4 https://bugs.webkit.org/show_bug.cgi?id=90841 5 6 Reviewed by Adrienne Walker. 7 8 * tests/CCLayerTreeHostImplTest.cpp: 9 1 10 2012-07-10 Xianzhu Wang <wangxianzhu@chromium.org> 2 11 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
r122252 r122272 2368 2368 // Kill the layer tree. 2369 2369 m_hostImpl->setRootLayer(CCLayerImpl::create(100)); 2370 // FIXME: Remove this when we don't use ManagedTextures in impl layers.2371 m_hostImpl->layerRenderer()->implTextureManager()->deleteEvictedTextures(m_hostImpl->layerRenderer()->implTextureAllocator());2372 2370 // There should be no textures left in use after. 2373 2371 EXPECT_EQ(0u, trackingWebGraphicsContext->numTextures());
Note: See TracChangeset
for help on using the changeset viewer.