diff options
author | Richard Grenville <pyxlcy@gmail.com> | 2013-05-12 18:21:16 +0800 |
---|---|---|
committer | Richard Grenville <pyxlcy@gmail.com> | 2013-05-12 18:21:16 +0800 |
commit | 2b0dfa9b968ce34f35919f9df216e668fec761b8 (patch) | |
tree | 090fa5fd1839dd4f6b395db1cb014fd895153d46 /common.h | |
parent | 060b5ab23c3fb18a8695e8f7e5d145f023b7b3b2 (diff) | |
download | tdebase-2b0dfa9b968ce34f35919f9df216e668fec761b8.tar.gz tdebase-2b0dfa9b968ce34f35919f9df216e668fec761b8.zip |
Misc: Add DEBUG_GLX_MARK & Misc
- GLX backend: Add DEBUG_GLX_MARK, to add GL marks around functions with
glStringMarkerGREMEDY(), and mark frame termination with
glFrameTerminatorGREMEDY().
- Print output of `compton -h` to stdout. (#110)
- GLX backend: Strip out elements with factor 0 in GLSL blur code.
Thanks to jrfonseca for guides. (#107)
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -317,6 +317,11 @@ typedef void (*f_ReleaseTexImageEXT) (Display *display, GLXDrawable drawable, in typedef void (*f_CopySubBuffer) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#ifdef DEBUG_GLX_MARK +typedef void (*f_StringMarkerGREMEDY) (GLsizei len, const void *string); +typedef void (*f_FrameTerminatorGREMEDY) (void); +#endif + /// @brief Wrapper of a GLX FBConfig. typedef struct { GLXFBConfig cfg; @@ -688,6 +693,12 @@ typedef struct { f_ReleaseTexImageEXT glXReleaseTexImageProc; /// Pointer to glXCopySubBufferMESA function. f_CopySubBuffer glXCopySubBufferProc; +#ifdef DEBUG_GLX_MARK + /// Pointer to StringMarkerGREMEDY function. + f_StringMarkerGREMEDY glStringMarkerGREMEDY; + /// Pointer to FrameTerminatorGREMEDY function. + f_FrameTerminatorGREMEDY glFrameTerminatorGREMEDY; +#endif /// FBConfig-s for GLX pixmap of different depths. glx_fbconfig_t *glx_fbconfigs[OPENGL_MAX_DEPTH + 1]; #ifdef CONFIG_VSYNC_OPENGL_GLSL @@ -1803,6 +1814,38 @@ glx_create_program(const GLuint * const shaders, int nshaders); #endif #endif +/** + * Add a OpenGL debugging marker. + */ +static inline void +glx_mark_(session_t *ps, const char *func, XID xid, bool start) { +#ifdef DEBUG_GLX_MARK + if (BKEND_GLX == ps->o.backend && ps->glStringMarkerGREMEDY) { + if (!func) func = "(unknown)"; + const char *postfix = (start ? " (start)": " (end)"); + char *str = malloc((strlen(func) + 12 + 2 + + strlen(postfix) + 5) * sizeof(char)); + strcpy(str, func); + sprintf(str + strlen(str), "(%#010lx)%s", xid, postfix); + ps->glStringMarkerGREMEDY(strlen(str), str); + free(str); + } +#endif +} + +#define glx_mark(ps, xid, start) glx_mark_(ps, __func__, xid, start) + +/** + * Add a OpenGL debugging marker. + */ +static inline void +glx_mark_frame(session_t *ps) { +#ifdef DEBUG_GLX_MARK + if (BKEND_GLX == ps->o.backend && ps->glFrameTerminatorGREMEDY) + ps->glFrameTerminatorGREMEDY(); +#endif +} + static inline void free_texture(session_t *ps, glx_texture_t **pptex) { #ifdef CONFIG_VSYNC_OPENGL |