mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-09 23:11:39 +00:00
quick ARB_debug_output implementation
This commit is contained in:
parent
84422cfe79
commit
06e578bd37
2 changed files with 62 additions and 1 deletions
|
@ -139,6 +139,8 @@ QS_PFNGLUNIFORM1FPROC GL_Uniform1fFunc = NULL; //ericw
|
|||
QS_PFNGLUNIFORM3FPROC GL_Uniform3fFunc = NULL; //ericw
|
||||
QS_PFNGLUNIFORM4FPROC GL_Uniform4fFunc = NULL; //ericw
|
||||
|
||||
PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB = NULL; //ericw
|
||||
|
||||
//====================================
|
||||
|
||||
//johnfitz -- new cvars
|
||||
|
@ -546,6 +548,8 @@ static qboolean VID_SetMode (int width, int height, int bpp, qboolean fullscreen
|
|||
CDAudio_Pause ();
|
||||
BGM_Pause ();
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
|
||||
|
||||
/* z-buffer depth */
|
||||
if (bpp == 16)
|
||||
{
|
||||
|
@ -693,6 +697,8 @@ static qboolean VID_SetMode (int width, int height, int bpp, qboolean fullscreen
|
|||
// no pending changes
|
||||
vid_changed = false;
|
||||
|
||||
// setup debug callback
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -903,6 +909,45 @@ static qboolean GL_ParseExtensionList (const char *list, const char *name)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void APIENTRY GL_DebugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam)
|
||||
{
|
||||
const char *sourceString;
|
||||
const char *typeString;
|
||||
const char *severityString;
|
||||
|
||||
switch (source)
|
||||
{
|
||||
case GL_DEBUG_SOURCE_API_ARB: sourceString = "GL_DEBUG_SOURCE_API_ARB"; break;
|
||||
case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: sourceString = "GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB"; break;
|
||||
case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: sourceString = "GL_DEBUG_SOURCE_SHADER_COMPILER_ARB"; break;
|
||||
case GL_DEBUG_SOURCE_THIRD_PARTY_ARB: sourceString = "GL_DEBUG_SOURCE_THIRD_PARTY_ARB"; break;
|
||||
case GL_DEBUG_SOURCE_APPLICATION_ARB: sourceString = "GL_DEBUG_SOURCE_APPLICATION_ARB"; break;
|
||||
case GL_DEBUG_SOURCE_OTHER_ARB: sourceString = "GL_DEBUG_SOURCE_OTHER_ARB"; break;
|
||||
default: sourceString = "unknown"; break;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GL_DEBUG_TYPE_ERROR_ARB: typeString = "GL_DEBUG_TYPE_ERROR_ARB"; break;
|
||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: typeString = "GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB"; break;
|
||||
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: typeString = "GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB"; break;
|
||||
case GL_DEBUG_TYPE_PORTABILITY_ARB: typeString = "GL_DEBUG_TYPE_PORTABILITY_ARB"; break;
|
||||
case GL_DEBUG_TYPE_PERFORMANCE_ARB: typeString = "GL_DEBUG_TYPE_PERFORMANCE_ARB"; break;
|
||||
case GL_DEBUG_TYPE_OTHER_ARB: typeString = "GL_DEBUG_TYPE_OTHER_ARB"; break;
|
||||
default: typeString = "unknown"; break;
|
||||
}
|
||||
|
||||
switch (severity)
|
||||
{
|
||||
case GL_DEBUG_SEVERITY_HIGH_ARB: severityString = "GL_DEBUG_SEVERITY_HIGH_ARB"; break;
|
||||
case GL_DEBUG_SEVERITY_MEDIUM_ARB: severityString = "GL_DEBUG_SEVERITY_MEDIUM_ARB"; break;
|
||||
case GL_DEBUG_SEVERITY_LOW_ARB: severityString = "GL_DEBUG_SEVERITY_LOW_ARB"; break;
|
||||
default: severityString = "unknown"; break;
|
||||
}
|
||||
|
||||
SDL_Log("ARB_debug_output: %s, %s, %d, %s: '%s'\n", sourceString, typeString, (int)id, severityString, message);
|
||||
}
|
||||
|
||||
static void GL_CheckExtensions (void)
|
||||
{
|
||||
int swap_control;
|
||||
|
@ -1168,7 +1213,7 @@ static void GL_CheckExtensions (void)
|
|||
{
|
||||
Con_Warning ("GLSL gamma not available, using hardware gamma\n");
|
||||
}
|
||||
|
||||
|
||||
// GLSL alias model rendering
|
||||
//
|
||||
if (COM_CheckParm("-noglslalias"))
|
||||
|
@ -1181,6 +1226,19 @@ static void GL_CheckExtensions (void)
|
|||
{
|
||||
Con_Warning ("GLSL alias model rendering not available, using Fitz renderer\n");
|
||||
}
|
||||
|
||||
// ARB_debug_output
|
||||
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
|
||||
if (glDebugMessageCallbackARB)
|
||||
{
|
||||
Con_Printf("FOUND: ARB_debug_output\n");
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
glDebugMessageCallbackARB(GL_DebugMessageCallback, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Warning("ARB_debug_output not available\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -231,6 +231,9 @@ extern qboolean gl_glsl_alias_able;
|
|||
//ericw -- NPOT texture support
|
||||
extern qboolean gl_texture_NPOT;
|
||||
|
||||
//ericw -- debug output
|
||||
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||
|
||||
//johnfitz -- polygon offset
|
||||
#define OFFSET_BMODEL 1
|
||||
#define OFFSET_NONE 0
|
||||
|
|
Loading…
Reference in a new issue