mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-30 15:41:47 +00:00
Improve debug level filtering
This commit is contained in:
parent
b21b65eb43
commit
f75b6d8c5d
2 changed files with 26 additions and 1 deletions
|
@ -156,6 +156,26 @@ void FGLDebug::UpdateLoggingLevel()
|
|||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// The log may already contain entries for a debug level we are no longer
|
||||
// interested in..
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool FGLDebug::IsFilteredByDebugLevel(GLenum severity)
|
||||
{
|
||||
int severityLevel = 0;
|
||||
switch (severity)
|
||||
{
|
||||
case GL_DEBUG_SEVERITY_LOW: severityLevel = 1; break;
|
||||
case GL_DEBUG_SEVERITY_MEDIUM: severityLevel = 2; break;
|
||||
case GL_DEBUG_SEVERITY_HIGH: severityLevel = 3; break;
|
||||
case GL_DEBUG_SEVERITY_NOTIFICATION: severityLevel = 4; break;
|
||||
}
|
||||
return severityLevel >= (int)gl_debug_level;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Prints all logged messages to the console
|
||||
|
@ -193,6 +213,7 @@ void FGLDebug::OutputMessageLog()
|
|||
GLsizei offset = 0;
|
||||
for (GLuint i = 0; i < numMessages; i++)
|
||||
{
|
||||
if (!IsFilteredByDebugLevel(severities[i]))
|
||||
PrintMessage(sources[i], types[i], ids[i], severities[i], lengths[i], &messageLog[offset]);
|
||||
offset += lengths[i];
|
||||
}
|
||||
|
@ -248,6 +269,9 @@ void FGLDebug::PrintMessage(GLenum source, GLenum type, GLuint id, GLenum severi
|
|||
|
||||
void FGLDebug::DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam)
|
||||
{
|
||||
if (IsFilteredByDebugLevel(severity))
|
||||
return;
|
||||
|
||||
PrintMessage(source, type, id, severity, length, message);
|
||||
|
||||
if (severity != GL_DEBUG_SEVERITY_NOTIFICATION)
|
||||
|
|
|
@ -22,6 +22,7 @@ private:
|
|||
void UpdateLoggingLevel();
|
||||
void OutputMessageLog();
|
||||
|
||||
static bool IsFilteredByDebugLevel(GLenum severity);
|
||||
static void PrintMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message);
|
||||
|
||||
static void APIENTRY DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam);
|
||||
|
|
Loading…
Reference in a new issue