Software: Migrate logging over to fmt

Migrates the software backend over to the fmt-capable logger.
This commit is contained in:
Lioncash 2020-11-09 03:13:59 -05:00
parent 413d64e7fc
commit 23a8baa605
5 changed files with 33 additions and 20 deletions

View File

@ -56,7 +56,9 @@ static void SetPixelAlphaOnly(u32 offset, u8 a)
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format)); ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
break;
} }
} }
@ -87,7 +89,7 @@ static void SetPixelColorOnly(u32 offset, u8* rgb)
break; break;
case PEControl::RGB565_Z16: 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 src = *(u32*)rgb;
u32* dst = (u32*)&efb[offset]; u32* dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000; u32 val = *dst & 0xff000000;
@ -96,7 +98,9 @@ static void SetPixelColorOnly(u32 offset, u8* rgb)
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format)); ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
break;
} }
} }
@ -128,7 +132,7 @@ static void SetPixelAlphaColor(u32 offset, u8* color)
break; break;
case PEControl::RGB565_Z16: 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 src = *(u32*)color;
u32* dst = (u32*)&efb[offset]; u32* dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000; u32 val = *dst & 0xff000000;
@ -137,7 +141,9 @@ static void SetPixelAlphaColor(u32 offset, u8* color)
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format)); ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
break;
} }
} }
@ -159,11 +165,12 @@ static u32 GetPixelColor(u32 offset)
Convert6To8((src >> 18) & 0x3f) << 24; // Red Convert6To8((src >> 18) & 0x3f) << 24; // Red
case PEControl::RGB565_Z16: 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); return 0xff | ((src & 0x00ffffff) << 8);
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format)); ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
return 0; return 0;
} }
} }
@ -184,7 +191,7 @@ static void SetPixelDepth(u32 offset, u32 depth)
break; break;
case PEControl::RGB565_Z16: 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* dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000; u32 val = *dst & 0xff000000;
val |= depth & 0x00ffffff; val |= depth & 0x00ffffff;
@ -192,7 +199,9 @@ static void SetPixelDepth(u32 offset, u32 depth)
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format)); ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
break;
} }
} }
@ -211,12 +220,14 @@ static u32 GetPixelDepth(u32 offset)
break; break;
case PEControl::RGB565_Z16: 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; depth = (*(u32*)&efb[offset]) & 0x00ffffff;
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format)); ERROR_LOG_FMT(VIDEO, "Unsupported pixel format: {}",
static_cast<int>(bpmem.zcontrol.pixel_format));
break;
} }
return depth; return depth;
@ -554,7 +565,7 @@ void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle<int>
{ {
if (!xfb_in_ram) 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; return;
} }
@ -569,7 +580,7 @@ void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle<int>
// copy always has an even width, which might not be true. // copy always has an even width, which might not be true.
if (left & 1 || right & 1) 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 // this will show up as wrongly encoded
} }
@ -677,7 +688,8 @@ bool ZCompare(u16 x, u16 y, u32 z)
break; break;
default: default:
pass = false; pass = false;
ERROR_LOG(VIDEO, "Bad Z compare mode %i", (int)bpmem.zmode.func); ERROR_LOG_FMT(VIDEO, "Bad Z compare mode {}", static_cast<int>(bpmem.zmode.func));
break;
} }
if (pass && bpmem.zmode.updateenable) if (pass && bpmem.zmode.updateenable)

View File

@ -41,13 +41,13 @@ bool SWOGLWindow::Initialize(const WindowSystemInfo& wsi)
// Init extension support. // Init extension support.
if (!GLExtensions::Init(m_gl_context.get())) 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; return false;
} }
else if (GLExtensions::Version() < 310) else if (GLExtensions::Version() < 310)
{ {
ERROR_LOG(VIDEO, "OpenGL Version %d detected, but at least 3.1 is required.", ERROR_LOG_FMT(VIDEO, "OpenGL Version {} detected, but at least 3.1 is required.",
GLExtensions::Version()); GLExtensions::Version());
return false; return false;
} }

View File

@ -110,7 +110,7 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
xfmem.MatrixIndexB.Tex6MtxIdx != g_main_cp_state.matrix_index_b.Tex6MtxIdx || xfmem.MatrixIndexB.Tex6MtxIdx != g_main_cp_state.matrix_index_b.Tex6MtxIdx ||
xfmem.MatrixIndexB.Tex7MtxIdx != g_main_cp_state.matrix_index_b.Tex7MtxIdx) 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; m_vertex.posMtx = xfmem.MatrixIndexA.PosNormalMtxIdx;

View File

@ -37,7 +37,7 @@ void SetupUnit::SetupVertex()
SetupQuad(); SetupQuad();
break; break;
case OpcodeDecoder::GX_DRAW_QUADS_2: 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(); SetupQuad();
break; break;
case OpcodeDecoder::GX_DRAW_TRIANGLES: case OpcodeDecoder::GX_DRAW_TRIANGLES:

View File

@ -445,7 +445,8 @@ void TransformTexCoord(const InputVertexData* src, OutputVertexData* dst, bool s
dst->texCoords[coordNum].z = 1.0f; dst->texCoords[coordNum].z = 1.0f;
break; break;
default: default:
ERROR_LOG(VIDEO, "Bad tex gen type %i", texinfo.texgentype.Value()); ERROR_LOG_FMT(VIDEO, "Bad tex gen type {}", texinfo.texgentype.Value());
break;
} }
} }