diff --git a/src/common/d3d12/texture.cpp b/src/common/d3d12/texture.cpp index 4ceab364..0eee05a4 100644 --- a/src/common/d3d12/texture.cpp +++ b/src/common/d3d12/texture.cpp @@ -243,14 +243,9 @@ bool Texture::BeginStreamUpdate(u32 x, u32 y, u32 width, u32 height, void** out_ if (!g_d3d12_context->GetTextureStreamBuffer().ReserveMemory(upload_size, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT)) { - Log_PerfPrintf("Executing command buffer while waiting for %u bytes (%ux%u) in upload buffer", upload_size, width, - height); g_d3d12_context->ExecuteCommandList(false); if (!g_d3d12_context->GetTextureStreamBuffer().ReserveMemory(upload_size, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT)) - { - Log_ErrorPrintf("Failed to reserve %u bytes for %ux%u upload", upload_size, width, height); return false; - } } *out_data = g_d3d12_context->GetTextureStreamBuffer().GetCurrentHostPointer(); @@ -392,4 +387,4 @@ bool Texture::CreateDSVDescriptor(ID3D12Resource* resource, DXGI_FORMAT format, return true; } -} // namespace D3D12 \ No newline at end of file +} // namespace D3D12 diff --git a/src/common/jit_code_buffer.cpp b/src/common/jit_code_buffer.cpp index 15a6dc83..c3228af2 100644 --- a/src/common/jit_code_buffer.cpp +++ b/src/common/jit_code_buffer.cpp @@ -309,4 +309,4 @@ void JitCodeBuffer::WriteProtect(bool enabled) pthread_jit_write_protect_np(enabled ? 1 : 0); } -#endif \ No newline at end of file +#endif diff --git a/src/common/log.h b/src/common/log.h index 132b65d3..fe66a1e5 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -56,8 +56,6 @@ void Writev(const char* channelName, const char* functionName, LOGLEVEL level, c #define Log_ErrorPrintf(...) Log::Writef(___LogChannel___, __func__, LOGLEVEL_ERROR, __VA_ARGS__) #define Log_WarningPrint(msg) Log::Write(___LogChannel___, __func__, LOGLEVEL_WARNING, msg) #define Log_WarningPrintf(...) Log::Writef(___LogChannel___, __func__, LOGLEVEL_WARNING, __VA_ARGS__) -#define Log_PerfPrint(msg) Log::Write(___LogChannel___, __func__, LOGLEVEL_PERF, msg) -#define Log_PerfPrintf(...) Log::Writef(___LogChannel___, __func__, LOGLEVEL_PERF, __VA_ARGS__) #define Log_InfoPrint(msg) Log::Write(___LogChannel___, __func__, LOGLEVEL_INFO, msg) #define Log_InfoPrintf(...) Log::Writef(___LogChannel___, __func__, LOGLEVEL_INFO, __VA_ARGS__) #define Log_VerbosePrint(msg) Log::Write(___LogChannel___, __func__, LOGLEVEL_VERBOSE, msg) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 608e925a..e729de51 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -20,8 +20,6 @@ add_library(core cpu_core.cpp cpu_core.h cpu_core_private.h - cpu_disasm.cpp - cpu_disasm.h cpu_types.cpp cpu_types.h digital_controller.cpp diff --git a/src/core/bios.cpp b/src/core/bios.cpp index 4113e22c..7253f99a 100644 --- a/src/core/bios.cpp +++ b/src/core/bios.cpp @@ -3,7 +3,6 @@ #include "common/file_system.h" #include "common/log.h" #include "common/md5_digest.h" -#include "cpu_disasm.h" #include #include Log_SetChannel(BIOS); @@ -160,12 +159,6 @@ void PatchBIOS(u8* image, u32 image_size, u32 address, u32 value, u32 mask /*= U std::memcpy(&existing_value, &image[offset], sizeof(existing_value)); u32 new_value = (existing_value & ~mask) | value; std::memcpy(&image[offset], &new_value, sizeof(new_value)); - - SmallString old_disasm, new_disasm; - CPU::DisassembleInstruction(&old_disasm, address, existing_value); - CPU::DisassembleInstruction(&new_disasm, address, new_value); - Log_DevPrintf("BIOS-Patch 0x%08X (+0x%X): 0x%08X %s -> %08X %s", address, offset, existing_value, - old_disasm.GetCharArray(), new_value, new_disasm.GetCharArray()); } bool PatchBIOSEnableTTY(u8* image, u32 image_size, const Hash& hash) diff --git a/src/core/bus.cpp b/src/core/bus.cpp index 5c4eb889..60630976 100644 --- a/src/core/bus.cpp +++ b/src/core/bus.cpp @@ -8,7 +8,6 @@ #include "cpu_code_cache.h" #include "cpu_core.h" #include "cpu_core_private.h" -#include "cpu_disasm.h" #include "dma.h" #include "gpu.h" #include "host_interface.h" diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index 8218ee41..255deb30 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -4,7 +4,6 @@ #include "common/log.h" #include "cpu_core.h" #include "cpu_core_private.h" -#include "cpu_disasm.h" #include "settings.h" #include "system.h" #include "timing_event.h" @@ -587,9 +586,6 @@ recompile: if (block->recompile_count >= RECOMPILE_COUNT_TO_FALL_BACK_TO_INTERPRETER) { - Log_PerfPrintf("Block 0x%08X has been recompiled %u times in %u frames, falling back to interpreter", - block->GetPC(), block->recompile_count, frame_diff); - FallbackExistingBlockToInterpreter(block); return false; } @@ -605,7 +601,6 @@ recompile: if (!CompileBlock(block)) { - Log_PerfPrintf("Failed to recompile block 0x%08X, falling back to interpreter.", block->GetPC()); FallbackExistingBlockToInterpreter(block); return false; } @@ -717,25 +712,9 @@ bool CompileBlock(CodeBlock* block) } if (!block->instructions.empty()) - { block->instructions.back().is_last_instruction = true; - -#ifdef _DEBUG - SmallString disasm; - Log_DebugPrintf("Block at 0x%08X", block->GetPC()); - for (const CodeBlockInstruction& cbi : block->instructions) - { - CPU::DisassembleInstruction(&disasm, cbi.pc, cbi.instruction.bits); - Log_DebugPrintf("[%s %s 0x%08X] %08X %s", cbi.is_branch_delay_slot ? "BD" : " ", - cbi.is_load_delay_slot ? "LD" : " ", cbi.pc, cbi.instruction.bits, disasm.GetCharArray()); - } -#endif - } else - { - Log_WarningPrintf("Empty block compiled at 0x%08X", block->key.GetPC()); return false; - } #ifdef WITH_RECOMPILER if (g_settings.IsUsingRecompiler()) diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index b82b2cbd..80ec96a8 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -2,10 +2,8 @@ #include "bus.h" #include "common/align.h" #include "common/file_system.h" -#include "common/log.h" #include "common/state_wrapper.h" #include "cpu_core_private.h" -#include "cpu_disasm.h" #include "cpu_recompiler_thunks.h" #include "gte.h" #include "host_interface.h" @@ -14,8 +12,6 @@ #include "system.h" #include "timing_event.h" -Log_SetChannel(CPU::Core); - namespace CPU { static void SetPC(u32 new_pc); @@ -175,18 +171,6 @@ ALWAYS_INLINE_RELEASE static void RaiseException(u32 CAUSE_bits, u32 EPC, u32 ve g_state.cop0_regs.cause.bits = (g_state.cop0_regs.cause.bits & ~Cop0Registers::CAUSE::EXCEPTION_WRITE_MASK) | (CAUSE_bits & Cop0Registers::CAUSE::EXCEPTION_WRITE_MASK); -#ifdef _DEBUG - if (g_state.cop0_regs.cause.Excode != Exception::INT && g_state.cop0_regs.cause.Excode != Exception::Syscall && - g_state.cop0_regs.cause.Excode != Exception::BP) - { - Log_DevPrintf("Exception %u at 0x%08X (epc=0x%08X, BD=%s, CE=%u)", - static_cast(g_state.cop0_regs.cause.Excode.GetValue()), g_state.current_instruction_pc, - g_state.cop0_regs.EPC, g_state.cop0_regs.cause.BD ? "true" : "false", - g_state.cop0_regs.cause.CE.GetValue()); - DisassembleAndPrint(g_state.current_instruction_pc, 4, 0); - } -#endif - if (g_state.cop0_regs.cause.BD) { // TAR is set to the address which was being fetched in this instruction, or the next instruction to execute if the @@ -362,34 +346,29 @@ ALWAYS_INLINE_RELEASE static void WriteCop0Reg(Cop0Reg reg, u32 value) case Cop0Reg::BPC: { g_state.cop0_regs.BPC = value; - Log_DevPrintf("COP0 BPC <- %08X", value); } break; case Cop0Reg::BPCM: { g_state.cop0_regs.BPCM = value; - Log_DevPrintf("COP0 BPCM <- %08X", value); } break; case Cop0Reg::BDA: { g_state.cop0_regs.BDA = value; - Log_DevPrintf("COP0 BDA <- %08X", value); } break; case Cop0Reg::BDAM: { g_state.cop0_regs.BDAM = value; - Log_DevPrintf("COP0 BDAM <- %08X", value); } break; case Cop0Reg::JUMPDEST: { - Log_WarningPrintf("Ignoring write to Cop0 JUMPDEST"); } break; @@ -397,7 +376,6 @@ ALWAYS_INLINE_RELEASE static void WriteCop0Reg(Cop0Reg reg, u32 value) { g_state.cop0_regs.dcic.bits = (g_state.cop0_regs.dcic.bits & ~Cop0Registers::DCIC::WRITE_MASK) | (value & Cop0Registers::DCIC::WRITE_MASK); - Log_DevPrintf("COP0 DCIC <- %08X (now %08X)", value, g_state.cop0_regs.dcic.bits); UpdateDebugDispatcherFlag(); } break; @@ -406,7 +384,6 @@ ALWAYS_INLINE_RELEASE static void WriteCop0Reg(Cop0Reg reg, u32 value) { g_state.cop0_regs.sr.bits = (g_state.cop0_regs.sr.bits & ~Cop0Registers::SR::WRITE_MASK) | (value & Cop0Registers::SR::WRITE_MASK); - Log_DebugPrintf("COP0 SR <- %08X (now %08X)", value, g_state.cop0_regs.sr.bits); CheckForPendingInterrupt(); } break; @@ -415,13 +392,11 @@ ALWAYS_INLINE_RELEASE static void WriteCop0Reg(Cop0Reg reg, u32 value) { g_state.cop0_regs.cause.bits = (g_state.cop0_regs.cause.bits & ~Cop0Registers::CAUSE::WRITE_MASK) | (value & Cop0Registers::CAUSE::WRITE_MASK); - Log_DebugPrintf("COP0 CAUSE <- %08X (now %08X)", value, g_state.cop0_regs.cause.bits); CheckForPendingInterrupt(); } break; default: - Log_DevPrintf("Unknown COP0 reg write %u (%08X)", ZeroExtend32(static_cast(reg)), value); break; } } @@ -439,7 +414,6 @@ ALWAYS_INLINE_RELEASE void Cop0ExecutionBreakpointCheck() if (bpcm == 0 || ((pc ^ bpc) & bpcm) != 0u) return; - Log_DevPrintf("Cop0 execution breakpoint at %08X", pc); g_state.cop0_regs.dcic.status_any_break = true; g_state.cop0_regs.dcic.status_bpc_code_break = true; DispatchCop0Breakpoint(); @@ -465,8 +439,6 @@ ALWAYS_INLINE_RELEASE void Cop0DataBreakpointCheck(VirtualMemoryAddress address) if (bdam == 0 || ((address ^ bda) & bdam) != 0u) return; - Log_DevPrintf("Cop0 data breakpoint for %08X at %08X", address, g_state.current_instruction_pc); - g_state.cop0_regs.dcic.status_any_break = true; g_state.cop0_regs.dcic.status_bda_data_break = true; if constexpr (type == MemoryAccessType::Read) @@ -477,47 +449,6 @@ ALWAYS_INLINE_RELEASE void Cop0DataBreakpointCheck(VirtualMemoryAddress address) DispatchCop0Breakpoint(); } -#ifdef _DEBUG - -static void TracePrintInstruction() -{ - const u32 pc = g_state.current_instruction_pc; - const u32 bits = g_state.current_instruction.bits; - - TinyString instr; - TinyString comment; - DisassembleInstruction(&instr, pc, bits); - DisassembleInstructionComment(&comment, pc, bits, &g_state.regs); - if (!comment.IsEmpty()) - { - for (u32 i = instr.GetLength(); i < 30; i++) - instr.AppendCharacter(' '); - instr.AppendString("; "); - instr.AppendString(comment); - } - - std::printf("%08x: %08x %s\n", pc, bits, instr.GetCharArray()); -} - -#endif - -static void PrintInstruction(u32 bits, u32 pc, Registers* regs, const char* prefix) -{ - TinyString instr; - TinyString comment; - DisassembleInstruction(&instr, pc, bits); - DisassembleInstructionComment(&comment, pc, bits, regs); - if (!comment.IsEmpty()) - { - for (u32 i = instr.GetLength(); i < 30; i++) - instr.AppendCharacter(' '); - instr.AppendString("; "); - instr.AppendString(comment); - } - - Log_DevPrintf("%s%08x: %08x %s", prefix, pc, bits, instr.GetCharArray()); -} - ALWAYS_INLINE static constexpr bool AddOverflow(u32 old_value, u32 add_value, u32 new_value) { return (((new_value ^ old_value) & (new_value ^ add_value)) & UINT32_C(0x80000000)) != 0; @@ -528,49 +459,12 @@ ALWAYS_INLINE static constexpr bool SubOverflow(u32 old_value, u32 sub_value, u3 return (((new_value ^ old_value) & (old_value ^ sub_value)) & UINT32_C(0x80000000)) != 0; } -void DisassembleAndPrint(u32 addr, const char* prefix) -{ - u32 bits = 0; - SafeReadMemoryWord(addr, &bits); - PrintInstruction(bits, addr, &g_state.regs, prefix); -} - -void DisassembleAndPrint(u32 addr, u32 instructions_before /* = 0 */, u32 instructions_after /* = 0 */) -{ - u32 disasm_addr = addr - (instructions_before * sizeof(u32)); - for (u32 i = 0; i < instructions_before; i++) - { - DisassembleAndPrint(disasm_addr, ""); - disasm_addr += sizeof(u32); - } - - // <= to include the instruction itself - for (u32 i = 0; i <= instructions_after; i++) - { - DisassembleAndPrint(disasm_addr, (i == 0) ? "---->" : ""); - disasm_addr += sizeof(u32); - } -} - template ALWAYS_INLINE_RELEASE static void ExecuteInstruction() { restart_instruction: const Instruction inst = g_state.current_instruction; -#if 0 - if (g_state.current_instruction_pc == 0x80030000) - { - TRACE_EXECUTION = true; - __debugbreak(); - } -#endif - -#ifdef _DEBUG - if (TRACE_EXECUTION) - TracePrintInstruction(); -#endif - // Skip nops. Makes PGXP-CPU quicker, but also the regular interpreter. if (inst.bits == 0) return; @@ -1319,7 +1213,6 @@ restart_instruction: { if (InUserMode() && !g_state.cop0_regs.sr.CU0) { - Log_WarningPrintf("Coprocessor 0 not present in user mode"); RaiseException(Exception::CpU); return; } @@ -1349,7 +1242,6 @@ restart_instruction: break; default: - Log_ErrorPrintf("Unhandled instruction at %08X: %08X", g_state.current_instruction_pc, inst.bits); break; } } @@ -1374,7 +1266,6 @@ restart_instruction: break; default: - Log_ErrorPrintf("Unhandled instruction at %08X: %08X", g_state.current_instruction_pc, inst.bits); break; } } @@ -1385,7 +1276,6 @@ restart_instruction: { if (!g_state.cop0_regs.sr.CE2) { - Log_WarningPrintf("Coprocessor 2 not enabled"); RaiseException(Exception::CpU); return; } @@ -1438,7 +1328,6 @@ restart_instruction: break; default: - Log_ErrorPrintf("Unhandled instruction at %08X: %08X", g_state.current_instruction_pc, inst.bits); break; } } @@ -1453,7 +1342,6 @@ restart_instruction: { if (!g_state.cop0_regs.sr.CE2) { - Log_WarningPrintf("Coprocessor 2 not enabled"); RaiseException(Exception::CpU); return; } @@ -1475,7 +1363,6 @@ restart_instruction: { if (!g_state.cop0_regs.sr.CE2) { - Log_WarningPrintf("Coprocessor 2 not enabled"); RaiseException(Exception::CpU); return; } @@ -1511,8 +1398,6 @@ restart_instruction: if (SafeReadInstruction(g_state.current_instruction_pc, &ram_value) && ram_value != g_state.current_instruction.bits) { - Log_ErrorPrintf("Stale icache at 0x%08X - ICache: %08X RAM: %08X", g_state.current_instruction_pc, - g_state.current_instruction.bits, ram_value); g_state.current_instruction.bits = ram_value; goto restart_instruction; } @@ -1554,7 +1439,6 @@ void UpdateDebugDispatcherFlag() if (use_debug_dispatcher == g_state.use_debug_dispatcher) return; - Log_DevPrintf("%s debug dispatcher", use_debug_dispatcher ? "Now using" : "No longer using"); g_state.use_debug_dispatcher = use_debug_dispatcher; ForceDispatcherExit(); } @@ -1605,8 +1489,6 @@ bool AddBreakpoint(VirtualMemoryAddress address, bool auto_clear, bool enabled) if (HasBreakpointAtAddress(address)) return false; - Log_InfoPrintf("Adding breakpoint at %08X, auto clear = %u", address, static_cast(auto_clear)); - Breakpoint bp{address, nullptr, auto_clear ? 0 : s_breakpoint_counter++, 0, auto_clear, enabled}; s_breakpoints.push_back(std::move(bp)); UpdateDebugDispatcherFlag(); @@ -1625,8 +1507,6 @@ bool AddBreakpointWithCallback(VirtualMemoryAddress address, BreakpointCallback if (HasBreakpointAtAddress(address)) return false; - Log_InfoPrintf("Adding breakpoint with callback at %08X", address); - Breakpoint bp{address, callback, 0, 0, false, true}; s_breakpoints.push_back(std::move(bp)); UpdateDebugDispatcherFlag(); diff --git a/src/core/cpu_core.h b/src/core/cpu_core.h index 693e356c..d2d1a949 100644 --- a/src/core/cpu_core.h +++ b/src/core/cpu_core.h @@ -152,10 +152,6 @@ bool SafeWriteMemoryWord(VirtualMemoryAddress addr, u32 value); void SetExternalInterrupt(u8 bit); void ClearExternalInterrupt(u8 bit); -void DisassembleAndPrint(u32 addr); -void DisassembleAndLog(u32 addr); -void DisassembleAndPrint(u32 addr, u32 instructions_before, u32 instructions_after); - // Breakpoint callback - if the callback returns false, the breakpoint will be removed. using BreakpointCallback = bool (*)(VirtualMemoryAddress address); diff --git a/src/core/cpu_disasm.cpp b/src/core/cpu_disasm.cpp deleted file mode 100644 index 6caacc40..00000000 --- a/src/core/cpu_disasm.cpp +++ /dev/null @@ -1,488 +0,0 @@ -#include "cpu_disasm.h" -#include "common/assert.h" -#include "cpu_core.h" -#include - -namespace CPU { - -enum Operand : u8 -{ - Operand_None, - i_rs, - i_rt, - i_imm, - j_target, - r_rs, - r_rt, - r_rd, - r_shamt, - r_funct -}; - -struct TableEntry -{ - const char* format; -}; - -static const std::array s_base_table = {{ - "", // 0 - "UNKNOWN", // 1 - "j $jt", // 2 - "jal $jt", // 3 - "beq $rs, $rt, $rel", // 4 - "bne $rs, $rt, $rel", // 5 - "blez $rs, $rel", // 6 - "bgtz $rs, $rel", // 7 - "addi $rt, $rs, $imm", // 8 - "addiu $rt, $rs, $imm", // 9 - "slti $rt, $rs, $imm", // 10 - "sltiu $rt, $rs, $immu", // 11 - "andi $rt, $rs, $immu", // 12 - "ori $rt, $rs, $immu", // 13 - "xori $rt, $rs, $immu", // 14 - "lui $rt, $imm", // 15 - "UNKNOWN", // 16 - "UNKNOWN", // 17 - "UNKNOWN", // 18 - "UNKNOWN", // 19 - "UNKNOWN", // 20 - "UNKNOWN", // 21 - "UNKNOWN", // 22 - "UNKNOWN", // 23 - "UNKNOWN", // 24 - "UNKNOWN", // 25 - "UNKNOWN", // 26 - "UNKNOWN", // 27 - "UNKNOWN", // 28 - "UNKNOWN", // 29 - "UNKNOWN", // 30 - "UNKNOWN", // 31 - "lb $rt, $offsetrs", // 32 - "lh $rt, $offsetrs", // 33 - "lwl $rt, $offsetrs", // 34 - "lw $rt, $offsetrs", // 35 - "lbu $rt, $offsetrs", // 36 - "lhu $rt, $offsetrs", // 37 - "lwr $rt, $offsetrs", // 38 - "UNKNOWN", // 39 - "sb $rt, $offsetrs", // 40 - "sh $rt, $offsetrs", // 41 - "swl $rt, $offsetrs", // 42 - "sw $rt, $offsetrs", // 43 - "UNKNOWN", // 44 - "UNKNOWN", // 45 - "swr $rt, $offsetrs", // 46 - "UNKNOWN", // 47 - "lwc0 $coprt, $offsetrs", // 48 - "lwc1 $coprt, $offsetrs", // 49 - "lwc2 $coprt, $offsetrs", // 50 - "lwc3 $coprt, $offsetrs", // 51 - "UNKNOWN", // 52 - "UNKNOWN", // 53 - "UNKNOWN", // 54 - "UNKNOWN", // 55 - "swc0 $coprt, $offsetrs", // 56 - "swc1 $coprt, $offsetrs", // 57 - "swc2 $coprt, $offsetrs", // 58 - "swc3 $coprt, $offsetrs", // 59 - "UNKNOWN", // 60 - "UNKNOWN", // 61 - "UNKNOWN", // 62 - "UNKNOWN" // 63 -}}; - -static const std::array s_special_table = {{ - "sll $rd, $rt, $shamt", // 0 - "UNKNOWN", // 1 - "srl $rd, $rt, $shamt", // 2 - "sra $rd, $rt, $shamt", // 3 - "sllv $rd, $rt, $rs", // 4 - "UNKNOWN", // 5 - "srlv $rd, $rt, $rs", // 6 - "srav $rd, $rt, $rs", // 7 - "jr $rs", // 8 - "jalr $rd, $rs", // 9 - "UNKNOWN", // 10 - "UNKNOWN", // 11 - "syscall", // 12 - "break", // 13 - "UNKNOWN", // 14 - "UNKNOWN", // 15 - "mfhi $rd", // 16 - "mthi $rs", // 17 - "mflo $rd", // 18 - "mtlo $rs", // 19 - "UNKNOWN", // 20 - "UNKNOWN", // 21 - "UNKNOWN", // 22 - "UNKNOWN", // 23 - "mult $rs, $rt", // 24 - "multu $rs, $rt", // 25 - "div $rs, $rt", // 26 - "divu $rs, $rt", // 27 - "UNKNOWN", // 28 - "UNKNOWN", // 29 - "UNKNOWN", // 30 - "UNKNOWN", // 31 - "add $rd, $rs, $rt", // 32 - "addu $rd, $rs, $rt", // 33 - "sub $rd, $rs, $rt", // 34 - "subu $rd, $rs, $rt", // 35 - "and $rd, $rs, $rt", // 36 - "or $rd, $rs, $rt", // 37 - "xor $rd, $rs, $rt", // 38 - "nor $rd, $rs, $rt", // 39 - "UNKNOWN", // 40 - "UNKNOWN", // 41 - "slt $rd, $rs, $rt", // 42 - "sltu $rd, $rs, $rt", // 43 - "UNKNOWN", // 44 - "UNKNOWN", // 45 - "UNKNOWN", // 46 - "UNKNOWN", // 47 - "UNKNOWN", // 48 - "UNKNOWN", // 49 - "UNKNOWN", // 50 - "UNKNOWN", // 51 - "UNKNOWN", // 52 - "UNKNOWN", // 53 - "UNKNOWN", // 54 - "UNKNOWN", // 55 - "UNKNOWN", // 56 - "UNKNOWN", // 57 - "UNKNOWN", // 58 - "UNKNOWN", // 59 - "UNKNOWN", // 60 - "UNKNOWN", // 61 - "UNKNOWN", // 62 - "UNKNOWN" // 63 -}}; - -static const std::array, 4> s_cop_common_table = { - {{CopCommonInstruction::mfcn, "mfc$cop $rt, $coprd"}, - {CopCommonInstruction::cfcn, "cfc$cop $rt, $coprd"}, - {CopCommonInstruction::mtcn, "mtc$cop $rt, $coprd"}, - {CopCommonInstruction::ctcn, "ctc$cop $rt, $coprd"}}}; - -static const std::array, 1> s_cop0_table = {{{Cop0Instruction::rfe, "rfe"}}}; - -static void FormatInstruction(String* dest, const Instruction inst, u32 pc, const char* format) -{ - dest->Clear(); - - const char* str = format; - while (*str != '\0') - { - const char ch = *(str++); - if (ch != '$') - { - dest->AppendCharacter(ch); - continue; - } - - if (std::strncmp(str, "rs", 2) == 0) - { - dest->AppendString(GetRegName(inst.r.rs)); - str += 2; - } - else if (std::strncmp(str, "rt", 2) == 0) - { - dest->AppendString(GetRegName(inst.r.rt)); - str += 2; - } - else if (std::strncmp(str, "rd", 2) == 0) - { - dest->AppendString(GetRegName(inst.r.rd)); - str += 2; - } - else if (std::strncmp(str, "shamt", 5) == 0) - { - dest->AppendFormattedString("%d", ZeroExtend32(inst.r.shamt.GetValue())); - str += 5; - } - else if (std::strncmp(str, "immu", 4) == 0) - { - dest->AppendFormattedString("%u", inst.i.imm_zext32()); - str += 4; - } - else if (std::strncmp(str, "imm", 3) == 0) - { - // dest->AppendFormattedString("%d", static_cast(inst.i.imm_sext32())); - dest->AppendFormattedString("%04x", inst.i.imm_zext32()); - str += 3; - } - else if (std::strncmp(str, "rel", 3) == 0) - { - const u32 target = (pc + UINT32_C(4)) + (inst.i.imm_sext32() << 2); - dest->AppendFormattedString("%08x", target); - str += 3; - } - else if (std::strncmp(str, "offsetrs", 8) == 0) - { - const s32 offset = static_cast(inst.i.imm_sext32()); - dest->AppendFormattedString("%d(%s)", offset, GetRegName(inst.i.rs)); - str += 8; - } - else if (std::strncmp(str, "jt", 2) == 0) - { - const u32 target = ((pc + UINT32_C(4)) & UINT32_C(0xF0000000)) | (inst.j.target << 2); - dest->AppendFormattedString("%08x", target); - str += 2; - } - else if (std::strncmp(str, "copcc", 5) == 0) - { - dest->AppendCharacter(((inst.bits & (UINT32_C(1) << 24)) != 0) ? 't' : 'f'); - str += 5; - } - else if (std::strncmp(str, "coprd", 5) == 0) - { - dest->AppendFormattedString("%u", ZeroExtend32(static_cast(inst.r.rd.GetValue()))); - str += 5; - } - else if (std::strncmp(str, "coprt", 5) == 0) - { - dest->AppendFormattedString("%u", ZeroExtend32(static_cast(inst.r.rt.GetValue()))); - str += 5; - } - else if (std::strncmp(str, "cop", 3) == 0) - { - dest->AppendFormattedString("%u", static_cast(inst.op.GetValue()) & INSTRUCTION_COP_N_MASK); - str += 3; - } - else - { - Panic("Unknown operand"); - } - } -} - -static void FormatComment(String* dest, const Instruction inst, u32 pc, Registers* regs, const char* format) -{ - const char* str = format; - while (*str != '\0') - { - const char ch = *(str++); - if (ch != '$') - continue; - - if (std::strncmp(str, "rs", 2) == 0) - { - dest->AppendFormattedString("%s%s=0x%08X", dest->IsEmpty() ? "" : ", ", GetRegName(inst.r.rs), - regs->r[static_cast(inst.r.rs.GetValue())]); - - str += 2; - } - else if (std::strncmp(str, "rt", 2) == 0) - { - dest->AppendFormattedString("%s%s=0x%08X", dest->IsEmpty() ? "" : ", ", GetRegName(inst.r.rt), - regs->r[static_cast(inst.r.rt.GetValue())]); - str += 2; - } - else if (std::strncmp(str, "rd", 2) == 0) - { - dest->AppendFormattedString("%s%s=0x%08X", dest->IsEmpty() ? "" : ", ", GetRegName(inst.r.rd), - regs->r[static_cast(inst.r.rd.GetValue())]); - str += 2; - } - else if (std::strncmp(str, "shamt", 5) == 0) - { - str += 5; - } - else if (std::strncmp(str, "immu", 4) == 0) - { - str += 4; - } - else if (std::strncmp(str, "imm", 3) == 0) - { - str += 3; - } - else if (std::strncmp(str, "rel", 3) == 0) - { - str += 3; - } - else if (std::strncmp(str, "offsetrs", 8) == 0) - { - const s32 offset = static_cast(inst.i.imm_sext32()); - dest->AppendFormattedString("%saddr=0x%08X", dest->IsEmpty() ? "" : ", ", - regs->r[static_cast(inst.i.rs.GetValue())] + offset); - str += 8; - } - else if (std::strncmp(str, "jt", 2) == 0) - { - str += 2; - } - else if (std::strncmp(str, "copcc", 5) == 0) - { - str += 5; - } - else if (std::strncmp(str, "coprd", 5) == 0) - { - str += 5; - } - else if (std::strncmp(str, "coprt", 5) == 0) - { - str += 5; - } - else if (std::strncmp(str, "cop", 3) == 0) - { - str += 3; - } - else - { - Panic("Unknown operand"); - } - } -} - -template -void FormatCopInstruction(String* dest, u32 pc, const Instruction inst, const std::pair* table, - size_t table_size, T table_key) -{ - for (size_t i = 0; i < table_size; i++) - { - if (table[i].first == table_key) - { - FormatInstruction(dest, inst, pc, table[i].second); - return; - } - } - - dest->Format("", ZeroExtend32(inst.cop.cop_n.GetValue()), inst.cop.imm25.GetValue()); -} - -template -void FormatCopComment(String* dest, u32 pc, Registers* regs, const Instruction inst, - const std::pair* table, size_t table_size, T table_key) -{ - for (size_t i = 0; i < table_size; i++) - { - if (table[i].first == table_key) - { - FormatComment(dest, inst, pc, regs, table[i].second); - return; - } - } -} - -void DisassembleInstruction(String* dest, u32 pc, u32 bits) -{ - const Instruction inst{bits}; - switch (inst.op) - { - case InstructionOp::funct: - FormatInstruction(dest, inst, pc, s_special_table[static_cast(inst.r.funct.GetValue())]); - return; - - case InstructionOp::cop0: - case InstructionOp::cop1: - case InstructionOp::cop2: - case InstructionOp::cop3: - { - if (inst.cop.IsCommonInstruction()) - { - FormatCopInstruction(dest, pc, inst, s_cop_common_table.data(), s_cop_common_table.size(), inst.cop.CommonOp()); - } - else - { - switch (inst.op) - { - case InstructionOp::cop0: - { - FormatCopInstruction(dest, pc, inst, s_cop0_table.data(), s_cop0_table.size(), inst.cop.Cop0Op()); - } - break; - - case InstructionOp::cop1: - case InstructionOp::cop2: - case InstructionOp::cop3: - default: - { - dest->Format("", ZeroExtend32(inst.cop.cop_n.GetValue()), inst.cop.imm25.GetValue()); - } - break; - } - } - } - break; - - // special case for bltz/bgez{al} - case InstructionOp::b: - { - const u8 rt = static_cast(inst.i.rt.GetValue()); - const bool bgez = ConvertToBoolUnchecked(rt & u8(1)); - const bool link = ConvertToBoolUnchecked((rt >> 4) & u8(1)); - if (link) - FormatInstruction(dest, inst, pc, bgez ? "bgezal $rs, $rel" : "bltzal $rs, $rel"); - else - FormatInstruction(dest, inst, pc, bgez ? "bgez $rs, $rel" : "bltz $rs, $rel"); - } - break; - - default: - FormatInstruction(dest, inst, pc, s_base_table[static_cast(inst.op.GetValue())]); - break; - } -} - -void DisassembleInstructionComment(String* dest, u32 pc, u32 bits, Registers* regs) -{ - const Instruction inst{bits}; - switch (inst.op) - { - case InstructionOp::funct: - FormatComment(dest, inst, pc, regs, s_special_table[static_cast(inst.r.funct.GetValue())]); - return; - - case InstructionOp::cop0: - case InstructionOp::cop1: - case InstructionOp::cop2: - case InstructionOp::cop3: - { - if (inst.cop.IsCommonInstruction()) - { - FormatCopComment(dest, pc, regs, inst, s_cop_common_table.data(), s_cop_common_table.size(), - inst.cop.CommonOp()); - } - else - { - switch (inst.op) - { - case InstructionOp::cop0: - { - FormatCopComment(dest, pc, regs, inst, s_cop0_table.data(), s_cop0_table.size(), inst.cop.Cop0Op()); - } - break; - - case InstructionOp::cop1: - case InstructionOp::cop2: - case InstructionOp::cop3: - default: - { - dest->Format("", ZeroExtend32(inst.cop.cop_n.GetValue()), inst.cop.imm25.GetValue()); - } - break; - } - } - } - break; - - // special case for bltz/bgez{al} - case InstructionOp::b: - { - const u8 rt = static_cast(inst.i.rt.GetValue()); - const bool bgez = ConvertToBoolUnchecked(rt & u8(1)); - const bool link = ConvertToBoolUnchecked((rt >> 4) & u8(1)); - if (link) - FormatComment(dest, inst, pc, regs, bgez ? "bgezal $rs, $rel" : "bltzal $rs, $rel"); - else - FormatComment(dest, inst, pc, regs, bgez ? "bgez $rs, $rel" : "bltz $rs, $rel"); - } - break; - - default: - FormatComment(dest, inst, pc, regs, s_base_table[static_cast(inst.op.GetValue())]); - break; - } -} - -} // namespace CPU \ No newline at end of file diff --git a/src/core/cpu_disasm.h b/src/core/cpu_disasm.h deleted file mode 100644 index e99d0660..00000000 --- a/src/core/cpu_disasm.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#include "common/string.h" -#include "cpu_types.h" - -namespace CPU { -void DisassembleInstruction(String* dest, u32 pc, u32 bits); -void DisassembleInstructionComment(String* dest, u32 pc, u32 bits, Registers* regs); -} // namespace CPU diff --git a/src/core/cpu_recompiler_code_generator.cpp b/src/core/cpu_recompiler_code_generator.cpp index b5afc3cd..a01db23b 100644 --- a/src/core/cpu_recompiler_code_generator.cpp +++ b/src/core/cpu_recompiler_code_generator.cpp @@ -2,7 +2,6 @@ #include "common/log.h" #include "cpu_core.h" #include "cpu_core_private.h" -#include "cpu_disasm.h" #include "gte.h" #include "pgxp.h" #include "settings.h" diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index 0a705f3c..17a857f2 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -18,8 +18,7 @@ ALWAYS_INLINE static constexpr std::tuple MinMax(T v1, T v2) { if (v1 > v2) return std::tie(v2, v1); - else - return std::tie(v1, v2); + return std::tie(v1, v2); } ALWAYS_INLINE static bool ShouldUseUVLimits() @@ -91,7 +90,6 @@ bool GPU_HW::Initialize(HostDisplay* host_display) UpdateSoftwareRenderer(false); - PrintSettingsToLog(); return true; } @@ -192,8 +190,6 @@ void GPU_HW::UpdateHWSettings(bool* framebuffer_changed, bool* shaders_changed) } UpdateSoftwareRenderer(true); - - PrintSettingsToLog(); } u32 GPU_HW::CalculateResolutionScale() const @@ -270,21 +266,6 @@ std::tuple GPU_HW::GetFullDisplayResolution(bool scaled /* = true */) return std::make_tuple(m_crtc_state.display_width * scale, m_crtc_state.display_height * scale); } -void GPU_HW::PrintSettingsToLog() -{ - Log_InfoPrintf("Resolution Scale: %u (%ux%u), maximum %u", m_resolution_scale, VRAM_WIDTH * m_resolution_scale, - VRAM_HEIGHT * m_resolution_scale, m_max_resolution_scale); - Log_InfoPrintf("Multisampling: %ux%s", m_multisamples, m_per_sample_shading ? " (per sample shading)" : ""); - Log_InfoPrintf("Dithering: %s%s", m_true_color ? "Disabled" : "Enabled", - (!m_true_color && m_scaled_dithering) ? " (Scaled)" : ""); - Log_InfoPrintf("Texture Filtering: %s", Settings::GetTextureFilterDisplayName(m_texture_filtering)); - Log_InfoPrintf("Dual-source blending: %s", m_supports_dual_source_blend ? "Supported" : "Not supported"); - Log_InfoPrintf("Using UV limits: %s", m_using_uv_limits ? "YES" : "NO"); - Log_InfoPrintf("Depth buffer: %s", m_pgxp_depth_buffer ? "YES" : "NO"); - Log_InfoPrintf("Downsampling: %s", Settings::GetDownsampleModeDisplayName(m_downsample_mode)); - Log_InfoPrintf("Using software renderer for readbacks: %s", m_sw_renderer ? "YES" : "NO"); -} - void GPU_HW::UpdateVRAMReadTexture() { m_renderer_stats.num_vram_read_texture_updates++; @@ -1108,7 +1089,6 @@ void GPU_HW::ResetBatchVertexDepth() if (m_pgxp_depth_buffer) return; - Log_PerfPrint("Resetting batch vertex depth"); FlushRender(); UpdateDepthBufferFromMaskBit(); diff --git a/src/core/gpu_hw.h b/src/core/gpu_hw.h index d609e426..c6c2d44b 100644 --- a/src/core/gpu_hw.h +++ b/src/core/gpu_hw.h @@ -418,6 +418,4 @@ private: m_batch_current_vertex_ptr->Set(std::forward(args)...); m_batch_current_vertex_ptr++; } - - void PrintSettingsToLog(); }; diff --git a/src/core/gpu_hw_d3d12.cpp b/src/core/gpu_hw_d3d12.cpp index 617c7726..439445a4 100644 --- a/src/core/gpu_hw_d3d12.cpp +++ b/src/core/gpu_hw_d3d12.cpp @@ -175,7 +175,6 @@ void GPU_HW_D3D12::MapBatchVertexPointer(u32 required_vertices) const u32 required_space = required_vertices * sizeof(BatchVertex); if (!m_vertex_stream_buffer.ReserveMemory(required_space, sizeof(BatchVertex))) { - Log_PerfPrintf("Executing command buffer while waiting for %u bytes in vertex stream buffer", required_space); g_d3d12_context->ExecuteCommandList(false); RestoreGraphicsAPIState(); if (!m_vertex_stream_buffer.ReserveMemory(required_space, sizeof(BatchVertex))) @@ -203,7 +202,6 @@ void GPU_HW_D3D12::UploadUniformBuffer(const void* data, u32 data_size) { if (!m_uniform_stream_buffer.ReserveMemory(data_size, D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT)) { - Log_PerfPrintf("Executing command buffer while waiting for %u bytes in uniform stream buffer", data_size); g_d3d12_context->ExecuteCommandList(false); RestoreGraphicsAPIState(); if (!m_uniform_stream_buffer.ReserveMemory(data_size, D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT)) @@ -758,13 +756,8 @@ bool GPU_HW_D3D12::CreateTextureReplacementStreamBuffer() { if (m_texture_replacment_stream_buffer.IsValid()) return true; - if (!m_texture_replacment_stream_buffer.Create(TEXTURE_REPLACEMENT_BUFFER_SIZE)) - { - Log_ErrorPrint("Failed to allocate texture replacement streaming buffer"); return false; - } - return true; } @@ -780,24 +773,17 @@ bool GPU_HW_D3D12::BlitVRAMReplacementTexture(const TextureReplacementTexture* t if (!m_vram_write_replacement_texture.Create(tex->GetWidth(), tex->GetHeight(), 1, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, D3D12_RESOURCE_FLAG_NONE)) - { - Log_ErrorPrint("Failed to create VRAM write replacement texture"); return false; - } } const u32 copy_pitch = Common::AlignUpPow2(tex->GetWidth() * sizeof(u32), D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); const u32 required_size = copy_pitch * tex->GetHeight(); if (!m_texture_replacment_stream_buffer.ReserveMemory(required_size, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT)) { - Log_PerfPrint("Executing command buffer while waiting for texture replacement buffer space"); g_d3d12_context->ExecuteCommandList(false); RestoreGraphicsAPIState(); if (!m_texture_replacment_stream_buffer.ReserveMemory(required_size, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT)) - { - Log_ErrorPrintf("Failed to allocate %u bytes from texture replacement streaming buffer", required_size); return false; - } } // buffer -> texture @@ -1031,7 +1017,6 @@ void GPU_HW_D3D12::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* d const u32 alignment = D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT; // ??? if (!m_texture_stream_buffer.ReserveMemory(data_size, alignment)) { - Log_PerfPrintf("Executing command buffer while waiting for %u bytes in stream buffer", data_size); g_d3d12_context->ExecuteCommandList(false); RestoreGraphicsAPIState(); if (!m_texture_stream_buffer.ReserveMemory(data_size, alignment)) diff --git a/src/core/gpu_hw_vulkan.cpp b/src/core/gpu_hw_vulkan.cpp index d84bf3fa..302f91c4 100644 --- a/src/core/gpu_hw_vulkan.cpp +++ b/src/core/gpu_hw_vulkan.cpp @@ -249,7 +249,6 @@ void GPU_HW_Vulkan::MapBatchVertexPointer(u32 required_vertices) const u32 required_space = required_vertices * sizeof(BatchVertex); if (!m_vertex_stream_buffer.ReserveMemory(required_space, sizeof(BatchVertex))) { - Log_PerfPrintf("Executing command buffer while waiting for %u bytes in vertex stream buffer", required_space); ExecuteCommandBuffer(false, true); if (!m_vertex_stream_buffer.ReserveMemory(required_space, sizeof(BatchVertex))) Panic("Failed to reserve vertex stream buffer memory"); @@ -277,7 +276,6 @@ void GPU_HW_Vulkan::UploadUniformBuffer(const void* data, u32 data_size) const u32 alignment = static_cast(g_vulkan_context->GetUniformBufferAlignment()); if (!m_uniform_stream_buffer.ReserveMemory(data_size, alignment)) { - Log_PerfPrintf("Executing command buffer while waiting for %u bytes in uniform stream buffer", data_size); ExecuteCommandBuffer(false, true); if (!m_uniform_stream_buffer.ReserveMemory(data_size, alignment)) Panic("Failed to reserve uniform stream buffer memory"); @@ -1616,7 +1614,6 @@ void GPU_HW_Vulkan::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* g_vulkan_context->GetTexelBufferAlignment())); if (!m_texture_stream_buffer.ReserveMemory(data_size, alignment)) { - Log_PerfPrintf("Executing command buffer while waiting for %u bytes in stream buffer", data_size); ExecuteCommandBuffer(false, true); if (!m_texture_stream_buffer.ReserveMemory(data_size, alignment)) { @@ -1800,10 +1797,7 @@ bool GPU_HW_Vulkan::CreateTextureReplacementStreamBuffer() return true; if (!m_texture_replacment_stream_buffer.Create(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, TEXTURE_REPLACEMENT_BUFFER_SIZE)) - { - Log_ErrorPrint("Failed to allocate texture replacement streaming buffer"); return false; - } Vulkan::Util::SetObjectName(g_vulkan_context->GetDevice(), m_texture_replacment_stream_buffer.GetBuffer(), "Texture Replacement Stream Buffer"); @@ -1828,23 +1822,16 @@ bool GPU_HW_Vulkan::BlitVRAMReplacementTexture(const TextureReplacementTexture* if (!m_vram_write_replacement_texture.Create(tex->GetWidth(), tex->GetHeight(), 1, 1, VK_FORMAT_R8G8B8A8_UNORM, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT)) - { - Log_ErrorPrint("Failed to create VRAM write replacement texture"); return false; - } } const u32 required_size = tex->GetWidth() * tex->GetHeight() * sizeof(u32); const u32 alignment = static_cast(g_vulkan_context->GetBufferImageGranularity()); if (!m_texture_replacment_stream_buffer.ReserveMemory(required_size, alignment)) { - Log_PerfPrint("Executing command buffer while waiting for texture replacement buffer space"); ExecuteCommandBuffer(false, true); if (!m_texture_replacment_stream_buffer.ReserveMemory(required_size, alignment)) - { - Log_ErrorPrintf("Failed to allocate %u bytes from texture replacement streaming buffer", required_size); return false; - } } // upload to buffer diff --git a/src/core/gpu_sw.cpp b/src/core/gpu_sw.cpp index e1363a56..e7982b88 100644 --- a/src/core/gpu_sw.cpp +++ b/src/core/gpu_sw.cpp @@ -1,13 +1,11 @@ #include "gpu_sw.h" #include "common/align.h" #include "common/assert.h" -#include "common/log.h" #include "common/make_array.h" #include "common/platform.h" #include "host_display.h" #include "system.h" #include -Log_SetChannel(GPU_SW); #if defined(CPU_X64) #include @@ -597,8 +595,6 @@ void GPU_SW::DispatchRenderCommand() if ((max_x - min_x) >= MAX_PRIMITIVE_WIDTH || (max_y - min_y) >= MAX_PRIMITIVE_HEIGHT) { - Log_DebugPrintf("Culling too-large polygon: %d,%d %d,%d %d,%d", cmd->vertices[0].x, cmd->vertices[0].y, - cmd->vertices[1].x, cmd->vertices[1].y, cmd->vertices[2].x, cmd->vertices[2].y); } else { @@ -618,9 +614,6 @@ void GPU_SW::DispatchRenderCommand() // Cull polygons which are too large. if ((max_x_123 - min_x_123) >= MAX_PRIMITIVE_WIDTH || (max_y_123 - min_y_123) >= MAX_PRIMITIVE_HEIGHT) { - Log_DebugPrintf("Culling too-large polygon (quad second half): %d,%d %d,%d %d,%d", cmd->vertices[2].x, - cmd->vertices[2].y, cmd->vertices[1].x, cmd->vertices[1].y, cmd->vertices[0].x, - cmd->vertices[0].y); } else { @@ -677,10 +670,7 @@ void GPU_SW::DispatchRenderCommand() cmd->height = static_cast((width_and_height >> 16) & VRAM_HEIGHT_MASK); if (cmd->width >= MAX_PRIMITIVE_WIDTH || cmd->height >= MAX_PRIMITIVE_HEIGHT) - { - Log_DebugPrintf("Culling too-large rectangle: %d,%d %dx%d", cmd->x, cmd->y, cmd->width, cmd->height); return; - } } break; } @@ -742,11 +732,7 @@ void GPU_SW::DispatchRenderCommand() const auto [min_x, max_x] = MinMax(cmd->vertices[0].x, cmd->vertices[1].x); const auto [min_y, max_y] = MinMax(cmd->vertices[0].y, cmd->vertices[1].y); if ((max_x - min_x) >= MAX_PRIMITIVE_WIDTH || (max_y - min_y) >= MAX_PRIMITIVE_HEIGHT) - { - Log_DebugPrintf("Culling too-large line: %d,%d - %d,%d", cmd->vertices[0].y, cmd->vertices[0].y, - cmd->vertices[1].x, cmd->vertices[1].y); return; - } const u32 clip_left = static_cast(std::clamp(min_x, m_drawing_area.left, m_drawing_area.right)); const u32 clip_right = static_cast(std::clamp(max_x, m_drawing_area.left, m_drawing_area.right)) + 1u; @@ -786,8 +772,6 @@ void GPU_SW::DispatchRenderCommand() const auto [min_y, max_y] = MinMax(cmd->vertices[i - 1].x, cmd->vertices[i].y); if ((max_x - min_x) >= MAX_PRIMITIVE_WIDTH || (max_y - min_y) >= MAX_PRIMITIVE_HEIGHT) { - Log_DebugPrintf("Culling too-large line: %d,%d - %d,%d", cmd->vertices[i - 1].x, cmd->vertices[i - 1].y, - cmd->vertices[i].x, cmd->vertices[i].y); } else { diff --git a/src/core/gte.cpp b/src/core/gte.cpp index 809f604d..d4b941e8 100644 --- a/src/core/gte.cpp +++ b/src/core/gte.cpp @@ -251,17 +251,6 @@ u32 ReadRegister(u32 index) void WriteRegister(u32 index, u32 value) { -#if 0 - if (index < 32) - { - Log_DebugPrintf("DataReg(%u) <- 0x%08X", index, value); - } - else - { - Log_DebugPrintf("ControlReg(%u) <- 0x%08X", index, value); - } -#endif - switch (index) { case 1: // V0[z] diff --git a/src/core/host_interface.cpp b/src/core/host_interface.cpp index d707233d..c53be0f3 100644 --- a/src/core/host_interface.cpp +++ b/src/core/host_interface.cpp @@ -57,14 +57,6 @@ void HostInterface::Shutdown() bool HostInterface::BootSystem(std::shared_ptr parameters) { - if (!parameters->state_stream) - { - if (parameters->filename.empty()) - Log_InfoPrintf("Boot Filename: "); - else - Log_InfoPrintf("Boot Filename: %s", parameters->filename.c_str()); - } - if (!AcquireHostDisplay()) { ReportError(g_host_interface->TranslateString("System", "Failed to acquire host display.")); diff --git a/src/core/spu.cpp b/src/core/spu.cpp index 3fdadab8..ea9c5f29 100644 --- a/src/core/spu.cpp +++ b/src/core/spu.cpp @@ -2,13 +2,11 @@ #include "cdrom.h" #include "common/audio_stream.h" #include "common/file_system.h" -#include "common/log.h" #include "common/state_wrapper.h" #include "dma.h" #include "host_interface.h" #include "interrupt_controller.h" #include "system.h" -Log_SetChannel(SPU); SPU g_spu; @@ -233,28 +231,22 @@ u16 SPU::ReadRegister(u32 offset) return m_reverb_registers.mBASE; case 0x1F801DA4 - SPU_BASE: - Log_TracePrintf("SPU IRQ address -> 0x%04X", ZeroExtend32(m_irq_address)); return m_irq_address; case 0x1F801DA6 - SPU_BASE: - Log_TracePrintf("SPU transfer address register -> 0x%04X", ZeroExtend32(m_transfer_address_reg)); return m_transfer_address_reg; case 0x1F801DA8 - SPU_BASE: - Log_TracePrintf("SPU transfer data register read"); return UINT16_C(0xFFFF); case 0x1F801DAA - SPU_BASE: - Log_TracePrintf("SPU control register -> 0x%04X", ZeroExtend32(m_SPUCNT.bits)); return m_SPUCNT.bits; case 0x1F801DAC - SPU_BASE: - Log_TracePrintf("SPU transfer control register -> 0x%04X", ZeroExtend32(m_transfer_control.bits)); return m_transfer_control.bits; case 0x1F801DAE - SPU_BASE: GeneratePendingSamples(); - Log_TracePrintf("SPU status register -> 0x%04X", ZeroExtend32(m_SPUCNT.bits)); return m_SPUSTAT.bits; case 0x1F801DB0 - SPU_BASE: @@ -291,11 +283,9 @@ u16 SPU::ReadRegister(u32 offset) GeneratePendingSamples(); if (offset & 0x02) return m_voices[voice_index].left_volume.current_level; - else - return m_voices[voice_index].right_volume.current_level; + return m_voices[voice_index].right_volume.current_level; } - Log_DevPrintf("Unknown SPU register read: offset 0x%X (address 0x%08X)", offset, offset | SPU_BASE); return UINT16_C(0xFFFF); } } @@ -307,7 +297,6 @@ void SPU::WriteRegister(u32 offset, u16 value) { case 0x1F801D80 - SPU_BASE: { - Log_DebugPrintf("SPU main volume left <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_main_volume_left_reg.bits = value; m_main_volume_left.Reset(m_main_volume_left_reg); @@ -316,7 +305,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D82 - SPU_BASE: { - Log_DebugPrintf("SPU main volume right <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_main_volume_right_reg.bits = value; m_main_volume_right.Reset(m_main_volume_right_reg); @@ -325,7 +313,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D84 - SPU_BASE: { - Log_DebugPrintf("SPU reverb output volume left <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_reverb_registers.vLOUT = value; return; @@ -333,7 +320,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D86 - SPU_BASE: { - Log_DebugPrintf("SPU reverb output volume right <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_reverb_registers.vROUT = value; return; @@ -341,7 +327,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D88 - SPU_BASE: { - Log_DebugPrintf("SPU key on low <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_key_on_register = (m_key_on_register & 0xFFFF0000) | ZeroExtend32(value); } @@ -349,7 +334,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D8A - SPU_BASE: { - Log_DebugPrintf("SPU key on high <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_key_on_register = (m_key_on_register & 0x0000FFFF) | (ZeroExtend32(value) << 16); } @@ -357,7 +341,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D8C - SPU_BASE: { - Log_DebugPrintf("SPU key off low <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_key_off_register = (m_key_off_register & 0xFFFF0000) | ZeroExtend32(value); } @@ -365,7 +348,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D8E - SPU_BASE: { - Log_DebugPrintf("SPU key off high <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_key_off_register = (m_key_off_register & 0x0000FFFF) | (ZeroExtend32(value) << 16); } @@ -375,7 +357,6 @@ void SPU::WriteRegister(u32 offset, u16 value) { GeneratePendingSamples(); m_pitch_modulation_enable_register = (m_pitch_modulation_enable_register & 0xFFFF0000) | ZeroExtend32(value); - Log_DebugPrintf("SPU pitch modulation enable register <- 0x%08X", m_pitch_modulation_enable_register); } break; @@ -384,13 +365,11 @@ void SPU::WriteRegister(u32 offset, u16 value) GeneratePendingSamples(); m_pitch_modulation_enable_register = (m_pitch_modulation_enable_register & 0x0000FFFF) | (ZeroExtend32(value) << 16); - Log_DebugPrintf("SPU pitch modulation enable register <- 0x%08X", m_pitch_modulation_enable_register); } break; case 0x1F801D94 - SPU_BASE: { - Log_DebugPrintf("SPU noise mode register <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_noise_mode_register = (m_noise_mode_register & 0xFFFF0000) | ZeroExtend32(value); } @@ -398,7 +377,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D96 - SPU_BASE: { - Log_DebugPrintf("SPU noise mode register <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_noise_mode_register = (m_noise_mode_register & 0x0000FFFF) | (ZeroExtend32(value) << 16); } @@ -406,7 +384,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D98 - SPU_BASE: { - Log_DebugPrintf("SPU reverb on register <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_reverb_on_register = (m_reverb_on_register & 0xFFFF0000) | ZeroExtend32(value); } @@ -414,7 +391,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801D9A - SPU_BASE: { - Log_DebugPrintf("SPU reverb on register <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_reverb_on_register = (m_reverb_on_register & 0x0000FFFF) | (ZeroExtend32(value) << 16); } @@ -422,7 +398,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801DA2 - SPU_BASE: { - Log_DebugPrintf("SPU reverb base address < 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_reverb_registers.mBASE = value; m_reverb_base_address = ZeroExtend32(value << 2) & 0x3FFFFu; @@ -432,7 +407,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801DA4 - SPU_BASE: { - Log_DebugPrintf("SPU IRQ address register <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_irq_address = value; @@ -444,31 +418,22 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801DA6 - SPU_BASE: { - Log_DebugPrintf("SPU transfer address register <- 0x%04X", ZeroExtend32(value)); m_transfer_event->InvokeEarly(); m_transfer_address_reg = value; m_transfer_address = ZeroExtend32(value) * 8; if (IsRAMIRQTriggerable() && CheckRAMIRQ(m_transfer_address)) - { - Log_DebugPrintf("Trigger IRQ @ %08X %04X from transfer address reg set", m_transfer_address, - m_transfer_address / 8); TriggerRAMIRQ(); - } return; } case 0x1F801DA8 - SPU_BASE: { - Log_TracePrintf("SPU transfer data register <- 0x%04X (RAM offset 0x%08X)", ZeroExtend32(value), - m_transfer_address); - ManualTransferWrite(value); return; } case 0x1F801DAA - SPU_BASE: { - Log_DebugPrintf("SPU control register <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); const SPUCNT new_value{value}; @@ -482,16 +447,12 @@ void SPU::WriteRegister(u32 offset, u16 value) { // I would guess on the console it would gradually write the FIFO out. Hopefully nothing relies on this // level of timing granularity if we force it all out here. - Log_WarningPrintf("Draining write SPU transfer FIFO with %u bytes left", m_transfer_fifo.GetSize()); TickCount ticks = std::numeric_limits::max(); ExecuteFIFOWriteToRAM(ticks); DebugAssert(m_transfer_fifo.IsEmpty()); } else - { - Log_DebugPrintf("Clearing read SPU transfer FIFO with %u bytes left", m_transfer_fifo.GetSize()); m_transfer_fifo.Clear(); - } } } @@ -519,14 +480,12 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801DAC - SPU_BASE: { - Log_DebugPrintf("SPU transfer control register <- 0x%04X", ZeroExtend32(value)); m_transfer_control.bits = value; return; } case 0x1F801DB0 - SPU_BASE: { - Log_DebugPrintf("SPU left cd audio register <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_cd_audio_volume_left = value; } @@ -534,7 +493,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801DB2 - SPU_BASE: { - Log_DebugPrintf("SPU right cd audio register <- 0x%04X", ZeroExtend32(value)); GeneratePendingSamples(); m_cd_audio_volume_right = value; } @@ -543,7 +501,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801DB4 - SPU_BASE: { // External volumes aren't used, so don't bother syncing. - Log_DebugPrintf("SPU left external volume register <- 0x%04X", ZeroExtend32(value)); m_external_volume_left = value; } break; @@ -551,7 +508,6 @@ void SPU::WriteRegister(u32 offset, u16 value) case 0x1F801DB6 - SPU_BASE: { // External volumes aren't used, so don't bother syncing. - Log_DebugPrintf("SPU right external volume register <- 0x%04X", ZeroExtend32(value)); m_external_volume_right = value; } break; @@ -573,14 +529,11 @@ void SPU::WriteRegister(u32 offset, u16 value) if (offset >= (0x1F801DC0 - SPU_BASE) && offset < (0x1F801E00 - SPU_BASE)) { const u32 reg = (offset - (0x1F801DC0 - SPU_BASE)) / 2; - Log_DebugPrintf("SPU reverb register %u <- 0x%04X", reg, value); GeneratePendingSamples(); m_reverb_registers.rev[reg] = value; return; } - Log_DevPrintf("Unknown SPU register write: offset 0x%X (address 0x%08X) value 0x%04X", offset, offset | SPU_BASE, - ZeroExtend32(value)); return; } } @@ -597,7 +550,6 @@ u16 SPU::ReadVoiceRegister(u32 offset) if (reg_index >= 6 && (voice.IsOn() || m_key_on_register & (1u << voice_index))) GeneratePendingSamples(); - Log_TracePrintf("Read voice %u register %u -> 0x%02X", voice_index, reg_index, voice.regs.index[reg_index]); return voice.regs.index[reg_index]; } @@ -616,7 +568,6 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) { case 0x00: // volume left { - Log_DebugPrintf("SPU voice %u volume left <- 0x%04X", voice_index, value); voice.regs.volume_left.bits = value; voice.left_volume.Reset(voice.regs.volume_left); } @@ -624,7 +575,6 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) case 0x02: // volume right { - Log_DebugPrintf("SPU voice %u volume right <- 0x%04X", voice_index, value); voice.regs.volume_right.bits = value; voice.right_volume.Reset(voice.regs.volume_right); } @@ -632,21 +582,18 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) case 0x04: // sample rate { - Log_DebugPrintf("SPU voice %u ADPCM sample rate <- 0x%04X", voice_index, value); voice.regs.adpcm_sample_rate = value; } break; case 0x06: // start address { - Log_DebugPrintf("SPU voice %u ADPCM start address <- 0x%04X", voice_index, value); voice.regs.adpcm_start_address = value; } break; case 0x08: // adsr low { - Log_DebugPrintf("SPU voice %u ADSR low <- 0x%04X (was 0x%04X)", voice_index, value, voice.regs.adsr.bits_low); voice.regs.adsr.bits_low = value; if (voice.IsOn()) voice.UpdateADSREnvelope(); @@ -655,7 +602,6 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) case 0x0A: // adsr high { - Log_DebugPrintf("SPU voice %u ADSR high <- 0x%04X (was 0x%04X)", voice_index, value, voice.regs.adsr.bits_low); voice.regs.adsr.bits_high = value; if (voice.IsOn()) voice.UpdateADSREnvelope(); @@ -664,7 +610,6 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) case 0x0C: // adsr volume { - Log_DebugPrintf("SPU voice %u ADSR volume <- 0x%04X (was 0x%04X)", voice_index, value, voice.regs.adsr_volume); voice.regs.adsr_volume = value; } break; @@ -678,23 +623,12 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) // - Valkyrie Profile const bool ignore_loop_address = voice.IsOn() && !voice.is_first_block; - Log_DebugPrintf("SPU voice %u ADPCM repeat address <- 0x%04X", voice_index, value); voice.regs.adpcm_repeat_address = value; voice.ignore_loop_address |= ignore_loop_address; - - if (!ignore_loop_address) - { - Log_DevPrintf("Not ignoring loop address, the ADPCM repeat address of 0x%04X for voice %u will be overwritten", - value, voice_index); - } } break; default: - { - Log_ErrorPrintf("Unknown SPU voice %u register write: offset 0x%X (address 0x%08X) value 0x%04X", offset, - voice_index, offset | SPU_BASE, ZeroExtend32(value)); - } break; } } @@ -710,7 +644,6 @@ void SPU::CheckForLateRAMIRQs() { if (CheckRAMIRQ(m_transfer_address)) { - Log_DebugPrintf("Trigger IRQ @ %08X %04X from late transfer", m_transfer_address, m_transfer_address / 8); TriggerRAMIRQ(); return; } @@ -726,7 +659,6 @@ void SPU::CheckForLateRAMIRQs() const u32 address = v.current_address * 8; if (CheckRAMIRQ(address) || CheckRAMIRQ((address + 8) & RAM_MASK)) { - Log_DebugPrintf("Trigger IRQ @ %08X %04X from late", address, address / 8); TriggerRAMIRQ(); return; } @@ -736,11 +668,9 @@ void SPU::CheckForLateRAMIRQs() void SPU::WriteToCaptureBuffer(u32 index, s16 value) { const u32 ram_address = (index * CAPTURE_BUFFER_SIZE_PER_CHANNEL) | ZeroExtend16(m_capture_buffer_position); - // Log_DebugPrintf("write to capture buffer %u (0x%08X) <- 0x%04X", index, ram_address, u16(value)); std::memcpy(&m_ram[ram_address], &value, sizeof(value)); if (IsRAMIRQTriggerable() && CheckRAMIRQ(ram_address)) { - Log_DebugPrintf("Trigger IRQ @ %08X %04X from capture buffer", ram_address, ram_address / 8); TriggerRAMIRQ(); } } @@ -763,10 +693,7 @@ void ALWAYS_INLINE SPU::ExecuteFIFOReadFromRAM(TickCount& ticks) ticks -= TRANSFER_TICKS_PER_HALFWORD; if (IsRAMIRQTriggerable() && CheckRAMIRQ(m_transfer_address)) - { - Log_DebugPrintf("Trigger IRQ @ %08X %04X from transfer read", m_transfer_address, m_transfer_address / 8); TriggerRAMIRQ(); - } } } @@ -780,10 +707,7 @@ void ALWAYS_INLINE SPU::ExecuteFIFOWriteToRAM(TickCount& ticks) ticks -= TRANSFER_TICKS_PER_HALFWORD; if (IsRAMIRQTriggerable() && CheckRAMIRQ(m_transfer_address)) - { - Log_DebugPrintf("Trigger IRQ @ %08X %04X from transfer write", m_transfer_address, m_transfer_address / 8); TriggerRAMIRQ(); - } } } @@ -844,10 +768,7 @@ void SPU::ExecuteTransfer(TickCount ticks) void SPU::ManualTransferWrite(u16 value) { if (m_transfer_fifo.IsFull()) - { - Log_WarningPrintf("FIFO full, dropping write of 0x%04X", value); return; - } m_transfer_fifo.Push(value); UpdateTransferEvent(); @@ -966,13 +887,10 @@ void SPU::DMARead(u32* words, u32 word_count) fill_value = halfwords[size - 1]; } - Log_WarningPrintf("Transfer FIFO underflow, filling with 0x%04X", fill_value); std::fill_n(&halfwords[size], halfword_count - size, fill_value); } else - { m_transfer_fifo.PopRange(halfwords, halfword_count); - } UpdateDMARequest(); UpdateTransferEvent(); @@ -986,9 +904,6 @@ void SPU::DMAWrite(const u32* words, u32 word_count) const u32 words_to_transfer = std::min(m_transfer_fifo.GetSpace(), halfword_count); m_transfer_fifo.PushRange(halfwords, words_to_transfer); - if (words_to_transfer != halfword_count) - Log_WarningPrintf("Transfer FIFO overflow, dropping %u halfwords", halfword_count - words_to_transfer); - UpdateDMARequest(); UpdateTransferEvent(); } @@ -1359,10 +1274,7 @@ void SPU::ReadADPCMBlock(u16 address, ADPCMBlock* block) { u32 ram_address = (ZeroExtend32(address) * 8) & RAM_MASK; if (IsRAMIRQTriggerable() && (CheckRAMIRQ(ram_address) || CheckRAMIRQ((ram_address + 8) & RAM_MASK))) - { - Log_DebugPrintf("Trigger IRQ @ %08X %04X from ADPCM reader", ram_address, ram_address / 8); TriggerRAMIRQ(); - } // fast path - no wrap-around if ((ram_address + sizeof(ADPCMBlock)) <= RAM_SIZE) @@ -1399,10 +1311,7 @@ ALWAYS_INLINE_RELEASE std::tuple SPU::SampleVoice(u32 voice_index) voice.has_samples = true; if (voice.current_block_flags.loop_start && !voice.ignore_loop_address) - { - Log_TracePrintf("Voice %u loop start @ 0x%08X", voice_index, ZeroExtend32(voice.current_address)); voice.regs.adpcm_repeat_address = voice.current_address; - } } // skip interpolation when the volume is muted anyway @@ -1458,14 +1367,7 @@ ALWAYS_INLINE_RELEASE std::tuple SPU::SampleVoice(u32 voice_index) voice.current_address = voice.regs.adpcm_repeat_address & ~u16(1); if (!voice.current_block_flags.loop_repeat) - { - Log_TracePrintf("Voice %u loop end+mute @ 0x%08X", voice_index, ZeroExtend32(voice.current_address)); voice.ForceOff(); - } - else - { - Log_TracePrintf("Voice %u loop end+repeat @ 0x%08X", voice_index, ZeroExtend32(voice.current_address)); - } } }