Only use opengl debug groups if the LOVE_GRAPHICS_DEBUG environment variable is set to 1.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-02-12 17:58:28 -04:00
parent df540cedea
commit 97789b18c0
6 changed files with 47 additions and 32 deletions
+15
View File
@@ -28,6 +28,7 @@
// C++
#include <algorithm>
#include <stdlib.h>
namespace love
{
@@ -35,6 +36,8 @@ namespace graphics
{
static bool gammaCorrect = false;
static bool debugMode = false;
static bool debugModeQueried = false;
void setGammaCorrect(bool gammacorrect)
{
@@ -80,6 +83,18 @@ Colorf unGammaCorrectColor(const Colorf &c)
return r;
}
bool isDebugEnabled()
{
if (!debugModeQueried)
{
const char *debugenv = getenv("LOVE_GRAPHICS_DEBUG");
debugMode = debugenv != nullptr && debugenv[0] != '0';
debugModeQueried = true;
}
return debugMode;
}
love::Type Graphics::type("graphics", &Module::type);
Shader::ShaderSource Graphics::defaultShaderCode[Shader::LANGUAGE_MAX_ENUM][2];