Only use KHR_debug if available

This commit is contained in:
Magnus Norddahl 2016-08-22 19:25:13 +02:00
commit 1594cc9570
4 changed files with 20 additions and 6 deletions

View file

@ -49,7 +49,14 @@
#include <signal.h>
#endif
CVAR(Int, gl_debug_level, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CUSTOM_CVAR(Int, gl_debug_level, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
if (!FGLDebug::HasDebugApi())
{
Printf("No OpenGL debug support detected.\n");
}
}
CVAR(Bool, gl_debug_breakpoint, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
//-----------------------------------------------------------------------------
@ -60,6 +67,9 @@ CVAR(Bool, gl_debug_breakpoint, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
void FGLDebug::Update()
{
if (!HasDebugApi())
return;
SetupBreakpointMode();
UpdateLoggingLevel();
OutputMessageLog();
@ -74,7 +84,7 @@ void FGLDebug::Update()
void FGLDebug::LabelObject(GLenum type, GLuint handle, const FString &name)
{
if (gl_debug_level != 0)
if (HasDebugApi() && gl_debug_level != 0)
{
glObjectLabel(type, handle, (GLsizei)name.Len(), name.GetChars());
}
@ -82,7 +92,7 @@ void FGLDebug::LabelObject(GLenum type, GLuint handle, const FString &name)
void FGLDebug::LabelObjectPtr(void *ptr, const FString &name)
{
if (gl_debug_level != 0)
if (HasDebugApi() && gl_debug_level != 0)
{
glObjectPtrLabel(ptr, (GLsizei)name.Len(), name.GetChars());
}
@ -97,7 +107,7 @@ void FGLDebug::LabelObjectPtr(void *ptr, const FString &name)
void FGLDebug::PushGroup(const FString &name)
{
if (gl_debug_level != 0)
if (HasDebugApi() && gl_debug_level != 0)
{
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, (GLsizei)name.Len(), name.GetChars());
}
@ -105,7 +115,7 @@ void FGLDebug::PushGroup(const FString &name)
void FGLDebug::PopGroup()
{
if (gl_debug_level != 0)
if (HasDebugApi() && gl_debug_level != 0)
{
glPopDebugGroup();
}