mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-06 19:45:33 +00:00
RegTest: Support replaying GPU dumps
This commit is contained in:
parent
b7832e609f
commit
1ed9e609a5
@ -6,13 +6,12 @@ import subprocess
|
|||||||
import multiprocessing
|
import multiprocessing
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
def is_game_path(path):
|
def is_game_path(path:str):
|
||||||
idx = path.rfind('.')
|
lpath = path.lower()
|
||||||
if idx < 0:
|
for extension in ["cue", "chd", "psxgpu", "psxgpu.zst", "psxgpu.xz"]:
|
||||||
return False
|
if path.endswith(extension):
|
||||||
|
return True
|
||||||
extension = path[idx + 1:].strip().lower()
|
return False
|
||||||
return extension in ["cue", "chd"]
|
|
||||||
|
|
||||||
|
|
||||||
def run_regression_test(runner, destdir, dump_interval, frames, renderer, cargs, gamepath):
|
def run_regression_test(runner, destdir, dump_interval, frames, renderer, cargs, gamepath):
|
||||||
@ -31,8 +30,10 @@ def run_regression_test(runner, destdir, dump_interval, frames, renderer, cargs,
|
|||||||
return os.path.basename(gamepath)
|
return os.path.basename(gamepath)
|
||||||
|
|
||||||
|
|
||||||
def run_regression_tests(runner, gamedir, destdir, dump_interval, frames, parallel, renderer, cargs):
|
def run_regression_tests(runner, gamedirs, destdir, dump_interval, frames, parallel, renderer, cargs):
|
||||||
paths = glob.glob(gamedir + "/*.*", recursive=True)
|
paths = []
|
||||||
|
for gamedir in gamedirs:
|
||||||
|
paths += glob.glob(os.path.realpath(gamedir) + "/*.*", recursive=True)
|
||||||
gamepaths = list(filter(is_game_path, paths))
|
gamepaths = list(filter(is_game_path, paths))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -64,7 +65,7 @@ def run_regression_tests(runner, gamedir, destdir, dump_interval, frames, parall
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Generate frame dump images for regression tests")
|
parser = argparse.ArgumentParser(description="Generate frame dump images for regression tests")
|
||||||
parser.add_argument("-runner", action="store", required=True, help="Path to DuckStation regression test runner")
|
parser.add_argument("-runner", action="store", required=True, help="Path to DuckStation regression test runner")
|
||||||
parser.add_argument("-gamedir", action="store", required=True, help="Directory containing game images")
|
parser.add_argument("-gamedir", action="append", required=True, help="Directory containing game images")
|
||||||
parser.add_argument("-destdir", action="store", required=True, help="Base directory to dump frames to")
|
parser.add_argument("-destdir", action="store", required=True, help="Base directory to dump frames to")
|
||||||
parser.add_argument("-dumpinterval", action="store", type=int, default=600, help="Interval to dump frames at")
|
parser.add_argument("-dumpinterval", action="store", type=int, default=600, help="Interval to dump frames at")
|
||||||
parser.add_argument("-frames", action="store", type=int, default=36000, help="Number of frames to run")
|
parser.add_argument("-frames", action="store", type=int, default=36000, help="Number of frames to run")
|
||||||
@ -86,7 +87,7 @@ if __name__ == "__main__":
|
|||||||
if (args.cpu is not None):
|
if (args.cpu is not None):
|
||||||
cargs += ["-cpu", args.cpu]
|
cargs += ["-cpu", args.cpu]
|
||||||
|
|
||||||
if not run_regression_tests(args.runner, os.path.realpath(args.gamedir), os.path.realpath(args.destdir), args.dumpinterval, args.frames, args.parallel, args.renderer, cargs):
|
if not run_regression_tests(args.runner, args.gamedir, os.path.realpath(args.destdir), args.dumpinterval, args.frames, args.parallel, args.renderer, cargs):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@ -106,6 +106,7 @@ public:
|
|||||||
ALWAYS_INLINE const std::string& GetPath() const { return m_path; }
|
ALWAYS_INLINE const std::string& GetPath() const { return m_path; }
|
||||||
ALWAYS_INLINE const std::string& GetSerial() const { return m_serial; }
|
ALWAYS_INLINE const std::string& GetSerial() const { return m_serial; }
|
||||||
ALWAYS_INLINE ConsoleRegion GetRegion() const { return m_region; }
|
ALWAYS_INLINE ConsoleRegion GetRegion() const { return m_region; }
|
||||||
|
ALWAYS_INLINE size_t GetFrameCount() const { return m_frame_offsets.size(); }
|
||||||
|
|
||||||
static std::unique_ptr<Player> Open(std::string path, Error* error);
|
static std::unique_ptr<Player> Open(std::string path, Error* error);
|
||||||
|
|
||||||
|
@ -622,6 +622,11 @@ bool System::IsReplayingGPUDump()
|
|||||||
return static_cast<bool>(s_state.gpu_dump_player);
|
return static_cast<bool>(s_state.gpu_dump_player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t System::GetGPUDumpFrameCount()
|
||||||
|
{
|
||||||
|
return s_state.gpu_dump_player ? s_state.gpu_dump_player->GetFrameCount() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool System::IsStartupCancelled()
|
bool System::IsStartupCancelled()
|
||||||
{
|
{
|
||||||
return s_state.startup_cancelled.load(std::memory_order_acquire);
|
return s_state.startup_cancelled.load(std::memory_order_acquire);
|
||||||
|
@ -172,6 +172,7 @@ bool IsValid();
|
|||||||
bool IsValidOrInitializing();
|
bool IsValidOrInitializing();
|
||||||
bool IsExecuting();
|
bool IsExecuting();
|
||||||
bool IsReplayingGPUDump();
|
bool IsReplayingGPUDump();
|
||||||
|
size_t GetGPUDumpFrameCount();
|
||||||
|
|
||||||
bool IsStartupCancelled();
|
bool IsStartupCancelled();
|
||||||
void CancelPendingStartup();
|
void CancelPendingStartup();
|
||||||
|
@ -726,14 +726,6 @@ bool RegTestHost::ParseCommandLineParameters(int argc, char* argv[], std::option
|
|||||||
|
|
||||||
bool RegTestHost::SetNewDataRoot(const std::string& filename)
|
bool RegTestHost::SetNewDataRoot(const std::string& filename)
|
||||||
{
|
{
|
||||||
Error error;
|
|
||||||
std::unique_ptr<CDImage> image = CDImage::Open(filename.c_str(), false, &error);
|
|
||||||
if (!image)
|
|
||||||
{
|
|
||||||
ERROR_LOG("Failed to open CD image '{}' to set data root: {}", Path::GetFileName(filename), error.GetDescription());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!s_dump_base_directory.empty())
|
if (!s_dump_base_directory.empty())
|
||||||
{
|
{
|
||||||
std::string game_subdir = Path::SanitizeFileName(Path::GetFileTitle(filename));
|
std::string game_subdir = Path::SanitizeFileName(Path::GetFileTitle(filename));
|
||||||
@ -808,6 +800,13 @@ int main(int argc, char* argv[])
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (System::IsReplayingGPUDump() && !s_dump_base_directory.empty())
|
||||||
|
{
|
||||||
|
INFO_LOG("Replaying GPU dump, dumping all frames.");
|
||||||
|
s_frame_dump_interval = 1;
|
||||||
|
s_frames_to_run = static_cast<u32>(System::GetGPUDumpFrameCount());
|
||||||
|
}
|
||||||
|
|
||||||
if (s_frame_dump_interval > 0)
|
if (s_frame_dump_interval > 0)
|
||||||
{
|
{
|
||||||
if (s_dump_base_directory.empty())
|
if (s_dump_base_directory.empty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user