Commit 85add5ec authored by Volker Krause's avatar Volker Krause
Browse files

Improve OpenGL version handling

Move the unstructured vendor-specific information to its own element, so
we can properly categorize the OpenGL version.
parent 482d6f5f
......@@ -257,6 +257,8 @@ private slots:
QVERIFY(!m.value(QLatin1String("renderer")).toString().isEmpty());
QVERIFY(m.contains(QLatin1String("version")));
QVERIFY(!m.value(QLatin1String("version")).toString().isEmpty());
QVERIFY(m.contains(QLatin1String("vendorVersion")));
QVERIFY(!m.value(QLatin1String("vendorVersion")).toString().isEmpty());
QVERIFY(m.contains(QLatin1String("glslVersion")));
QVERIFY(!m.value(QLatin1String("glslVersion")).toString().isEmpty());
#endif
......
......@@ -375,6 +375,10 @@
"name": "version",
"type": "string"
},
{
"name": "vendorVersion",
"type": "string"
},
{
"name": "glslVersion",
"type": "string"
......
......@@ -21,6 +21,10 @@
"name": "version",
"type": "string"
},
{
"name": "vendorVersion",
"type": "string"
},
{
"name": "glslVersion",
"type": "string"
......
......@@ -60,7 +60,19 @@ QVariant OpenGLInfoSource::data()
QOpenGLFunctions functions(&context);
m.insert(QStringLiteral("vendor"), QString::fromLocal8Bit(reinterpret_cast<const char*>(functions.glGetString(GL_VENDOR))));
m.insert(QStringLiteral("renderer"), QString::fromLocal8Bit(reinterpret_cast<const char*>(functions.glGetString(GL_RENDERER))));
m.insert(QStringLiteral("version"), QString::fromLocal8Bit(reinterpret_cast<const char*>(functions.glGetString(GL_VERSION))));
int major = 0, minor = 0;
functions.glGetIntegerv(GL_MAJOR_VERSION, &major);
functions.glGetIntegerv(GL_MINOR_VERSION, &minor);
m.insert(QStringLiteral("version"), QString(QString::number(major) + QLatin1Char('.') + QString::number(minor)));
auto vendorVersion = QString::fromLocal8Bit(reinterpret_cast<const char*>(functions.glGetString(GL_VERSION)));
const auto idx = vendorVersion.indexOf(QLatin1Char(' '));
if (idx > 0) {
vendorVersion = vendorVersion.mid(idx + 1);
if (!vendorVersion.isEmpty())
m.insert(QStringLiteral("vendorVersion"), vendorVersion);
}
m.insert(QStringLiteral("glslVersion"), QString::fromLocal8Bit(reinterpret_cast<const char*>(functions.glGetString(GL_SHADING_LANGUAGE_VERSION))));
switch (context.format().profile()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment