diff --git a/Utilities/Log.h b/Utilities/Log.h index f97426ddde..bf2a5c1887 100644 --- a/Utilities/Log.h +++ b/Utilities/Log.h @@ -122,7 +122,6 @@ namespace logs namespace logs { /* Small set of predefined channels */ - LOG_CHANNEL(RSX); LOG_CHANNEL(HLE); LOG_CHANNEL(PPU); LOG_CHANNEL(SPU); @@ -135,3 +134,5 @@ namespace logs #define LOG_TODO(ch, fmt, ...) logs::ch.todo ("" fmt, ##__VA_ARGS__) #define LOG_TRACE(ch, fmt, ...) logs::ch.trace ("" fmt, ##__VA_ARGS__) #define LOG_FATAL(ch, fmt, ...) logs::ch.fatal ("" fmt, ##__VA_ARGS__) + +LOG_CHANNEL(rsx_log, "RSX"); diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 1e18a4ddad..90a4ef1da8 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1117,7 +1117,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) } catch (const std::exception& e) { - LOG_FATAL(RSX, "g_access_violation_handler(0x%x, %d): %s", addr, is_writing, e.what()); + rsx_log.fatal("g_access_violation_handler(0x%x, %d): %s", addr, is_writing, e.what()); if (cpu) { diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index 624cf25094..2ac4124ce7 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -378,7 +378,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 // sanity check, the head should have a 'queued' buffer on it, and it should have been previously 'queued' const u32 sanity_check = 0x40000000 & (1 << flip_idx); if ((driverInfo.head[a3].flipFlags & sanity_check) != sanity_check) - LOG_ERROR(RSX, "Display Flip Queued: Flipping non previously queued buffer 0x%llx", a4); + rsx_log.error("Display Flip Queued: Flipping non previously queued buffer 0x%llx", a4); } else { @@ -392,7 +392,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64 } if (flip_idx == ~0u) { - LOG_ERROR(RSX, "Display Flip: Couldn't find display buffer offset, flipping 0. Offset: 0x%x", a4); + rsx_log.error("Display Flip: Couldn't find display buffer offset, flipping 0. Offset: 0x%x", a4); flip_idx = 0; } } diff --git a/rpcs3/Emu/RSX/Capture/rsx_replay.cpp b/rpcs3/Emu/RSX/Capture/rsx_replay.cpp index a1b4a7d836..7c7061eed2 100644 --- a/rpcs3/Emu/RSX/Capture/rsx_replay.cpp +++ b/rpcs3/Emu/RSX/Capture/rsx_replay.cpp @@ -250,7 +250,7 @@ namespace rsx } catch (const std::exception& e) { - LOG_FATAL(RSX, "%s thrown: %s", typeid(e).name(), e.what()); + rsx_log.fatal("%s thrown: %s", typeid(e).name(), e.what()); Emu.Pause(); } } diff --git a/rpcs3/Emu/RSX/CgBinaryFragmentProgram.cpp b/rpcs3/Emu/RSX/CgBinaryFragmentProgram.cpp index 0184366f00..77820cf338 100644 --- a/rpcs3/Emu/RSX/CgBinaryFragmentProgram.cpp +++ b/rpcs3/Emu/RSX/CgBinaryFragmentProgram.cpp @@ -184,7 +184,7 @@ template std::string CgBinaryDisasm::GetSrcDisAsm(T src) } else { - LOG_ERROR(RSX, "Bad src reg num: %d", u32{ dst.src_attr_reg_num }); + rsx_log.error("Bad src reg num: %d", u32{ dst.src_attr_reg_num }); } break; } @@ -196,7 +196,7 @@ template std::string CgBinaryDisasm::GetSrcDisAsm(T src) break; default: - LOG_ERROR(RSX, "Bad src type %d", u32{ src.reg_type }); + rsx_log.error("Bad src type %d", u32{ src.reg_type }); break; } @@ -461,7 +461,7 @@ void CgBinaryDisasm::TaskFP() if (SCB()) break; } - LOG_ERROR(RSX, "Unknown/illegal instruction: 0x%x (forced unit %d)", m_opcode, forced_unit); + rsx_log.error("Unknown/illegal instruction: 0x%x (forced unit %d)", m_opcode, forced_unit); break; } diff --git a/rpcs3/Emu/RSX/CgBinaryProgram.h b/rpcs3/Emu/RSX/CgBinaryProgram.h index 30b41b1200..d9bdf40585 100644 --- a/rpcs3/Emu/RSX/CgBinaryProgram.h +++ b/rpcs3/Emu/RSX/CgBinaryProgram.h @@ -234,7 +234,7 @@ public: std::string GetCgParamRes(u32 /*offset*/) const { - // LOG_WARNING(RSX, "GetCgParamRes offset 0x%x", offset); + // rsx_log.warning("GetCgParamRes offset 0x%x", offset); // TODO return ""; } diff --git a/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp b/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp index 1a290a1247..643c36e33b 100644 --- a/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp +++ b/rpcs3/Emu/RSX/CgBinaryVertexProgram.cpp @@ -61,7 +61,7 @@ std::string CgBinaryDisasm::GetDSTDisasm(bool is_sca) default: if (d3.dst > 15) - LOG_ERROR(RSX, "dst index out of range: %u", d3.dst); + rsx_log.error("dst index out of range: %u", d3.dst); ret += fmt::format("o[%d]", d3.dst) + mask; // Vertex Program supports double destinations, notably in MOV @@ -89,7 +89,7 @@ std::string CgBinaryDisasm::GetSRCDisasm(const u32 n) } else { - LOG_ERROR(RSX, "Bad input src num: %d", u32{ d1.input_src }); + rsx_log.error("Bad input src num: %d", u32{ d1.input_src }); ret += fmt::format("v[%d] # bad src", d1.input_src); } break; @@ -98,7 +98,7 @@ std::string CgBinaryDisasm::GetSRCDisasm(const u32 n) break; default: - LOG_ERROR(RSX, "Bad src%u reg type: %d", n, u32{ src[n].reg_type }); + rsx_log.error("Bad src%u reg type: %d", n, u32{ src[n].reg_type }); Emu.Pause(); break; } @@ -367,7 +367,7 @@ void CgBinaryDisasm::TaskVP() if (i < m_data.size()) { - LOG_ERROR(RSX, "Program end before buffer end."); + rsx_log.error("Program end before buffer end."); } break; @@ -413,7 +413,7 @@ void CgBinaryDisasm::TaskVP() case RSX_SCA_OPCODE_POP: SetDSTScaDisasm(""); break; default: - LOG_ERROR(RSX, "Unknown vp sca_opcode 0x%x", u32{ d1.sca_opcode }); + rsx_log.error("Unknown vp sca_opcode 0x%x", u32{ d1.sca_opcode }); break; } @@ -446,7 +446,7 @@ void CgBinaryDisasm::TaskVP() case RSX_VEC_OPCODE_TXL: SetDSTVecDisasm("$t, $0"); break; default: - LOG_ERROR(RSX, "Unknown vp opcode 0x%x", u32{ d1.vec_opcode }); + rsx_log.error("Unknown vp opcode 0x%x", u32{ d1.vec_opcode }); break; } } diff --git a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp index 2fb357e951..8c9e3a2b01 100644 --- a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp @@ -35,7 +35,7 @@ void FragmentProgramDecompiler::SetDst(std::string code, u32 flags) case 7: code = "(" + code + " / "; modifier = "8."; break; default: - LOG_ERROR(RSX, "Bad scale: %d", u32{ src1.scale }); + rsx_log.error("Bad scale: %d", u32{ src1.scale }); break; } @@ -288,7 +288,7 @@ std::string FragmentProgramDecompiler::ClampValue(const std::string& code, u32 p // Doesn't seem to do anything to the input from hw tests, same as 0 break; default: - LOG_ERROR(RSX, "Unexpected precision modifier (%d)\n", precision); + rsx_log.error("Unexpected precision modifier (%d)\n", precision); break; } @@ -609,7 +609,7 @@ template std::string FragmentProgramDecompiler::GetSRC(T src) // UNK if (reg_var == "unk") { - LOG_ERROR(RSX, "Bad src reg num: %d", u32{ dst.src_attr_reg_num }); + rsx_log.error("Bad src reg num: %d", u32{ dst.src_attr_reg_num }); } ret += reg_var; @@ -633,7 +633,7 @@ template std::string FragmentProgramDecompiler::GetSRC(T src) break; case RSX_FP_REGISTER_TYPE_UNKNOWN: // ??? Used by a few games, what is it? - LOG_ERROR(RSX, "Src type 3 used, opcode=0x%X, dst=0x%X s0=0x%X s1=0x%X s2=0x%X", + rsx_log.error("Src type 3 used, opcode=0x%X, dst=0x%X s0=0x%X s1=0x%X s2=0x%X", dst.opcode, dst.HEX, src0.HEX, src1.HEX, src2.HEX); ret += AddType3(); @@ -641,7 +641,7 @@ template std::string FragmentProgramDecompiler::GetSRC(T src) break; default: - LOG_ERROR(RSX, "Bad src type %d", u32{ src.reg_type }); + rsx_log.error("Bad src type %d", u32{ src.reg_type }); Emu.Pause(); break; } @@ -714,7 +714,7 @@ std::string FragmentProgramDecompiler::BuildCode() if (!properties.has_discard_op) { // NOTE: Discard operation overrides output - LOG_WARNING(RSX, "Shader does not write to any output register and will be NOPed"); + rsx_log.warning("Shader does not write to any output register and will be NOPed"); main = "/*" + main + "*/"; } } @@ -1127,10 +1127,10 @@ std::string FragmentProgramDecompiler::Decompile() { case RSX_FP_OPCODE_BRK: if (m_loop_count) AddFlowOp("break"); - else LOG_ERROR(RSX, "BRK opcode found outside of a loop"); + else rsx_log.error("BRK opcode found outside of a loop"); break; case RSX_FP_OPCODE_CAL: - LOG_ERROR(RSX, "Unimplemented SIP instruction: CAL"); + rsx_log.error("Unimplemented SIP instruction: CAL"); break; case RSX_FP_OPCODE_FENCT: AddCode("//FENCT"); @@ -1212,7 +1212,7 @@ std::string FragmentProgramDecompiler::Decompile() if (handle_sct_scb(opcode)) break; forced_unit = FORCE_NONE; - LOG_ERROR(RSX, "Unknown/illegal instruction: 0x%x (forced unit %d)", opcode, prev_force_unit); + rsx_log.error("Unknown/illegal instruction: 0x%x (forced unit %d)", opcode, prev_force_unit); break; } @@ -1226,7 +1226,7 @@ std::string FragmentProgramDecompiler::Decompile() while (m_code_level > 1) { - LOG_ERROR(RSX, "Hanging block found at end of shader. Malformed shader?"); + rsx_log.error("Hanging block found at end of shader. Malformed shader?"); m_code_level--; AddCode("}"); diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp b/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp index adc69397df..8eb36e08f1 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp @@ -59,7 +59,7 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert if (!fast_exit) { // This can be harmless if a dangling RET was encountered before - LOG_ERROR(RSX, "vp_analyser: Possible infinite loop detected"); + rsx_log.error("vp_analyser: Possible infinite loop detected"); current_instrution++; continue; } @@ -142,7 +142,7 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert { if (call_stack.empty()) { - LOG_ERROR(RSX, "vp_analyser: RET found outside subroutine call"); + rsx_log.error("vp_analyser: RET found outside subroutine call"); } else { @@ -236,7 +236,7 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert { if (!dst_prog.instruction_mask[target]) { - LOG_ERROR(RSX, "vp_analyser: Failed, branch target 0x%x was not resolved", target); + rsx_log.error("vp_analyser: Failed, branch target 0x%x was not resolved", target); } } } diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.h b/rpcs3/Emu/RSX/Common/ProgramStateCache.h index 2fd55ebaaf..ef5e6d4d03 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.h +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.h @@ -213,7 +213,7 @@ protected: return std::forward_as_tuple(__null_vertex_program, false); } - LOG_NOTICE(RSX, "VP not found in buffer!"); + rsx_log.notice("VP not found in buffer!"); lock.upgrade(); auto [it, inserted] = m_vertex_shader_cache.try_emplace(rsx_vp); @@ -249,7 +249,7 @@ protected: return std::forward_as_tuple(__null_fragment_program, false); } - LOG_NOTICE(RSX, "FP not found in buffer!"); + rsx_log.notice("FP not found in buffer!"); fragment_program_ucode_copy = malloc(rsx_fp.ucode_length); verify("malloc() failed!" HERE), fragment_program_ucode_copy; @@ -419,7 +419,7 @@ public: } pipeline_storage_type pipeline = backend_traits::build_pipeline(link_entry->vp, link_entry->fp, link_entry->props, std::forward(args)...); - LOG_SUCCESS(RSX, "New program compiled successfully"); + rsx_log.success("New program compiled successfully"); std::lock_guard lock(m_pipeline_mutex); m_storage[key] = std::move(pipeline); @@ -469,13 +469,13 @@ public: } else { - LOG_NOTICE(RSX, "Add program (vp id = %d, fp id = %d)", vertex_program.id, fragment_program.id); + rsx_log.notice("Add program (vp id = %d, fp id = %d)", vertex_program.id, fragment_program.id); m_program_compiled_flag = true; pipeline_storage_type pipeline = backend_traits::build_pipeline(vertex_program, fragment_program, pipelineProperties, std::forward(args)...); std::lock_guard lock(m_pipeline_mutex); auto &rtn = m_storage[key] = std::move(pipeline); - LOG_SUCCESS(RSX, "New program compiled successfully"); + rsx_log.success("New program compiled successfully"); return rtn; } } @@ -496,7 +496,7 @@ public: return __null_pipeline_handle; } - LOG_NOTICE(RSX, "Add program (vp id = %d, fp id = %d)", vertex_program.id, fragment_program.id); + rsx_log.notice("Add program (vp id = %d, fp id = %d)", vertex_program.id, fragment_program.id); m_program_compiled_flag = true; lock.upgrade(); diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index cfa17f7974..8cf059cbae 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -752,7 +752,7 @@ u8 get_format_block_size_in_bytes(int format) case CELL_GCM_TEXTURE_COMPRESSED_DXT45: case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT: return 16; default: - LOG_ERROR(RSX, "Unimplemented block size in bytes for texture format: 0x%x", format); + rsx_log.error("Unimplemented block size in bytes for texture format: 0x%x", format); return 1; } } @@ -789,7 +789,7 @@ u8 get_format_block_size_in_texel(int format) case CELL_GCM_TEXTURE_COMPRESSED_DXT23: case CELL_GCM_TEXTURE_COMPRESSED_DXT45: return 4; default: - LOG_ERROR(RSX, "Unimplemented block size in texels for texture format: 0x%x", format); + rsx_log.error("Unimplemented block size in texels for texture format: 0x%x", format); return 1; } } @@ -916,7 +916,7 @@ static size_t get_texture_size(u32 format, u16 width, u16 height, u16 depth, u32 if (width > 1 || height > 1) { // If width == 1, the scanning just returns texel 0, so it is a valid setup - LOG_ERROR(RSX, "Invalid texture pitch setup, width=%d, height=%d, format=0x%x(0x%x)", + rsx_log.error("Invalid texture pitch setup, width=%d, height=%d, format=0x%x(0x%x)", width, height, format, gcm_format); } diff --git a/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp b/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp index 4ff17c52a5..c4d54775ec 100644 --- a/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp @@ -56,12 +56,12 @@ std::string VertexProgramDecompiler::GetDST(bool is_sca) { if (d3.dst > 15) { - LOG_ERROR(RSX, "dst index out of range: %u", d3.dst); + rsx_log.error("dst index out of range: %u", d3.dst); } if (is_address_reg) { - LOG_ERROR(RSX, "ARL opcode writing to output register!"); + rsx_log.error("ARL opcode writing to output register!"); } const auto reg_type = getFloatTypeName(4); @@ -120,7 +120,7 @@ std::string VertexProgramDecompiler::GetSRC(const u32 n) } else { - LOG_ERROR(RSX, "Bad input src num: %d", u32{ d1.input_src }); + rsx_log.error("Bad input src num: %d", u32{ d1.input_src }); ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), "in_unk", d1.input_src); } break; @@ -130,7 +130,7 @@ std::string VertexProgramDecompiler::GetSRC(const u32 n) break; default: - LOG_ERROR(RSX, "Bad src%u reg type: %d", n, u32{ src[n].reg_type }); + rsx_log.error("Bad src%u reg type: %d", n, u32{ src[n].reg_type }); Emu.Pause(); break; } @@ -192,7 +192,7 @@ void VertexProgramDecompiler::SetDST(bool is_sca, std::string value) else { // Broken instruction? - LOG_ERROR(RSX, "Operation has no output defined! (0x%x, 0x%x, 0x%x, 0x%x)", d0.HEX, d1.HEX, d2.HEX, d3.HEX); + rsx_log.error("Operation has no output defined! (0x%x, 0x%x, 0x%x, 0x%x)", d0.HEX, d1.HEX, d2.HEX, d3.HEX); dest = " //"; } @@ -284,7 +284,7 @@ std::string VertexProgramDecompiler::GetOptionalBranchCond() { std::string cond_operator = d3.brb_cond_true ? " != " : " == "; std::string cond = "(transform_branch_bits & (1 << " + std::to_string(d3.branch_index) + "))" + cond_operator + "0"; - + return "if (" + cond + ")"; } @@ -386,7 +386,7 @@ std::string VertexProgramDecompiler::BuildCode() bool is_valid = m_parr.HasParam(PF_PARAM_OUT, getFloatTypeName(4), "dst_reg0"); if (!is_valid) { - LOG_WARNING(RSX, "Vertex program has no POS output, shader will be NOPed"); + rsx_log.warning("Vertex program has no POS output, shader will be NOPed"); main_body = "/*" + main_body + "*/"; } @@ -488,7 +488,7 @@ std::string VertexProgramDecompiler::Decompile() while (!m_call_stack.empty()) { - LOG_ERROR(RSX, "vertex program end in subroutine call!"); + rsx_log.error("vertex program end in subroutine call!"); do_function_return(); } @@ -612,7 +612,7 @@ std::string VertexProgramDecompiler::Decompile() } default: AddCode(fmt::format("//Unknown vp opcode 0x%x", u32{ d1.vec_opcode })); - LOG_ERROR(RSX, "Unknown vp opcode 0x%x", u32{ d1.vec_opcode }); + rsx_log.error("Unknown vp opcode 0x%x", u32{ d1.vec_opcode }); program_end = true; break; } @@ -646,7 +646,7 @@ std::string VertexProgramDecompiler::Decompile() else { //TODO - LOG_ERROR(RSX, "BRA opcode found in subroutine!"); + rsx_log.error("BRA opcode found in subroutine!"); } } break; @@ -667,7 +667,7 @@ std::string VertexProgramDecompiler::Decompile() else { //TODO - LOG_ERROR(RSX, "BRI opcode found in subroutine!"); + rsx_log.error("BRI opcode found in subroutine!"); } } break; @@ -678,7 +678,7 @@ std::string VertexProgramDecompiler::Decompile() break; case RSX_SCA_OPCODE_CLI: // works same as BRI - LOG_ERROR(RSX, "Unimplemented VP opcode CLI"); + rsx_log.error("Unimplemented VP opcode CLI"); AddCode("//CLI"); do_function_call("$ifcond"); break; @@ -709,7 +709,7 @@ std::string VertexProgramDecompiler::Decompile() else { //TODO - LOG_ERROR(RSX, "BRA opcode found in subroutine!"); + rsx_log.error("BRA opcode found in subroutine!"); } break; @@ -721,16 +721,16 @@ std::string VertexProgramDecompiler::Decompile() break; case RSX_SCA_OPCODE_PSH: // works differently (PSH o[1].x A0;) - LOG_ERROR(RSX, "Unimplemented sca_opcode PSH"); + rsx_log.error("Unimplemented sca_opcode PSH"); break; case RSX_SCA_OPCODE_POP: // works differently (POP o[1].x;) - LOG_ERROR(RSX, "Unimplemented sca_opcode POP"); + rsx_log.error("Unimplemented sca_opcode POP"); break; default: AddCode(fmt::format("//Unknown vp sca_opcode 0x%x", u32{ d1.sca_opcode })); - LOG_ERROR(RSX, "Unknown vp sca_opcode 0x%x", u32{ d1.sca_opcode }); + rsx_log.error("Unknown vp sca_opcode 0x%x", u32{ d1.sca_opcode }); program_end = true; break; } @@ -744,7 +744,7 @@ std::string VertexProgramDecompiler::Decompile() if ((i + 1) < m_instr_count) { // In rare cases, this might be harmless (large coalesced program blocks controlled via branches aka ubershaders) - LOG_ERROR(RSX, "Vertex program block aborts prematurely. Expect glitches"); + rsx_log.error("Vertex program block aborts prematurely. Expect glitches"); } break; diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index ba5d487594..92224179f1 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -746,7 +746,7 @@ namespace rsx { if (address_is_bound(addr)) { - LOG_ERROR(RSX, "Cannot invalidate a currently bound render target!"); + rsx_log.error("Cannot invalidate a currently bound render target!"); return; } @@ -802,7 +802,7 @@ namespace rsx // Sanity check if (UNLIKELY(surface_internal_pitch > required_pitch)) { - LOG_WARNING(RSX, "Invalid 2D region descriptor. w=%d, h=%d, bpp=%d, pitch=%d", + rsx_log.warning("Invalid 2D region descriptor. w=%d, h=%d, bpp=%d, pitch=%d", required_width, required_height, required_bpp, required_pitch); return {}; } diff --git a/rpcs3/Emu/RSX/Common/surface_utils.h b/rpcs3/Emu/RSX/Common/surface_utils.h index 9e32ab0f8f..2a9f23eae9 100644 --- a/rpcs3/Emu/RSX/Common/surface_utils.h +++ b/rpcs3/Emu/RSX/Common/surface_utils.h @@ -159,7 +159,7 @@ namespace rsx if (!old_contents.empty()) { // Cascade resource derefs - LOG_ERROR(RSX, "Resource was destroyed whilst holding a resource reference!"); + rsx_log.error("Resource was destroyed whilst holding a resource reference!"); } } diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index e34feebf5f..0783fb5e4f 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -353,9 +353,9 @@ namespace rsx return; if (error) - LOG_ERROR(RSX, "%s", *result.first); + rsx_log.error("%s", *result.first); else - LOG_WARNING(RSX, "%s", *result.first); + rsx_log.warning("%s", *result.first); } template @@ -510,7 +510,7 @@ namespace rsx count++; } } - //LOG_ERROR(RSX, "Set protection of %d blocks to 0x%x", count, static_cast(prot)); + //rsx_log.error("Set protection of %d blocks to 0x%x", count, static_cast(prot)); }; auto discard_set = [this](std::vector& _set) @@ -1032,7 +1032,7 @@ namespace rsx if (dimensions_mismatch != nullptr) { auto &tex = *dimensions_mismatch; - LOG_WARNING(RSX, "Cached object for address 0x%X was found, but it does not match stored parameters (width=%d vs %d; height=%d vs %d; depth=%d vs %d; mipmaps=%d vs %d)", + rsx_log.warning("Cached object for address 0x%X was found, but it does not match stored parameters (width=%d vs %d; height=%d vs %d; depth=%d vs %d; mipmaps=%d vs %d)", range.start, width, tex.get_width(), height, tex.get_height(), depth, tex.get_depth(), mipmaps, tex.get_mipmaps()); } @@ -1170,7 +1170,7 @@ namespace rsx if (region_ptr == nullptr) { AUDIT(m_flush_always_cache.find(memory_range) == m_flush_always_cache.end()); - LOG_ERROR(RSX, "set_memory_flags(0x%x, 0x%x, %d): region_ptr == nullptr", memory_range.start, memory_range.end, static_cast(flags)); + rsx_log.error("set_memory_flags(0x%x, 0x%x, %d): region_ptr == nullptr", memory_range.start, memory_range.end, static_cast(flags)); return; } @@ -1766,7 +1766,7 @@ namespace rsx } else { - LOG_ERROR(RSX, "Unimplemented unnormalized sampling for texture type %d", static_cast(extended_dimension)); + rsx_log.error("Unimplemented unnormalized sampling for texture type %d", static_cast(extended_dimension)); } } @@ -1962,7 +1962,7 @@ namespace rsx if (UNLIKELY((src_h + src.offset_y) > src.height)) { // TODO: Special case that needs wrapping around (custom blit) - LOG_ERROR(RSX, "Transfer cropped in Y, src_h=%d, offset_y=%d, block_h=%d", src_h, src.offset_y, src.height); + rsx_log.error("Transfer cropped in Y, src_h=%d, offset_y=%d, block_h=%d", src_h, src.offset_y, src.height); src_h = src.height - src.offset_y; dst_h = u16(src_h * scale_y + 0.000001f); @@ -1971,7 +1971,7 @@ namespace rsx if (UNLIKELY((src_w + src.offset_x) > src.width)) { // TODO: Special case that needs wrapping around (custom blit) - LOG_ERROR(RSX, "Transfer cropped in X, src_w=%d, offset_x=%d, block_w=%d", src_w, src.offset_x, src.width); + rsx_log.error("Transfer cropped in X, src_w=%d, offset_x=%d, block_w=%d", src_w, src.offset_x, src.width); src_w = src.width - src.offset_x; dst_w = u16(src_w * scale_x + 0.000001f); @@ -2188,7 +2188,7 @@ namespace rsx } else { - //LOG_TRACE(RSX, "Blit transfer to surface with dims %dx%d", dst_dimensions.width, dst.height); + //rsx_log.trace("Blit transfer to surface with dims %dx%d", dst_dimensions.width, dst.height); } } @@ -2315,7 +2315,7 @@ namespace rsx if (cached_dest->is_depth_texture() != src_is_depth) { // Opt to cancel the destination. Can also use typeless convert - LOG_WARNING(RSX, "Format mismatch on blit destination block. Performance warning."); + rsx_log.warning("Format mismatch on blit destination block. Performance warning."); // The invalidate call before creating a new target will remove this section cached_dest = nullptr; diff --git a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h index b979ddb846..4511375dee 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h @@ -118,7 +118,7 @@ namespace rsx return CELL_GCM_TEXTURE_DEPTH16; } - LOG_ERROR(RSX, "Unsupported depth conversion (0x%X)", gcm_format); + rsx_log.error("Unsupported depth conversion (0x%X)", gcm_format); return gcm_format; } @@ -398,11 +398,11 @@ namespace rsx if (found_slices > 0) { //TODO: Gather remaining sides from the texture cache or upload from cpu (too slow?) - LOG_ERROR(RSX, "Could not gather all required slices for cubemap/3d generation"); + rsx_log.error("Could not gather all required slices for cubemap/3d generation"); } else { - LOG_WARNING(RSX, "Could not gather textures into an atlas; using CPU fallback..."); + rsx_log.warning("Could not gather textures into an atlas; using CPU fallback..."); } } } diff --git a/rpcs3/Emu/RSX/Common/texture_cache_utils.h b/rpcs3/Emu/RSX/Common/texture_cache_utils.h index 73b67d2e15..6b3a1a0a46 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_utils.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_utils.h @@ -1341,7 +1341,7 @@ namespace rsx void on_miss() { - LOG_WARNING(RSX, "Cache miss at address 0x%X. This is gonna hurt...", get_section_base()); + rsx_log.warning("Cache miss at address 0x%X. This is gonna hurt...", get_section_base()); m_tex_cache->on_miss(*derived()); } @@ -1456,7 +1456,7 @@ namespace rsx const auto num_exclusions = flush_exclusions.size(); if (num_exclusions > 0) { - LOG_WARNING(RSX, "Slow imp_flush path triggered with non-empty flush_exclusions (%d exclusions, %d bytes), performance might suffer", num_exclusions, valid_length); + rsx_log.warning("Slow imp_flush path triggered with non-empty flush_exclusions (%d exclusions, %d bytes), performance might suffer", num_exclusions, valid_length); } for (s32 remaining = s32(valid_length); remaining > 0; remaining -= rsx_pitch) diff --git a/rpcs3/Emu/RSX/GL/GLCompute.h b/rpcs3/Emu/RSX/GL/GLCompute.h index 85ae084a76..b0ec9a3267 100644 --- a/rpcs3/Emu/RSX/GL/GLCompute.h +++ b/rpcs3/Emu/RSX/GL/GLCompute.h @@ -231,7 +231,7 @@ namespace gl if ((num_bytes_to_process + data_offset) > data->size()) { // Technically robust buffer access should keep the driver from crashing in OOB situations - LOG_ERROR(RSX, "Inadequate buffer length submitted for a compute operation." + rsx_log.error("Inadequate buffer length submitted for a compute operation." "Required=%d bytes, Available=%d bytes", num_bytes_to_process, data->size()); } diff --git a/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp b/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp index bab67c096d..5eea910b42 100644 --- a/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/RSX/GL/GLFragmentProgram.cpp @@ -140,7 +140,7 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS) if (m_shadow_sampled_textures & mask) { if (m_2d_sampled_textures & mask) - LOG_ERROR(RSX, "Texture unit %d is sampled as both a shadow texture and a depth texture", index); + rsx_log.error("Texture unit %d is sampled as both a shadow texture and a depth texture", index); else samplerType = "sampler2DShadow"; } @@ -397,12 +397,12 @@ void GLFragmentProgram::Compile() char* buf = new char[infoLength]; // Buffer to store infoLog glGetShaderInfoLog(id, infoLength, &len, buf); // Retrieve the shader info log into our buffer - LOG_ERROR(RSX, "Failed to compile shader: %s", buf); // Write log to the console + rsx_log.error("Failed to compile shader: %s", buf); // Write log to the console delete[] buf; } - LOG_NOTICE(RSX, "%s", shader); // Log the text of the shader that failed to compile + rsx_log.notice("%s", shader); // Log the text of the shader that failed to compile Emu.Pause(); // Pause the emulator, we can't really continue from here } } @@ -415,7 +415,7 @@ void GLFragmentProgram::Delete() { if (Emu.IsStopped()) { - LOG_WARNING(RSX, "GLFragmentProgram::Delete(): glDeleteShader(%d) avoided", id); + rsx_log.warning("GLFragmentProgram::Delete(): glDeleteShader(%d) avoided", id); } else { diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 6f4771635a..f295737435 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -85,17 +85,17 @@ namespace { // Note : maybe add is signed on gl case rsx::blend_equation::add_signed: - LOG_TRACE(RSX, "blend equation add_signed used. Emulating using FUNC_ADD"); + rsx_log.trace("blend equation add_signed used. Emulating using FUNC_ADD"); case rsx::blend_equation::add: return GL_FUNC_ADD; case rsx::blend_equation::min: return GL_MIN; case rsx::blend_equation::max: return GL_MAX; case rsx::blend_equation::substract: return GL_FUNC_SUBTRACT; case rsx::blend_equation::reverse_substract_signed: - LOG_TRACE(RSX, "blend equation reverse_subtract_signed used. Emulating using FUNC_REVERSE_SUBTRACT"); + rsx_log.trace("blend equation reverse_subtract_signed used. Emulating using FUNC_REVERSE_SUBTRACT"); case rsx::blend_equation::reverse_substract: return GL_FUNC_REVERSE_SUBTRACT; case rsx::blend_equation::reverse_add_signed: default: - LOG_ERROR(RSX, "Blend equation 0x%X is unimplemented!", static_cast(op)); + rsx_log.error("Blend equation 0x%X is unimplemented!", static_cast(op)); return GL_FUNC_ADD; } } @@ -690,9 +690,9 @@ void GLGSRender::on_init_thread() if (g_cfg.video.debug_output) gl::enable_debugging(); - LOG_NOTICE(RSX, "GL RENDERER: %s (%s)", reinterpret_cast(glGetString(GL_RENDERER)), reinterpret_cast(glGetString(GL_VENDOR))); - LOG_NOTICE(RSX, "GL VERSION: %s", reinterpret_cast(glGetString(GL_VERSION))); - LOG_NOTICE(RSX, "GLSL VERSION: %s", reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION))); + rsx_log.notice("GL RENDERER: %s (%s)", reinterpret_cast(glGetString(GL_RENDERER)), reinterpret_cast(glGetString(GL_VENDOR))); + rsx_log.notice("GL VERSION: %s", reinterpret_cast(glGetString(GL_VERSION))); + rsx_log.notice("GLSL VERSION: %s", reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION))); auto& gl_caps = gl::get_driver_caps(); @@ -708,12 +708,12 @@ void GLGSRender::on_init_thread() if (!gl_caps.ARB_depth_buffer_float_supported && g_cfg.video.force_high_precision_z_buffer) { - LOG_WARNING(RSX, "High precision Z buffer requested but your GPU does not support GL_ARB_depth_buffer_float. Option ignored."); + rsx_log.warning("High precision Z buffer requested but your GPU does not support GL_ARB_depth_buffer_float. Option ignored."); } if (!gl_caps.ARB_texture_barrier_supported && !gl_caps.NV_texture_barrier_supported && !g_cfg.video.strict_rendering_mode) { - LOG_WARNING(RSX, "Texture barriers are not supported by your GPU. Feedback loops will have undefined results."); + rsx_log.warning("Texture barriers are not supported by your GPU. Feedback loops will have undefined results."); } //Use industry standard resource alignment values as defaults @@ -731,10 +731,10 @@ void GLGSRender::on_init_thread() m_min_texbuffer_alignment = std::max(m_min_texbuffer_alignment, 16); m_uniform_buffer_offset_align = std::max(m_uniform_buffer_offset_align, 16); - LOG_NOTICE(RSX, "Supported texel buffer size reported: %d bytes", m_max_texbuffer_size); + rsx_log.notice("Supported texel buffer size reported: %d bytes", m_max_texbuffer_size); if (m_max_texbuffer_size < (16 * 0x100000)) { - LOG_ERROR(RSX, "Max texture buffer size supported is less than 16M which is useless. Expect undefined behaviour."); + rsx_log.error("Max texture buffer size supported is less than 16M which is useless. Expect undefined behaviour."); m_max_texbuffer_size = (16 * 0x100000); } @@ -780,14 +780,14 @@ void GLGSRender::on_init_thread() if (!gl_caps.ARB_buffer_storage_supported) { - LOG_WARNING(RSX, "Forcing use of legacy OpenGL buffers because ARB_buffer_storage is not supported"); + rsx_log.warning("Forcing use of legacy OpenGL buffers because ARB_buffer_storage is not supported"); // TODO: do not modify config options g_cfg.video.gl_legacy_buffers.from_string("true"); } if (g_cfg.video.gl_legacy_buffers) { - LOG_WARNING(RSX, "Using legacy openGL buffers."); + rsx_log.warning("Using legacy openGL buffers."); manually_flush_ring_buffers = true; m_attrib_ring_buffer = std::make_unique(); diff --git a/rpcs3/Emu/RSX/GL/GLHelpers.cpp b/rpcs3/Emu/RSX/GL/GLHelpers.cpp index 9c8ba3fd08..6123d58592 100644 --- a/rpcs3/Emu/RSX/GL/GLHelpers.cpp +++ b/rpcs3/Emu/RSX/GL/GLHelpers.cpp @@ -49,12 +49,12 @@ namespace gl { case GL_DEBUG_TYPE_ERROR: { - LOG_ERROR(RSX, "%s", message); + rsx_log.error("%s", message); return; } default: { - LOG_WARNING(RSX, "%s", message); + rsx_log.warning("%s", message); return; } } @@ -120,7 +120,7 @@ namespace gl if (status != GL_FRAMEBUFFER_COMPLETE) { - LOG_ERROR(RSX, "FBO check failed: 0x%04x", status); + rsx_log.error("FBO check failed: 0x%04x", status); return false; } diff --git a/rpcs3/Emu/RSX/GL/GLHelpers.h b/rpcs3/Emu/RSX/GL/GLHelpers.h index 3b3c6d3a46..5930a62f92 100644 --- a/rpcs3/Emu/RSX/GL/GLHelpers.h +++ b/rpcs3/Emu/RSX/GL/GLHelpers.h @@ -125,7 +125,7 @@ namespace gl { if (ext_name == test) { - LOG_NOTICE(RSX, "Extension %s is supported", ext_name); + rsx_log.notice("Extension %s is supported", ext_name); return true; } @@ -230,7 +230,7 @@ namespace gl } else { - LOG_ERROR(RSX, "Failed to get vendor string from driver. Are we missing a context?"); + rsx_log.error("Failed to get vendor string from driver. Are we missing a context?"); vendor_string = "intel"; //lowest acceptable value } @@ -362,7 +362,7 @@ namespace gl switch (err) { default: - LOG_ERROR(RSX, "gl::fence sync returned unknown error 0x%X", err); + rsx_log.error("gl::fence sync returned unknown error 0x%X", err); case GL_ALREADY_SIGNALED: case GL_CONDITION_SATISFIED: done = true; @@ -997,7 +997,7 @@ namespace gl } else { - LOG_ERROR(RSX, "OOM Error: Ring buffer was likely being used without notify() being called"); + rsx_log.error("OOM Error: Ring buffer was likely being used without notify() being called"); glFinish(); } @@ -1832,7 +1832,7 @@ namespace gl } else { - LOG_WARNING(RSX, "Cubemap upload via texture::copy_from is halfplemented!"); + rsx_log.warning("Cubemap upload via texture::copy_from is halfplemented!"); auto ptr = static_cast(src); const auto end = std::min(6u, region.z + region.depth); for (unsigned face = region.z; face < end; ++face) @@ -2760,7 +2760,7 @@ public: error_msg = buf.get(); } - LOG_ERROR(RSX, "Validation failed: %s", error_msg.c_str()); + rsx_log.error("Validation failed: %s", error_msg.c_str()); } } diff --git a/rpcs3/Emu/RSX/GL/GLOverlays.h b/rpcs3/Emu/RSX/GL/GLOverlays.h index 7d9aec3ea2..94a3d3a0f7 100644 --- a/rpcs3/Emu/RSX/GL/GLOverlays.h +++ b/rpcs3/Emu/RSX/GL/GLOverlays.h @@ -136,7 +136,7 @@ namespace gl { if (!compiled) { - LOG_ERROR(RSX, "You must initialize overlay passes with create() before calling run()"); + rsx_log.error("You must initialize overlay passes with create() before calling run()"); return; } @@ -267,7 +267,7 @@ namespace gl } else { - LOG_ERROR(RSX, "Overlay pass failed because framebuffer was not complete. Run with debug output enabled to diagnose the problem"); + rsx_log.error("Overlay pass failed because framebuffer was not complete. Run with debug output enabled to diagnose the problem"); } } }; diff --git a/rpcs3/Emu/RSX/GL/GLPresent.cpp b/rpcs3/Emu/RSX/GL/GLPresent.cpp index 0944142a8d..b26873589a 100644 --- a/rpcs3/Emu/RSX/GL/GLPresent.cpp +++ b/rpcs3/Emu/RSX/GL/GLPresent.cpp @@ -61,7 +61,7 @@ GLuint GLGSRender::get_present_source(gl::present_surface_info* info, const rsx: if (!image) { - LOG_WARNING(RSX, "Flip texture was not found in cache. Uploading surface from CPU"); + rsx_log.warning("Flip texture was not found in cache. Uploading surface from CPU"); gl::pixel_unpack_settings unpack_settings; unpack_settings.alignment(1).row_length(info->pitch / 4); diff --git a/rpcs3/Emu/RSX/GL/GLProgramBuffer.h b/rpcs3/Emu/RSX/GL/GLProgramBuffer.h index 166a631c81..b3ae265813 100644 --- a/rpcs3/Emu/RSX/GL/GLProgramBuffer.h +++ b/rpcs3/Emu/RSX/GL/GLProgramBuffer.h @@ -75,12 +75,12 @@ struct GLTraits result->uniforms[0] = GL_STREAM_BUFFER_START + 0; result->uniforms[1] = GL_STREAM_BUFFER_START + 1; - LOG_NOTICE(RSX, "*** prog id = %d", result->id()); - LOG_NOTICE(RSX, "*** vp id = %d", vertexProgramData.id); - LOG_NOTICE(RSX, "*** fp id = %d", fragmentProgramData.id); + rsx_log.notice("*** prog id = %d", result->id()); + rsx_log.notice("*** vp id = %d", vertexProgramData.id); + rsx_log.notice("*** fp id = %d", fragmentProgramData.id); - LOG_NOTICE(RSX, "*** vp shader = \n%s", vertexProgramData.shader.c_str()); - LOG_NOTICE(RSX, "*** fp shader = \n%s", fragmentProgramData.shader.c_str()); + rsx_log.notice("*** vp shader = \n%s", vertexProgramData.shader.c_str()); + rsx_log.notice("*** fp shader = \n%s", fragmentProgramData.shader.c_str()); return result; } diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index ce3a179f84..9381903959 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -146,7 +146,7 @@ namespace gl case GL_RGBA8: return GL_SRGB8_ALPHA8; default: - //LOG_ERROR(RSX, "No gamma conversion for format 0x%X", in_format); + //rsx_log.error("No gamma conversion for format 0x%X", in_format); return in_format; } } @@ -165,7 +165,7 @@ namespace gl case rsx::texture_wrap_mode::mirror_once_clamp: return GL_MIRROR_CLAMP_EXT; } - LOG_ERROR(RSX, "Texture wrap error: bad wrap (%d)", static_cast(wrap)); + rsx_log.error("Texture wrap error: bad wrap (%d)", static_cast(wrap)); return GL_REPEAT; } @@ -183,7 +183,7 @@ namespace gl case rsx::texture_max_anisotropy::x16: return 16.0f; } - LOG_ERROR(RSX, "Texture anisotropy error: bad max aniso (%d)", static_cast(aniso)); + rsx_log.error("Texture anisotropy error: bad max aniso (%d)", static_cast(aniso)); return 1.0f; } @@ -245,7 +245,7 @@ namespace gl case GL_LINEAR_MIPMAP_LINEAR: min_filter = GL_LINEAR; break; default: - LOG_ERROR(RSX, "No mipmap fallback defined for rsx_min_filter = 0x%X", static_cast(tex.min_filter())); + rsx_log.error("No mipmap fallback defined for rsx_min_filter = 0x%X", static_cast(tex.min_filter())); min_filter = GL_NEAREST; } } @@ -591,7 +591,7 @@ namespace gl switch (remap_lookup[channel]) { default: - LOG_ERROR(RSX, "Unknown remap function 0x%X", remap_lookup[channel]); + rsx_log.error("Unknown remap function 0x%X", remap_lookup[channel]); case CELL_GCM_TEXTURE_REMAP_REMAP: remap_values[channel] = swizzle_remap[remap_inputs[channel]]; break; diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index 3e7a033679..157e942f1b 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -184,11 +184,11 @@ namespace gl // AMD driver bug // Pixel transfer fails with GL_OUT_OF_MEMORY. Usually happens with float textures or operations attempting to swap endianness. // Failed operations also leak a large amount of memory - LOG_ERROR(RSX, "Memory transfer failure (AMD bug). Please update your driver to Adrenalin 19.4.3 or newer. Format=0x%x, Type=0x%x, Swap=%d", static_cast(format), static_cast(type), pack_unpack_swap_bytes); + rsx_log.error("Memory transfer failure (AMD bug). Please update your driver to Adrenalin 19.4.3 or newer. Format=0x%x, Type=0x%x, Swap=%d", static_cast(format), static_cast(type), pack_unpack_swap_bytes); } else { - LOG_ERROR(RSX, "Memory transfer failed with error 0x%x. Format=0x%x, Type=0x%x", error, static_cast(format), static_cast(type)); + rsx_log.error("Memory transfer failed with error 0x%x. Format=0x%x, Type=0x%x", error, static_cast(format), static_cast(type)); } } @@ -730,7 +730,7 @@ namespace gl if (GLenum err = glGetError()) { - LOG_WARNING(RSX, "Failed to copy image subresource with GL error 0x%X", err); + rsx_log.warning("Failed to copy image subresource with GL error 0x%X", err); return nullptr; } @@ -752,7 +752,7 @@ namespace gl if (GLenum err = glGetError()) { - LOG_WARNING(RSX, "Failed to copy image subresource with GL error 0x%X", err); + rsx_log.warning("Failed to copy image subresource with GL error 0x%X", err); return nullptr; } diff --git a/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp b/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp index c82d0e4926..eaddc162f5 100644 --- a/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp +++ b/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp @@ -300,11 +300,11 @@ void GLVertexProgram::Compile() char* buf = new char[r + 1](); GLsizei len; glGetShaderInfoLog(id, r, &len, buf); - LOG_ERROR(RSX, "Failed to compile vertex shader: %s", buf); + rsx_log.error("Failed to compile vertex shader: %s", buf); delete[] buf; } - LOG_NOTICE(RSX, "%s", shader.c_str()); + rsx_log.notice("%s", shader.c_str()); Emu.Pause(); } } @@ -317,7 +317,7 @@ void GLVertexProgram::Delete() { if (Emu.IsStopped()) { - LOG_WARNING(RSX, "GLVertexProgram::Delete(): glDeleteShader(%d) avoided", id); + rsx_log.warning("GLVertexProgram::Delete(): glDeleteShader(%d) avoided", id); } else { diff --git a/rpcs3/Emu/RSX/GL/OpenGL.cpp b/rpcs3/Emu/RSX/GL/OpenGL.cpp index 8c2a7f8886..599f4ca535 100644 --- a/rpcs3/Emu/RSX/GL/OpenGL.cpp +++ b/rpcs3/Emu/RSX/GL/OpenGL.cpp @@ -25,7 +25,7 @@ void gl::init() #ifdef _WIN32 #define OPENGL_PROC(p, n) OPENGL_PROC2(p, gl##n, gl##n) #define WGL_PROC(p, n) OPENGL_PROC2(p, wgl##n, wgl##n) -#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(n = (p)wglGetProcAddress(#tn))) LOG_ERROR(RSX, "OpenGL: initialization of " #tn " failed.") +#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(n = (p)wglGetProcAddress(#tn))) rsx_log.error("OpenGL: initialization of " #tn " failed.") #include "GLProcTable.h" #undef OPENGL_PROC #undef WGL_PROC @@ -55,8 +55,8 @@ void gl::set_swapinterval(int interval) } //No existing drawable or missing swap extension, EGL? - LOG_ERROR(RSX, "Failed to set swap interval"); + rsx_log.error("Failed to set swap interval"); #else - LOG_ERROR(RSX, "Swap control not implemented for this platform. Vsync options not available."); + rsx_log.error("Swap control not implemented for this platform. Vsync options not available."); #endif } diff --git a/rpcs3/Emu/RSX/Overlays/overlay_controls.h b/rpcs3/Emu/RSX/Overlays/overlay_controls.h index 482a669d2e..7a06f18737 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_controls.h +++ b/rpcs3/Emu/RSX/Overlays/overlay_controls.h @@ -131,7 +131,7 @@ namespace rsx { if (!fs::is_file(filename)) { - LOG_ERROR(RSX, "Image resource file `%s' not found", filename); + rsx_log.error("Image resource file `%s' not found", filename); return; } diff --git a/rpcs3/Emu/RSX/Overlays/overlay_font.cpp b/rpcs3/Emu/RSX/Overlays/overlay_font.cpp index f7978c58c2..4576a2bad3 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_font.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_font.cpp @@ -68,7 +68,7 @@ namespace rsx file_path = fallback_font; font_found = true; - LOG_NOTICE(RSX, "Found font file '%s' as a replacement for '%s'", fallback_font.c_str(), ttf_name); + rsx_log.notice("Found font file '%s' as a replacement for '%s'", fallback_font.c_str(), ttf_name); break; } } @@ -82,7 +82,7 @@ namespace rsx } else { - LOG_ERROR(RSX, "Failed to initialize font '%s.ttf'", ttf_name); + rsx_log.error("Failed to initialize font '%s.ttf'", ttf_name); return; } @@ -92,7 +92,7 @@ namespace rsx stbtt_pack_context context; if (!stbtt_PackBegin(&context, glyph_data.data(), width, height, 0, 1, nullptr)) { - LOG_ERROR(RSX, "Font packing failed"); + rsx_log.error("Font packing failed"); return; } @@ -104,7 +104,7 @@ namespace rsx if (!stbtt_PackFontRange(&context, bytes.data(), 0, size_px, 0, 256, pack_info.data())) { - LOG_ERROR(RSX, "Font packing failed"); + rsx_log.error("Font packing failed"); stbtt_PackEnd(&context); return; } diff --git a/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp b/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp index 98885adfe2..99f6352841 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp @@ -212,7 +212,7 @@ namespace rsx { if (auto error = run_input_loop()) { - LOG_ERROR(RSX, "Dialog input loop exited with error code=%d", error); + rsx_log.error("Dialog input loop exited with error code=%d", error); return error; } } @@ -235,7 +235,7 @@ namespace rsx { if (auto error = run_input_loop()) { - LOG_ERROR(RSX, "Dialog input loop exited with error code=%d", error); + rsx_log.error("Dialog input loop exited with error code=%d", error); } } else diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp index 583d732909..58c9c6ac0f 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp @@ -191,7 +191,7 @@ namespace rsx { if (auto error = run_input_loop()) { - LOG_ERROR(RSX, "Osk input loop exited with error code=%d", error); + rsx_log.error("Osk input loop exited with error code=%d", error); } }); } diff --git a/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp b/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp index 30a4b8c1cb..0321451302 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp @@ -34,7 +34,7 @@ namespace rsx } catch (const std::exception& e) { - LOG_ERROR(RSX, "Overlays: tried to convert incompatible color code: '%s' exception: '%s'", hex_color, e.what()); + rsx_log.error("Overlays: tried to convert incompatible color code: '%s' exception: '%s'", hex_color, e.what()); return color4f(0.0f, 0.0f, 0.0f, 0.0f); } diff --git a/rpcs3/Emu/RSX/Overlays/overlay_save_dialog.cpp b/rpcs3/Emu/RSX/Overlays/overlay_save_dialog.cpp index bb727a6c2c..2f4979c21f 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_save_dialog.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_save_dialog.cpp @@ -136,7 +136,7 @@ namespace rsx m_list->select_next(10); break; default: - LOG_TRACE(RSX, "[ui] Button %d pressed", static_cast(button_press)); + rsx_log.trace("[ui] Button %d pressed", static_cast(button_press)); } } diff --git a/rpcs3/Emu/RSX/Overlays/overlays.cpp b/rpcs3/Emu/RSX/Overlays/overlays.cpp index 383994dde0..54077269a8 100644 --- a/rpcs3/Emu/RSX/Overlays/overlays.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlays.cpp @@ -211,7 +211,7 @@ namespace rsx { if (++pad_index >= CELL_PAD_MAX_PORT_NUM) { - LOG_FATAL(RSX, "The native overlay cannot handle more than 7 pads! Current number of pads: %d", pad_index + 1); + rsx_log.fatal("The native overlay cannot handle more than 7 pads! Current number of pads: %d", pad_index + 1); continue; } diff --git a/rpcs3/Emu/RSX/RSXFIFO.cpp b/rpcs3/Emu/RSX/RSXFIFO.cpp index 87add68d35..662a9e3ede 100644 --- a/rpcs3/Emu/RSX/RSXFIFO.cpp +++ b/rpcs3/Emu/RSX/RSXFIFO.cpp @@ -206,7 +206,7 @@ namespace rsx { if (enabled) { - LOG_WARNING(RSX, "FIFO optimizations have been disabled as the application is not compatible with per-frame analysis"); + rsx_log.warning("FIFO optimizations have been disabled as the application is not compatible with per-frame analysis"); reset(false); fifo_hint = optimization_hint::application_not_compatible; @@ -307,7 +307,7 @@ namespace rsx } else { - LOG_ERROR(RSX, "Fifo flattener misalignment, disable FIFO reordering and report to developers"); + rsx_log.error("Fifo flattener misalignment, disable FIFO reordering and report to developers"); begin_end_ctr = 0; flush_cmd = 0u; } @@ -400,7 +400,7 @@ namespace rsx } case FIFO::FIFO_ERROR: { - LOG_ERROR(RSX, "FIFO error: possible desync event (last cmd = 0x%x)", fifo_ctrl->last_cmd()); + rsx_log.error("FIFO error: possible desync event (last cmd = 0x%x)", fifo_ctrl->last_cmd()); recover_fifo(); return; } @@ -422,7 +422,7 @@ namespace rsx performance_counters.state = FIFO_state::spinning; } - //LOG_WARNING(RSX, "rsx jump(0x%x) #addr=0x%x, cmd=0x%x, get=0x%x, put=0x%x", offs, m_ioAddress + get, cmd, get, put); + //rsx_log.warning("rsx jump(0x%x) #addr=0x%x, cmd=0x%x, get=0x%x, put=0x%x", offs, m_ioAddress + get, cmd, get, put); fifo_ctrl->set_get(offs); return; } @@ -441,7 +441,7 @@ namespace rsx performance_counters.state = FIFO_state::spinning; } - //LOG_WARNING(RSX, "rsx jump(0x%x) #addr=0x%x, cmd=0x%x, get=0x%x, put=0x%x", offs, m_ioAddress + get, cmd, get, put); + //rsx_log.warning("rsx jump(0x%x) #addr=0x%x, cmd=0x%x, get=0x%x, put=0x%x", offs, m_ioAddress + get, cmd, get, put); fifo_ctrl->set_get(offs); return; } @@ -450,7 +450,7 @@ namespace rsx if (fifo_ret_addr != RSX_CALL_STACK_EMPTY) { // Only one layer is allowed in the call stack. - LOG_ERROR(RSX, "FIFO: CALL found inside a subroutine. Discarding subroutine"); + rsx_log.error("FIFO: CALL found inside a subroutine. Discarding subroutine"); fifo_ctrl->set_get(std::exchange(fifo_ret_addr, RSX_CALL_STACK_EMPTY)); return; } @@ -464,7 +464,7 @@ namespace rsx { if (fifo_ret_addr == RSX_CALL_STACK_EMPTY) { - LOG_ERROR(RSX, "FIFO: RET found without corresponding CALL. Discarding queue"); + rsx_log.error("FIFO: RET found without corresponding CALL. Discarding queue"); fifo_ctrl->set_get(ctrl->put); return; } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 3ba7802455..046738dbb2 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -114,7 +114,7 @@ namespace rsx case CELL_GCM_CONTEXT_DMA_DEVICE_RW: case CELL_GCM_CONTEXT_DMA_DEVICE_R: - { + { if (offset < 0x100000 /*&& (offset % 0x10) == 0*/) { return render->device_addr + offset; @@ -455,7 +455,7 @@ namespace rsx } catch (const std::exception& e) { - LOG_FATAL(RSX, "%s thrown: %s", typeid(e).name(), e.what()); + rsx_log.fatal("%s thrown: %s", typeid(e).name(), e.what()); Emu.Pause(); } @@ -704,7 +704,7 @@ namespace rsx switch (clip_plane_control[index]) { default: - LOG_ERROR(RSX, "bad clip plane control (0x%x)", static_cast(clip_plane_control[index])); + rsx_log.error("bad clip plane control (0x%x)", static_cast(clip_plane_control[index])); case rsx::user_clip_plane_op::disable: clip_enabled_flags[index] = 0; @@ -957,7 +957,7 @@ namespace rsx if (layout.width == 0 || layout.height == 0) { - LOG_TRACE(RSX, "Invalid framebuffer setup, w=%d, h=%d", layout.width, layout.height); + rsx_log.trace("Invalid framebuffer setup, w=%d, h=%d", layout.width, layout.height); return; } @@ -1077,7 +1077,7 @@ namespace rsx switch (const auto mode = rsx::method_registers.surface_type()) { default: - LOG_ERROR(RSX, "Unknown raster mode 0x%x", static_cast(mode)); + rsx_log.error("Unknown raster mode 0x%x", static_cast(mode)); [[fallthrough]]; case rsx::surface_raster_type::linear: break; @@ -1130,7 +1130,7 @@ namespace rsx if (layout.color_pitch[index] < minimum_color_pitch) { // Unlike the depth buffer, when given a color target we know it is intended to be rendered to - LOG_ERROR(RSX, "Framebuffer setup error: Color target failed pitch check, Pitch=[%d, %d, %d, %d] + %d, target=%d, context=%d", + rsx_log.error("Framebuffer setup error: Color target failed pitch check, Pitch=[%d, %d, %d, %d] + %d, target=%d, context=%d", layout.color_pitch[0], layout.color_pitch[1], layout.color_pitch[2], layout.color_pitch[3], layout.zeta_pitch, static_cast(layout.target), static_cast(context)); @@ -1140,7 +1140,7 @@ namespace rsx if (layout.color_addresses[index] == layout.zeta_address) { - LOG_WARNING(RSX, "Framebuffer at 0x%X has aliasing color/depth targets, color_index=%d, zeta_pitch = %d, color_pitch=%d, context=%d", + rsx_log.warning("Framebuffer at 0x%X has aliasing color/depth targets, color_index=%d, zeta_pitch = %d, color_pitch=%d, context=%d", layout.zeta_address, index, layout.zeta_pitch, layout.color_pitch[index], static_cast(context)); m_framebuffer_state_contested = true; @@ -1182,7 +1182,7 @@ namespace rsx if (!framebuffer_status_valid && !layout.zeta_address) { - LOG_WARNING(RSX, "Framebuffer setup failed. Draw calls may have been lost"); + rsx_log.warning("Framebuffer setup failed. Draw calls may have been lost"); return; } @@ -1201,7 +1201,7 @@ namespace rsx // Tested with Turbo: Super stunt squad that only changes the window offset to declare new framebuffers // Sampling behavior clearly indicates the addresses are expected to have changed if (auto clip_type = rsx::method_registers.window_clip_type()) - LOG_ERROR(RSX, "Unknown window clip type 0x%X" HERE, clip_type); + rsx_log.error("Unknown window clip type 0x%X" HERE, clip_type); for (const auto &index : rsx::utility::get_rtt_indexes(layout.target)) { @@ -1221,7 +1221,7 @@ namespace rsx if ((window_clip_width && window_clip_width < layout.width) || (window_clip_height && window_clip_height < layout.height)) { - LOG_ERROR(RSX, "Unexpected window clip dimensions: window_clip=%dx%d, surface_clip=%dx%d", + rsx_log.error("Unexpected window clip dimensions: window_clip=%dx%d, surface_clip=%dx%d", window_clip_width, window_clip_height, layout.width, layout.height); } @@ -1676,7 +1676,7 @@ namespace rsx break; } default: - LOG_ERROR(RSX, "Depth texture bound to pipeline with unexpected format 0x%X", format); + rsx_log.error("Depth texture bound to pipeline with unexpected format 0x%X", format); } } else if (!backend_config.supports_hw_renormalization) @@ -1734,7 +1734,7 @@ namespace rsx //Check that the depth stage is not disabled if (!rsx::method_registers.depth_test_enabled()) { - LOG_ERROR(RSX, "FS exports depth component but depth test is disabled (INVALID_OPERATION)"); + rsx_log.error("FS exports depth component but depth test is disabled (INVALID_OPERATION)"); } } } @@ -2168,7 +2168,7 @@ namespace rsx return; } default: - LOG_ERROR(RSX, "Unknown zcull stat type %d", type); + rsx_log.error("Unknown zcull stat type %d", type); break; } } @@ -2520,7 +2520,7 @@ namespace rsx f.write(os.str()); } - LOG_SUCCESS(RSX, "capture successful: %s", filePath.c_str()); + rsx_log.success("capture successful: %s", filePath.c_str()); frame_capture.reset(); Emu.Pause(); @@ -2566,7 +2566,7 @@ namespace rsx if (g_cfg.video.frame_skip_enabled) { - LOG_ERROR(RSX, "Frame skip is not compatible with this application"); + rsx_log.error("Frame skip is not compatible with this application"); } } @@ -2836,7 +2836,7 @@ namespace rsx if (!m_pending_writes.front().query) { // If this happens, the assert above will fire. There should never be a queue header with no work to be done - LOG_ERROR(RSX, "Close to our death."); + rsx_log.error("Close to our death."); } m_next_tsc = 0; @@ -2939,7 +2939,7 @@ namespace rsx { if (It->query->sync_tag > m_sync_tag) { - // LOG_TRACE(RSX, "[Performance warning] Query hint emit during sync command."); + // rsx_log.trace("[Performance warning] Query hint emit during sync command."); ptimer->sync_hint(FIFO_hint::hint_zcull_sync, It->query); } diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 2b1c9d621d..fc31cde5d3 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -538,7 +538,7 @@ namespace rsx while (!buffer_queue.empty()); // Need to observe this happening in the wild - LOG_ERROR(RSX, "Display queue was discarded while not empty!"); + rsx_log.error("Display queue was discarded while not empty!"); return false; } }; diff --git a/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp b/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp index 2a88c73223..9630dd6bae 100644 --- a/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp +++ b/rpcs3/Emu/RSX/VK/VKCommonDecompiler.cpp @@ -184,8 +184,8 @@ namespace vk } else { - LOG_ERROR(RSX, "%s", shader_object.getInfoLog()); - LOG_ERROR(RSX, "%s", shader_object.getInfoDebugLog()); + rsx_log.error("%s", shader_object.getInfoLog()); + rsx_log.error("%s", shader_object.getInfoDebugLog()); } return success; diff --git a/rpcs3/Emu/RSX/VK/VKCompute.h b/rpcs3/Emu/RSX/VK/VKCompute.h index 36937ea999..63ceea4d47 100644 --- a/rpcs3/Emu/RSX/VK/VKCompute.h +++ b/rpcs3/Emu/RSX/VK/VKCompute.h @@ -357,7 +357,7 @@ namespace vk if ((num_bytes_to_process + data_offset) > data->size()) { // Technically robust buffer access should keep the driver from crashing in OOB situations - LOG_ERROR(RSX, "Inadequate buffer length submitted for a compute operation." + rsx_log.error("Inadequate buffer length submitted for a compute operation." "Required=%d bytes, Available=%d bytes", num_bytes_to_process, data->size()); } diff --git a/rpcs3/Emu/RSX/VK/VKDMA.cpp b/rpcs3/Emu/RSX/VK/VKDMA.cpp index aaad5f3235..51847bf6e1 100644 --- a/rpcs3/Emu/RSX/VK/VKDMA.cpp +++ b/rpcs3/Emu/RSX/VK/VKDMA.cpp @@ -337,7 +337,7 @@ namespace vk { // Technically legal but assuming a map->flush usage, this shouldnot happen // Optimizations could in theory batch together multiple transfers though - LOG_ERROR(RSX, "Sink request spans multiple allocated blocks!"); + rsx_log.error("Sink request spans multiple allocated blocks!"); const auto write_end = (sync_end + 1u); const auto written = (write_end - local_address); length -= written; @@ -349,7 +349,7 @@ namespace vk } else { - LOG_ERROR(RSX, "Sync command on range not mapped!"); + rsx_log.error("Sync command on range not mapped!"); return; } } diff --git a/rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp b/rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp index 97b8bdf395..79baa93b92 100644 --- a/rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp +++ b/rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp @@ -137,7 +137,7 @@ void VKFragmentDecompilerThread::insertConstants(std::stringstream & OS) if (m_shadow_sampled_textures & mask) { if (m_2d_sampled_textures & mask) - LOG_ERROR(RSX, "Texture unit %d is sampled as both a shadow texture and a depth texture", index); + rsx_log.error("Texture unit %d is sampled as both a shadow texture and a depth texture", index); else samplerType = "sampler2DShadow"; } diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 4af4b03bef..e249907123 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -119,7 +119,7 @@ namespace vk return std::make_pair(VK_FORMAT_R32_SFLOAT, vk::default_component_map()); default: - LOG_ERROR(RSX, "Surface color buffer: Unsupported surface color format (0x%x)", static_cast(color_format)); + rsx_log.error("Surface color buffer: Unsupported surface color format (0x%x)", static_cast(color_format)); return std::make_pair(VK_FORMAT_B8G8R8A8_UNORM, vk::default_component_map()); } } @@ -178,12 +178,12 @@ namespace vk switch (op) { case rsx::blend_equation::add_signed: - LOG_TRACE(RSX, "blend equation add_signed used. Emulating using FUNC_ADD"); + rsx_log.trace("blend equation add_signed used. Emulating using FUNC_ADD"); case rsx::blend_equation::add: return VK_BLEND_OP_ADD; case rsx::blend_equation::substract: return VK_BLEND_OP_SUBTRACT; case rsx::blend_equation::reverse_substract_signed: - LOG_TRACE(RSX, "blend equation reverse_subtract_signed used. Emulating using FUNC_REVERSE_SUBTRACT"); + rsx_log.trace("blend equation reverse_subtract_signed used. Emulating using FUNC_REVERSE_SUBTRACT"); case rsx::blend_equation::reverse_substract: return VK_BLEND_OP_REVERSE_SUBTRACT; case rsx::blend_equation::min: return VK_BLEND_OP_MIN; case rsx::blend_equation::max: return VK_BLEND_OP_MAX; @@ -362,7 +362,7 @@ VKGSRender::VKGSRender() : GSRender() } else { - LOG_FATAL(RSX, "Could not find a vulkan compatible GPU driver. Your GPU(s) may not support Vulkan, or you need to install the vulkan runtime and drivers"); + rsx_log.fatal("Could not find a vulkan compatible GPU driver. Your GPU(s) may not support Vulkan, or you need to install the vulkan runtime and drivers"); m_device = VK_NULL_HANDLE; return; } @@ -374,7 +374,7 @@ VKGSRender::VKGSRender() : GSRender() if (gpus.empty()) { //We can't throw in Emulator::Load, so we show error and return - LOG_FATAL(RSX, "No compatible GPU devices found"); + rsx_log.fatal("No compatible GPU devices found"); m_device = VK_NULL_HANDLE; return; } @@ -412,7 +412,7 @@ VKGSRender::VKGSRender() : GSRender() if (!m_swapchain) { m_device = VK_NULL_HANDLE; - LOG_FATAL(RSX, "Could not successfully initialize a swapchain"); + rsx_log.fatal("Could not successfully initialize a swapchain"); return; } @@ -487,7 +487,7 @@ VKGSRender::VKGSRender() : GSRender() if (m_texbuffer_view_size < 0x800000) { // Warn, only possibly expected on macOS - LOG_WARNING(RSX, "Current driver may crash due to memory limitations (%uk)", m_texbuffer_view_size / 1024); + rsx_log.warning("Current driver may crash due to memory limitations (%uk)", m_texbuffer_view_size / 1024); } for (auto &ctx : frame_context_storage) @@ -742,7 +742,7 @@ bool VKGSRender::on_access_violation(u32 address, bool is_writing) { if (vk::is_uninterruptible()) { - LOG_ERROR(RSX, "Fault in uninterruptible code!"); + rsx_log.error("Fault in uninterruptible code!"); } //Flush primary cb queue to sync pending changes (e.g image transitions!) @@ -1710,7 +1710,7 @@ void VKGSRender::end() if (!image_ptr) { - LOG_ERROR(RSX, "Texture upload failed to vtexture index %d. Binding null sampler.", i); + rsx_log.error("Texture upload failed to vtexture index %d. Binding null sampler.", i); m_program->bind_uniform({ vk::null_sampler(), vk::null_image_view(*m_current_command_buffer)->value, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL }, i, ::glsl::program_domain::glsl_vertex_program, @@ -1785,13 +1785,13 @@ void VKGSRender::end() if (occlusion_id == UINT32_MAX) { // Force flush - LOG_ERROR(RSX, "[Performance Warning] Out of free occlusion slots. Forcing hard sync."); + rsx_log.error("[Performance Warning] Out of free occlusion slots. Forcing hard sync."); ZCULL_control::sync(this); occlusion_id = m_occlusion_query_pool.find_free_slot(); if (occlusion_id == UINT32_MAX) { - //LOG_ERROR(RSX, "Occlusion pool overflow"); + //rsx_log.error("Occlusion pool overflow"); if (m_current_task) m_current_task->result = 1; } } @@ -2167,7 +2167,7 @@ void VKGSRender::flush_command_queue(bool hard_sync) if (!m_current_command_buffer->poke()) { - LOG_ERROR(RSX, "CB chain has run out of free entries!"); + rsx_log.error("CB chain has run out of free entries!"); } m_current_command_buffer->reset(); @@ -3039,7 +3039,7 @@ void VKGSRender::get_occlusion_query_result(rsx::reports::occlusion_query_info* m_flush_requests.clear_pending_flag(); } - LOG_ERROR(RSX, "[Performance warning] Unexpected ZCULL read caused a hard sync"); + rsx_log.error("[Performance warning] Unexpected ZCULL read caused a hard sync"); busy_wait(); } @@ -3216,7 +3216,7 @@ void VKGSRender::begin_conditional_rendering(const std::vectorpending); + rsx_log.error("Dubious query data pushed to cond render!, Please report to developers(q.pending=%d)", sources.front()->pending); } rsx::thread::begin_conditional_rendering(sources); diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.cpp b/rpcs3/Emu/RSX/VK/VKHelpers.cpp index 29cf2c92ce..b205142f86 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.cpp +++ b/rpcs3/Emu/RSX/VK/VKHelpers.cpp @@ -468,10 +468,10 @@ namespace vk break; case driver_vendor::INTEL: default: - LOG_WARNING(RSX, "Unsupported device: %s", gpu_name); + rsx_log.warning("Unsupported device: %s", gpu_name); } - LOG_NOTICE(RSX, "Vulkan: Renderer initialized on device '%s'", gpu_name); + rsx_log.notice("Vulkan: Renderer initialized on device '%s'", gpu_name); { // Buffer memory tests, only useful for portability on macOS @@ -917,7 +917,7 @@ namespace vk if ((get_system_time() - t) > timeout) { - LOG_ERROR(RSX, "[vulkan] vk::wait_for_event has timed out!"); + rsx_log.error("[vulkan] vk::wait_for_event has timed out!"); return VK_TIMEOUT; } } @@ -1029,7 +1029,7 @@ namespace vk case 0: fmt::throw_exception("Assertion Failed! Vulkan API call failed with unrecoverable error: %s%s", error_message.c_str(), faulting_addr); case 1: - LOG_ERROR(RSX, "Vulkan API call has failed with an error but will continue: %s%s", error_message.c_str(), faulting_addr); + rsx_log.error("Vulkan API call has failed with an error but will continue: %s%s", error_message.c_str(), faulting_addr); break; case 2: break; @@ -1044,11 +1044,11 @@ namespace vk { if (strstr(pMsg, "IMAGE_VIEW_TYPE_1D")) return false; - LOG_ERROR(RSX, "ERROR: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); + rsx_log.error("ERROR: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); } else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) { - LOG_WARNING(RSX, "WARNING: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); + rsx_log.warning("WARNING: [%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); } else { diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.h b/rpcs3/Emu/RSX/VK/VKHelpers.h index a3d081ba8d..87e0025bbe 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.h +++ b/rpcs3/Emu/RSX/VK/VKHelpers.h @@ -620,14 +620,14 @@ private: vkGetPhysicalDeviceMemoryProperties(pdev, &memory_properties); get_physical_device_features(allow_extensions); - LOG_NOTICE(RSX, "Found vulkan-compatible GPU: '%s' running on driver %s", get_name(), get_driver_version()); + rsx_log.notice("Found vulkan-compatible GPU: '%s' running on driver %s", get_name(), get_driver_version()); if (get_driver_vendor() == driver_vendor::RADV && get_name().find("LLVM 8.0.0") != std::string::npos) { // Serious driver bug causing black screens // See https://bugs.freedesktop.org/show_bug.cgi?id=110970 - LOG_FATAL(RSX, "RADV drivers have a major driver bug with LLVM 8.0.0 resulting in no visual output. Upgrade to LLVM version 8.0.1 or greater to avoid this issue."); + rsx_log.fatal("RADV drivers have a major driver bug with LLVM 8.0.0 resulting in no visual output. Upgrade to LLVM version 8.0.1 or greater to avoid this issue."); } if (get_chip_class() == chip_class::AMD_vega) @@ -842,7 +842,7 @@ private: { // TODO: Slow fallback to emulate this // Just warn and let the driver decide whether to crash or not - LOG_FATAL(RSX, "Your GPU driver does not support some required MSAA features. Expect problems."); + rsx_log.fatal("Your GPU driver does not support some required MSAA features. Expect problems."); } enabled_features.sampleRateShading = VK_TRUE; @@ -863,20 +863,20 @@ private: // Optionally disable unsupported stuff if (!pgpu->features.depthBounds) { - LOG_ERROR(RSX, "Your GPU does not support depth bounds testing. Graphics may not work correctly."); + rsx_log.error("Your GPU does not support depth bounds testing. Graphics may not work correctly."); enabled_features.depthBounds = VK_FALSE; } if (!pgpu->features.sampleRateShading && enabled_features.sampleRateShading) { - LOG_ERROR(RSX, "Your GPU does not support sample rate shading for multisampling. Graphics may be inaccurate when MSAA is enabled."); + rsx_log.error("Your GPU does not support sample rate shading for multisampling. Graphics may be inaccurate when MSAA is enabled."); enabled_features.sampleRateShading = VK_FALSE; } if (!pgpu->features.alphaToOne && enabled_features.alphaToOne) { // AMD proprietary drivers do not expose alphaToOne support - LOG_ERROR(RSX, "Your GPU does not support alpha-to-one for multisampling. Graphics may be inaccurate when MSAA is enabled."); + rsx_log.error("Your GPU does not support alpha-to-one for multisampling. Graphics may be inaccurate when MSAA is enabled."); enabled_features.alphaToOne = VK_FALSE; } @@ -899,11 +899,11 @@ private: shader_support_info.shaderFloat16 = VK_TRUE; device.pNext = &shader_support_info; - LOG_NOTICE(RSX, "GPU/driver supports float16 data types natively. Using native float16_t variables if possible."); + rsx_log.notice("GPU/driver supports float16 data types natively. Using native float16_t variables if possible."); } else { - LOG_NOTICE(RSX, "GPU/driver lacks support for float16 data types. All float16_t arithmetic will be emulated with float32_t."); + rsx_log.notice("GPU/driver lacks support for float16 data types. All float16_t arithmetic will be emulated with float32_t."); } CHECK_RESULT(vkCreateDevice(*pgpu, &device, nullptr, &dev)); @@ -1251,7 +1251,7 @@ private: { if (!is_open) { - LOG_ERROR(RSX, "commandbuffer->end was called but commandbuffer is not in a recording state"); + rsx_log.error("commandbuffer->end was called but commandbuffer is not in a recording state"); return; } @@ -1263,7 +1263,7 @@ private: { if (is_open) { - LOG_ERROR(RSX, "commandbuffer->submit was called whilst the command buffer is in a recording state"); + rsx_log.error("commandbuffer->submit was called whilst the command buffer is in a recording state"); return; } @@ -2035,7 +2035,7 @@ public: if (m_width == 0 || m_height == 0) { - LOG_ERROR(RSX, "Invalid window dimensions %d x %d", m_width, m_height); + rsx_log.error("Invalid window dimensions %d x %d", m_width, m_height); return false; } @@ -2114,7 +2114,7 @@ public: if (m_width == 0 || m_height == 0) { - LOG_ERROR(RSX, "Invalid window dimensions %d x %d", m_width, m_height); + rsx_log.error("Invalid window dimensions %d x %d", m_width, m_height); return false; } @@ -2174,7 +2174,7 @@ public: if (m_width == 0 || m_height == 0) { - LOG_ERROR(RSX, "Invalid window dimensions %d x %d", m_width, m_height); + rsx_log.error("Invalid window dimensions %d x %d", m_width, m_height); return false; } @@ -2184,7 +2184,7 @@ public: if (!XMatchVisualInfo(display, DefaultScreen(display), bit_depth, TrueColor, &visual)) #pragma GCC diagnostic pop { - LOG_ERROR(RSX, "Could not find matching visual info!" HERE); + rsx_log.error("Could not find matching visual info!" HERE); return false; } @@ -2207,7 +2207,7 @@ public: if (display == NULL) { - LOG_FATAL(RSX, "Could not create virtual display on this window protocol (Wayland?)"); + rsx_log.fatal("Could not create virtual display on this window protocol (Wayland?)"); return; } @@ -2413,7 +2413,7 @@ public: { if (vk_present_queue == VK_NULL_HANDLE) { - LOG_ERROR(RSX, "Cannot create WSI swapchain without a present queue"); + rsx_log.error("Cannot create WSI swapchain without a present queue"); return false; } @@ -2426,7 +2426,7 @@ public: if (surface_descriptors.maxImageExtent.width < m_width || surface_descriptors.maxImageExtent.height < m_height) { - LOG_ERROR(RSX, "Swapchain: Swapchain creation failed because dimensions cannot fit. Max = %d, %d, Requested = %d, %d", + rsx_log.error("Swapchain: Swapchain creation failed because dimensions cannot fit. Max = %d, %d, Requested = %d, %d", surface_descriptors.maxImageExtent.width, surface_descriptors.maxImageExtent.height, m_width, m_height); return false; @@ -2442,7 +2442,7 @@ public: { if (surface_descriptors.currentExtent.width == 0 || surface_descriptors.currentExtent.height == 0) { - LOG_WARNING(RSX, "Swapchain: Current surface extent is a null region. Is the window minimized?"); + rsx_log.warning("Swapchain: Current surface extent is a null region. Is the window minimized?"); return false; } @@ -2488,7 +2488,7 @@ public: break; } - LOG_NOTICE(RSX, "Swapchain: present mode %d in use.", static_cast(swapchain_present_mode)); + rsx_log.notice("Swapchain: present mode %d in use.", static_cast(swapchain_present_mode)); uint32_t nb_swap_images = surface_descriptors.minImageCount + 1; if (surface_descriptors.maxImageCount > 0) @@ -2696,7 +2696,7 @@ public: #endif //(WAYLAND) if (!found_surface_ext) { - LOG_ERROR(RSX, "Could not find a supported Vulkan surface extension"); + rsx_log.error("Could not find a supported Vulkan surface extension"); return 0; } #endif //(WIN32, __APPLE__) @@ -2716,7 +2716,7 @@ public: { if (result == VK_ERROR_LAYER_NOT_PRESENT) { - LOG_FATAL(RSX,"Could not initialize layer VK_LAYER_KHRONOS_validation"); + rsx_log.fatal("Could not initialize layer VK_LAYER_KHRONOS_validation"); } return false; @@ -2844,7 +2844,7 @@ public: if (!present_possible) { - LOG_ERROR(RSX, "It is not possible for the currently selected GPU to present to the window (Likely caused by NVIDIA driver running the current display)"); + rsx_log.error("It is not possible for the currently selected GPU to present to the window (Likely caused by NVIDIA driver running the current display)"); } // Search for a graphics and a present queue in the array of queue @@ -2885,7 +2885,7 @@ public: if (graphicsQueueNodeIndex == UINT32_MAX) { - LOG_FATAL(RSX, "Failed to find a suitable graphics queue" HERE); + rsx_log.fatal("Failed to find a suitable graphics queue" HERE); return nullptr; } @@ -2898,7 +2898,7 @@ public: if (!present_possible) { //Native(sw) swapchain - LOG_WARNING(RSX, "Falling back to software present support (native windowing API)"); + rsx_log.warning("Falling back to software present support (native windowing API)"); auto swapchain = new swapchain_NATIVE(dev, UINT32_MAX, graphicsQueueNodeIndex); swapchain->create(window_handle); return swapchain; @@ -3473,7 +3473,7 @@ public: std::string shader_type = type == ::glsl::program_domain::glsl_vertex_program ? "vertex" : type == ::glsl::program_domain::glsl_fragment_program ? "fragment" : "compute"; - LOG_NOTICE(RSX, "%s", m_source); + rsx_log.notice("%s", m_source); fmt::throw_exception("Failed to compile %s shader" HERE, shader_type); } @@ -3590,7 +3590,7 @@ public: if (!(get_heap_compatible_buffer_types() & usage)) { - LOG_WARNING(RSX, "Buffer usage %u is not heap-compatible using this driver, explicit staging buffer in use", usage); + rsx_log.warning("Buffer usage %u is not heap-compatible using this driver, explicit staging buffer in use", usage); shadow = std::make_unique(*device, size, memory_index, memory_flags, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, 0); usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; diff --git a/rpcs3/Emu/RSX/VK/VKPresent.cpp b/rpcs3/Emu/RSX/VK/VKPresent.cpp index 671f3316b3..02c1822e73 100644 --- a/rpcs3/Emu/RSX/VK/VKPresent.cpp +++ b/rpcs3/Emu/RSX/VK/VKPresent.cpp @@ -36,7 +36,7 @@ void VKGSRender::reinitialize_swapchain() // Rebuild swapchain. Old swapchain destruction is handled by the init_swapchain call if (!m_swapchain->init(m_swapchain_dims.width, m_swapchain_dims.height)) { - LOG_WARNING(RSX, "Swapchain initialization failed. Request ignored [%dx%d]", m_swapchain_dims.width, m_swapchain_dims.height); + rsx_log.warning("Swapchain initialization failed. Request ignored [%dx%d]", m_swapchain_dims.width, m_swapchain_dims.height); swapchain_unavailable = true; open_command_buffer(); return; @@ -381,7 +381,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info) if (info.stats.draw_calls > 0) { // This can be 'legal' if the window was being resized and no polling happened because of swapchain_unavailable flag - LOG_ERROR(RSX, "Possible data corruption on frame context storage detected"); + rsx_log.error("Possible data corruption on frame context storage detected"); } // There were no draws and back-to-back flips happened @@ -473,7 +473,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info) should_reinitialize_swapchain = true; break; case VK_ERROR_OUT_OF_DATE_KHR: - LOG_WARNING(RSX, "vkAcquireNextImageKHR failed with VK_ERROR_OUT_OF_DATE_KHR. Flip request ignored until surface is recreated."); + rsx_log.warning("vkAcquireNextImageKHR failed with VK_ERROR_OUT_OF_DATE_KHR. Flip request ignored until surface is recreated."); swapchain_unavailable = true; reinitialize_swapchain(); continue; diff --git a/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp b/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp index a480a43d16..b9cb03e1d6 100644 --- a/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp +++ b/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp @@ -128,7 +128,7 @@ namespace vk } } - LOG_NOTICE(RSX, "texture not found in program: %s", uniform_name.c_str()); + rsx_log.notice("texture not found in program: %s", uniform_name.c_str()); } void program::bind_uniform(const VkDescriptorImageInfo & image_descriptor, int texture_unit, ::glsl::program_domain domain, VkDescriptorSet &descriptor_set, bool is_stencil_mirror) @@ -166,7 +166,7 @@ namespace vk return; } - LOG_NOTICE(RSX, "texture not found in program: %stex%u", (domain == ::glsl::program_domain::glsl_vertex_program)? "v" : "", texture_unit); + rsx_log.notice("texture not found in program: %stex%u", (domain == ::glsl::program_domain::glsl_vertex_program)? "v" : "", texture_unit); } void program::bind_uniform(const VkDescriptorBufferInfo &buffer_descriptor, uint32_t binding_point, VkDescriptorSet &descriptor_set) @@ -204,8 +204,8 @@ namespace vk return; } } - - LOG_NOTICE(RSX, "vertex buffer not found in program: %s", binding_name.c_str()); + + rsx_log.notice("vertex buffer not found in program: %s", binding_name.c_str()); } void program::bind_buffer(const VkDescriptorBufferInfo &buffer_descriptor, uint32_t binding_point, VkDescriptorType type, VkDescriptorSet &descriptor_set) diff --git a/rpcs3/Emu/RSX/VK/VKRenderTargets.h b/rpcs3/Emu/RSX/VK/VKRenderTargets.h index adb6eb2254..c1c973ba5e 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderTargets.h +++ b/rpcs3/Emu/RSX/VK/VKRenderTargets.h @@ -509,7 +509,7 @@ namespace vk if (UNLIKELY(!any_valid_writes)) { - LOG_WARNING(RSX, "Surface at 0x%x inherited stale references", base_addr); + rsx_log.warning("Surface at 0x%x inherited stale references", base_addr); clear_rw_barrier(); shuffle_tag(); diff --git a/rpcs3/Emu/RSX/VK/VKResolveHelper.h b/rpcs3/Emu/RSX/VK/VKResolveHelper.h index 3ed48aba74..1cee9dc14e 100644 --- a/rpcs3/Emu/RSX/VK/VKResolveHelper.h +++ b/rpcs3/Emu/RSX/VK/VKResolveHelper.h @@ -81,7 +81,7 @@ namespace vk + kernel + "}\n"; - LOG_NOTICE(RSX, "Compute shader:\n%s", m_src); + rsx_log.notice("Compute shader:\n%s", m_src); } std::vector> get_descriptor_layout() override @@ -212,7 +212,7 @@ namespace vk fs_src += kernel + "}\n"; - LOG_NOTICE(RSX, "Resolve shader:\n%s", fs_src); + rsx_log.notice("Resolve shader:\n%s", fs_src); } std::vector get_push_constants() override diff --git a/rpcs3/Emu/RSX/VK/VKResourceManager.cpp b/rpcs3/Emu/RSX/VK/VKResourceManager.cpp index 9bfff2f525..d0258f80fd 100644 --- a/rpcs3/Emu/RSX/VK/VKResourceManager.cpp +++ b/rpcs3/Emu/RSX/VK/VKResourceManager.cpp @@ -45,7 +45,7 @@ namespace vk if (const auto ins = g_vmm_allocations.insert_or_assign(key, info); !ins.second) { - LOG_ERROR(RSX, "Duplicate vmm entry with memory handle 0x%llx", key); + rsx_log.error("Duplicate vmm entry with memory handle 0x%llx", key); } auto& vmm_size = g_vmm_memory_usage[memory_type]; @@ -53,7 +53,7 @@ namespace vk if (vmm_size > s_vmm_warn_threshold_size && (vmm_size - memory_size) <= s_vmm_warn_threshold_size) { - LOG_WARNING(RSX, "Memory type 0x%x has allocated more than %.2fG. Currently allocated %.2fG", + rsx_log.warning("Memory type 0x%x has allocated more than %.2fG. Currently allocated %.2fG", memory_type, size_in_GiB(s_vmm_warn_threshold_size), size_in_GiB(vmm_size)); } } diff --git a/rpcs3/Emu/RSX/VK/VKTexture.cpp b/rpcs3/Emu/RSX/VK/VKTexture.cpp index a1d3fb093c..24e0e99d65 100644 --- a/rpcs3/Emu/RSX/VK/VKTexture.cpp +++ b/rpcs3/Emu/RSX/VK/VKTexture.cpp @@ -394,7 +394,7 @@ namespace vk //Most depth/stencil formats cannot be scaled using hw blit if (src_format == VK_FORMAT_UNDEFINED) { - LOG_ERROR(RSX, "Could not blit depth/stencil image. src_fmt=0x%x", static_cast(src_format)); + rsx_log.error("Could not blit depth/stencil image. src_fmt=0x%x", static_cast(src_format)); } else { @@ -864,7 +864,7 @@ namespace vk final_mapping[channel] = base_remap[remap_vector.first[channel]]; break; default: - LOG_ERROR(RSX, "Unknown remap lookup value %d", remap_vector.second[channel]); + rsx_log.error("Unknown remap lookup value %d", remap_vector.second[channel]); } } @@ -951,19 +951,19 @@ namespace vk // Checks if (src_area.x2 <= src_area.x1 || src_area.y2 <= src_area.y1 || dst_area.x2 <= dst_area.x1 || dst_area.y2 <= dst_area.y1) { - LOG_ERROR(RSX, "Blit request consists of an empty region descriptor!"); + rsx_log.error("Blit request consists of an empty region descriptor!"); return; } if (src_area.x1 < 0 || src_area.x2 > static_cast(real_src->width()) || src_area.y1 < 0 || src_area.y2 > static_cast(real_src->height())) { - LOG_ERROR(RSX, "Blit request denied because the source region does not fit!"); + rsx_log.error("Blit request denied because the source region does not fit!"); return; } if (dst_area.x1 < 0 || dst_area.x2 > static_cast(real_dst->width()) || dst_area.y1 < 0 || dst_area.y2 > static_cast(real_dst->height())) { - LOG_ERROR(RSX, "Blit request denied because the destination region does not fit!"); + rsx_log.error("Blit request denied because the destination region does not fit!"); return; } diff --git a/rpcs3/Emu/RSX/rsx_cache.h b/rpcs3/Emu/RSX/rsx_cache.h index db9e1f1f84..aa04facf78 100644 --- a/rpcs3/Emu/RSX/rsx_cache.h +++ b/rpcs3/Emu/RSX/rsx_cache.h @@ -34,7 +34,7 @@ namespace rsx { verify(HERE), range.is_page_range(); - //LOG_ERROR(RSX, "memory_protect(0x%x, 0x%x, %x)", static_cast(range.start), static_cast(range.length()), static_cast(prot)); + //rsx_log.error("memory_protect(0x%x, 0x%x, %x)", static_cast(range.start), static_cast(range.length()), static_cast(prot)); utils::memory_protect(vm::base(range.start), range.length(), prot); #ifdef TEXTURE_CACHE_DEBUG @@ -448,7 +448,7 @@ namespace rsx fs::file f(filename); if (f.size() != sizeof(pipeline_data)) { - LOG_ERROR(RSX, "Removing cached pipeline object %s since it's not binary compatible with the current shader cache", tmp.name.c_str()); + rsx_log.error("Removing cached pipeline object %s since it's not binary compatible with the current shader cache", tmp.name.c_str()); fs::remove_file(filename); continue; } @@ -594,7 +594,7 @@ namespace rsx return; root.rewind(); - + // Progress dialog std::unique_ptr fallback_dlg; if (!dlg) @@ -633,7 +633,7 @@ namespace rsx if (vp.jump_table.size() > 32) { - LOG_ERROR(RSX, "shaders_cache: vertex program has more than 32 jump addresses. Entry not saved to cache"); + rsx_log.error("shaders_cache: vertex program has more than 32 jump addresses. Entry not saved to cache"); return; } diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 9b16bb8f9d..43311dcdc3 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -42,7 +42,7 @@ namespace rsx //Don't throw, gather information and ignore broken/garbage commands //TODO: Investigate why these commands are executed at all. (Heap corruption? Alignment padding?) const u32 cmd = rsx->get_fifo_cmd(); - LOG_ERROR(RSX, "Invalid RSX method 0x%x (arg=0x%x, start=0x%x, count=0x%x, non-inc=%s)", _reg << 2, arg, + rsx_log.error("Invalid RSX method 0x%x (arg=0x%x, start=0x%x, count=0x%x, non-inc=%s)", _reg << 2, arg, cmd & 0xfffc, (cmd >> 18) & 0x7ff, !!(cmd & RSX_METHOD_NON_INCREMENT_CMD)); rsx->invalid_command_interrupt_raised = true; } @@ -50,7 +50,7 @@ namespace rsx void trace_method(thread* rsx, u32 _reg, u32 arg) { // For unknown yet valid methods - LOG_TRACE(RSX, "RSX method 0x%x (arg=0x%x)", _reg << 2, arg); + rsx_log.trace("RSX method 0x%x (arg=0x%x)", _reg << 2, arg); } template struct vertex_data_type_from_element_type; @@ -117,7 +117,7 @@ namespace rsx if ((get_system_time() - start) > tdr) { // If longer than driver timeout force exit - LOG_ERROR(RSX, "nv406e::semaphore_acquire has timed out. semaphore_address=0x%X", addr); + rsx_log.error("nv406e::semaphore_acquire has timed out. semaphore_address=0x%X", addr); break; } } @@ -204,7 +204,7 @@ namespace rsx if ((location & ~7) != (CELL_GCM_CONTEXT_DMA_NOTIFY_MAIN_0 & ~7)) { - LOG_TRACE(RSX, "NV4097_NOTIFY: invalid context = 0x%x", method_registers.context_dma_notify()); + rsx_log.trace("NV4097_NOTIFY: invalid context = 0x%x", method_registers.context_dma_notify()); return; } @@ -420,7 +420,7 @@ namespace rsx if (address >= 468) { // Ignore addresses outside the usable [0, 467] range - LOG_WARNING(RSX, "Invalid transform register index (load=%d, index=%d)", load, index); + rsx_log.warning("Invalid transform register index (load=%d, index=%d)", load, index); return; } @@ -444,7 +444,7 @@ namespace rsx // PS3 seems to allow exceeding the program buffer by upto 32 instructions before crashing // Discard the "excess" instructions to not overflow our transform program buffer // TODO: Check if the instructions in the overflow area are executed by PS3 - LOG_WARNING(RSX, "Program buffer overflow!"); + rsx_log.warning("Program buffer overflow!"); return; } @@ -480,7 +480,7 @@ namespace rsx { rsxthr->in_begin_end = true; - LOG_WARNING(RSX, "Invalid NV4097_SET_BEGIN_END value: 0x%x", arg); + rsx_log.warning("Invalid NV4097_SET_BEGIN_END value: 0x%x", arg); return; } @@ -518,7 +518,7 @@ namespace rsx // Recover from invalid primitive only if draw clause is not empty rsxthr->invalid_command_interrupt_raised = true; - LOG_ERROR(RSX, "NV4097_SET_BEGIN_END aborted due to invalid primitive!"); + rsx_log.error("NV4097_SET_BEGIN_END aborted due to invalid primitive!"); return; } @@ -556,7 +556,7 @@ namespace rsx auto address_ptr = get_report_data_impl(offset); if (!address_ptr) { - LOG_ERROR(RSX, "Bad argument passed to NV4097_GET_REPORT, arg=0x%X", arg); + rsx_log.error("Bad argument passed to NV4097_GET_REPORT, arg=0x%X", arg); return; } @@ -570,7 +570,7 @@ namespace rsx rsx->get_zcull_stats(type, address_ptr); break; default: - LOG_ERROR(RSX, "NV4097_GET_REPORT: Bad type %d", type); + rsx_log.error("NV4097_GET_REPORT: Bad type %d", type); vm::_ref>(address_ptr).atomic_op([&](CellGcmReportData& data) { @@ -589,7 +589,7 @@ namespace rsx case CELL_GCM_ZCULL_STATS: break; default: - LOG_ERROR(RSX, "NV4097_CLEAR_REPORT_VALUE: Bad type: %d", arg); + rsx_log.error("NV4097_CLEAR_REPORT_VALUE: Bad type: %d", arg); break; } @@ -607,7 +607,7 @@ namespace rsx case 2: break; default: - LOG_ERROR(RSX, "Unknown render mode %d", mode); + rsx_log.error("Unknown render mode %d", mode); return; } @@ -616,7 +616,7 @@ namespace rsx if (!address_ptr) { - LOG_ERROR(RSX, "Bad argument passed to NV4097_SET_RENDER_ENABLE, arg=0x%X", arg); + rsx_log.error("Bad argument passed to NV4097_SET_RENDER_ENABLE, arg=0x%X", arg); return; } @@ -755,7 +755,7 @@ namespace rsx method_registers.registers[reg] = method_registers.register_previous_value; rsx->invalid_command_interrupt_raised = true; - LOG_ERROR(RSX, "Invalid NV4097_SET_INDEX_ARRAY_DMA value: 0x%x", arg); + rsx_log.error("Invalid NV4097_SET_INDEX_ARRAY_DMA value: 0x%x", arg); } } @@ -899,7 +899,7 @@ namespace rsx // Check both clip dimensions and dst dimensions if (clip_w == 0 || clip_h == 0) { - LOG_WARNING(RSX, "NV3089_IMAGE_IN: Operation NOPed out due to empty regions"); + rsx_log.warning("NV3089_IMAGE_IN: Operation NOPed out due to empty regions"); return; } @@ -924,7 +924,7 @@ namespace rsx case blit_engine::transfer_origin::center: break; default: - LOG_WARNING(RSX, "NV3089_IMAGE_IN_SIZE: unknown origin (%d)", static_cast(in_origin)); + rsx_log.warning("NV3089_IMAGE_IN_SIZE: unknown origin (%d)", static_cast(in_origin)); } if (operation != rsx::blit_engine::transfer_operation::srccopy) @@ -962,7 +962,7 @@ namespace rsx break; } default: - LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: unknown m_context_surface (0x%x)", static_cast(method_registers.blit_engine_context_surface())); + rsx_log.error("NV3089_IMAGE_IN_SIZE: unknown m_context_surface (0x%x)", static_cast(method_registers.blit_engine_context_surface())); return; } @@ -1051,7 +1051,7 @@ namespace rsx if (convert_w == 0 || convert_h == 0) { - LOG_ERROR(RSX, "NV3089_IMAGE_IN: Invalid dimensions or scaling factor. Request ignored (ds_dx=%f, dt_dy=%f)", + rsx_log.error("NV3089_IMAGE_IN: Invalid dimensions or scaling factor. Request ignored (ds_dx=%f, dt_dy=%f)", method_registers.blit_engine_ds_dx(), method_registers.blit_engine_dt_dy()); return; } @@ -1333,17 +1333,17 @@ namespace rsx // The existing GCM commands use only the value 0x1 for inFormat and outFormat if (in_format != 0x01 || out_format != 0x01) { - LOG_ERROR(RSX, "NV0039_BUFFER_NOTIFY: Unsupported format: inFormat=%d, outFormat=%d", in_format, out_format); + rsx_log.error("NV0039_BUFFER_NOTIFY: Unsupported format: inFormat=%d, outFormat=%d", in_format, out_format); } if (!line_count || !line_length) { - LOG_WARNING(RSX, "NV0039_BUFFER_NOTIFY NOPed out: pitch(in=0x%x, out=0x%x), line(len=0x%x, cnt=0x%x), fmt(in=0x%x, out=0x%x), notify=0x%x", + rsx_log.warning("NV0039_BUFFER_NOTIFY NOPed out: pitch(in=0x%x, out=0x%x), line(len=0x%x, cnt=0x%x), fmt(in=0x%x, out=0x%x), notify=0x%x", in_pitch, out_pitch, line_length, line_count, in_format, out_format, notify); return; } - LOG_TRACE(RSX, "NV0039_BUFFER_NOTIFY: pitch(in=0x%x, out=0x%x), line(len=0x%x, cnt=0x%x), fmt(in=0x%x, out=0x%x), notify=0x%x", + rsx_log.trace("NV0039_BUFFER_NOTIFY: pitch(in=0x%x, out=0x%x), line(len=0x%x, cnt=0x%x), fmt(in=0x%x, out=0x%x), notify=0x%x", in_pitch, out_pitch, line_length, line_count, in_format, out_format, notify); u32 src_offset = method_registers.nv0039_input_offset(); diff --git a/rpcs3/Emu/RSX/rsx_utils.h b/rpcs3/Emu/RSX/rsx_utils.h index 37898354ad..1dd8ad249b 100644 --- a/rpcs3/Emu/RSX/rsx_utils.h +++ b/rpcs3/Emu/RSX/rsx_utils.h @@ -155,7 +155,7 @@ namespace rsx switch (format) { default: - LOG_ERROR(RSX, "Invalid AV format 0x%x", format); + rsx_log.error("Invalid AV format 0x%x", format); case 0: // CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8: case 1: // CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8B8G8R8: return CELL_GCM_TEXTURE_A8R8G8B8; @@ -169,7 +169,7 @@ namespace rsx switch (format) { default: - LOG_ERROR(RSX, "Invalid AV format 0x%x", format); + rsx_log.error("Invalid AV format 0x%x", format); case 0: // CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8: case 1: // CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8B8G8R8: return 4; diff --git a/rpcs3/rpcs3qt/gl_gs_frame.cpp b/rpcs3/rpcs3qt/gl_gs_frame.cpp index d63ea7e190..0e4ae726c3 100644 --- a/rpcs3/rpcs3qt/gl_gs_frame.cpp +++ b/rpcs3/rpcs3qt/gl_gs_frame.cpp @@ -95,7 +95,7 @@ void gl_gs_frame::delete_context(draw_context_t ctx) } __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { - LOG_FATAL(RSX, "Your graphics driver just crashed whilst cleaning up. All consumed VRAM should have been released, but you may want to restart the emulator just in case"); + rsx_log.fatal("Your graphics driver just crashed whilst cleaning up. All consumed VRAM should have been released, but you may want to restart the emulator just in case"); } #else delete gl_ctx->handle; diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index e5d4457207..c0c8e50a18 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -569,11 +569,11 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: idx = 0; if (renderer.old_adapter.isEmpty()) { - LOG_WARNING(RSX, "%s adapter config empty: setting to default!", sstr(renderer.name)); + rsx_log.warning("%s adapter config empty: setting to default!", sstr(renderer.name)); } else { - LOG_WARNING(RSX, "Last used %s adapter not found: setting to default!", sstr(renderer.name)); + rsx_log.warning("Last used %s adapter not found: setting to default!", sstr(renderer.name)); } } ui->graphicsAdapterBox->setCurrentIndex(idx);