Skip to content

Commit

Permalink
Fixed|OpenGL: Enabling OpenGL debug logger, stopping logging properly
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Apr 27, 2017
1 parent 6044a78 commit 5c3b334
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions doomsday/sdk/libgui/src/graphics/glinfo.cpp
Expand Up @@ -72,6 +72,9 @@ DENG2_PIMPL_NOREF(GLInfo), public QOpenGLFunctions_Doomsday
PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA = nullptr;
#endif

#ifdef DENG_ENABLE_OPENGL_DEBUG_LOGGER
QOpenGLDebugLogger *logger = nullptr;
#endif

Impl()
{
Expand Down Expand Up @@ -223,7 +226,7 @@ DENG2_PIMPL_NOREF(GLInfo), public QOpenGLFunctions_Doomsday
#endif

#ifdef DENG_ENABLE_OPENGL_DEBUG_LOGGER
QOpenGLDebugLogger *logger = new QOpenGLDebugLogger(&GLWindow::main());
logger = new QOpenGLDebugLogger(&GLWindow::main());
if (!ext.KHR_debug)
{
qDebug() << "[GLInfo] GL_KHR_debug is not available";
Expand Down Expand Up @@ -284,14 +287,18 @@ DENG2_PIMPL_NOREF(GLInfo), public QOpenGLFunctions_Doomsday
case QOpenGLDebugMessage::LowSeverity:
mType = " low ";
break;
case QOpenGLDebugMessage::NotificationSeverity:
case QOpenGLDebugMessage::NotificationSeverity:
mType = " note ";
break;
default:
break;
}

qDebug("[OpenGL] %s (%s): %s", mType, mSeverity, debugMessage.message().toLatin1().constData());
qDebug("[OpenGL] %04x %s (%s): %s",
debugMessage.id(),
mType,
mSeverity,
debugMessage.message().toLatin1().constData());
});
logger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
}
Expand Down Expand Up @@ -378,7 +385,13 @@ void GLInfo::glInit()
}

void GLInfo::glDeinit()
{
{
#ifdef DENG_ENABLE_OPENGL_DEBUG_LOGGER
if (info.d->logger)
{
info.d->logger->stopLogging();
}
#endif
info.d.reset();
}

Expand Down
2 changes: 1 addition & 1 deletion doomsday/sdk/libgui/src/guiapp.cpp
Expand Up @@ -52,7 +52,7 @@ void GuiApp::setDefaultOpenGLFormat() // static
fmt.setDepthBufferSize(24);
fmt.setStencilBufferSize(8);
fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
#ifdef DENG_ENABLE_OPENGL_DEBUG_LOGGER
#ifdef DENG2_DEBUG
fmt.setOption(QSurfaceFormat::DebugContext, true);
#endif
QSurfaceFormat::setDefaultFormat(fmt);
Expand Down

0 comments on commit 5c3b334

Please sign in to comment.