Compare commits

...

1 Commits

Author SHA1 Message Date
ReinUsesLisp
8aa796732d renderer_opengl: Only log warnings when graphics debugging is enabled
This reduces noise in the log and it may increase performance on some
games where warnings are spammed.
2020-05-10 19:09:48 -03:00

View File

@@ -177,14 +177,19 @@ const char* GetType(GLenum type) {
void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
const GLchar* message, const void* user_param) {
const char format[] = "{} {} {}: {}";
static constexpr char format[] = "{} {} {}: {}";
if (severity == GL_DEBUG_SEVERITY_HIGH) {
LOG_CRITICAL(Render_OpenGL, format, GetSource(source), GetType(type), id, message);
return;
}
if (!Settings::values.renderer_debug) {
return;
}
const char* const str_source = GetSource(source);
const char* const str_type = GetType(type);
switch (severity) {
case GL_DEBUG_SEVERITY_HIGH:
LOG_CRITICAL(Render_OpenGL, format, str_source, str_type, id, message);
break;
case GL_DEBUG_SEVERITY_MEDIUM:
LOG_WARNING(Render_OpenGL, format, str_source, str_type, id, message);
break;