summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-01-14 14:26:46 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-01-15 11:13:22 +0100
commit83a5436e1a97b908f3089c3c8ef51f604989ef69 (patch)
tree4370fde3f375c6a85e0f2d8535cfbf2c24c94ded
parentccee9f651fff25dc3e9eb834652c30376963abf9 (diff)
Check if OpenGL context is supported
Before the support for dynamic GL builds, the WebCore initialize OpenGL shims would check if the OpenGL version had all the necessary methods. After we removed this we now risk continuing with an OpenGL version that is not supported by WebCore and can cause crashes. Task-number: QTBUG-43831 Change-Id: I19caffc645ea5dede8b98408cbe0cae5fae8c22f Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index edb7636d4..0c9fddc83 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -100,6 +100,7 @@ public:
void createGraphicsSurfaces(const IntSize&);
bool isOpenGLES() const;
+ bool isValid() const;
GraphicsContext3D* m_context;
HostWindow* m_hostWindow;
@@ -123,6 +124,13 @@ bool GraphicsContext3DPrivate::isOpenGLES() const
#endif
}
+bool GraphicsContext3DPrivate::isValid() const
+{
+ if (!m_platformContext || !m_platformContext->isValid())
+ return false;
+ return m_platformContext->isOpenGLES() || m_platformContext->format().majorVersion() >= 2;
+}
+
bool GraphicsContext3D::isGLES2Compliant() const
{
if (m_private)
@@ -408,12 +416,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi
m_functions = m_private.get();
validateAttributes();
- static bool initialized = false;
- static bool success = true;
- if (!initialized) {
- initialized = true;
- }
- if (!success) {
+ if (!m_private->isValid()) {
m_private = nullptr;
return;
}