Common: Migrate logging to fmt

Continues the migration of our code over to the fmt logger.
This commit is contained in:
Lioncash
2020-10-23 14:41:30 -04:00
parent 4f5c8bb42a
commit 4e8df93f41
18 changed files with 154 additions and 152 deletions

View File

@ -78,7 +78,7 @@ void GLContextEGL::DetectMode()
// Get how many configs there are
if (!eglChooseConfig(m_egl_display, attribs, nullptr, 0, &num_configs))
{
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config");
INFO_LOG_FMT(VIDEO, "Error: couldn't get an EGL visual config");
continue;
}
@ -87,7 +87,7 @@ void GLContextEGL::DetectMode()
// Get all the configurations
if (!eglChooseConfig(m_egl_display, attribs, config, num_configs, &num_configs))
{
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config");
INFO_LOG_FMT(VIDEO, "Error: couldn't get an EGL visual config");
delete[] config;
continue;
}
@ -110,18 +110,18 @@ void GLContextEGL::DetectMode()
if (supportsGL)
{
INFO_LOG(VIDEO, "Using OpenGL");
INFO_LOG_FMT(VIDEO, "Using OpenGL");
m_opengl_mode = Mode::OpenGL;
}
else if (supportsGLES3)
{
INFO_LOG(VIDEO, "Using OpenGL|ES");
INFO_LOG_FMT(VIDEO, "Using OpenGL|ES");
m_opengl_mode = Mode::OpenGLES;
}
else
{
// Errored before we found a mode
ERROR_LOG(VIDEO, "Error: Failed to detect OpenGL flavour, falling back to OpenGL");
ERROR_LOG_FMT(VIDEO, "Error: Failed to detect OpenGL flavour, falling back to OpenGL");
// This will fail to create a context, as it'll try to use the same attribs we just failed to
// find a matching config with
m_opengl_mode = Mode::OpenGL;
@ -149,13 +149,13 @@ bool GLContextEGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
m_egl_display = OpenEGLDisplay();
if (!m_egl_display)
{
INFO_LOG(VIDEO, "Error: eglGetDisplay() failed");
INFO_LOG_FMT(VIDEO, "Error: eglGetDisplay() failed");
return false;
}
if (!eglInitialize(m_egl_display, &egl_major, &egl_minor))
{
INFO_LOG(VIDEO, "Error: eglInitialize() failed");
INFO_LOG_FMT(VIDEO, "Error: eglInitialize() failed");
return false;
}
@ -191,13 +191,13 @@ bool GLContextEGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
ctx_attribs = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE};
break;
default:
ERROR_LOG(VIDEO, "Unknown opengl mode set");
ERROR_LOG_FMT(VIDEO, "Unknown opengl mode set");
return false;
}
if (!eglChooseConfig(m_egl_display, attribs, &m_config, 1, &num_configs))
{
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config");
INFO_LOG_FMT(VIDEO, "Error: couldn't get an EGL visual config");
return false;
}
@ -247,13 +247,13 @@ bool GLContextEGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
if (!m_egl_context)
{
INFO_LOG(VIDEO, "Error: eglCreateContext failed");
INFO_LOG_FMT(VIDEO, "Error: eglCreateContext failed");
return false;
}
if (!CreateWindowSurface())
{
ERROR_LOG(VIDEO, "Error: CreateWindowSurface failed 0x%04x", eglGetError());
ERROR_LOG_FMT(VIDEO, "Error: CreateWindowSurface failed {:#06x}", eglGetError());
return false;
}
@ -267,7 +267,7 @@ std::unique_ptr<GLContext> GLContextEGL::CreateSharedContext()
eglCreateContext(m_egl_display, m_config, m_egl_context, m_attribs.data());
if (!new_egl_context)
{
INFO_LOG(VIDEO, "Error: eglCreateContext failed 0x%04x", eglGetError());
INFO_LOG_FMT(VIDEO, "Error: eglCreateContext failed {:#06x}", eglGetError());
return nullptr;
}
@ -281,7 +281,7 @@ std::unique_ptr<GLContext> GLContextEGL::CreateSharedContext()
new_context->m_is_shared = true;
if (!new_context->CreateWindowSurface())
{
ERROR_LOG(VIDEO, "Error: CreateWindowSurface failed 0x%04x", eglGetError());
ERROR_LOG_FMT(VIDEO, "Error: CreateWindowSurface failed {:#06x}", eglGetError());
return nullptr;
}
@ -296,7 +296,7 @@ bool GLContextEGL::CreateWindowSurface()
m_egl_surface = eglCreateWindowSurface(m_egl_display, m_config, native_window, nullptr);
if (!m_egl_surface)
{
INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed");
INFO_LOG_FMT(VIDEO, "Error: eglCreateWindowSurface failed");
return false;
}
@ -305,8 +305,8 @@ bool GLContextEGL::CreateWindowSurface()
if (!eglQuerySurface(m_egl_display, m_egl_surface, EGL_WIDTH, &surface_width) ||
!eglQuerySurface(m_egl_display, m_egl_surface, EGL_HEIGHT, &surface_height))
{
WARN_LOG(VIDEO,
"Failed to get surface dimensions via eglQuerySurface. Size may be incorrect.");
WARN_LOG_FMT(VIDEO,
"Failed to get surface dimensions via eglQuerySurface. Size may be incorrect.");
}
m_backbuffer_width = static_cast<int>(surface_width);
m_backbuffer_height = static_cast<int>(surface_height);
@ -319,7 +319,7 @@ bool GLContextEGL::CreateWindowSurface()
m_egl_surface = eglCreatePbufferSurface(m_egl_display, m_config, attrib_list);
if (!m_egl_surface)
{
INFO_LOG(VIDEO, "Error: eglCreatePbufferSurface failed");
INFO_LOG_FMT(VIDEO, "Error: eglCreatePbufferSurface failed");
return false;
}
}
@ -338,7 +338,7 @@ void GLContextEGL::DestroyWindowSurface()
if (eglGetCurrentSurface(EGL_DRAW) == m_egl_surface)
eglMakeCurrent(m_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (!eglDestroySurface(m_egl_display, m_egl_surface))
NOTICE_LOG(VIDEO, "Could not destroy window surface.");
NOTICE_LOG_FMT(VIDEO, "Could not destroy window surface.");
m_egl_surface = EGL_NO_SURFACE;
}
@ -370,9 +370,9 @@ void GLContextEGL::DestroyContext()
if (eglGetCurrentContext() == m_egl_context)
eglMakeCurrent(m_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (!eglDestroyContext(m_egl_display, m_egl_context))
NOTICE_LOG(VIDEO, "Could not destroy drawing context.");
NOTICE_LOG_FMT(VIDEO, "Could not destroy drawing context.");
if (!m_is_shared && !eglTerminate(m_egl_display))
NOTICE_LOG(VIDEO, "Could not destroy display connection.");
NOTICE_LOG_FMT(VIDEO, "Could not destroy display connection.");
m_egl_context = EGL_NO_CONTEXT;
m_egl_display = EGL_NO_DISPLAY;
}