mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 12:42:32 +00:00
[glsl] Add support for debug callback
It's disabled at compile time for now, but everything needed is there.
This commit is contained in:
parent
e89afafc8f
commit
44bb24bbaf
4 changed files with 47 additions and 0 deletions
|
@ -435,4 +435,17 @@
|
|||
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
|
||||
|
||||
#define GL_DEBUG_TYPE_ERROR 0x824C
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
|
||||
#define GL_DEBUG_TYPE_PORTABILITY 0x824F
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
|
||||
#define GL_DEBUG_TYPE_OTHER 0x8251
|
||||
#define GL_DEBUG_SEVERITY_HIGH 0x9146
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
|
||||
#define GL_DEBUG_SEVERITY_LOW 0x9148
|
||||
#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
|
||||
#define GL_DEBUG_OUTPUT 0x92E0
|
||||
|
||||
|
||||
#endif//__glsl_defines_h
|
||||
|
|
|
@ -163,6 +163,8 @@ QFGL_NEED (void, glVertexAttrib4fv, (GLuint indx, const GLfloat* values))
|
|||
QFGL_NEED (void, glVertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr))
|
||||
QFGL_NEED (void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
|
||||
|
||||
QFGL_NEED (void, glDebugMessageCallback, (GLDEBUGPROC callback, const void *userParam))
|
||||
|
||||
#ifdef UNDEF_QFGL_DONT_NEED
|
||||
#undef QFGL_DONT_NEED
|
||||
#endif
|
||||
|
|
|
@ -44,4 +44,6 @@ typedef ptrdiff_t GLfixed;
|
|||
typedef ptrdiff_t GLintptr;
|
||||
typedef ptrdiff_t GLsizeiptr;
|
||||
|
||||
typedef void (GLAPIENTRY *GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam);
|
||||
|
||||
#endif//__QF_GLSL_types_h
|
||||
|
|
|
@ -153,6 +153,31 @@ GLSL_Shutdown_Common (void)
|
|||
GLSL_ShaderShutdown ();
|
||||
}
|
||||
|
||||
static void
|
||||
debug_breakpoint (GLenum type)
|
||||
{
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static void
|
||||
MessageCallback (GLenum source, GLenum type, GLuint id, GLenum severity,
|
||||
GLsizei length, const GLchar *message, const void *uparam)
|
||||
{
|
||||
if (type == GL_DEBUG_TYPE_OTHER
|
||||
&& severity == GL_DEBUG_SEVERITY_NOTIFICATION) {
|
||||
return;
|
||||
}
|
||||
if (type != GL_DEBUG_TYPE_PERFORMANCE) {
|
||||
fprintf (stderr,
|
||||
"GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
|
||||
( type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : "" ),
|
||||
type, severity, message );
|
||||
}
|
||||
if (type == GL_DEBUG_TYPE_ERROR) {
|
||||
debug_breakpoint (type);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GLSL_Init_Common (void)
|
||||
{
|
||||
|
@ -160,6 +185,11 @@ GLSL_Init_Common (void)
|
|||
|
||||
GLSL_Common_Init_Cvars ();
|
||||
|
||||
if (0) {
|
||||
qfeglEnable (GL_DEBUG_OUTPUT);
|
||||
qfeglDebugMessageCallback (MessageCallback, nullptr);
|
||||
}
|
||||
|
||||
GLSL_TextureInit ();
|
||||
|
||||
if (developer & SYS_glsl) {
|
||||
|
|
Loading…
Reference in a new issue