diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-07-22 16:14:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-24 13:58:18 +0200 |
commit | 34b83124246532f99dcad6cfd3fd3db93eb9a169 (patch) | |
tree | 6431818e335afc859fd85c3cf32a41440bd15155 /Source/WebCore/platform | |
parent | d5ade9de78ef6a234152308db67dfca34294e191 (diff) |
[Qt][WK1] Support WebGL with EGL on Linux
https://bugs.webkit.org/show_bug.cgi?id=118251
Reviewed by Kenneth Rohde Christiansen.
Source/WebCore:
Let GraphicsContext3D work without a GraphicsSurface.
* Target.pri:
* platform/graphics/OpenGLShims.cpp:
(WebCore::getProcAddress):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
Tools:
* qmake/mkspecs/features/features.prf:
Change-Id: I6b126c9e6cd01c0db508a63166bc3c66e80f64fc
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r-- | Source/WebCore/platform/graphics/OpenGLShims.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/OpenGLShims.cpp b/Source/WebCore/platform/graphics/OpenGLShims.cpp index 2f656b302..772a8f25c 100644 --- a/Source/WebCore/platform/graphics/OpenGLShims.cpp +++ b/Source/WebCore/platform/graphics/OpenGLShims.cpp @@ -40,7 +40,9 @@ OpenGLFunctionTable* openGLFunctionTable() #if PLATFORM(QT) static void* getProcAddress(const char* procName) { - return reinterpret_cast<void*>(QOpenGLContext::currentContext()->getProcAddress(procName)); + if (QOpenGLContext* context = QOpenGLContext::currentContext()) + return reinterpret_cast<void*>(context->getProcAddress(procName)); + return 0; } #else typedef void* (*glGetProcAddressType) (const char* procName); diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 7576b606f..d0492aff5 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -120,7 +120,6 @@ GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, H return; } -#if USE(GRAPHICS_SURFACE) #if QT_VERSION >= 0x050100 QOffscreenSurface* surface = new QOffscreenSurface; surface->create(); @@ -140,6 +139,8 @@ GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, H return; makeCurrentIfNeeded(); + +#if USE(GRAPHICS_SURFACE) IntSize surfaceSize(m_context->m_currentWidth, m_context->m_currentHeight); m_surfaceFlags = GraphicsSurface::SupportsTextureTarget | GraphicsSurface::SupportsSharing; @@ -223,8 +224,9 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper { blitMultisampleFramebufferAndRestoreContext(); - if (textureMapper->accelerationMode() == TextureMapper::OpenGLMode) { #if USE(GRAPHICS_SURFACE) + ASSERT(m_graphicsSurface); + if (textureMapper->accelerationMode() == TextureMapper::OpenGLMode) { // CGL only provides us the context, but not the view the context is currently bound to. // To make sure the context is bound the the right surface we have to do a makeCurrent through QOpenGL again. // FIXME: Remove this code as soon as GraphicsSurfaceMac makes use of NSOpenGL. @@ -241,9 +243,9 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper); m_graphicsSurface->paintToTextureMapper(texmapGL, targetRect, matrix, opacity, mask); -#endif return; } +#endif GraphicsContext* context = textureMapper->graphicsContext(); QPainter* painter = context->platformContext(); |