mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Only use opengl debug groups if the LOVE_GRAPHICS_DEBUG environment variable is set to 1.
--HG-- branch : minor
This commit is contained in:
@@ -272,17 +272,7 @@ bool Graphics::setMode(int width, int height, int pixelwidth, int pixelheight, b
|
||||
else
|
||||
setGammaCorrect(false);
|
||||
|
||||
bool enabledebug = false;
|
||||
|
||||
if (GLAD_VERSION_3_0)
|
||||
{
|
||||
// Enable OpenGL's debug output if a debug context has been created.
|
||||
GLint flags = 0;
|
||||
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
|
||||
enabledebug = (flags & GL_CONTEXT_FLAG_DEBUG_BIT) != 0;
|
||||
}
|
||||
|
||||
setDebug(enabledebug);
|
||||
setDebug(isDebugEnabled());
|
||||
|
||||
if (streamBufferState.vb[0] == nullptr)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,32 @@ static void *LOVEGetProcAddress(const char *name)
|
||||
return SDL_GL_GetProcAddress(name);
|
||||
}
|
||||
|
||||
OpenGL::TempDebugGroup::TempDebugGroup(const char *name)
|
||||
{
|
||||
if (isDebugEnabled())
|
||||
{
|
||||
if (GLAD_VERSION_4_3 || (GLAD_KHR_debug && !GLAD_ES_VERSION_2_0))
|
||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, 0, (const GLchar *) name);
|
||||
else if (GLAD_ES_VERSION_2_0 && GLAD_KHR_debug)
|
||||
glPushDebugGroupKHR(GL_DEBUG_SOURCE_APPLICATION, 0, 0, (const GLchar *) name);
|
||||
else if (GLAD_EXT_debug_marker)
|
||||
glPushGroupMarkerEXT(0, (const GLchar *) name);
|
||||
}
|
||||
}
|
||||
|
||||
OpenGL::TempDebugGroup::~TempDebugGroup()
|
||||
{
|
||||
if (isDebugEnabled())
|
||||
{
|
||||
if (GLAD_VERSION_4_3 || (GLAD_KHR_debug && !GLAD_ES_VERSION_2_0))
|
||||
glPopDebugGroup();
|
||||
else if (GLAD_ES_VERSION_2_0 && GLAD_KHR_debug)
|
||||
glPopDebugGroupKHR();
|
||||
else if (GLAD_EXT_debug_marker)
|
||||
glPopGroupMarkerEXT();
|
||||
}
|
||||
}
|
||||
|
||||
OpenGL::OpenGL()
|
||||
: stats()
|
||||
, contextInitialized(false)
|
||||
|
||||
@@ -101,25 +101,8 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
TempDebugGroup(const char *name)
|
||||
{
|
||||
if (GLAD_VERSION_4_3 || (GLAD_KHR_debug && !GLAD_ES_VERSION_2_0))
|
||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, 0, (const GLchar *) name);
|
||||
else if (GLAD_ES_VERSION_2_0 && GLAD_KHR_debug)
|
||||
glPushDebugGroupKHR(GL_DEBUG_SOURCE_APPLICATION, 0, 0, (const GLchar *) name);
|
||||
else if (GLAD_EXT_debug_marker)
|
||||
glPushGroupMarkerEXT(0, (const GLchar *) name);
|
||||
}
|
||||
|
||||
~TempDebugGroup()
|
||||
{
|
||||
if (GLAD_VERSION_4_3 || (GLAD_KHR_debug && !GLAD_ES_VERSION_2_0))
|
||||
glPopDebugGroup();
|
||||
else if (GLAD_ES_VERSION_2_0 && GLAD_KHR_debug)
|
||||
glPopDebugGroupKHR();
|
||||
else if (GLAD_EXT_debug_marker)
|
||||
glPopGroupMarkerEXT();
|
||||
}
|
||||
TempDebugGroup(const char *name);
|
||||
~TempDebugGroup();
|
||||
};
|
||||
|
||||
struct Stats
|
||||
|
||||
Reference in New Issue
Block a user