VideoCommon: Migrate over to fmt

Migrates off the printf-based formatting where applicable.
This commit is contained in:
Lioncash 2020-11-13 22:33:26 -05:00
parent 8a621c2d5e
commit 3d9b2aa005
32 changed files with 310 additions and 281 deletions

View File

@ -126,7 +126,7 @@ u32 AbstractTexture::CalculateStrideForFormat(AbstractTextureFormat format, u32
case AbstractTextureFormat::D32F_S8:
return static_cast<size_t>(row_length) * 8;
default:
PanicAlert("Unhandled texture format.");
PanicAlertFmt("Unhandled texture format.");
return 0;
}
}
@ -153,7 +153,7 @@ u32 AbstractTexture::GetTexelSizeForFormat(AbstractTextureFormat format)
case AbstractTextureFormat::D32F_S8:
return 8;
default:
PanicAlert("Unhandled texture format.");
PanicAlertFmt("Unhandled texture format.");
return 0;
}
}

View File

@ -122,7 +122,7 @@ bool AsyncShaderCompiler::StartWorkerThreads(u32 num_worker_threads)
void* thread_param = nullptr;
if (!WorkerThreadInitMainThread(&thread_param))
{
WARN_LOG(VIDEO, "Failed to initialize shader compiler worker thread.");
WARN_LOG_FMT(VIDEO, "Failed to initialize shader compiler worker thread.");
break;
}
@ -133,7 +133,7 @@ bool AsyncShaderCompiler::StartWorkerThreads(u32 num_worker_threads)
if (!m_worker_thread_start_result.load())
{
WARN_LOG(VIDEO, "Failed to start shader compiler worker thread.");
WARN_LOG_FMT(VIDEO, "Failed to start shader compiler worker thread.");
thr.join();
break;
}
@ -198,7 +198,7 @@ void AsyncShaderCompiler::WorkerThreadEntryPoint(void* param)
// Initialize worker thread with backend-specific method.
if (!WorkerThreadInitWorkerThread(param))
{
WARN_LOG(VIDEO, "Failed to initialize shader compiler worker.");
WARN_LOG_FMT(VIDEO, "Failed to initialize shader compiler worker.");
m_worker_thread_start_result.store(false);
m_init_event.Set();
return;

View File

@ -5,6 +5,7 @@
#include "VideoCommon/BPFunctions.h"
#include <algorithm>
#include <string_view>
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
@ -223,11 +224,11 @@ void OnPixelFormatChange()
if (!g_ActiveConfig.bEFBEmulateFormatChanges)
return;
auto old_format = g_renderer->GetPrevPixelFormat();
auto new_format = bpmem.zcontrol.pixel_format;
const auto old_format = g_renderer->GetPrevPixelFormat();
const auto new_format = bpmem.zcontrol.pixel_format;
g_renderer->StorePixelFormat(new_format);
DEBUG_LOG(VIDEO, "pixelfmt: pixel=%d, zc=%d", static_cast<int>(new_format),
DEBUG_LOG_FMT(VIDEO, "pixelfmt: pixel={}, zc={}", static_cast<int>(new_format),
static_cast<int>(bpmem.zcontrol.zformat));
// no need to reinterpret pixel data in these cases
@ -291,7 +292,7 @@ void OnPixelFormatChange()
break;
}
ERROR_LOG(VIDEO, "Unhandled EFB format change: %d to %d", static_cast<int>(old_format),
ERROR_LOG_FMT(VIDEO, "Unhandled EFB format change: {} to {}", static_cast<int>(old_format),
static_cast<int>(new_format));
}
@ -304,21 +305,21 @@ void SetInterlacingMode(const BPCmd& bp)
{
// SDK always sets bpmem.lineptwidth.lineaspect via BPMEM_LINEPTWIDTH
// just before this cmd
const char* action[] = {"don't adjust", "adjust"};
DEBUG_LOG(VIDEO, "BPMEM_FIELDMODE texLOD:%s lineaspect:%s", action[bpmem.fieldmode.texLOD],
static constexpr std::string_view action[] = {"don't adjust", "adjust"};
DEBUG_LOG_FMT(VIDEO, "BPMEM_FIELDMODE texLOD:{} lineaspect:{}", action[bpmem.fieldmode.texLOD],
action[bpmem.lineptwidth.lineaspect]);
}
break;
case BPMEM_FIELDMASK:
{
// Determines if fields will be written to EFB (always computed)
const char* action[] = {"skip", "write"};
DEBUG_LOG(VIDEO, "BPMEM_FIELDMASK even:%s odd:%s", action[bpmem.fieldmask.even],
static constexpr std::string_view action[] = {"skip", "write"};
DEBUG_LOG_FMT(VIDEO, "BPMEM_FIELDMASK even:{} odd:{}", action[bpmem.fieldmask.even],
action[bpmem.fieldmask.odd]);
}
break;
default:
ERROR_LOG(VIDEO, "SetInterlacingMode default");
ERROR_LOG_FMT(VIDEO, "SetInterlacingMode default");
break;
}
}

View File

@ -90,11 +90,11 @@ static void BPWritten(const BPCmd& bp)
switch (bp.address)
{
case BPMEM_GENMODE: // Set the Generation Mode
PRIM_LOG("genmode: texgen=%d, col=%d, multisampling=%d, tev=%d, cullmode=%d, ind=%d, zfeeze=%d",
(u32)bpmem.genMode.numtexgens, (u32)bpmem.genMode.numcolchans,
(u32)bpmem.genMode.multisampling, (u32)bpmem.genMode.numtevstages + 1,
(u32)bpmem.genMode.cullmode, (u32)bpmem.genMode.numindstages,
(u32)bpmem.genMode.zfreeze);
PRIM_LOG("genmode: texgen={}, col={}, multisampling={}, tev={}, cullmode={}, ind={}, zfeeze={}",
bpmem.genMode.numtexgens.Value(), bpmem.genMode.numcolchans.Value(),
bpmem.genMode.multisampling.Value(), bpmem.genMode.numtevstages.Value() + 1,
static_cast<u32>(bpmem.genMode.cullmode), bpmem.genMode.numindstages.Value(),
bpmem.genMode.zfreeze.Value());
if (bp.changes)
PixelShaderManager::SetGenModeChanged();
@ -138,7 +138,7 @@ static void BPWritten(const BPCmd& bp)
GeometryShaderManager::SetLinePtWidthChanged();
return;
case BPMEM_ZMODE: // Depth Control
PRIM_LOG("zmode: test=%u, func=%u, upd=%u", bpmem.zmode.testenable.Value(),
PRIM_LOG("zmode: test={}, func={}, upd={}", bpmem.zmode.testenable.Value(),
bpmem.zmode.func.Value(), bpmem.zmode.updateenable.Value());
SetDepthMode();
PixelShaderManager::SetZModeControl();
@ -146,7 +146,7 @@ static void BPWritten(const BPCmd& bp)
case BPMEM_BLENDMODE: // Blending Control
if (bp.changes & 0xFFFF)
{
PRIM_LOG("blendmode: en=%u, open=%u, colupd=%u, alphaupd=%u, dst=%u, src=%u, sub=%u, mode=%u",
PRIM_LOG("blendmode: en={}, open={}, colupd={}, alphaupd={}, dst={}, src={}, sub={}, mode={}",
bpmem.blendmode.blendenable.Value(), bpmem.blendmode.logicopenable.Value(),
bpmem.blendmode.colorupdate.Value(), bpmem.blendmode.alphaupdate.Value(),
bpmem.blendmode.dstfactor.Value(), bpmem.blendmode.srcfactor.Value(),
@ -158,7 +158,7 @@ static void BPWritten(const BPCmd& bp)
}
return;
case BPMEM_CONSTANTALPHA: // Set Destination Alpha
PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha.Value(),
PRIM_LOG("constalpha: alp={}, en={}", bpmem.dstalpha.alpha.Value(),
bpmem.dstalpha.enable.Value());
if (bp.changes)
{
@ -181,11 +181,11 @@ static void BPWritten(const BPCmd& bp)
g_framebuffer_manager->InvalidatePeekCache(false);
if (!Fifo::UseDeterministicGPUThread())
PixelEngine::SetFinish(); // may generate interrupt
DEBUG_LOG(VIDEO, "GXSetDrawDone SetPEFinish (value: 0x%02X)", (bp.newvalue & 0xFFFF));
DEBUG_LOG_FMT(VIDEO, "GXSetDrawDone SetPEFinish (value: {:#04X})", bp.newvalue & 0xFFFF);
return;
default:
WARN_LOG(VIDEO, "GXSetDrawDone ??? (value 0x%02X)", (bp.newvalue & 0xFFFF));
WARN_LOG_FMT(VIDEO, "GXSetDrawDone ??? (value {:#04X})", bp.newvalue & 0xFFFF);
return;
}
return;
@ -194,14 +194,14 @@ static void BPWritten(const BPCmd& bp)
g_framebuffer_manager->InvalidatePeekCache(false);
if (!Fifo::UseDeterministicGPUThread())
PixelEngine::SetToken(static_cast<u16>(bp.newvalue & 0xFFFF), false);
DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (bp.newvalue & 0xFFFF));
DEBUG_LOG_FMT(VIDEO, "SetPEToken {:#06X}", bp.newvalue & 0xFFFF);
return;
case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID
g_texture_cache->FlushEFBCopies();
g_framebuffer_manager->InvalidatePeekCache(false);
if (!Fifo::UseDeterministicGPUThread())
PixelEngine::SetToken(static_cast<u16>(bp.newvalue & 0xFFFF), true);
DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (bp.newvalue & 0xFFFF));
DEBUG_LOG_FMT(VIDEO, "SetPEToken + INT {:#06X}", bp.newvalue & 0xFFFF);
return;
// ------------------------
@ -243,8 +243,8 @@ static void BPWritten(const BPCmd& bp)
int copy_height = srcRect.GetHeight();
if (srcRect.right > s32(EFB_WIDTH) || srcRect.bottom > s32(EFB_HEIGHT))
{
WARN_LOG(VIDEO, "Oversized EFB copy: %dx%d (offset %d,%d stride %u)", copy_width, copy_height,
srcRect.left, srcRect.top, destStride);
WARN_LOG_FMT(VIDEO, "Oversized EFB copy: {}x{} (offset {},{} stride {})", copy_width,
copy_height, srcRect.left, srcRect.top, destStride);
// Adjust the copy size to fit within the EFB. So that we don't end up with a stretched image,
// instead of clamping the source rectangle, we reduce it by the over-sized amount.
@ -291,9 +291,9 @@ static void BPWritten(const BPCmd& bp)
u32 height = static_cast<u32>(num_xfb_lines);
DEBUG_LOG(VIDEO,
"RenderToXFB: destAddr: %08x | srcRect {%d %d %d %d} | fbWidth: %u | "
"fbStride: %u | fbHeight: %u | yScale: %f",
DEBUG_LOG_FMT(VIDEO,
"RenderToXFB: destAddr: {:08x} | srcRect [{} {} {} {}] | fbWidth: {} | "
"fbStride: {} | fbHeight: {} | yScale: {}",
destAddr, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom,
bpmem.copyTexSrcWH.x + 1, destStride, height, yScale);
@ -370,9 +370,10 @@ static void BPWritten(const BPCmd& bp)
PixelShaderManager::SetFogColorChanged();
return;
case BPMEM_ALPHACOMPARE: // Compare Alpha Values
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", (int)bpmem.alpha_test.ref0,
(int)bpmem.alpha_test.ref1, (int)bpmem.alpha_test.comp0, (int)bpmem.alpha_test.comp1,
(int)bpmem.alpha_test.logic);
PRIM_LOG("alphacmp: ref0={}, ref1={}, comp0={}, comp1={}, logic={}",
bpmem.alpha_test.ref0.Value(), bpmem.alpha_test.ref1.Value(),
static_cast<int>(bpmem.alpha_test.comp0), static_cast<int>(bpmem.alpha_test.comp1),
static_cast<int>(bpmem.alpha_test.logic));
if (bp.changes & 0xFFFF)
PixelShaderManager::SetAlpha();
if (bp.changes)
@ -382,7 +383,7 @@ static void BPWritten(const BPCmd& bp)
}
return;
case BPMEM_BIAS: // BIAS
PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias.Value());
PRIM_LOG("ztex bias={:#x}", bpmem.ztex1.bias.Value());
if (bp.changes)
PixelShaderManager::SetZTextureBias();
return;
@ -393,9 +394,9 @@ static void BPWritten(const BPCmd& bp)
if (bp.changes & 12)
PixelShaderManager::SetZTextureOpChanged();
#if defined(_DEBUG) || defined(DEBUGFAST)
const char* pzop[] = {"DISABLE", "ADD", "REPLACE", "?"};
const char* pztype[] = {"Z8", "Z16", "Z24", "?"};
PRIM_LOG("ztex op=%s, type=%s", pzop[bpmem.ztex2.op], pztype[bpmem.ztex2.type]);
static constexpr std::string_view pzop[] = {"DISABLE", "ADD", "REPLACE", "?"};
static constexpr std::string_view pztype[] = {"Z8", "Z16", "Z24", "?"};
PRIM_LOG("ztex op={}, type={}", pzop[bpmem.ztex2.op], pztype[bpmem.ztex2.type]);
#endif
}
return;
@ -711,7 +712,8 @@ static void BPWritten(const BPCmd& bp)
break;
}
WARN_LOG(VIDEO, "Unknown BP opcode: address = 0x%08x value = 0x%08x", bp.address, bp.newvalue);
WARN_LOG_FMT(VIDEO, "Unknown BP opcode: address = {:#010x} value = {:#010x}", bp.address,
bp.newvalue);
}
// Call browser: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg()

View File

@ -361,13 +361,13 @@ void UpdateInterrupts(u64 userdata)
if (userdata)
{
s_interrupt_set.Set();
DEBUG_LOG(COMMANDPROCESSOR, "Interrupt set");
DEBUG_LOG_FMT(COMMANDPROCESSOR, "Interrupt set");
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true);
}
else
{
s_interrupt_set.Clear();
DEBUG_LOG(COMMANDPROCESSOR, "Interrupt cleared");
DEBUG_LOG_FMT(COMMANDPROCESSOR, "Interrupt cleared");
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false);
}
CoreTiming::ForceExceptionCheck(0);
@ -395,21 +395,21 @@ void SetCPStatusFromGPU()
{
if (!fifo.bFF_Breakpoint)
{
DEBUG_LOG(COMMANDPROCESSOR, "Hit breakpoint at %i", fifo.CPReadPointer);
DEBUG_LOG_FMT(COMMANDPROCESSOR, "Hit breakpoint at {}", fifo.CPReadPointer);
fifo.bFF_Breakpoint = true;
}
}
else
{
if (fifo.bFF_Breakpoint)
DEBUG_LOG(COMMANDPROCESSOR, "Cleared breakpoint at %i", fifo.CPReadPointer);
DEBUG_LOG_FMT(COMMANDPROCESSOR, "Cleared breakpoint at {}", fifo.CPReadPointer);
fifo.bFF_Breakpoint = false;
}
}
else
{
if (fifo.bFF_Breakpoint)
DEBUG_LOG(COMMANDPROCESSOR, "Cleared breakpoint at %i", fifo.CPReadPointer);
DEBUG_LOG_FMT(COMMANDPROCESSOR, "Cleared breakpoint at {}", fifo.CPReadPointer);
fifo.bFF_Breakpoint = false;
}
@ -462,7 +462,7 @@ void SetCPStatusFromCPU()
if (!interrupt || bpInt || undfInt || ovfInt)
{
s_interrupt_set.Set(interrupt);
DEBUG_LOG(COMMANDPROCESSOR, "Interrupt set");
DEBUG_LOG_FMT(COMMANDPROCESSOR, "Interrupt set");
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, interrupt);
}
}
@ -483,9 +483,9 @@ void SetCpStatusRegister()
m_CPStatusReg.UnderflowLoWatermark = fifo.bFF_LoWatermark;
m_CPStatusReg.OverflowHiWatermark = fifo.bFF_HiWatermark;
DEBUG_LOG(COMMANDPROCESSOR, "\t Read from STATUS_REGISTER : %04x", m_CPStatusReg.Hex);
DEBUG_LOG(
COMMANDPROCESSOR, "(r) status: iBP %s | fReadIdle %s | fCmdIdle %s | iOvF %s | iUndF %s",
DEBUG_LOG_FMT(COMMANDPROCESSOR, "\t Read from STATUS_REGISTER : {:04x}", m_CPStatusReg.Hex);
DEBUG_LOG_FMT(
COMMANDPROCESSOR, "(r) status: iBP {} | fReadIdle {} | fCmdIdle {} | iOvF {} | iUndF {}",
m_CPStatusReg.Breakpoint ? "ON" : "OFF", m_CPStatusReg.ReadIdle ? "ON" : "OFF",
m_CPStatusReg.CommandIdle ? "ON" : "OFF", m_CPStatusReg.OverflowHiWatermark ? "ON" : "OFF",
m_CPStatusReg.UnderflowLoWatermark ? "ON" : "OFF");
@ -509,7 +509,7 @@ void SetCpControlRegister()
fifo.bFF_GPReadEnable = m_CPCtrlReg.GPReadEnable;
}
DEBUG_LOG(COMMANDPROCESSOR, "\t GPREAD %s | BP %s | Int %s | OvF %s | UndF %s | LINK %s",
DEBUG_LOG_FMT(COMMANDPROCESSOR, "\t GPREAD {} | BP {} | Int {} | OvF {} | UndF {} | LINK {}",
fifo.bFF_GPReadEnable ? "ON" : "OFF", fifo.bFF_BPEnable ? "ON" : "OFF",
fifo.bFF_BPInt ? "ON" : "OFF", m_CPCtrlReg.FifoOverflowIntEnable ? "ON" : "OFF",
m_CPCtrlReg.FifoUnderflowIntEnable ? "ON" : "OFF",
@ -525,7 +525,7 @@ void SetCpClearRegister()
void HandleUnknownOpcode(u8 cmd_byte, void* buffer, bool preprocess)
{
// TODO(Omega): Maybe dump FIFO to file on this error
PanicAlertT("GFX FIFO: Unknown Opcode (0x%02x @ %p, %s).\n"
PanicAlertFmtT("GFX FIFO: Unknown Opcode ({:#04x} @ {}, {}).\n"
"This means one of the following:\n"
"* The emulated GPU got desynced, disabling dual core can help\n"
"* Command stream corrupted by some spurious memory bug\n"
@ -536,27 +536,28 @@ void HandleUnknownOpcode(u8 cmd_byte, void* buffer, bool preprocess)
cmd_byte, buffer, preprocess ? "preprocess=true" : "preprocess=false");
{
PanicAlert("Illegal command %02x\n"
"CPBase: 0x%08x\n"
"CPEnd: 0x%08x\n"
"CPHiWatermark: 0x%08x\n"
"CPLoWatermark: 0x%08x\n"
"CPReadWriteDistance: 0x%08x\n"
"CPWritePointer: 0x%08x\n"
"CPReadPointer: 0x%08x\n"
"CPBreakpoint: 0x%08x\n"
"bFF_GPReadEnable: %s\n"
"bFF_BPEnable: %s\n"
"bFF_BPInt: %s\n"
"bFF_Breakpoint: %s\n"
"bFF_GPLinkEnable: %s\n"
"bFF_HiWatermarkInt: %s\n"
"bFF_LoWatermarkInt: %s\n",
PanicAlertFmt("Illegal command {:02x}\n"
"CPBase: {:#010x}\n"
"CPEnd: {:#010x}\n"
"CPHiWatermark: {:#010x}\n"
"CPLoWatermark: {:#010x}\n"
"CPReadWriteDistance: {:#010x}\n"
"CPWritePointer: {:#010x}\n"
"CPReadPointer: {:#010x}\n"
"CPBreakpoint: {:#010x}\n"
"bFF_GPReadEnable: {}\n"
"bFF_BPEnable: {}\n"
"bFF_BPInt: {}\n"
"bFF_Breakpoint: {}\n"
"bFF_GPLinkEnable: {}\n"
"bFF_HiWatermarkInt: {}\n"
"bFF_LoWatermarkInt: {}\n",
cmd_byte, fifo.CPBase, fifo.CPEnd, fifo.CPHiWatermark, fifo.CPLoWatermark,
fifo.CPReadWriteDistance, fifo.CPWritePointer, fifo.CPReadPointer, fifo.CPBreakpoint,
fifo.bFF_GPReadEnable ? "true" : "false", fifo.bFF_BPEnable ? "true" : "false",
fifo.bFF_BPInt ? "true" : "false", fifo.bFF_Breakpoint ? "true" : "false",
fifo.bFF_GPLinkEnable ? "true" : "false", fifo.bFF_HiWatermarkInt ? "true" : "false",
fifo.CPReadWriteDistance, fifo.CPWritePointer, fifo.CPReadPointer,
fifo.CPBreakpoint, fifo.bFF_GPReadEnable ? "true" : "false",
fifo.bFF_BPEnable ? "true" : "false", fifo.bFF_BPInt ? "true" : "false",
fifo.bFF_Breakpoint ? "true" : "false", fifo.bFF_GPLinkEnable ? "true" : "false",
fifo.bFF_HiWatermarkInt ? "true" : "false",
fifo.bFF_LoWatermarkInt ? "true" : "false");
}
}

View File

@ -123,7 +123,7 @@ void Init()
void Shutdown()
{
if (s_gpu_mainloop.IsRunning())
PanicAlert("Fifo shutting down while active");
PanicAlertFmt("FIFO shutting down while active");
Common::FreeMemoryPages(s_video_buffer, FIFO_SIZE + 4);
s_video_buffer = nullptr;
@ -167,7 +167,10 @@ void SyncGPU(SyncGPUReason reason, bool may_move_read_ptr)
// Opportunistically reset FIFOs so we don't wrap around.
if (may_move_read_ptr && s_fifo_aux_write_ptr != s_fifo_aux_read_ptr)
PanicAlert("aux fifo not synced (%p, %p)", s_fifo_aux_write_ptr, s_fifo_aux_read_ptr);
{
PanicAlertFmt("Aux FIFO not synced ({}, {})", fmt::ptr(s_fifo_aux_write_ptr),
fmt::ptr(s_fifo_aux_read_ptr));
}
memmove(s_fifo_aux_data, s_fifo_aux_read_ptr, s_fifo_aux_write_ptr - s_fifo_aux_read_ptr);
s_fifo_aux_write_ptr -= (s_fifo_aux_read_ptr - s_fifo_aux_data);
@ -206,7 +209,7 @@ void PushFifoAuxBuffer(const void* ptr, size_t size)
{
// That will sync us up to the last 32 bytes, so this short region
// of FIFO would have to point to a 2MB display list or something.
PanicAlert("absurdly large aux buffer");
PanicAlertFmt("Absurdly large aux buffer");
return;
}
}
@ -224,13 +227,13 @@ void* PopFifoAuxBuffer(size_t size)
// Description: RunGpuLoop() sends data through this function.
static void ReadDataFromFifo(u32 readPtr)
{
size_t len = 32;
if (len > (size_t)(s_video_buffer + FIFO_SIZE - s_video_buffer_write_ptr))
constexpr size_t len = 32;
if (len > static_cast<size_t>(s_video_buffer + FIFO_SIZE - s_video_buffer_write_ptr))
{
size_t existing_len = s_video_buffer_write_ptr - s_video_buffer_read_ptr;
if (len > (size_t)(FIFO_SIZE - existing_len))
const size_t existing_len = s_video_buffer_write_ptr - s_video_buffer_read_ptr;
if (len > static_cast<size_t>(FIFO_SIZE - existing_len))
{
PanicAlert("FIFO out of bounds (existing %zu + new %zu > %u)", existing_len, len, FIFO_SIZE);
PanicAlertFmt("FIFO out of bounds (existing {} + new {} > {})", existing_len, len, FIFO_SIZE);
return;
}
memmove(s_video_buffer, s_video_buffer_read_ptr, existing_len);
@ -245,9 +248,9 @@ static void ReadDataFromFifo(u32 readPtr)
// The deterministic_gpu_thread version.
static void ReadDataFromFifoOnCPU(u32 readPtr)
{
size_t len = 32;
constexpr size_t len = 32;
u8* write_ptr = s_video_buffer_write_ptr;
if (len > (size_t)(s_video_buffer + FIFO_SIZE - write_ptr))
if (len > static_cast<size_t>(s_video_buffer + FIFO_SIZE - write_ptr))
{
// We can't wrap around while the GPU is working on the data.
// This should be very rare due to the reset in SyncGPU.
@ -260,14 +263,14 @@ static void ReadDataFromFifoOnCPU(u32 readPtr)
if (s_video_buffer_pp_read_ptr != s_video_buffer_read_ptr)
{
PanicAlert("desynced read pointers");
PanicAlertFmt("Desynced read pointers");
return;
}
write_ptr = s_video_buffer_write_ptr;
size_t existing_len = write_ptr - s_video_buffer_pp_read_ptr;
if (len > (size_t)(FIFO_SIZE - existing_len))
const size_t existing_len = write_ptr - s_video_buffer_pp_read_ptr;
if (len > static_cast<size_t>(FIFO_SIZE - existing_len))
{
PanicAlert("FIFO out of bounds (existing %zu + new %zu > %u)", existing_len, len, FIFO_SIZE);
PanicAlertFmt("FIFO out of bounds (existing {} + new {} > {})", existing_len, len, FIFO_SIZE);
return;
}
}

View File

@ -43,38 +43,38 @@ bool FramebufferManager::Initialize()
{
if (!CreateEFBFramebuffer())
{
PanicAlert("Failed to create EFB framebuffer");
PanicAlertFmt("Failed to create EFB framebuffer");
return false;
}
m_efb_cache_tile_size = static_cast<u32>(std::max(g_ActiveConfig.iEFBAccessTileSize, 0));
if (!CreateReadbackFramebuffer())
{
PanicAlert("Failed to create EFB readback framebuffer");
PanicAlertFmt("Failed to create EFB readback framebuffer");
return false;
}
if (!CompileReadbackPipelines())
{
PanicAlert("Failed to compile EFB readback pipelines");
PanicAlertFmt("Failed to compile EFB readback pipelines");
return false;
}
if (!CompileConversionPipelines())
{
PanicAlert("Failed to compile EFB conversion pipelines");
PanicAlertFmt("Failed to compile EFB conversion pipelines");
return false;
}
if (!CompileClearPipelines())
{
PanicAlert("Failed to compile EFB clear pipelines");
PanicAlertFmt("Failed to compile EFB clear pipelines");
return false;
}
if (!CompilePokePipelines())
{
PanicAlert("Failed to compile EFB poke pipelines");
PanicAlertFmt("Failed to compile EFB poke pipelines");
return false;
}
@ -89,7 +89,7 @@ void FramebufferManager::RecreateEFBFramebuffer()
DestroyReadbackFramebuffer();
DestroyEFBFramebuffer();
if (!CreateEFBFramebuffer() || !CreateReadbackFramebuffer())
PanicAlert("Failed to recreate EFB framebuffer");
PanicAlertFmt("Failed to recreate EFB framebuffer");
}
void FramebufferManager::RecompileShaders()
@ -101,7 +101,7 @@ void FramebufferManager::RecompileShaders()
if (!CompileReadbackPipelines() || !CompileConversionPipelines() || !CompileClearPipelines() ||
!CompilePokePipelines())
{
PanicAlert("Failed to recompile EFB pipelines");
PanicAlertFmt("Failed to recompile EFB pipelines");
}
}
@ -415,7 +415,7 @@ void FramebufferManager::SetEFBCacheTileSize(u32 size)
m_efb_cache_tile_size = size;
DestroyReadbackFramebuffer();
if (!CreateReadbackFramebuffer())
PanicAlert("Failed to create EFB readback framebuffers");
PanicAlertFmt("Failed to create EFB readback framebuffers");
}
void FramebufferManager::InvalidatePeekCache(bool forced)
@ -939,7 +939,7 @@ void FramebufferManager::DoLoadState(PointerWrap& p)
if (!color_tex || !depth_tex ||
color_tex->texture->GetLayers() != m_efb_color_texture->GetLayers())
{
WARN_LOG(VIDEO, "Failed to deserialize EFB contents. Clearing instead.");
WARN_LOG_FMT(VIDEO, "Failed to deserialize EFB contents. Clearing instead.");
g_renderer->SetAndClearFramebuffer(
m_efb_framebuffer.get(), {{0.0f, 0.0f, 0.0f, 0.0f}},
g_ActiveConfig.backend_info.bSupportsReversedDepthRange ? 1.0f : 0.0f);

View File

@ -626,7 +626,7 @@ std::string GenerateTextureReinterpretShader(TextureFormat from_format, TextureF
break;
default:
WARN_LOG(VIDEO, "From format %u is not supported", static_cast<u32>(from_format));
WARN_LOG_FMT(VIDEO, "From format {} is not supported", static_cast<u32>(from_format));
return "{}\n";
}
@ -678,7 +678,7 @@ std::string GenerateTextureReinterpretShader(TextureFormat from_format, TextureF
}
break;
default:
WARN_LOG(VIDEO, "To format %u is not supported", static_cast<u32>(to_format));
WARN_LOG_FMT(VIDEO, "To format {} is not supported", static_cast<u32>(to_format));
return "{}\n";
}

View File

@ -119,8 +119,8 @@ void HiresTexture::Update()
if (failed_insert)
{
ERROR_LOG(VIDEO, "One or more textures at path '%s' were already inserted",
texture_directory.c_str());
ERROR_LOG_FMT(VIDEO, "One or more textures at path '{}' were already inserted",
texture_directory);
}
}
@ -371,7 +371,7 @@ std::unique_ptr<HiresTexture> HiresTexture::Load(const std::string& base_filenam
if (!LoadTexture(level, buffer))
{
ERROR_LOG(VIDEO, "Custom texture %s failed to load", filename.c_str());
ERROR_LOG_FMT(VIDEO, "Custom texture {} failed to load", filename);
break;
}
}
@ -387,19 +387,19 @@ std::unique_ptr<HiresTexture> HiresTexture::Load(const std::string& base_filenam
const Level& first_mip = ret->m_levels[0];
if (first_mip.width * height != first_mip.height * width)
{
ERROR_LOG(VIDEO,
"Invalid custom texture size %ux%u for texture %s. The aspect differs "
"from the native size %ux%u.",
first_mip.width, first_mip.height, first_mip_file.path.c_str(), width, height);
ERROR_LOG_FMT(VIDEO,
"Invalid custom texture size {}x{} for texture {}. The aspect differs "
"from the native size {}x{}.",
first_mip.width, first_mip.height, first_mip_file.path, width, height);
}
// Same deal if the custom texture isn't a multiple of the native size.
if (width != 0 && height != 0 && (first_mip.width % width || first_mip.height % height))
{
ERROR_LOG(VIDEO,
"Invalid custom texture size %ux%u for texture %s. Please use an integer "
"upscaling factor based on the native size %ux%u.",
first_mip.width, first_mip.height, first_mip_file.path.c_str(), width, height);
ERROR_LOG_FMT(VIDEO,
"Invalid custom texture size {}x{} for texture {}. Please use an integer "
"upscaling factor based on the native size {}x{}.",
first_mip.width, first_mip.height, first_mip_file.path, width, height);
}
// Verify that each mip level is the correct size (divide by 2 each time).
@ -416,16 +416,16 @@ std::unique_ptr<HiresTexture> HiresTexture::Load(const std::string& base_filenam
if (current_mip_width == level.width && current_mip_height == level.height)
continue;
ERROR_LOG(VIDEO,
"Invalid custom texture size %dx%d for texture %s. Mipmap level %u must be %dx%d.",
level.width, level.height, first_mip_file.path.c_str(), mip_level,
current_mip_width, current_mip_height);
ERROR_LOG_FMT(
VIDEO, "Invalid custom texture size {}x{} for texture {}. Mipmap level {} must be {}x{}.",
level.width, level.height, first_mip_file.path, mip_level, current_mip_width,
current_mip_height);
}
else
{
// It is invalid to have more than a single 1x1 mipmap.
ERROR_LOG(VIDEO, "Custom texture %s has too many 1x1 mipmaps. Skipping extra levels.",
first_mip_file.path.c_str());
ERROR_LOG_FMT(VIDEO, "Custom texture {} has too many 1x1 mipmaps. Skipping extra levels.",
first_mip_file.path);
}
// Drop this mip level and any others after it.
@ -437,8 +437,8 @@ std::unique_ptr<HiresTexture> HiresTexture::Load(const std::string& base_filenam
if (std::any_of(ret->m_levels.begin(), ret->m_levels.end(),
[&ret](const Level& l) { return l.format != ret->m_levels[0].format; }))
{
ERROR_LOG(VIDEO, "Custom texture %s has inconsistent formats across mip levels.",
first_mip_file.path.c_str());
ERROR_LOG_FMT(VIDEO, "Custom texture {} has inconsistent formats across mip levels.",
first_mip_file.path);
return nullptr;
}

View File

@ -410,10 +410,10 @@ bool ReadMipLevel(HiresTexture::Level* level, File::IOFile& file, const std::str
if (mip_level == 0 && info.block_size > 1 &&
((width % info.block_size) != 0 || (height % info.block_size) != 0))
{
ERROR_LOG(VIDEO,
"Invalid dimensions for DDS texture %s. For compressed textures of this format, "
"the width/height of the first mip level must be a multiple of %u.",
filename.c_str(), info.block_size);
ERROR_LOG_FMT(VIDEO,
"Invalid dimensions for DDS texture {}. For compressed textures of this format, "
"the width/height of the first mip level must be a multiple of {}.",
filename, info.block_size);
return false;
}

View File

@ -51,8 +51,7 @@ bool TextureToPng(const u8* data, int row_stride, const std::string& filename, i
File::IOFile fp(filename, "wb");
if (!fp.IsOpen())
{
PanicAlertT("Screenshot failed: Could not open file \"%s\" (error %d)", filename.c_str(),
errno);
PanicAlertFmtT("Screenshot failed: Could not open file \"{}\" (error {})", filename, errno);
goto finalise;
}
@ -60,7 +59,7 @@ bool TextureToPng(const u8* data, int row_stride, const std::string& filename, i
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (png_ptr == nullptr)
{
PanicAlert("Screenshot failed: Could not allocate write struct");
PanicAlertFmt("Screenshot failed: Could not allocate write struct");
goto finalise;
}
@ -68,7 +67,7 @@ bool TextureToPng(const u8* data, int row_stride, const std::string& filename, i
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr)
{
PanicAlert("Screenshot failed: Could not allocate info struct");
PanicAlertFmt("Screenshot failed: Could not allocate info struct");
goto finalise;
}
@ -82,7 +81,7 @@ bool TextureToPng(const u8* data, int row_stride, const std::string& filename, i
// would need to be volatile).
if (setjmp(png_jmpbuf(png_ptr)))
{
PanicAlert("Screenshot failed: Error during PNG creation");
PanicAlertFmt("Screenshot failed: Error during PNG creation");
goto finalise;
}

View File

@ -165,7 +165,7 @@ u16* AddQuads(u16* index_ptr, u32 num_verts, u32 index)
template <bool pr>
u16* AddQuads_nonstandard(u16* index_ptr, u32 num_verts, u32 index)
{
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");
return AddQuads<pr>(index_ptr, num_verts, index);
}

View File

@ -111,7 +111,7 @@ u8* Run(DataReader src, u32* cycles, bool in_display_list)
case GX_UNKNOWN_RESET:
total_cycles += 6; // Datel software uses this command
DEBUG_LOG(VIDEO, "GX Reset?: %08x", cmd_byte);
DEBUG_LOG_FMT(VIDEO, "GX Reset?: {:08x}", cmd_byte);
break;
case GX_LOAD_CP_REG:
@ -187,7 +187,7 @@ u8* Run(DataReader src, u32* cycles, bool in_display_list)
if (in_display_list)
{
total_cycles += 6;
INFO_LOG(VIDEO, "recursive display list detected");
INFO_LOG_FMT(VIDEO, "recursive display list detected");
}
else
{
@ -202,12 +202,12 @@ u8* Run(DataReader src, u32* cycles, bool in_display_list)
case GX_CMD_UNKNOWN_METRICS: // zelda 4 swords calls it and checks the metrics registers after
// that
total_cycles += 6;
DEBUG_LOG(VIDEO, "GX 0x44: %08x", cmd_byte);
DEBUG_LOG_FMT(VIDEO, "GX 0x44: {:08x}", cmd_byte);
break;
case GX_CMD_INVL_VC: // Invalidate Vertex Cache
total_cycles += 6;
DEBUG_LOG(VIDEO, "Invalidate (vertex cache?)");
DEBUG_LOG_FMT(VIDEO, "Invalidate (vertex cache?)");
break;
case GX_LOAD_BP_REG:
@ -257,8 +257,8 @@ u8* Run(DataReader src, u32* cycles, bool in_display_list)
{
if (!s_is_fifo_error_seen)
CommandProcessor::HandleUnknownOpcode(cmd_byte, opcode_start, is_preprocess);
ERROR_LOG(VIDEO, "FIFO: Unknown Opcode(0x%02x @ %p, preprocessing = %s)", cmd_byte,
opcode_start, is_preprocess ? "yes" : "no");
ERROR_LOG_FMT(VIDEO, "FIFO: Unknown Opcode({:#04x} @ {}, preprocessing = {})", cmd_byte,
fmt::ptr(opcode_start), is_preprocess ? "yes" : "no");
s_is_fifo_error_seen = true;
total_cycles += 1;
}

View File

@ -221,7 +221,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
m_Control.PEToken = 0; // this flag is write only
m_Control.PEFinish = 0; // this flag is write only
DEBUG_LOG(PIXELENGINE, "(w16) CTRL_REGISTER: 0x%04x", val);
DEBUG_LOG_FMT(PIXELENGINE, "(w16) CTRL_REGISTER: {:#06x}", val);
UpdateInterrupts();
}));
@ -294,7 +294,7 @@ static void RaiseEvent()
// THIS IS EXECUTED FROM VIDEO THREAD
void SetToken(const u16 token, const bool interrupt)
{
DEBUG_LOG(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", token);
DEBUG_LOG_FMT(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: {:04x})", token);
std::lock_guard<std::mutex> lk(s_token_finish_mutex);
@ -308,7 +308,7 @@ void SetToken(const u16 token, const bool interrupt)
// THIS IS EXECUTED FROM VIDEO THREAD (BPStructs.cpp) when a new frame has been drawn
void SetFinish()
{
DEBUG_LOG(PIXELENGINE, "VIDEO Set Finish");
DEBUG_LOG_FMT(PIXELENGINE, "VIDEO Set Finish");
std::lock_guard<std::mutex> lk(s_token_finish_mutex);

View File

@ -1521,7 +1521,7 @@ static void WriteFog(ShaderCode& out, const pixel_shader_uid_data* uid_data)
else
{
if (uid_data->fog_fsel != 2)
WARN_LOG(VIDEO, "Unknown Fog Type! %08x", uid_data->fog_fsel);
WARN_LOG_FMT(VIDEO, "Unknown Fog Type! {:08x}", uid_data->fog_fsel);
}
out.Write("\tint ifog = iround(fog * 256.0);\n");

View File

@ -200,7 +200,7 @@ void PixelShaderManager::SetTevColor(int index, int component, s32 value)
c[component] = value;
dirty = true;
PRIM_LOG("tev color%d: %d %d %d %d", index, c[0], c[1], c[2], c[3]);
PRIM_LOG("tev color{}: {} {} {} {}", index, c[0], c[1], c[2], c[3]);
}
void PixelShaderManager::SetTevKonstColor(int index, int component, s32 value)
@ -220,7 +220,7 @@ void PixelShaderManager::SetTevKonstColor(int index, int component, s32 value)
constants.konst[index + 16 + component * 4][2] = value;
constants.konst[index + 16 + component * 4][3] = value;
PRIM_LOG("tev konst color%d: %d %d %d %d", index, c[0], c[1], c[2], c[3]);
PRIM_LOG("tev konst color{}: {} {} {} {}", index, c[0], c[1], c[2], c[3]);
}
void PixelShaderManager::SetTevOrder(int index, u32 order)
@ -352,7 +352,7 @@ void PixelShaderManager::SetIndMatrixChanged(int matrixidx)
constants.indtexmtx[2 * matrixidx + 1][3] = 17 - scale;
dirty = true;
PRIM_LOG("indmtx%d: scale=%d, mat=(%d %d %d; %d %d %d)", matrixidx, scale,
PRIM_LOG("indmtx{}: scale={}, mat=({} {} {}; {} {} {})", matrixidx, scale,
bpmem.indmtx[matrixidx].col0.ma, bpmem.indmtx[matrixidx].col1.mc,
bpmem.indmtx[matrixidx].col2.me, bpmem.indmtx[matrixidx].col0.mb,
bpmem.indmtx[matrixidx].col1.md, bpmem.indmtx[matrixidx].col2.mf);

View File

@ -72,7 +72,7 @@ void PostProcessingConfiguration::LoadShader(const std::string& shader)
if (!File::ReadFileToString(path, code))
{
ERROR_LOG(VIDEO, "Post-processing shader not found: %s", path.c_str());
ERROR_LOG_FMT(VIDEO, "Post-processing shader not found: {}", path);
LoadDefaultShader();
return;
}
@ -640,7 +640,7 @@ bool PostProcessing::CompileVertexShader()
m_vertex_shader = g_renderer->CreateShaderFromSource(ShaderStage::Vertex, ss.str());
if (!m_vertex_shader)
{
PanicAlert("Failed to compile post-processing vertex shader");
PanicAlertFmt("Failed to compile post-processing vertex shader");
return false;
}
@ -729,7 +729,7 @@ bool PostProcessing::CompilePixelShader()
ShaderStage::Pixel, GetHeader() + m_config.GetShaderCode() + GetFooter());
if (!m_pixel_shader)
{
PanicAlert("Failed to compile post-processing shader %s", m_config.GetShader().c_str());
PanicAlertFmt("Failed to compile post-processing shader {}", m_config.GetShader());
// Use default shader.
m_config.LoadDefaultShader();

View File

@ -900,7 +900,7 @@ bool Renderer::InitializeImGui()
{
if (!ImGui::CreateContext())
{
PanicAlert("Creating ImGui context failed");
PanicAlertFmt("Creating ImGui context failed");
return false;
}
@ -919,7 +919,7 @@ bool Renderer::InitializeImGui()
m_imgui_vertex_format = CreateNativeVertexFormat(vdecl);
if (!m_imgui_vertex_format)
{
PanicAlert("Failed to create imgui vertex format");
PanicAlertFmt("Failed to create imgui vertex format");
return false;
}
@ -935,7 +935,7 @@ bool Renderer::InitializeImGui()
std::unique_ptr<AbstractTexture> font_tex = CreateTexture(font_tex_config);
if (!font_tex)
{
PanicAlert("Failed to create imgui texture");
PanicAlertFmt("Failed to create imgui texture");
return false;
}
font_tex->Load(0, font_tex_width, font_tex_height, font_tex_width, font_tex_pixels,
@ -962,7 +962,7 @@ bool Renderer::RecompileImGuiPipeline()
CreateShaderFromSource(ShaderStage::Pixel, FramebufferShaderGen::GenerateImGuiPixelShader());
if (!vertex_shader || !pixel_shader)
{
PanicAlert("Failed to compile imgui shaders");
PanicAlertFmt("Failed to compile imgui shaders");
return false;
}
@ -974,7 +974,7 @@ bool Renderer::RecompileImGuiPipeline()
ShaderStage::Geometry, FramebufferShaderGen::GeneratePassthroughGeometryShader(1, 1));
if (!geometry_shader)
{
PanicAlert("Failed to compile imgui geometry shader");
PanicAlertFmt("Failed to compile imgui geometry shader");
return false;
}
}
@ -1000,7 +1000,7 @@ bool Renderer::RecompileImGuiPipeline()
m_imgui_pipeline = CreatePipeline(pconfig);
if (!m_imgui_pipeline)
{
PanicAlert("Failed to create imgui pipeline");
PanicAlertFmt("Failed to create imgui pipeline");
return false;
}
@ -1436,7 +1436,7 @@ bool Renderer::CheckFrameDumpRenderTexture(u32 target_width, u32 target_height)
AbstractTextureFormat::RGBA8, AbstractTextureFlag_RenderTarget));
if (!m_frame_dump_render_texture)
{
PanicAlert("Failed to allocate frame dump render texture");
PanicAlertFmt("Failed to allocate frame dump render texture");
return false;
}
m_frame_dump_render_framebuffer = CreateFramebuffer(m_frame_dump_render_texture.get(), nullptr);
@ -1480,7 +1480,7 @@ void Renderer::FlushFrameDump()
}
else
{
ERROR_LOG(VIDEO, "Failed to map texture for dumping.");
ERROR_LOG_FMT(VIDEO, "Failed to map texture for dumping.");
}
m_frame_dump_needs_flush = false;
@ -1552,7 +1552,7 @@ void Renderer::FrameDumpThreadFunc()
#if !defined(HAVE_FFMPEG)
if (dump_to_ffmpeg)
{
WARN_LOG(VIDEO, "FrameDump: Dolphin was not compiled with FFmpeg, using fallback option. "
WARN_LOG_FMT(VIDEO, "FrameDump: Dolphin was not compiled with FFmpeg, using fallback option. "
"Frames will be saved as PNG images instead.");
dump_to_ffmpeg = false;
}
@ -1666,7 +1666,7 @@ bool Renderer::StartFrameDumpToImage(const FrameDump::FrameData&)
std::string filename = GetFrameDumpNextImageFileName();
if (File::Exists(filename))
{
if (!AskYesNoT("Frame dump image(s) '%s' already exists. Overwrite?", filename.c_str()))
if (!AskYesNoFmtT("Frame dump image(s) '{}' already exists. Overwrite?", filename))
return false;
}
}

View File

@ -76,7 +76,7 @@ void ShaderCache::Reload()
ClearCaches();
if (!CompileSharedPipelines())
PanicAlert("Failed to compile shared pipelines after reload.");
PanicAlertFmt("Failed to compile shared pipelines after reload.");
if (g_ActiveConfig.bShaderCache)
LoadCaches();
@ -249,7 +249,7 @@ void ShaderCache::LoadShaderCache(T& cache, APIType api_type, const char* type,
std::string filename = GetDiskShaderCacheFileName(api_type, type, include_gameid, true);
CacheReader reader(cache);
u32 count = cache.disk_cache.OpenAndRead(filename, reader);
INFO_LOG(VIDEO, "Loaded %u cached shaders from %s", count, filename.c_str());
INFO_LOG_FMT(VIDEO, "Loaded {} cached shaders from {}", count, filename);
}
template <typename T>
@ -303,8 +303,8 @@ void ShaderCache::LoadPipelineCache(T& cache, LinearDiskCache<DiskKeyType, u8>&
std::string filename = GetDiskShaderCacheFileName(api_type, type, include_gameid, true);
CacheReader reader(this, cache);
u32 count = disk_cache.OpenAndRead(filename, reader);
INFO_LOG(VIDEO, "Loaded %u cached pipelines from %s", count, filename.c_str());
const u32 count = disk_cache.OpenAndRead(filename, reader);
INFO_LOG_FMT(VIDEO, "Loaded {} cached pipelines from {}", count, filename);
// If any of the pipelines in the cache failed to create, it's likely because of a change of
// driver version, or system configuration. In this case, when the UID cache picks up the pipeline
@ -312,8 +312,8 @@ void ShaderCache::LoadPipelineCache(T& cache, LinearDiskCache<DiskKeyType, u8>&
// the old cache data around, so discard and recreate the disk cache.
if (reader.AnyFailed())
{
WARN_LOG(VIDEO, "Failed to load one or more pipelines from cache '%s'. Discarding.",
filename.c_str());
WARN_LOG_FMT(VIDEO, "Failed to load one or more pipelines from cache '{}'. Discarding.",
filename);
disk_cache.Close();
File::Delete(filename);
disk_cache.OpenAndRead(filename, reader);
@ -586,7 +586,8 @@ AbstractPipelineConfig ShaderCache::GetGXPipelineConfig(
if (config.blending_state.logicopenable && !g_ActiveConfig.backend_info.bSupportsLogicOp)
{
WARN_LOG(VIDEO, "Approximating logic op with blending, this will produce incorrect rendering.");
WARN_LOG_FMT(VIDEO,
"Approximating logic op with blending, this will produce incorrect rendering.");
config.blending_state.ApproximateLogicOpWithBlending();
}
@ -791,8 +792,7 @@ void ShaderCache::LoadPipelineUIDCache()
}
}
INFO_LOG(VIDEO, "Read %u pipeline UIDs from %s",
static_cast<unsigned>(m_gx_pipeline_cache.size()), filename.c_str());
INFO_LOG_FMT(VIDEO, "Read {} pipeline UIDs from {}", m_gx_pipeline_cache.size(), filename);
}
void ShaderCache::ClosePipelineUIDCache()
@ -824,7 +824,7 @@ void ShaderCache::AppendGXPipelineUID(const GXPipelineUid& config)
SerializePipelineUid(config, disk_uid);
if (!m_gx_pipeline_uid_cache_file.WriteBytes(&disk_uid, sizeof(disk_uid)))
{
WARN_LOG(VIDEO, "Writing pipeline UID to cache failed, closing file.");
WARN_LOG_FMT(VIDEO, "Writing pipeline UID to cache failed, closing file.");
m_gx_pipeline_uid_cache_file.Close();
}
}

View File

@ -114,7 +114,7 @@ bool TextureCacheBase::Initialize()
{
if (!CreateUtilityTextures())
{
PanicAlert("Failed to create utility textures.");
PanicAlertFmt("Failed to create utility textures.");
return false;
}
@ -268,7 +268,7 @@ TextureCacheBase::ApplyPaletteToEntry(TCacheEntry* entry, u8* palette, TLUTForma
const AbstractPipeline* pipeline = g_shader_cache->GetPaletteConversionPipeline(tlutfmt);
if (!pipeline)
{
ERROR_LOG(VIDEO, "Failed to get conversion pipeline for format 0x%02X",
ERROR_LOG_FMT(VIDEO, "Failed to get conversion pipeline for format {:#04X}",
static_cast<u32>(tlutfmt));
return nullptr;
}
@ -321,7 +321,7 @@ TextureCacheBase::ApplyPaletteToEntry(TCacheEntry* entry, u8* palette, TLUTForma
}
else
{
ERROR_LOG(VIDEO, "Texel buffer upload of %u bytes failed", palette_size);
ERROR_LOG_FMT(VIDEO, "Texel buffer upload of {} bytes failed", palette_size);
g_renderer->EndUtilityDrawing();
}
@ -337,8 +337,8 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::ReinterpretEntry(const TCacheEn
g_shader_cache->GetTextureReinterpretPipeline(existing_entry->format.texfmt, new_format);
if (!pipeline)
{
ERROR_LOG(VIDEO,
"Failed to obtain texture reinterpreting pipeline from format 0x%02X to 0x%02X",
ERROR_LOG_FMT(VIDEO,
"Failed to obtain texture reinterpreting pipeline from format {:#04X} to {:#04X}",
static_cast<u32>(existing_entry->format.texfmt), static_cast<u32>(new_format));
return nullptr;
}
@ -388,7 +388,7 @@ void TextureCacheBase::ScaleTextureCacheEntryTo(TextureCacheBase::TCacheEntry* e
const u32 max = g_ActiveConfig.backend_info.MaxTextureSize;
if (max < new_width || max < new_height)
{
ERROR_LOG(VIDEO, "Texture too big, width = %d, height = %d", new_width, new_height);
ERROR_LOG_FMT(VIDEO, "Texture too big, width = {}, height = {}", new_width, new_height);
return;
}
@ -397,7 +397,7 @@ void TextureCacheBase::ScaleTextureCacheEntryTo(TextureCacheBase::TCacheEntry* e
std::optional<TexPoolEntry> new_texture = AllocateTexture(newconfig);
if (!new_texture)
{
ERROR_LOG(VIDEO, "Scaling failed due to texture allocation failure");
ERROR_LOG_FMT(VIDEO, "Scaling failed due to texture allocation failure");
return;
}
@ -465,7 +465,7 @@ void TextureCacheBase::SerializeTexture(AbstractTexture* tex, const TextureConfi
}
else
{
PanicAlert("Failed to create staging texture for serialization");
PanicAlertFmt("Failed to create staging texture for serialization");
}
p.Do(texture_data);
@ -485,7 +485,7 @@ std::optional<TextureCacheBase::TexPoolEntry> TextureCacheBase::DeserializeTextu
auto tex = AllocateTexture(config);
if (!tex)
{
PanicAlert("Failed to create texture for deserialization");
PanicAlertFmt("Failed to create texture for deserialization");
return std::nullopt;
}
@ -494,13 +494,13 @@ std::optional<TextureCacheBase::TexPoolEntry> TextureCacheBase::DeserializeTextu
{
for (u32 level = 0; level < config.levels; level++)
{
u32 level_width = std::max(config.width >> level, 1u);
u32 level_height = std::max(config.height >> level, 1u);
size_t stride = AbstractTexture::CalculateStrideForFormat(config.format, level_width);
size_t size = stride * level_height;
const u32 level_width = std::max(config.width >> level, 1u);
const u32 level_height = std::max(config.height >> level, 1u);
const size_t stride = AbstractTexture::CalculateStrideForFormat(config.format, level_width);
const size_t size = stride * level_height;
if ((start + size) > texture_data.size())
{
ERROR_LOG(VIDEO, "Insufficient texture data for layer %u level %u", layer, level);
ERROR_LOG_FMT(VIDEO, "Insufficient texture data for layer {} level {}", layer, level);
return tex;
}
@ -1273,7 +1273,7 @@ TextureCacheBase::GetTexture(u32 address, u32 width, u32 height, const TextureFo
if (!src_data)
{
ERROR_LOG(VIDEO, "Trying to use an invalid texture address 0x%8x", address);
ERROR_LOG_FMT(VIDEO, "Trying to use an invalid texture address {:#010x}", address);
return nullptr;
}
@ -1718,7 +1718,7 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
const u8* src_data = Memory::GetPointer(address);
if (!src_data)
{
ERROR_LOG(VIDEO, "Trying to load XFB texture from invalid address 0x%8x", address);
ERROR_LOG_FMT(VIDEO, "Trying to load XFB texture from invalid address {:#010x}", address);
return nullptr;
}
@ -2087,7 +2087,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
u8* dst = Memory::GetPointer(dstAddr);
if (dst == nullptr)
{
ERROR_LOG(VIDEO, "Trying to copy from EFB to invalid address 0x%8x", dstAddr);
ERROR_LOG_FMT(VIDEO, "Trying to copy from EFB to invalid address {:#010x}", dstAddr);
return;
}
@ -2145,7 +2145,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
// To avoid a "incorrect" result, we simply skip doing the copy_to_vram code path
// so if the game does try to use the scrambled texture, dolphin will grab the scrambled
// texture (or black if copy_to_ram is also disabled) out of ram.
ERROR_LOG(VIDEO, "Memory stride too small (%i < %i)", dstStride, bytes_per_row);
ERROR_LOG_FMT(VIDEO, "Memory stride too small ({} < {})", dstStride, bytes_per_row);
copy_to_vram = false;
}
@ -2408,7 +2408,7 @@ std::unique_ptr<AbstractStagingTexture> TextureCacheBase::GetEFBCopyStagingTextu
std::unique_ptr<AbstractStagingTexture> tex = g_renderer->CreateStagingTexture(
StagingTextureType::Readback, m_efb_encoding_texture->GetConfig());
if (!tex)
WARN_LOG(VIDEO, "Failed to create EFB copy staging texture");
WARN_LOG_FMT(VIDEO, "Failed to create EFB copy staging texture");
return tex;
}
@ -2487,7 +2487,7 @@ TextureCacheBase::AllocateTexture(const TextureConfig& config)
std::unique_ptr<AbstractTexture> texture = g_renderer->CreateTexture(config);
if (!texture)
{
WARN_LOG(VIDEO, "Failed to allocate a %ux%ux%u texture", config.width, config.height,
WARN_LOG_FMT(VIDEO, "Failed to allocate a {}x{}x{} texture", config.width, config.height,
config.layers);
return {};
}
@ -2498,7 +2498,7 @@ TextureCacheBase::AllocateTexture(const TextureConfig& config)
framebuffer = g_renderer->CreateFramebuffer(texture.get(), nullptr);
if (!framebuffer)
{
WARN_LOG(VIDEO, "Failed to allocate a %ux%ux%u framebuffer", config.width, config.height,
WARN_LOG_FMT(VIDEO, "Failed to allocate a {}x{}x{} framebuffer", config.width, config.height,
config.layers);
return {};
}
@ -2660,7 +2660,7 @@ void TextureCacheBase::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_cop
NeedsCopyFilterInShader(filter_coefficients)));
if (!copy_pipeline)
{
WARN_LOG(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
WARN_LOG_FMT(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
return;
}
@ -2728,7 +2728,7 @@ void TextureCacheBase::CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams&
const AbstractPipeline* copy_pipeline = g_shader_cache->GetEFBCopyToRAMPipeline(params);
if (!copy_pipeline)
{
WARN_LOG(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
WARN_LOG_FMT(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
return;
}

View File

@ -49,7 +49,8 @@ u16 GetEncodedSampleCount(EFBCopyFormat format)
case EFBCopyFormat::XFB:
return 2;
default:
PanicAlert("Invalid EFB Copy Format (0x%X)! (GetEncodedSampleCount)", static_cast<int>(format));
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GetEncodedSampleCount)",
static_cast<int>(format));
return 1;
}
}
@ -839,7 +840,7 @@ std::string GenerateEncodingShader(const EFBCopyParams& params, APIType api_type
WriteXFBEncoder(code, api_type, params);
break;
default:
PanicAlert("Invalid EFB Copy Format (0x%X)! (GenerateEncodingShader)",
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GenerateEncodingShader)",
static_cast<int>(params.copy_format));
break;
}
@ -1487,7 +1488,7 @@ float4 DecodePixel(int val)
break;
default:
PanicAlert("Unknown format");
PanicAlertFmt("Unknown format");
break;
}

View File

@ -209,7 +209,8 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
break;
default:
ERROR_LOG(VIDEO, "Unknown copy zbuf format: 0x%X", static_cast<int>(uid_data->dst_format));
ERROR_LOG_FMT(VIDEO, "Unknown copy zbuf format: {:#X}",
static_cast<int>(uid_data->dst_format));
out.Write(" ocol0 = float4(texcol.bgr, 0.0);\n");
break;
}
@ -239,7 +240,7 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
break;
default:
ERROR_LOG(VIDEO, "Unknown copy intensity format: 0x%X",
ERROR_LOG_FMT(VIDEO, "Unknown copy intensity format: {:#X}",
static_cast<int>(uid_data->dst_format));
out.Write(" ocol0 = texcol;\n");
break;
@ -315,7 +316,8 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
break;
default:
ERROR_LOG(VIDEO, "Unknown copy color format: 0x%X", static_cast<int>(uid_data->dst_format));
ERROR_LOG_FMT(VIDEO, "Unknown copy color format: {:#X}",
static_cast<int>(uid_data->dst_format));
out.Write(" ocol0 = texcol;\n");
break;
}

View File

@ -51,7 +51,8 @@ int TexDecoder_GetTexelSizeInNibbles(TextureFormat format)
case TextureFormat::XFB:
return 4;
default:
PanicAlert("Invalid Texture Format (0x%X)! (GetTexelSizeInNibbles)", static_cast<int>(format));
PanicAlertFmt("Invalid Texture Format ({:#X})! (GetTexelSizeInNibbles)",
static_cast<int>(format));
return 1;
}
}
@ -90,7 +91,8 @@ int TexDecoder_GetBlockWidthInTexels(TextureFormat format)
case TextureFormat::XFB:
return 16;
default:
PanicAlert("Invalid Texture Format (0x%X)! (GetBlockWidthInTexels)", static_cast<int>(format));
PanicAlertFmt("Invalid Texture Format ({:#X})! (GetBlockWidthInTexels)",
static_cast<int>(format));
return 8;
}
}
@ -124,7 +126,8 @@ int TexDecoder_GetBlockHeightInTexels(TextureFormat format)
case TextureFormat::XFB:
return 1;
default:
PanicAlert("Invalid Texture Format (0x%X)! (GetBlockHeightInTexels)", static_cast<int>(format));
PanicAlertFmt("Invalid Texture Format ({:#X})! (GetBlockHeightInTexels)",
static_cast<int>(format));
return 4;
}
}
@ -158,7 +161,7 @@ int TexDecoder_GetEFBCopyBlockWidthInTexels(EFBCopyFormat format)
case EFBCopyFormat::XFB:
return 16;
default:
PanicAlert("Invalid EFB Copy Format (0x%X)! (GetEFBCopyBlockWidthInTexels)",
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GetEFBCopyBlockWidthInTexels)",
static_cast<int>(format));
return 8;
}
@ -193,7 +196,7 @@ int TexDecoder_GetEFBCopyBlockHeightInTexels(EFBCopyFormat format)
case EFBCopyFormat::XFB:
return 1;
default:
PanicAlert("Invalid EFB Copy Format (0x%X)! (GetEFBCopyBlockHeightInTexels)",
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GetEFBCopyBlockHeightInTexels)",
static_cast<int>(format));
return 4;
}
@ -245,7 +248,8 @@ TextureFormat TexDecoder_GetEFBCopyBaseFormat(EFBCopyFormat format)
case EFBCopyFormat::XFB:
return TextureFormat::XFB;
default:
PanicAlert("Invalid EFB Copy Format (0x%X)! (GetEFBCopyBaseFormat)", static_cast<int>(format));
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GetEFBCopyBaseFormat)",
static_cast<int>(format));
return static_cast<TextureFormat>(format);
}
}

View File

@ -1491,7 +1491,7 @@ void _TexDecoder_DecodeImpl(u32* dst, const u8* src, int width, int height, Text
break;
default:
PanicAlert("Invalid Texture Format (0x%X)! (_TexDecoder_DecodeImpl)",
PanicAlertFmt("Invalid Texture Format ({:#X})! (_TexDecoder_DecodeImpl)",
static_cast<int>(texformat));
break;
}

View File

@ -25,14 +25,14 @@ static void PosMtx_ReadDirect_UByte(VertexLoader* loader)
if (loader->m_counter < 3)
VertexLoaderManager::position_matrix_index[loader->m_counter + 1] = posmtx;
DataWrite<u32>(posmtx);
PRIM_LOG("posmtx: %d, ", posmtx);
PRIM_LOG("posmtx: {}, ", posmtx);
}
static void TexMtx_ReadDirect_UByte(VertexLoader* loader)
{
loader->m_curtexmtx[loader->m_texmtxread] = DataRead<u8>() & 0x3f;
PRIM_LOG("texmtx%d: %d, ", loader->m_texmtxread, loader->m_curtexmtx[loader->m_texmtxread]);
PRIM_LOG("texmtx{}: {}, ", loader->m_texmtxread, loader->m_curtexmtx[loader->m_texmtxread]);
loader->m_texmtxread++;
}
@ -184,8 +184,8 @@ void VertexLoader::CompileVertexTranslator()
if (pFunc == nullptr)
{
PanicAlert("VertexLoader_Normal::GetFunction(%i %i %i %i) returned zero!",
(u32)m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements,
PanicAlertFmt("VertexLoader_Normal::GetFunction({} {} {} {}) returned zero!",
m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements,
m_VtxAttr.NormalIndex3);
}
WriteCall(pFunc);

View File

@ -168,10 +168,10 @@ public:
}
else
{
ERROR_LOG(VIDEO, "Can't compare vertex loaders that expect different vertex formats!");
ERROR_LOG(VIDEO, "a: m_VertexSize %d, m_native_components 0x%08x, stride %d",
ERROR_LOG_FMT(VIDEO, "Can't compare vertex loaders that expect different vertex formats!");
ERROR_LOG_FMT(VIDEO, "a: m_VertexSize {}, m_native_components {:#010x}, stride {}",
a->m_VertexSize, a->m_native_components, a->m_native_vtx_decl.stride);
ERROR_LOG(VIDEO, "b: m_VertexSize %d, m_native_components 0x%08x, stride %d",
ERROR_LOG_FMT(VIDEO, "b: m_VertexSize {}, m_native_components {:#010x}, stride {}",
b->m_VertexSize, b->m_native_components, b->m_native_vtx_decl.stride);
}
}
@ -188,16 +188,21 @@ public:
b->RunVertices(src, DataReader(buffer_b.data(), buffer_b.data() + buffer_b.size()), count);
if (count_a != count_b)
ERROR_LOG(VIDEO,
"The two vertex loaders have loaded a different amount of vertices (a: %d, b: %d).",
{
ERROR_LOG_FMT(
VIDEO,
"The two vertex loaders have loaded a different amount of vertices (a: {}, b: {}).",
count_a, count_b);
}
if (memcmp(buffer_a.data(), buffer_b.data(),
std::min(count_a, count_b) * m_native_vtx_decl.stride))
ERROR_LOG(VIDEO,
{
ERROR_LOG_FMT(VIDEO,
"The two vertex loaders have loaded different data "
"(guru meditation 0x%016" PRIx64 ", 0x%08x, 0x%08x, 0x%08x).",
"(guru meditation {:#018x}, {:#010x}, {:#010x}, {:#010x}).",
m_VtxDesc.Hex, m_vat.g0.Hex, m_vat.g1.Hex, m_vat.g2.Hex);
}
memcpy(dst.GetPointer(), buffer_a.data(), count_a * m_native_vtx_decl.stride);
m_numLoadedVertices += count;
@ -246,6 +251,6 @@ std::unique_ptr<VertexLoaderBase> VertexLoaderBase::CreateVertexLoader(const TVt
if (loader->IsInitialized())
return loader;
PanicAlert("No Vertex Loader found.");
PanicAlertFmt("No Vertex Loader found.");
return nullptr;
}

View File

@ -15,7 +15,7 @@
#include "VideoCommon/VertexLoaderUtils.h"
// warning: mapping buffer should be disabled to use this
#define LOG_NORM() // PRIM_LOG("norm: %f %f %f, ", ((float*)g_vertex_manager_write_ptr)[-3],
#define LOG_NORM() // PRIM_LOG("norm: {} {} {}, ", ((float*)g_vertex_manager_write_ptr)[-3],
// ((float*)g_vertex_manager_write_ptr)[-2],
// ((float*)g_vertex_manager_write_ptr)[-1]);

View File

@ -144,14 +144,20 @@ DataReader VertexManagerBase::PrepareForAdditionalData(int primitive, u32 count,
Flush();
if (count > m_index_generator.GetRemainingIndices())
ERROR_LOG(VIDEO, "Too little remaining index values. Use 32-bit or reset them on flush.");
{
ERROR_LOG_FMT(VIDEO, "Too little remaining index values. Use 32-bit or reset them on flush.");
}
if (count > GetRemainingIndices(primitive))
ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all indices! "
{
ERROR_LOG_FMT(VIDEO, "VertexManager: Buffer not large enough for all indices! "
"Increase MAXIBUFFERSIZE or we need primitive breaking after all.");
}
if (needed_vertex_bytes > GetRemainingSize())
ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all vertices! "
{
ERROR_LOG_FMT(VIDEO, "VertexManager: Buffer not large enough for all vertices! "
"Increase MAXVBUFFERSIZE or we need primitive breaking after all.");
}
}
m_cull_all = cullall;
@ -358,11 +364,12 @@ void VertexManagerBase::Flush()
if (xfmem.numTexGen.numTexGens != bpmem.genMode.numtexgens ||
xfmem.numChan.numColorChans != bpmem.genMode.numcolchans)
{
ERROR_LOG(VIDEO,
"Mismatched configuration between XF and BP stages - %u/%u texgens, %u/%u colors. "
ERROR_LOG_FMT(
VIDEO,
"Mismatched configuration between XF and BP stages - {}/{} texgens, {}/{} colors. "
"Skipping draw. Please report on the issue tracker.",
xfmem.numTexGen.numTexGens, bpmem.genMode.numtexgens.Value(),
xfmem.numChan.numColorChans, bpmem.genMode.numcolchans.Value());
xfmem.numTexGen.numTexGens, bpmem.genMode.numtexgens.Value(), xfmem.numChan.numColorChans,
bpmem.genMode.numcolchans.Value());
// Analytics reporting so we can discover which games have this problem, that way when we
// eventually simulate the behavior we have test cases for it.
@ -381,7 +388,7 @@ void VertexManagerBase::Flush()
}
#if defined(_DEBUG) || defined(DEBUGFAST)
PRIM_LOG("frame%d:\n texgen=%u, numchan=%u, dualtex=%u, ztex=%u, cole=%u, alpe=%u, ze=%u",
PRIM_LOG("frame{}:\n texgen={}, numchan={}, dualtex={}, ztex={}, cole={}, alpe={}, ze={}",
g_ActiveConfig.iSaveTargetId, xfmem.numTexGen.numTexGens, xfmem.numChan.numColorChans,
xfmem.dualTexTrans.enabled, bpmem.ztex2.op.Value(), bpmem.blendmode.colorupdate.Value(),
bpmem.blendmode.alphaupdate.Value(), bpmem.zmode.updateenable.Value());
@ -389,11 +396,11 @@ void VertexManagerBase::Flush()
for (u32 i = 0; i < xfmem.numChan.numColorChans; ++i)
{
LitChannel* ch = &xfmem.color[i];
PRIM_LOG("colchan%u: matsrc=%u, light=0x%x, ambsrc=%u, diffunc=%u, attfunc=%u", i,
PRIM_LOG("colchan{}: matsrc={}, light={:#x}, ambsrc={}, diffunc={}, attfunc={}", i,
ch->matsource.Value(), ch->GetFullLightMask(), ch->ambsource.Value(),
ch->diffusefunc.Value(), ch->attnfunc.Value());
ch = &xfmem.alpha[i];
PRIM_LOG("alpchan%u: matsrc=%u, light=0x%x, ambsrc=%u, diffunc=%u, attfunc=%u", i,
PRIM_LOG("alpchan{}: matsrc={}, light={:#x}, ambsrc={}, diffunc={}, attfunc={}", i,
ch->matsource.Value(), ch->GetFullLightMask(), ch->ambsource.Value(),
ch->diffusefunc.Value(), ch->attnfunc.Value());
}
@ -406,15 +413,15 @@ void VertexManagerBase::Flush()
if (tinfo.texgentype != XF_TEXGEN_REGULAR)
tinfo.projection = 0;
PRIM_LOG("txgen%u: proj=%u, input=%u, gentype=%u, srcrow=%u, embsrc=%u, emblght=%u, "
"postmtx=%u, postnorm=%u",
PRIM_LOG("txgen{}: proj={}, input={}, gentype={}, srcrow={}, embsrc={}, emblght={}, "
"postmtx={}, postnorm={}",
i, tinfo.projection.Value(), tinfo.inputform.Value(), tinfo.texgentype.Value(),
tinfo.sourcerow.Value(), tinfo.embosssourceshift.Value(),
tinfo.embosslightshift.Value(), xfmem.postMtxInfo[i].index.Value(),
xfmem.postMtxInfo[i].normalize.Value());
}
PRIM_LOG("pixel: tev=%u, ind=%u, texgen=%u, dstalpha=%u, alphatest=0x%x",
PRIM_LOG("pixel: tev={}, ind={}, texgen={}, dstalpha={}, alphatest={:#x}",
bpmem.genMode.numtevstages.Value() + 1, bpmem.genMode.numindstages.Value(),
bpmem.genMode.numtexgens.Value(), bpmem.dstalpha.enable.Value(),
(bpmem.alpha_test.hex >> 16) & 0xff);
@ -502,8 +509,8 @@ void VertexManagerBase::Flush()
if (xfmem.numTexGen.numTexGens != bpmem.genMode.numtexgens)
{
ERROR_LOG(VIDEO,
"xf.numtexgens (%d) does not match bp.numtexgens (%d). Error in command stream.",
ERROR_LOG_FMT(VIDEO,
"xf.numtexgens ({}) does not match bp.numtexgens ({}). Error in command stream.",
xfmem.numTexGen.numTexGens, bpmem.genMode.numtexgens.Value());
}
}
@ -813,12 +820,12 @@ void VertexManagerBase::OnEndFrame()
{
std::ostringstream ss;
std::for_each(m_cpu_accesses_this_frame.begin(), m_cpu_accesses_this_frame.end(), [&ss](u32 idx) { ss << idx << ","; });
WARN_LOG(VIDEO, "CPU EFB accesses in last frame: %s", ss.str().c_str());
WARN_LOG_FMT(VIDEO, "CPU EFB accesses in last frame: {}", ss.str());
}
{
std::ostringstream ss;
std::for_each(m_scheduled_command_buffer_kicks.begin(), m_scheduled_command_buffer_kicks.end(), [&ss](u32 idx) { ss << idx << ","; });
WARN_LOG(VIDEO, "Scheduled command buffer kicks: %s", ss.str().c_str());
WARN_LOG_FMT(VIDEO, "Scheduled command buffer kicks: {}", ss.str());
}
#endif

View File

@ -412,10 +412,10 @@ void VertexShaderManager::SetConstants()
break;
default:
ERROR_LOG(VIDEO, "Unknown projection type: %d", xfmem.projection.type);
ERROR_LOG_FMT(VIDEO, "Unknown projection type: {}", xfmem.projection.type);
}
PRIM_LOG("Projection: %f %f %f %f %f %f", rawProjection[0], rawProjection[1], rawProjection[2],
PRIM_LOG("Projection: {} {} {} {} {} {}", rawProjection[0], rawProjection[1], rawProjection[2],
rawProjection[3], rawProjection[4], rawProjection[5]);
auto corrected_matrix = s_viewportCorrection * Common::Matrix44::FromArray(g_fProjectionMatrix);

View File

@ -10,7 +10,7 @@
#include <string>
#include <vector>
#include "fmt/format.h"
#include <fmt/format.h>
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
@ -163,7 +163,8 @@ u16 VideoBackendBase::Video_GetBoundingBox(int index)
static bool warn_once = true;
if (warn_once)
{
ERROR_LOG(VIDEO, "BBox shall be used but it is disabled. Please use a gameini to enable it "
ERROR_LOG_FMT(VIDEO,
"BBox shall be used but it is disabled. Please use a gameini to enable it "
"for this game.");
}
warn_once = false;
@ -175,7 +176,8 @@ u16 VideoBackendBase::Video_GetBoundingBox(int index)
static bool warn_once = true;
if (warn_once)
{
PanicAlertT("This game requires bounding box emulation to run properly but your graphics "
PanicAlertFmtT(
"This game requires bounding box emulation to run properly but your graphics "
"card or its drivers do not support it. As a result you will experience bugs or "
"freezes while running this game.");
}

View File

@ -20,11 +20,13 @@ constexpr u32 MAX_XFB_WIDTH = 720;
// that are next to each other in memory (TODO: handle that situation).
constexpr u32 MAX_XFB_HEIGHT = 576;
#define PRIM_LOG(...) DEBUG_LOG(VIDEO, ##__VA_ARGS__)
#define PRIM_LOG(...) DEBUG_LOG_FMT(VIDEO, ##__VA_ARGS__)
// warning: mapping buffer should be disabled to use this
// #define LOG_VTX() DEBUG_LOG(VIDEO, "vtx: %f %f %f, ", ((float*)g_vertex_manager_write_ptr)[-3],
// ((float*)g_vertex_manager_write_ptr)[-2], ((float*)g_vertex_manager_write_ptr)[-1]);
// #define LOG_VTX() DEBUG_LOG_FMT(VIDEO, "vtx: {} {} {}, ",
// ((float*)g_vertex_manager_write_ptr)[-3],
// ((float*)g_vertex_manager_write_ptr)[-2],
// ((float*)g_vertex_manager_write_ptr)[-1]);
#define LOG_VTX()

View File

@ -179,7 +179,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
case 0x104d:
case 0x104e:
case 0x104f:
DEBUG_LOG(VIDEO, "Possible Normal Mtx XF reg?: %x=%x", address, newValue);
DEBUG_LOG_FMT(VIDEO, "Possible Normal Mtx XF reg?: {:x}={:x}", address, newValue);
break;
case 0x1013:
@ -190,7 +190,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src)
default:
if (newValue != 0) // Ignore writes of zero.
WARN_LOG(VIDEO, "Unknown XF Reg: %x=%x", address, newValue);
WARN_LOG_FMT(VIDEO, "Unknown XF Reg: {:x}={:x}", address, newValue);
break;
}
@ -207,7 +207,7 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, DataReader src)
// do not allow writes past registers
if (baseAddress + transferSize > 0x1058)
{
WARN_LOG(VIDEO, "XF load exceeds address space: %x %d bytes", baseAddress, transferSize);
WARN_LOG_FMT(VIDEO, "XF load exceeds address space: {:x} {} bytes", baseAddress, transferSize);
if (baseAddress >= 0x1058)
transferSize = 0;