51873329cb
- backport upstream fixes - drop -fno-delete-null-pointer-checks hack (included in qt5-rpm-macros as needed now)
117 lines
5.1 KiB
Diff
117 lines
5.1 KiB
Diff
From d4efd5ab810e92202efe672be29136324dd2a3f9 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?D=C4=81vis=20Mos=C4=81ns?= <davispuh@gmail.com>
|
|
Date: Mon, 28 Dec 2015 05:43:18 +0200
|
|
Subject: [PATCH] Check for NULL from glGetString
|
|
|
|
glGetString can return NULL pointer in case of error
|
|
so check for it before using.
|
|
|
|
Change-Id: Ia07424c8f2b3ce6dce675514900a509e3ef3b739
|
|
---
|
|
src/particles/qquickimageparticle.cpp | 6 ++++--
|
|
src/quick/scenegraph/qsgcontext.cpp | 22 ++++++++++++++++------
|
|
.../qsgdefaultdistancefieldglyphcache.cpp | 8 +++++---
|
|
src/quick/scenegraph/util/qsgatlastexture.cpp | 4 ++--
|
|
4 files changed, 27 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
|
|
index d78a350..b54861e 100644
|
|
--- a/src/particles/qquickimageparticle.cpp
|
|
+++ b/src/particles/qquickimageparticle.cpp
|
|
@@ -1276,14 +1276,16 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
|
|
// OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros,
|
|
// causing point sprites who read gl_PointCoord in the frag shader to come out as
|
|
// green-red blobs.
|
|
- if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "ATI")) {
|
|
+ const char *vendor = (const char *) glGetString(GL_VENDOR);
|
|
+ if (perfLevel < Deformable && vendor && strstr(vendor, "ATI")) {
|
|
perfLevel = Deformable;
|
|
}
|
|
#endif
|
|
|
|
#ifdef Q_OS_LINUX
|
|
// Nouveau drivers can potentially freeze a machine entirely when taking the point-sprite path.
|
|
- if (perfLevel < Deformable && strstr((const char *) glGetString(GL_VENDOR), "nouveau"))
|
|
+ const char *vendor = (const char *) glGetString(GL_VENDOR);
|
|
+ if (perfLevel < Deformable && vendor && strstr(vendor, "nouveau"))
|
|
perfLevel = Deformable;
|
|
#endif
|
|
|
|
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
|
|
index dd6977e..43d549f 100644
|
|
--- a/src/quick/scenegraph/qsgcontext.cpp
|
|
+++ b/src/quick/scenegraph/qsgcontext.cpp
|
|
@@ -624,14 +624,24 @@ void QSGRenderContext::initialize(QOpenGLContext *context)
|
|
m_sg->renderContextInitialized(this);
|
|
|
|
#ifdef Q_OS_LINUX
|
|
+ while (funcs->glGetError() != GL_NO_ERROR);
|
|
+
|
|
const char *vendor = (const char *) funcs->glGetString(GL_VENDOR);
|
|
- if (strstr(vendor, "nouveau"))
|
|
- m_brokenIBOs = true;
|
|
const char *renderer = (const char *) funcs->glGetString(GL_RENDERER);
|
|
- if (strstr(renderer, "llvmpipe"))
|
|
- m_serializedRender = true;
|
|
- if (strstr(vendor, "Hisilicon Technologies") && strstr(renderer, "Immersion.16"))
|
|
- m_brokenIBOs = true;
|
|
+
|
|
+ if (vendor && renderer) {
|
|
+ if (strstr(vendor, "nouveau"))
|
|
+ m_brokenIBOs = true;
|
|
+ if (strstr(renderer, "llvmpipe"))
|
|
+ m_serializedRender = true;
|
|
+ if (strstr(vendor, "Hisilicon Technologies") && strstr(renderer, "Immersion.16"))
|
|
+ m_brokenIBOs = true;
|
|
+ } else {
|
|
+ GLenum err;
|
|
+ while ((err = funcs->glGetError()) != GL_NO_ERROR) {
|
|
+ qWarning("QSGRenderContext::initialize: GL error %x from glGetString", err);
|
|
+ }
|
|
+ }
|
|
#endif
|
|
|
|
emit initialized();
|
|
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
|
|
index dcc485c..43e234b 100644
|
|
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
|
|
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
|
|
@@ -488,9 +488,11 @@ bool QSGDefaultDistanceFieldGlyphCache::useTextureUploadWorkaround() const
|
|
static bool set = false;
|
|
static bool useWorkaround = false;
|
|
if (!set) {
|
|
- useWorkaround = qstrcmp(reinterpret_cast<const char*>(m_funcs->glGetString(GL_RENDERER)),
|
|
- "Mali-400 MP") == 0;
|
|
- set = true;
|
|
+ const char *renderer = reinterpret_cast<const char*>(m_funcs->glGetString(GL_RENDERER));
|
|
+ if (renderer) {
|
|
+ useWorkaround = qstrcmp(renderer, "Mali-400 MP") == 0;
|
|
+ set = true;
|
|
+ }
|
|
}
|
|
return useWorkaround;
|
|
}
|
|
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
|
|
index 8e8e870..d726907 100644
|
|
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
|
|
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
|
|
@@ -150,13 +150,13 @@ Atlas::Atlas(const QSize &size)
|
|
wrongfullyReportsBgra8888Support = false;
|
|
|
|
const char *ext = (const char *) QOpenGLContext::currentContext()->functions()->glGetString(GL_EXTENSIONS);
|
|
- if (!wrongfullyReportsBgra8888Support
|
|
+ if (!wrongfullyReportsBgra8888Support && ext
|
|
&& (strstr(ext, "GL_EXT_bgra")
|
|
|| strstr(ext, "GL_EXT_texture_format_BGRA8888")
|
|
|| strstr(ext, "GL_IMG_texture_format_BGRA8888"))) {
|
|
m_internalFormat = m_externalFormat = GL_BGRA;
|
|
#ifdef Q_OS_IOS
|
|
- } else if (strstr(ext, "GL_APPLE_texture_format_BGRA8888")) {
|
|
+ } else if (ext && strstr(ext, "GL_APPLE_texture_format_BGRA8888")) {
|
|
m_internalFormat = GL_RGBA;
|
|
m_externalFormat = GL_BGRA;
|
|
#endif // IOS
|
|
--
|
|
1.9.3
|
|
|