GSRunner: Support upscale parameter

This commit is contained in:
Stenzek 2023-03-05 16:04:29 +10:00 committed by refractionpcsx2
parent 2c4e02ff34
commit 54e59e2f7b
2 changed files with 23 additions and 6 deletions

View File

@ -556,6 +556,19 @@ static bool ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& param
continue;
}
else if (CHECK_ARG_PARAM("-upscale"))
{
const float upscale = StringUtil::FromChars<float>(argv[++i]).value_or(0.0f);
if (upscale < 0.5f)
{
Console.WriteLn("Invalid upscale multiplier");
return false;
}
Console.WriteLn(fmt::format("Setting upscale multiplier to {}", upscale));
s_settings_interface.SetFloatValue("EmuCore/GS", "upscale_multiplier", upscale);
continue;
}
else if (CHECK_ARG_PARAM("-logfile"))
{
const char* logfile = argv[++i];

View File

@ -16,7 +16,7 @@ def is_gs_path(path):
return False
def run_regression_test(runner, dumpdir, renderer, parallel, renderhacks, gspath):
def run_regression_test(runner, dumpdir, renderer, upscale, renderhacks, parallel, gspath):
args = [runner]
gsname = Path(gspath).name
while gsname.rfind('.') >= 0:
@ -29,6 +29,9 @@ def run_regression_test(runner, dumpdir, renderer, parallel, renderhacks, gspath
if renderer is not None:
args.extend(["-renderer", renderer])
if upscale != 1.0:
args.extend(["-upscale", str(upscale)])
if renderhacks is not None:
args.extend(["-renderhacks", renderhacks])
@ -50,7 +53,7 @@ def run_regression_test(runner, dumpdir, renderer, parallel, renderhacks, gspath
subprocess.run(args)
def run_regression_tests(runner, gsdir, dumpdir, renderer, renderhacks, parallel=1):
def run_regression_tests(runner, gsdir, dumpdir, renderer, upscale, renderhacks, parallel=1):
paths = glob.glob(gsdir + "/*.*", recursive=True)
gamepaths = list(filter(is_gs_path, paths))
@ -61,10 +64,10 @@ def run_regression_tests(runner, gsdir, dumpdir, renderer, renderhacks, parallel
if parallel <= 1:
for game in gamepaths:
run_regression_test(runner, dumpdir, renderer, parallel, renderhacks, game)
run_regression_test(runner, dumpdir, renderer, upscale, renderhacks, parallel, game)
else:
print("Processing %u games on %u processors" % (len(gamepaths), parallel))
func = partial(run_regression_test, runner, dumpdir, renderer, parallel, renderhacks)
func = partial(run_regression_test, runner, dumpdir, renderer, upscale, renderhacks, parallel)
pool = multiprocessing.Pool(parallel)
pool.map(func, gamepaths)
pool.close()
@ -79,12 +82,13 @@ if __name__ == "__main__":
parser.add_argument("-gsdir", action="store", required=True, help="Directory containing GS dumps")
parser.add_argument("-dumpdir", action="store", required=True, help="Base directory to dump frames to")
parser.add_argument("-renderer", action="store", required=False, help="Renderer to use")
parser.add_argument("-upscale", action="store", type=float, default=1, help="Upscaling multiplier to use")
parser.add_argument("-renderhacks", action="store", required=False, help="Enable HW Rendering hacks")
parser.add_argument("-parallel", action="store", type=int, default=1, help="Number of proceeses to run")
parser.add_argument("-renderhacks", action="store", required=False, help="Enable HW Renering hacks")
args = parser.parse_args()
if not run_regression_tests(args.runner, os.path.realpath(args.gsdir), os.path.realpath(args.dumpdir), args.renderer, args.renderhacks, args.parallel):
if not run_regression_tests(args.runner, os.path.realpath(args.gsdir), os.path.realpath(args.dumpdir), args.renderer, args.upscale, args.renderhacks, args.parallel):
sys.exit(1)
else:
sys.exit(0)