From dc8cdc95d022c0a864fdef5e8dbaff96d3799875 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 22 Oct 2022 21:34:03 +1000 Subject: [PATCH] GSRunner: Write log and disable cache in parallel runs --- pcsx2-gsrunner/Main.cpp | 30 ++++++++++++++++++++++++++++++ pcsx2-gsrunner/test_run_dumps.py | 13 +++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/pcsx2-gsrunner/Main.cpp b/pcsx2-gsrunner/Main.cpp index 9553283a07..987fae2d21 100644 --- a/pcsx2-gsrunner/Main.cpp +++ b/pcsx2-gsrunner/Main.cpp @@ -129,6 +129,13 @@ bool GSRunner::InitializeConfig() si.SetBoolValue("EmuCore/GS", "OsdShowResolution", true); si.SetBoolValue("EmuCore/GS", "OsdShowGSStats", true); + // remove memory cards, so we don't have sharing violations + for (u32 i = 0; i < 2; i++) + { + si.SetBoolValue("MemoryCards", fmt::format("Slot{}_Enable", i + 1).c_str(), false); + si.SetStringValue("MemoryCards", fmt::format("Slot{}_Filename", i + 1).c_str(), ""); + } + CommonHost::LoadStartupSettings(); return true; } @@ -436,6 +443,8 @@ static void PrintCommandLineHelp(const char* progname) std::fprintf(stderr, " -renderer : Sets the graphics renderer. Defaults to Auto.\n"); std::fprintf(stderr, " -window: Forces a window to be displayed.\n"); std::fprintf(stderr, " -surfaceless: Disables showing a window.\n"); + std::fprintf(stderr, " -logfile : Writes emu log to filename.\n"); + std::fprintf(stderr, " -noshadercache: Disables the shader cache (useful for parallel runs).\n"); std::fprintf(stderr, " --: Signals that no more arguments will follow and the remaining\n" " parameters make up the filename. Use when the filename contains\n" " spaces or starts with a dash.\n"); @@ -522,6 +531,26 @@ static bool ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& param s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", static_cast(type)); continue; } + else if (CHECK_ARG_PARAM("-logfile")) + { + const char* logfile = argv[++i]; + if (std::strlen(logfile) > 0) + { + // disable timestamps, since we want to be able to diff the logs + Console.WriteLn("Logging to %s...", logfile); + CommonHost::SetFileLogPath(logfile); + s_settings_interface.SetBoolValue("Logging", "EnableFileLogging", true); + s_settings_interface.SetBoolValue("Logging", "EnableTimestamps", false); + } + + continue; + } + else if (CHECK_ARG("-noshadercache")) + { + Console.WriteLn("Disabling shader cache"); + s_settings_interface.SetBoolValue("EmuCore/GS", "disable_shader_cache", false); + continue; + } else if (CHECK_ARG("-window")) { Console.WriteLn("Creating window"); @@ -608,6 +637,7 @@ int main(int argc, char* argv[]) return false; } + // apply new settings (e.g. pick up renderer change) VMManager::ApplySettings(); if (VMManager::Initialize(params)) diff --git a/pcsx2-gsrunner/test_run_dumps.py b/pcsx2-gsrunner/test_run_dumps.py index 2e673f3080..c843b0b90e 100644 --- a/pcsx2-gsrunner/test_run_dumps.py +++ b/pcsx2-gsrunner/test_run_dumps.py @@ -16,24 +16,29 @@ def is_gs_path(path): return False -def run_regression_test(runner, dumpdir, renderer, gspath): +def run_regression_test(runner, dumpdir, renderer, parallel, gspath): args = [runner] gsname = Path(gspath).name while gsname.rfind('.') >= 0: gsname = gsname[:gsname.rfind('.')] - real_dumpdir = os.path.join(dumpdir, gsname) + real_dumpdir = os.path.join(dumpdir, gsname).strip() if not os.path.exists(real_dumpdir): os.mkdir(real_dumpdir) if renderer is not None: args.extend(["-renderer", renderer]) args.extend(["-dumpdir", real_dumpdir]) + args.extend(["-logfile", os.path.join(real_dumpdir, "emulog.txt")]) # loop a couple of times for those stubborn merge/interlace dumps that don't render anything # the first time around args.extend(["-loop", "2"]) + # disable shader cache for parallel runs, otherwise it'll have sharing violations + if parallel > 1: + args.append("-noshadercache") + args.append("--") args.append(gspath) @@ -52,10 +57,10 @@ def run_regression_tests(runner, gsdir, dumpdir, renderer, parallel=1): if parallel <= 1: for game in gamepaths: - run_regression_test(runner, dumpdir, renderer, game) + run_regression_test(runner, dumpdir, renderer, parallel, game) else: print("Processing %u games on %u processors" % (len(gamepaths), parallel)) - func = partial(run_regression_test, runner, dumpdir, renderer) + func = partial(run_regression_test, runner, dumpdir, renderer, parallel) pool = multiprocessing.Pool(parallel) pool.map(func, gamepaths) pool.close()