mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
Only use KHR_debug if available
This commit is contained in:
parent
250be72939
commit
1594cc9570
4 changed files with 20 additions and 6 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ public:
|
|||
static void PushGroup(const FString &name);
|
||||
static void PopGroup();
|
||||
|
||||
static bool HasDebugApi() { return (gl.flags & RFL_DEBUG) != 0; }
|
||||
|
||||
private:
|
||||
void SetupBreakpointMode();
|
||||
void UpdateLoggingLevel();
|
||||
|
|
|
@ -253,6 +253,7 @@ void gl_LoadExtensions()
|
|||
}
|
||||
|
||||
if (gl.version >= 4.3f || CheckExtension("GL_ARB_invalidate_subdata")) gl.flags |= RFL_INVALIDATE_BUFFER;
|
||||
if (gl.version >= 4.3f || CheckExtension("GL_KHR_debug")) gl.flags |= RFL_DEBUG;
|
||||
|
||||
const char *lm = Args->CheckValue("-lightmethod");
|
||||
if (lm != NULL)
|
||||
|
|
|
@ -25,7 +25,8 @@ enum RenderFlags
|
|||
RFL_NO_DEPTHSTENCIL = 64,
|
||||
RFL_NO_CLIP_PLANES = 128,
|
||||
|
||||
RFL_INVALIDATE_BUFFER = 256
|
||||
RFL_INVALIDATE_BUFFER = 256,
|
||||
RFL_DEBUG = 512
|
||||
};
|
||||
|
||||
enum TexMode
|
||||
|
|
Loading…
Reference in a new issue