Changeset View
Standalone View
source/lib/ogl.h
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | |||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
// implementation limits / feature detect | // implementation limits / feature detect | ||||
extern GLint ogl_max_tex_size; /// [pixels] | extern GLint ogl_max_tex_size; /// [pixels] | ||||
extern GLint ogl_max_tex_units; /// limit on GL_TEXTUREn | extern GLint ogl_max_tex_units; /// limit on GL_TEXTUREn | ||||
#define OGL_SCOPED_DEBUG_GROUP(groupName) ogl_DebugScopedGroup glDebugScopedGroup(groupName) | |||||
#ifdef NDEBUG | |||||
# define KHR_DEBUG_ENABLED 1 | |||||
vladislavbelov: It should be `0` I suppose. | |||||
#else | |||||
Not Done Inline ActionsMaybe ogl_DebugScopedGroup? vladislavbelov: Maybe `ogl_DebugScopedGroup`? | |||||
# define KHR_DEBUG_ENABLED 1 | |||||
#endif | |||||
#if KHR_DEBUG_ENABLED | |||||
/** | |||||
* RAII for glPushDebugGroup() and glPopDebugGroup(). | |||||
*/ | |||||
struct ogl_DebugScopedGroup | |||||
{ | |||||
ogl_DebugScopedGroup(const char* message) | |||||
{ | |||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0x0ad, -1, message); | |||||
vladislavbelovUnsubmitted Not Done Inline ActionsMaybe we need to check for the extension. vladislavbelov: Maybe we need to check for the extension. | |||||
} | |||||
Not Done Inline ActionsIt doesn't make sense to generate even an empty struct. I suggest to replace ogl_DebugGroup group("Draw GUI element"); by one macro like OGL_DEBUG_GROUP("Draw GUI element");, like it's done for profiler. BTW can't we just add groups in PROFILER2? Because we already have GL queries there and it seems reasonable to have them together. vladislavbelov: It doesn't make sense to generate even an empty `struct`. I suggest to replace `ogl_DebugGroup… | |||||
Not Done Inline ActionsNote that your PROFILE2() macro does exactly the same thing, by creating a CProfile2Region object named profile2__ (see source/ps/Profiler2.h:536), except this object contains a m_Name pointer so it can’t be eluded by the compiler. It shouldn’t contain it though, you don’t reuse it at all after the constructor is done, that sounds like an easy optimisation. Adding groups the same way would be ok, but I’m not sure why go through the indirection of your profiler when you just want to have raii for OpenGL calls. linkmauve: Note that your `PROFILE2()` macro does exactly the same thing, by creating a `CProfile2Region`… | |||||
~ogl_DebugScopedGroup() | |||||
{ | |||||
glPopDebugGroup(); | |||||
} | |||||
}; | |||||
#else | |||||
// Fallback when we're not debugging. | |||||
struct ogl_DebugScopedGroup | |||||
{ | |||||
ogl_DebugScopedGroup(const char* UNUSED(message)) {} | |||||
~ogl_DebugScopedGroup() {} | |||||
}; | |||||
#endif | |||||
#endif // #ifndef INCLUDED_OGL | #endif // #ifndef INCLUDED_OGL |
It should be 0 I suppose.