From 23a8baa6057c67298f68c6c5d65c177642125212 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Nov 2020 03:13:59 -0500 Subject: [PATCH] Software: Migrate logging over to fmt Migrates the software backend over to the fmt-capable logger. --- .../VideoBackends/Software/EfbInterface.cpp | 40 ++++++++++++------- .../VideoBackends/Software/SWOGLWindow.cpp | 6 +-- .../VideoBackends/Software/SWVertexLoader.cpp | 2 +- .../Core/VideoBackends/Software/SetupUnit.cpp | 2 +- .../VideoBackends/Software/TransformUnit.cpp | 3 +- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index 7118ff8615..0bd2f0343d 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -56,7 +56,9 @@ static void SetPixelAlphaOnly(u32 offset, u8 a) } break; default: - ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast(bpmem.zcontrol.pixel_format)); + ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", + static_cast(bpmem.zcontrol.pixel_format)); + break; } } @@ -87,7 +89,7 @@ static void SetPixelColorOnly(u32 offset, u8* rgb) break; case PEControl::RGB565_Z16: { - INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet"); + INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet"); u32 src = *(u32*)rgb; u32* dst = (u32*)&efb[offset]; u32 val = *dst & 0xff000000; @@ -96,7 +98,9 @@ static void SetPixelColorOnly(u32 offset, u8* rgb) } break; default: - ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast(bpmem.zcontrol.pixel_format)); + ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", + static_cast(bpmem.zcontrol.pixel_format)); + break; } } @@ -128,7 +132,7 @@ static void SetPixelAlphaColor(u32 offset, u8* color) break; case PEControl::RGB565_Z16: { - INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet"); + INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet"); u32 src = *(u32*)color; u32* dst = (u32*)&efb[offset]; u32 val = *dst & 0xff000000; @@ -137,7 +141,9 @@ static void SetPixelAlphaColor(u32 offset, u8* color) } break; default: - ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast(bpmem.zcontrol.pixel_format)); + ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", + static_cast(bpmem.zcontrol.pixel_format)); + break; } } @@ -159,11 +165,12 @@ static u32 GetPixelColor(u32 offset) Convert6To8((src >> 18) & 0x3f) << 24; // Red case PEControl::RGB565_Z16: - INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet"); + INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet"); return 0xff | ((src & 0x00ffffff) << 8); default: - ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast(bpmem.zcontrol.pixel_format)); + ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", + static_cast(bpmem.zcontrol.pixel_format)); return 0; } } @@ -184,7 +191,7 @@ static void SetPixelDepth(u32 offset, u32 depth) break; case PEControl::RGB565_Z16: { - INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet"); + INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet"); u32* dst = (u32*)&efb[offset]; u32 val = *dst & 0xff000000; val |= depth & 0x00ffffff; @@ -192,7 +199,9 @@ static void SetPixelDepth(u32 offset, u32 depth) } break; default: - ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast(bpmem.zcontrol.pixel_format)); + ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", + static_cast(bpmem.zcontrol.pixel_format)); + break; } } @@ -211,12 +220,14 @@ static u32 GetPixelDepth(u32 offset) break; case PEControl::RGB565_Z16: { - INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet"); + INFO_LOG_FMT(VIDEO, "RGB565_Z16 is not supported correctly yet"); depth = (*(u32*)&efb[offset]) & 0x00ffffff; } break; default: - ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast(bpmem.zcontrol.pixel_format)); + ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}", + static_cast(bpmem.zcontrol.pixel_format)); + break; } return depth; @@ -554,7 +565,7 @@ void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle { if (!xfb_in_ram) { - WARN_LOG(VIDEO, "Tried to copy to invalid XFB address"); + WARN_LOG_FMT(VIDEO, "Tried to copy to invalid XFB address"); return; } @@ -569,7 +580,7 @@ void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle // copy always has an even width, which might not be true. if (left & 1 || right & 1) { - WARN_LOG(VIDEO, "Trying to copy XFB to from unaligned EFB source"); + WARN_LOG_FMT(VIDEO, "Trying to copy XFB to from unaligned EFB source"); // this will show up as wrongly encoded } @@ -677,7 +688,8 @@ bool ZCompare(u16 x, u16 y, u32 z) break; default: pass = false; - ERROR_LOG(VIDEO, "Bad Z compare mode %i", (int)bpmem.zmode.func); + ERROR_LOG_FMT(VIDEO, "Bad Z compare mode {}", static_cast(bpmem.zmode.func)); + break; } if (pass && bpmem.zmode.updateenable) diff --git a/Source/Core/VideoBackends/Software/SWOGLWindow.cpp b/Source/Core/VideoBackends/Software/SWOGLWindow.cpp index e0e0e236c0..1a9fe69cf6 100644 --- a/Source/Core/VideoBackends/Software/SWOGLWindow.cpp +++ b/Source/Core/VideoBackends/Software/SWOGLWindow.cpp @@ -41,13 +41,13 @@ bool SWOGLWindow::Initialize(const WindowSystemInfo& wsi) // Init extension support. if (!GLExtensions::Init(m_gl_context.get())) { - ERROR_LOG(VIDEO, "GLExtensions::Init failed!Does your video card support OpenGL 2.0?"); + ERROR_LOG_FMT(VIDEO, "GLExtensions::Init failed!Does your video card support OpenGL 2.0?"); return false; } else if (GLExtensions::Version() < 310) { - ERROR_LOG(VIDEO, "OpenGL Version %d detected, but at least 3.1 is required.", - GLExtensions::Version()); + ERROR_LOG_FMT(VIDEO, "OpenGL Version {} detected, but at least 3.1 is required.", + GLExtensions::Version()); return false; } diff --git a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp index 9d273bb1cf..06758a3d42 100644 --- a/Source/Core/VideoBackends/Software/SWVertexLoader.cpp +++ b/Source/Core/VideoBackends/Software/SWVertexLoader.cpp @@ -110,7 +110,7 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType) xfmem.MatrixIndexB.Tex6MtxIdx != g_main_cp_state.matrix_index_b.Tex6MtxIdx || xfmem.MatrixIndexB.Tex7MtxIdx != g_main_cp_state.matrix_index_b.Tex7MtxIdx) { - ERROR_LOG(VIDEO, "Matrix indices don't match"); + ERROR_LOG_FMT(VIDEO, "Matrix indices don't match"); } m_vertex.posMtx = xfmem.MatrixIndexA.PosNormalMtxIdx; diff --git a/Source/Core/VideoBackends/Software/SetupUnit.cpp b/Source/Core/VideoBackends/Software/SetupUnit.cpp index 4a4600fab4..589d404552 100644 --- a/Source/Core/VideoBackends/Software/SetupUnit.cpp +++ b/Source/Core/VideoBackends/Software/SetupUnit.cpp @@ -37,7 +37,7 @@ void SetupUnit::SetupVertex() SetupQuad(); break; case OpcodeDecoder::GX_DRAW_QUADS_2: - WARN_LOG(VIDEO, "Non-standard primitive drawing command GL_DRAW_QUADS_2"); + WARN_LOG_FMT(VIDEO, "Non-standard primitive drawing command GL_DRAW_QUADS_2"); SetupQuad(); break; case OpcodeDecoder::GX_DRAW_TRIANGLES: diff --git a/Source/Core/VideoBackends/Software/TransformUnit.cpp b/Source/Core/VideoBackends/Software/TransformUnit.cpp index 9fae537527..26c718d506 100644 --- a/Source/Core/VideoBackends/Software/TransformUnit.cpp +++ b/Source/Core/VideoBackends/Software/TransformUnit.cpp @@ -445,7 +445,8 @@ void TransformTexCoord(const InputVertexData* src, OutputVertexData* dst, bool s dst->texCoords[coordNum].z = 1.0f; break; default: - ERROR_LOG(VIDEO, "Bad tex gen type %i", texinfo.texgentype.Value()); + ERROR_LOG_FMT(VIDEO, "Bad tex gen type {}", texinfo.texgentype.Value()); + break; } }