Changeset 86301 in webkit
- Timestamp:
- May 11, 2011 7:16:38 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86299 r86301 1 2011-05-11 Nat Duca <nduca@chromium.org> 2 3 Reviewed by James Robinson. 4 5 [chromium] Use mapTexSubImage2D for tile uploads if available 6 https://bugs.webkit.org/show_bug.cgi?id=60008 7 8 * platform/graphics/chromium/LayerTilerChromium.cpp: 9 (WebCore::LayerTilerChromium::LayerTilerChromium): 10 (WebCore::LayerTilerChromium::update): 11 (WebCore::LayerTilerChromium::updateFromPixels): 12 * platform/graphics/chromium/LayerTilerChromium.h: 13 1 14 2011-05-11 Alexis Menard <alexis.menard@openbossa.org> 2 15 -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r86278 r86301 122 122 { 123 123 m_contextSupportsLatch = m_context->getExtensions()->supports("GL_CHROMIUM_latch"); 124 m_contextSupportsMapSub = m_context->getExtensions()->supports("GL_CHROMIUM_map_sub"); 125 if (m_contextSupportsMapSub) 126 m_context->getExtensions()->ensureEnabled("GL_CHROMIUM_map_sub"); 124 127 m_hardwareCompositing = initializeSharedObjects(); 125 128 m_rootLayerContentTiler = LayerTilerChromium::create(this, IntSize(256, 256), LayerTilerChromium::NoBorderTexels); -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
r86278 r86301 74 74 75 75 GraphicsContext3D* context(); 76 bool contextSupportsMapSub() const { return m_contextSupportsMapSub; } 76 77 77 78 void invalidateRootLayerRect(const IntRect& dirtyRect); … … 241 242 242 243 bool m_contextSupportsLatch; 244 bool m_contextSupportsMapSub; 243 245 244 246 bool m_animating; -
trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp
r85716 r86301 31 31 #include "LayerTilerChromium.h" 32 32 33 #include "Extensions3DChromium.h" 33 34 #include "GraphicsContext.h" 34 35 #include "GraphicsContext3D.h" … … 54 55 : m_skipsDraw(false) 55 56 , m_tilingData(max(tileSize.width(), tileSize.height()), 0, 0, border == HasBorderTexels) 57 , m_useMapSubForUploads(layerRenderer->contextSupportsMapSub()) 56 58 , m_layerRenderer(layerRenderer) 57 59 { … … 85 87 86 88 m_tileSize = size; 87 m_tilePixels = adoptArrayPtr(new uint8_t[m_tileSize.width() * m_tileSize.height() * 4]); 89 if (!m_useMapSubForUploads) 90 m_tilePixels = adoptArrayPtr(new uint8_t[m_tileSize.width() * m_tileSize.height() * 4]); 88 91 m_tilingData.setMaxTextureSize(max(size.width(), size.height())); 89 92 } … … 342 345 CRASH(); 343 346 344 const uint8_t* pixelSource;345 if (paintRect.width() == sourceRect.width() && !paintOffset.x())346 pixelSource = &paintPixels[4 * paintOffset.y() * paintRect.width()];347 else {348 // Strides not equal, so do a row-by-row memcpy from the349 // paint results into a temp buffer for uploading.350 for (int row = 0; row < destRect.height(); ++row)351 memcpy(&m_tilePixels[destRect.width() * 4 * row],352 &paintPixels[4 * (paintOffset.x() + (paintOffset.y() + row) * paintRect.width())],353 destRect.width() * 4);354 355 pixelSource = &m_tilePixels[0];356 }357 358 tile->texture()->bindTexture();359 360 347 const GC3Dint filter = m_tilingData.borderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; 361 348 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter)); 362 349 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter)); 363 350 364 GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); 351 tile->texture()->bindTexture(); 352 353 if (m_useMapSubForUploads) { 354 // Upload tile data via a mapped transfer buffer 355 Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions()); 356 uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); 357 ASSERT(pixelDest); 358 if (paintRect.width() == sourceRect.width() && !paintOffset.x()) 359 memcpy(pixelDest, &paintPixels[4 * paintOffset.y() * paintRect.width()], paintRect.width() * destRect.height() * 4); 360 else { 361 // Strides not equal, so do a row-by-row memcpy from the 362 // paint results into the pixelDest 363 for (int row = 0; row < destRect.height(); ++row) 364 memcpy(&pixelDest[destRect.width() * 4 * row], 365 &paintPixels[4 * (paintOffset.x() + (paintOffset.y() + row) * paintRect.width())], 366 destRect.width() * 4); 367 } 368 extensions->unmapTexSubImage2DCHROMIUM(pixelDest); 369 } else { 370 const uint8_t* pixelSource; 371 if (paintRect.width() == sourceRect.width() && !paintOffset.x()) 372 pixelSource = &paintPixels[4 * paintOffset.y() * paintRect.width()]; 373 else { 374 // Strides not equal, so do a row-by-row memcpy from the 375 // paint results into a temp buffer for uploading. 376 for (int row = 0; row < destRect.height(); ++row) 377 memcpy(&m_tilePixels[destRect.width() * 4 * row], 378 &paintPixels[4 * (paintOffset.x() + (paintOffset.y() + row) * paintRect.width())], 379 destRect.width() * 4); 380 381 pixelSource = &m_tilePixels[0]; 382 } 383 384 385 GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); 386 } 365 387 366 388 tile->clearDirty(); -
trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h
r85002 r86301 168 168 TilingData m_tilingData; 169 169 170 // Whether the tiler will use GL_CHROMIUM_map_sub for texture uploads. 171 bool m_useMapSubForUploads; 172 170 173 LayerRendererChromium* m_layerRenderer; 171 174 }; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
r85261 r86301 28 28 #include "CCHeadsUpDisplay.h" 29 29 30 #include "Extensions3DChromium.h" 30 31 #include "Font.h" 31 32 #include "FontDescription.h" … … 51 52 , m_showFPSCounter(false) 52 53 , m_showPlatformLayerTree(false) 54 , m_useMapSubForUploads(owner->contextSupportsMapSub()) 53 55 { 54 56 m_beginTimeHistoryInSec[0] = currentTime(); … … 107 109 108 110 m_hudTexture->bindTexture(); 109 GLC(context.get(), context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); 111 if (m_useMapSubForUploads) { 112 Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions()); 113 uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); 114 memcpy(pixelDest, locker.pixels(), hudSize.width() * hudSize.height() * 4); 115 extensions->unmapTexSubImage2DCHROMIUM(pixelDest); 116 } else 117 GLC(context.get(), context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); 110 118 } 111 119 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h
r85261 r86301 87 87 OwnPtr<Font> m_smallFont; 88 88 OwnPtr<Font> m_mediumFont; 89 90 bool m_useMapSubForUploads; 89 91 }; 90 92
Note: See TracChangeset
for help on using the changeset viewer.