OpenGL: Migrate logging over to fmt

Migrates over to the fmt-capable logger.
This commit is contained in:
Lioncash 2020-11-09 03:08:00 -05:00
parent 4d9a7c7a54
commit 413d64e7fc
3 changed files with 32 additions and 31 deletions

View File

@ -104,7 +104,7 @@ void PerfQueryGL::EnableQuery(PerfQueryGroup type)
if (m_query_buffer.size() == m_query_count) if (m_query_buffer.size() == m_query_count)
{ {
FlushOne(); FlushOne();
// ERROR_LOG(VIDEO, "Flushed query buffer early!"); // ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!");
} }
// start query // start query
@ -198,7 +198,7 @@ void PerfQueryGLESNV::EnableQuery(PerfQueryGroup type)
if (m_query_buffer.size() == m_query_count) if (m_query_buffer.size() == m_query_count)
{ {
FlushOne(); FlushOne();
// ERROR_LOG(VIDEO, "Flushed query buffer early!"); // ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!");
} }
// start query // start query

View File

@ -357,7 +357,7 @@ bool ProgramShaderCache::CheckShaderCompileResult(GLuint id, GLenum type, std::s
if (compileStatus != GL_TRUE) if (compileStatus != GL_TRUE)
{ {
ERROR_LOG(VIDEO, "%s failed compilation:\n%s", prefix, info_log.c_str()); ERROR_LOG_FMT(VIDEO, "{} failed compilation:\n{}", prefix, info_log);
std::string filename = VideoBackendBase::BadShaderFilename(prefix, num_failures++); std::string filename = VideoBackendBase::BadShaderFilename(prefix, num_failures++);
std::ofstream file; std::ofstream file;
@ -376,7 +376,7 @@ bool ProgramShaderCache::CheckShaderCompileResult(GLuint id, GLenum type, std::s
return false; return false;
} }
WARN_LOG(VIDEO, "%s compiled with warnings:\n%s", prefix, info_log.c_str()); WARN_LOG_FMT(VIDEO, "{} compiled with warnings:\n{}", prefix, info_log);
} }
return true; return true;
@ -396,7 +396,7 @@ bool ProgramShaderCache::CheckProgramLinkResult(GLuint id, std::string_view vcod
glGetProgramInfoLog(id, length, &length, &info_log[0]); glGetProgramInfoLog(id, length, &length, &info_log[0]);
if (linkStatus != GL_TRUE) if (linkStatus != GL_TRUE)
{ {
ERROR_LOG(VIDEO, "Program failed linking:\n%s", info_log.c_str()); ERROR_LOG_FMT(VIDEO, "Program failed linking:\n{}", info_log);
std::string filename = VideoBackendBase::BadShaderFilename("p", num_failures++); std::string filename = VideoBackendBase::BadShaderFilename("p", num_failures++);
std::ofstream file; std::ofstream file;
File::OpenFStream(file, filename, std::ios_base::out); File::OpenFStream(file, filename, std::ios_base::out);
@ -421,7 +421,7 @@ bool ProgramShaderCache::CheckProgramLinkResult(GLuint id, std::string_view vcod
return false; return false;
} }
WARN_LOG(VIDEO, "Program linked with warnings:\n%s", info_log.c_str()); WARN_LOG_FMT(VIDEO, "Program linked with warnings:\n{}", info_log);
} }
return true; return true;
@ -554,7 +554,7 @@ PipelineProgram* ProgramShaderCache::GetPipelineProgram(const GLVertexFormat* ve
glGetProgramiv(prog->shader.glprogid, GL_LINK_STATUS, &link_status); glGetProgramiv(prog->shader.glprogid, GL_LINK_STATUS, &link_status);
if (link_status != GL_TRUE) if (link_status != GL_TRUE)
{ {
WARN_LOG(VIDEO, "Failed to create GL program from program binary."); WARN_LOG_FMT(VIDEO, "Failed to create GL program from program binary.");
prog->shader.Destroy(); prog->shader.Destroy();
return nullptr; return nullptr;
} }

View File

@ -105,19 +105,19 @@ static void APIENTRY ErrorCallback(GLenum source, GLenum type, GLuint id, GLenum
switch (severity) switch (severity)
{ {
case GL_DEBUG_SEVERITY_HIGH_ARB: case GL_DEBUG_SEVERITY_HIGH_ARB:
ERROR_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); ERROR_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
break; break;
case GL_DEBUG_SEVERITY_MEDIUM_ARB: case GL_DEBUG_SEVERITY_MEDIUM_ARB:
WARN_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); WARN_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
break; break;
case GL_DEBUG_SEVERITY_LOW_ARB: case GL_DEBUG_SEVERITY_LOW_ARB:
DEBUG_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); DEBUG_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
break; break;
case GL_DEBUG_SEVERITY_NOTIFICATION: case GL_DEBUG_SEVERITY_NOTIFICATION:
DEBUG_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); DEBUG_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
break; break;
default: default:
ERROR_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); ERROR_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
break; break;
} }
} }
@ -307,7 +307,7 @@ static void InitDriverInfo()
version = 100 * major + minor; version = 100 * major + minor;
if (change >= change_scale) if (change >= change_scale)
{ {
ERROR_LOG(VIDEO, "Version changeID overflow - change:%d scale:%f", change, change_scale); ERROR_LOG_FMT(VIDEO, "Version changeID overflow - change:{} scale:{}", change, change_scale);
} }
else else
{ {
@ -734,33 +734,34 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
g_Config.VerifyValidity(); g_Config.VerifyValidity();
UpdateActiveConfig(); UpdateActiveConfig();
OSD::AddMessage(StringFromFormat("Video Info: %s, %s, %s", g_ogl_config.gl_vendor, OSD::AddMessage(fmt::format("Video Info: {}, {}, {}", g_ogl_config.gl_vendor,
g_ogl_config.gl_renderer, g_ogl_config.gl_version), g_ogl_config.gl_renderer, g_ogl_config.gl_version),
5000); 5000);
if (!g_ogl_config.bSupportsGLBufferStorage && !g_ogl_config.bSupportsGLPinnedMemory) if (!g_ogl_config.bSupportsGLBufferStorage && !g_ogl_config.bSupportsGLPinnedMemory)
{ {
OSD::AddMessage(StringFromFormat("Your OpenGL driver does not support %s_buffer_storage.", OSD::AddMessage(fmt::format("Your OpenGL driver does not support {}_buffer_storage.",
m_main_gl_context->IsGLES() ? "EXT" : "ARB"), m_main_gl_context->IsGLES() ? "EXT" : "ARB"),
60000); 60000);
OSD::AddMessage("This device's performance will be terrible.", 60000); OSD::AddMessage("This device's performance will be terrible.", 60000);
OSD::AddMessage("Please ask your device vendor for an updated OpenGL driver.", 60000); OSD::AddMessage("Please ask your device vendor for an updated OpenGL driver.", 60000);
} }
WARN_LOG(VIDEO, "Missing OGL Extensions: %s%s%s%s%s%s%s%s%s%s%s%s%s%s", WARN_LOG_FMT(VIDEO, "Missing OGL Extensions: {}{}{}{}{}{}{}{}{}{}{}{}{}{}",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ", g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ", g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
g_ActiveConfig.backend_info.bSupportsEarlyZ ? "" : "EarlyZ ", g_ActiveConfig.backend_info.bSupportsEarlyZ ? "" : "EarlyZ ",
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ", g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
supports_glsl_cache ? "" : "ShaderCache ", supports_glsl_cache ? "" : "ShaderCache ",
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ", g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
g_ogl_config.bSupportsGLBufferStorage ? "" : "BufferStorage ", g_ogl_config.bSupportsGLBufferStorage ? "" : "BufferStorage ",
g_ogl_config.bSupportsGLSync ? "" : "Sync ", g_ogl_config.bSupportsMSAA ? "" : "MSAA ", g_ogl_config.bSupportsGLSync ? "" : "Sync ",
g_ActiveConfig.backend_info.bSupportsSSAA ? "" : "SSAA ", g_ogl_config.bSupportsMSAA ? "" : "MSAA ",
g_ActiveConfig.backend_info.bSupportsGSInstancing ? "" : "GSInstancing ", g_ActiveConfig.backend_info.bSupportsSSAA ? "" : "SSAA ",
g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl ", g_ActiveConfig.backend_info.bSupportsGSInstancing ? "" : "GSInstancing ",
g_ogl_config.bSupportsCopySubImage ? "" : "CopyImageSubData ", g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl ",
g_ActiveConfig.backend_info.bSupportsDepthClamp ? "" : "DepthClamp "); g_ogl_config.bSupportsCopySubImage ? "" : "CopyImageSubData ",
g_ActiveConfig.backend_info.bSupportsDepthClamp ? "" : "DepthClamp ");
// Handle VSync on/off // Handle VSync on/off
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_VSYNC)) if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_VSYNC))