Improve OpenGL logging.
This commit is contained in:
parent
8d7ced5c74
commit
c946611689
1 changed files with 20 additions and 3 deletions
|
|
@ -14,7 +14,7 @@
|
||||||
#include <QtGui/QOpenGLFunctions>
|
#include <QtGui/QOpenGLFunctions>
|
||||||
#include <QtWidgets/QOpenGLWidget>
|
#include <QtWidgets/QOpenGLWidget>
|
||||||
|
|
||||||
#define LOG_ONCE(x) static auto logged = [&] { LOG(x); return true; };
|
#define LOG_ONCE(x) static auto logged = [&] { LOG(x); return true; }();
|
||||||
|
|
||||||
namespace Ui::GL {
|
namespace Ui::GL {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
@ -64,11 +64,28 @@ Capabilities CheckCapabilities(QWidget *widget) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const auto supported = context->format();
|
const auto supported = context->format();
|
||||||
if (supported.profile() == QSurfaceFormat::NoProfile) {
|
switch (supported.profile()) {
|
||||||
LOG_ONCE(("OpenGL: NoProfile received in final format."));
|
case QSurfaceFormat::NoProfile: {
|
||||||
|
LOG_ONCE(("OpenGL Profile: None."));
|
||||||
return {};
|
return {};
|
||||||
|
} break;
|
||||||
|
case QSurfaceFormat::CoreProfile: {
|
||||||
|
LOG_ONCE(("OpenGL Profile: Core."));
|
||||||
|
} break;
|
||||||
|
case QSurfaceFormat::CompatibilityProfile: {
|
||||||
|
LOG_ONCE(("OpenGL Profile: Compatibility."));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
static const auto extensionsLogged = [&] {
|
static const auto extensionsLogged = [&] {
|
||||||
|
const auto renderer = reinterpret_cast<const char*>(
|
||||||
|
functions->glGetString(GL_RENDERER));
|
||||||
|
LOG(("OpenGL Renderer: %1").arg(renderer ? renderer : "[nullptr]"));
|
||||||
|
const auto vendor = reinterpret_cast<const char*>(
|
||||||
|
functions->glGetString(GL_VENDOR));
|
||||||
|
LOG(("OpenGL Vendor: %1").arg(vendor ? vendor : "[nullptr]"));
|
||||||
|
const auto version = reinterpret_cast<const char*>(
|
||||||
|
functions->glGetString(GL_VERSION));
|
||||||
|
LOG(("OpenGL Version: %1").arg(version ? version : "[nullptr]"));
|
||||||
auto list = QStringList();
|
auto list = QStringList();
|
||||||
for (const auto extension : context->extensions()) {
|
for (const auto extension : context->extensions()) {
|
||||||
list.append(QString::fromLatin1(extension));
|
list.append(QString::fromLatin1(extension));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue