Allow inserting GL string markers (GREMEDY_string_marker)
This commit is contained in:
parent
5979c5f778
commit
bc31922c33
|
@ -22,6 +22,11 @@
|
||||||
#ifndef DEBUGLOGGER_H
|
#ifndef DEBUGLOGGER_H
|
||||||
#define DEBUGLOGGER_H
|
#define DEBUGLOGGER_H
|
||||||
|
|
||||||
|
#include "gl-fun.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
struct DebugLoggerPrivate;
|
struct DebugLoggerPrivate;
|
||||||
|
|
||||||
class DebugLogger
|
class DebugLogger
|
||||||
|
@ -34,4 +39,13 @@ private:
|
||||||
DebugLoggerPrivate *p;
|
DebugLoggerPrivate *p;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define GL_MARKER(format, ...) \
|
||||||
|
if (gl.StringMarker) \
|
||||||
|
{ \
|
||||||
|
char buf[128]; \
|
||||||
|
int len = snprintf(buf, sizeof(buf), format, ##__VA_ARGS__); \
|
||||||
|
gl.StringMarker(std::min<size_t>(len, sizeof(buf)), buf); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // DEBUGLOGGER_H
|
#endif // DEBUGLOGGER_H
|
||||||
|
|
|
@ -172,6 +172,13 @@ void initGLFunctions()
|
||||||
GL_DEBUG_KHR_FUN;
|
GL_DEBUG_KHR_FUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HAVE_EXT(GREMEDY_string_marker))
|
||||||
|
{
|
||||||
|
#undef EXT_SUFFIX
|
||||||
|
#define EXT_SUFFIX "GREMEDY"
|
||||||
|
GL_GREMEMDY_FUN;
|
||||||
|
}
|
||||||
|
|
||||||
/* Misc caps */
|
/* Misc caps */
|
||||||
if (!gles || glMajor >= 3 || HAVE_EXT(EXT_unpack_subimage))
|
if (!gles || glMajor >= 3 || HAVE_EXT(EXT_unpack_subimage))
|
||||||
gl.unpack_subimage = true;
|
gl.unpack_subimage = true;
|
||||||
|
|
|
@ -55,9 +55,10 @@ typedef void (APIENTRYP _PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GL
|
||||||
typedef void (APIENTRYP _PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
typedef void (APIENTRYP _PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||||
typedef void (APIENTRYP _PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
typedef void (APIENTRYP _PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||||
|
|
||||||
/* Debug callback */
|
/* Debugging */
|
||||||
typedef void (APIENTRY * _GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void *userParam);
|
typedef void (APIENTRY * _GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void *userParam);
|
||||||
typedef void (APIENTRYP _PFNGLDEBUGMESSAGECALLBACKPROC) (_GLDEBUGPROC callback, const void *userParam);
|
typedef void (APIENTRYP _PFNGLDEBUGMESSAGECALLBACKPROC) (_GLDEBUGPROC callback, const void *userParam);
|
||||||
|
typedef void (APIENTRYP _PFNGLSTRINGMARKERPROC) (GLsizei len, const GLvoid *string);
|
||||||
|
|
||||||
/* Buffer object */
|
/* Buffer object */
|
||||||
typedef void (APIENTRYP _PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);
|
typedef void (APIENTRYP _PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);
|
||||||
|
@ -193,6 +194,9 @@ typedef void (APIENTRYP _PFNGLBINDVERTEXARRAYPROC) (GLuint array);
|
||||||
#define GL_DEBUG_KHR_FUN \
|
#define GL_DEBUG_KHR_FUN \
|
||||||
GL_FUN(DebugMessageCallback, _PFNGLDEBUGMESSAGECALLBACKPROC)
|
GL_FUN(DebugMessageCallback, _PFNGLDEBUGMESSAGECALLBACKPROC)
|
||||||
|
|
||||||
|
#define GL_GREMEMDY_FUN \
|
||||||
|
GL_FUN(StringMarker, _PFNGLSTRINGMARKERPROC)
|
||||||
|
|
||||||
|
|
||||||
struct GLFunctions
|
struct GLFunctions
|
||||||
{
|
{
|
||||||
|
@ -203,6 +207,7 @@ struct GLFunctions
|
||||||
GL_FBO_BLIT_FUN
|
GL_FBO_BLIT_FUN
|
||||||
GL_VAO_FUN
|
GL_VAO_FUN
|
||||||
GL_DEBUG_KHR_FUN
|
GL_DEBUG_KHR_FUN
|
||||||
|
GL_GREMEMDY_FUN
|
||||||
|
|
||||||
bool glsles;
|
bool glsles;
|
||||||
bool unpack_subimage;
|
bool unpack_subimage;
|
||||||
|
|
Loading…
Reference in New Issue