summaryrefslogtreecommitdiffstats
path: root/src/qtdiag
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-05-10 12:46:36 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-05-11 08:55:35 +0000
commit7ea01c466888c81d21b8bd0e8c87f0fe9c68489b (patch)
treeda5cea2bcbc7300ef1662f872fbfe8e7f15d82ab /src/qtdiag
parentdb7d5348030fb17914dd603a8f46c869e50b0636 (diff)
qtdiag: Output available Open GL profiles
Request the functions and check whether they can be initialized. Change-Id: I2a9577a8e4e168535dec55e8c39f21a17bfc5b7a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/qtdiag')
-rw-r--r--src/qtdiag/qtdiag.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/qtdiag/qtdiag.cpp b/src/qtdiag/qtdiag.cpp
index 71c3d3397..219bb71e5 100644
--- a/src/qtdiag/qtdiag.cpp
+++ b/src/qtdiag/qtdiag.cpp
@@ -37,6 +37,7 @@
#ifndef QT_NO_OPENGL
# include <QtGui/QOpenGLContext>
# include <QtGui/QOpenGLFunctions>
+# include <QtGui/QOpenGLVersionProfile>
#endif // QT_NO_OPENGL
#include <QtGui/QWindow>
#include <QtGui/QTouchDevice>
@@ -171,7 +172,30 @@ void dumpGlInfo(QTextStream &str, bool listExtensions)
<< "\nVersion: " << reinterpret_cast<const char *>(functions.glGetString(GL_VERSION))
<< "\nShading language: " << reinterpret_cast<const char *>(functions.glGetString(GL_SHADING_LANGUAGE_VERSION))
<< "\nFormat: " << context.format();
-
+# ifndef QT_OPENGL_ES_2
+ GLint majorVersion;
+ functions.glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
+ GLint minorVersion;
+ functions.glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
+ const QByteArray openGlVersionFunctionsName = "QOpenGLFunctions_"
+ + QByteArray::number(majorVersion) + '_' + QByteArray::number(minorVersion);
+ str << "\nProfile: None (" << openGlVersionFunctionsName << ')';
+ if (majorVersion > 3 || (majorVersion == 3 && minorVersion >= 1)) {
+ QOpenGLVersionProfile profile;
+ profile.setVersion(majorVersion, minorVersion);
+ profile.setProfile(QSurfaceFormat::CoreProfile);
+ if (QAbstractOpenGLFunctions *f = context.versionFunctions(profile)) {
+ if (f->initializeOpenGLFunctions())
+ str << ", Core (" << openGlVersionFunctionsName << "_Core)";
+ }
+ profile.setProfile(QSurfaceFormat::CompatibilityProfile);
+ if (QAbstractOpenGLFunctions *f = context.versionFunctions(profile)) {
+ if (f->initializeOpenGLFunctions())
+ str << ", Compatibility (" << openGlVersionFunctionsName << "_Compatibility)";
+ }
+ }
+ str << '\n';
+# endif // !QT_OPENGL_ES_2
if (listExtensions) {
QList<QByteArray> extensionList = context.extensions().toList();
std::sort(extensionList.begin(), extensionList.end());