Changeset 211681 in webkit
- Timestamp:
- Feb 5, 2017 9:22:45 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r211680 r211681 1 2017-02-05 Zan Dobersek <zdobersek@igalia.com> 2 3 Move TextureMapper-specific logic out of GraphicsContext3DPrivate 4 https://bugs.webkit.org/show_bug.cgi?id=167096 5 6 Reviewed by Alex Christensen. 7 8 Move the TextureMapper-specific functionality in GraphicsContext3DPrivate into a 9 separate class. The new TextureMapperGC3DPlatformLayer class inherits from the 10 class that's aliased to the PlatformLayer type, like GraphicsContext3DPrivate did 11 before. 12 13 In GraphicsContext3D, the new m_texmapLayer member variable of the 14 std::unique_ptr<TextureMapperGC3DPlatformLayer> type is used for configurations 15 that enable TextureMapper, largely the same way the GraphicsContext3DPrivate 16 object was used before. The remaining code in GraphicsContext3DPrivate is left 17 unchanged to keep it working for other ports. 18 19 No new tests -- no change in behavior. 20 21 * platform/TextureMapper.cmake: 22 * platform/graphics/GraphicsContext3D.h: 23 * platform/graphics/GraphicsContext3DPrivate.cpp: 24 (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate): 25 (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate): Deleted. 26 (WebCore::GraphicsContext3DPrivate::proxy): Deleted. 27 (WebCore::GraphicsContext3DPrivate::swapBuffersIfNeeded): Deleted. 28 (WebCore::GraphicsContext3DPrivate::paintToTextureMapper): Deleted. 29 * platform/graphics/GraphicsContext3DPrivate.h: 30 * platform/graphics/cairo/GraphicsContext3DCairo.cpp: 31 (WebCore::GraphicsContext3D::GraphicsContext3D): 32 (WebCore::GraphicsContext3D::~GraphicsContext3D): 33 (WebCore::GraphicsContext3D::makeContextCurrent): 34 (WebCore::GraphicsContext3D::platformGraphicsContext3D): 35 (WebCore::GraphicsContext3D::platformLayer): 36 * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: 37 (WebCore::GraphicsContext3D::createForCurrentGLContext): 38 * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp: Copied from Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp. 39 (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer): 40 (WebCore::TextureMapperGC3DPlatformLayer::~TextureMapperGC3DPlatformLayer): 41 (WebCore::TextureMapperGC3DPlatformLayer::makeContextCurrent): 42 (WebCore::TextureMapperGC3DPlatformLayer::platformContext): 43 (WebCore::TextureMapperGC3DPlatformLayer::proxy): 44 (WebCore::TextureMapperGC3DPlatformLayer::swapBuffersIfNeeded): 45 (WebCore::TextureMapperGC3DPlatformLayer::paintToTextureMapper): 46 * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DPrivate.h. 47 (WebCore::TextureMapperGC3DPlatformLayer::renderStyle): 48 1 49 2017-02-05 Zalan Bujtas <zalan@apple.com> 2 50 -
trunk/Source/WebCore/platform/TextureMapper.cmake
r202675 r211681 10 10 platform/graphics/texmap/TextureMapperBackingStore.cpp 11 11 platform/graphics/texmap/TextureMapperFPSCounter.cpp 12 platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp 12 13 platform/graphics/texmap/TextureMapperLayer.cpp 13 14 platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp -
trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
r211244 r211681 101 101 #if USE(CAIRO) 102 102 class PlatformContextCairo; 103 #endif 104 #if USE(TEXTURE_MAPPER) 105 class TextureMapperGC3DPlatformLayer; 103 106 #endif 104 107 … … 1417 1420 ListHashSet<GC3Denum> m_syntheticErrors; 1418 1421 1422 #if USE(TEXTURE_MAPPER) && !PLATFORM(EFL) 1423 friend class TextureMapperGC3DPlatformLayer; 1424 std::unique_ptr<TextureMapperGC3DPlatformLayer> m_texmapLayer; 1425 #else 1419 1426 friend class GraphicsContext3DPrivate; 1420 1427 std::unique_ptr<GraphicsContext3DPrivate> m_private; 1428 #endif 1421 1429 1422 1430 WebGLRenderingContextBase* m_webglContext; -
trunk/Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp
r210828 r211681 26 26 #include <wtf/StdLibExtras.h> 27 27 28 #if USE(CAIRO)29 #include "PlatformContextCairo.h"30 #endif31 28 32 29 #if USE(OPENGL_ES_2) … … 37 34 #endif 38 35 39 #if USE(TEXTURE_MAPPER_GL)40 #include <texmap/TextureMapperGL.h>41 #endif42 43 #if USE(COORDINATED_GRAPHICS_THREADED)44 #include "TextureMapperPlatformLayerBuffer.h"45 #endif46 47 36 using namespace std; 48 37 49 38 namespace WebCore { 50 39 51 GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, GraphicsContext3D::RenderStyle renderStyle) 52 : m_context(context) 53 , m_renderStyle(renderStyle) 40 GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D*, GraphicsContext3D::RenderStyle renderStyle) 41 : m_renderStyle(renderStyle) 54 42 { 55 43 switch (renderStyle) { … … 63 51 break; 64 52 } 65 66 #if USE(COORDINATED_GRAPHICS_THREADED)67 if (m_renderStyle == GraphicsContext3D::RenderOffscreen)68 m_platformLayerProxy = adoptRef(new TextureMapperPlatformLayerProxy());69 #endif70 53 } 71 54 72 GraphicsContext3DPrivate::~GraphicsContext3DPrivate() 73 { 74 #if USE(TEXTURE_MAPPER) && !USE(COORDINATED_GRAPHICS_THREADED) 75 if (client()) 76 client()->platformLayerWillBeDestroyed(); 77 #endif 78 } 55 GraphicsContext3DPrivate::~GraphicsContext3DPrivate() = default; 79 56 80 57 bool GraphicsContext3DPrivate::makeContextCurrent() … … 88 65 } 89 66 90 #if USE(COORDINATED_GRAPHICS_THREADED)91 RefPtr<TextureMapperPlatformLayerProxy> GraphicsContext3DPrivate::proxy() const92 {93 return m_platformLayerProxy.copyRef();94 }95 96 void GraphicsContext3DPrivate::swapBuffersIfNeeded()97 {98 ASSERT(m_renderStyle == GraphicsContext3D::RenderOffscreen);99 if (m_context->layerComposited())100 return;101 102 m_context->prepareTexture();103 IntSize textureSize(m_context->m_currentWidth, m_context->m_currentHeight);104 TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture | (m_context->m_attrs.alpha ? TextureMapperGL::ShouldBlend : 0);105 106 {107 LockHolder holder(m_platformLayerProxy->lock());108 m_platformLayerProxy->pushNextBuffer(std::make_unique<TextureMapperPlatformLayerBuffer>(m_context->m_compositorTexture, textureSize, flags));109 }110 111 m_context->markLayerComposited();112 }113 #elif USE(TEXTURE_MAPPER)114 void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)115 {116 if (!m_glContext)117 return;118 119 ASSERT(m_renderStyle == GraphicsContext3D::RenderOffscreen);120 121 m_context->markLayerComposited();122 123 #if USE(TEXTURE_MAPPER_GL)124 if (m_context->m_attrs.antialias && m_context->m_state.boundFBO == m_context->m_multisampleFBO) {125 GLContext* previousActiveContext = GLContext::current();126 if (previousActiveContext != m_glContext.get())127 m_context->makeContextCurrent();128 129 m_context->resolveMultisamplingIfNecessary();130 ::glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_state.boundFBO);131 132 if (previousActiveContext && previousActiveContext != m_glContext.get())133 previousActiveContext->makeContextCurrent();134 }135 136 TextureMapperGL& texmapGL = static_cast<TextureMapperGL&>(textureMapper);137 TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture | (m_context->m_attrs.alpha ? TextureMapperGL::ShouldBlend : 0);138 IntSize textureSize(m_context->m_currentWidth, m_context->m_currentHeight);139 texmapGL.drawTexture(m_context->m_texture, flags, textureSize, targetRect, matrix, opacity);140 #endif // USE(TEXTURE_MAPPER_GL)141 }142 #endif // USE(TEXTURE_MAPPER)143 144 67 } // namespace WebCore 145 68 -
trunk/Source/WebCore/platform/graphics/GraphicsContext3DPrivate.h
r202854 r211681 25 25 #include "PlatformLayer.h" 26 26 27 #if USE(TEXTURE_MAPPER)28 #include "TextureMapperPlatformLayer.h"29 #include "TextureMapperPlatformLayerProxy.h"30 #endif31 32 27 namespace WebCore { 33 28 34 29 class BitmapTextureGL; 35 30 36 class GraphicsContext3DPrivate 37 #if USE(TEXTURE_MAPPER) 38 : public PlatformLayer 39 #endif 40 { 31 class GraphicsContext3DPrivate { 41 32 public: 42 33 GraphicsContext3DPrivate(GraphicsContext3D*, GraphicsContext3D::RenderStyle); … … 47 38 GraphicsContext3D::RenderStyle renderStyle() { return m_renderStyle; } 48 39 49 #if USE(COORDINATED_GRAPHICS_THREADED)50 RefPtr<TextureMapperPlatformLayerProxy> proxy() const override;51 void swapBuffersIfNeeded() override;52 #elif USE(TEXTURE_MAPPER)53 virtual void paintToTextureMapper(TextureMapper&, const FloatRect& target, const TransformationMatrix&, float opacity);54 #endif55 56 40 private: 57 GraphicsContext3D* m_context;58 41 std::unique_ptr<GLContext> m_glContext; 59 42 GraphicsContext3D::RenderStyle m_renderStyle; 60 61 #if USE(COORDINATED_GRAPHICS_THREADED)62 RefPtr<TextureMapperPlatformLayerProxy> m_platformLayerProxy;63 RefPtr<BitmapTextureGL> m_compositorTexture;64 #endif65 43 }; 66 44 -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
r210800 r211681 55 55 #endif 56 56 57 #if USE(TEXTURE_MAPPER) 58 #include "TextureMapperGC3DPlatformLayer.h" 59 #endif 60 57 61 namespace WebCore { 58 62 … … 92 96 , m_multisampleDepthStencilBuffer(0) 93 97 , m_multisampleColorBuffer(0) 94 , m_private(std::make_unique<GraphicsContext3DPrivate>(this, renderStyle)) 95 { 98 { 99 #if USE(TEXTURE_MAPPER) 100 m_texmapLayer = std::make_unique<TextureMapperGC3DPlatformLayer>(*this, renderStyle); 101 #else 102 m_private = std::make_unique<GraphicsContext3DPrivate>(this, renderStyle); 103 #endif 104 96 105 makeContextCurrent(); 97 106 … … 201 210 GraphicsContext3D::~GraphicsContext3D() 202 211 { 212 #if USE(TEXTURE_MAPPER) 213 if (m_texmapLayer->renderStyle() == RenderToCurrentGLContext) 214 return; 215 #else 203 216 if (m_private->renderStyle() == RenderToCurrentGLContext) 204 217 return; 218 #endif 205 219 206 220 makeContextCurrent(); … … 339 353 bool GraphicsContext3D::makeContextCurrent() 340 354 { 341 if (!m_private) 342 return false; 343 return m_private->makeContextCurrent(); 355 #if USE(TEXTURE_MAPPER) 356 if (m_texmapLayer) 357 return m_texmapLayer->makeContextCurrent(); 358 #else 359 if (m_private) 360 return m_private->makeContextCurrent(); 361 #endif 362 return false; 344 363 } 345 364 … … 350 369 PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() 351 370 { 371 #if USE(TEXTURE_MAPPER) 372 return m_texmapLayer->platformContext(); 373 #else 352 374 return m_private->platformContext(); 375 #endif 353 376 } 354 377 … … 369 392 PlatformLayer* GraphicsContext3D::platformLayer() const 370 393 { 394 #if USE(TEXTURE_MAPPER) 395 return m_texmapLayer.get(); 396 #else 371 397 return m_private.get(); 398 #endif 372 399 } 373 400 -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
r210800 r211681 134 134 { 135 135 auto context = adoptRef(*new GraphicsContext3D({ }, 0, GraphicsContext3D::RenderToCurrentGLContext)); 136 #if USE(TEXTURE_MAPPER) && !PLATFORM(EFL) 137 if (!context->m_texmapLayer) 138 return nullptr; 139 #else 136 140 if (!context->m_private) 137 141 return nullptr; 142 #endif 138 143 return WTFMove(context); 139 144 }
Note: See TracChangeset
for help on using the changeset viewer.