diff --git a/core/kyty/graphics/host_gpu/renderer/pipeline/pipelineManifest.cpp b/core/kyty/graphics/host_gpu/renderer/pipeline/pipelineManifest.cpp index ded8eac92cd..5ccba1fdbdf 100644 --- a/core/kyty/graphics/host_gpu/renderer/pipeline/pipelineManifest.cpp +++ b/core/kyty/graphics/host_gpu/renderer/pipeline/pipelineManifest.cpp @@ -241,6 +241,7 @@ struct PipelineCache::ManifestState { uint32_t pipelines = 0; uint32_t pipelines_known = 0; uint32_t pipelines_failed = 0; + size_t restored_graphics = 0; uint32_t compute = 0; uint32_t compute_cached = 0; uint32_t compute_failed = 0; @@ -781,6 +782,7 @@ void PipelineCache::OpenManifest() { } #if defined(ANYPS5_KYTY) ManifestState::PrioritizeRestoredCompute(m_restore_jobs); + state.restored_graphics = std::ranges::count(m_restore_jobs, false, &AsyncPipelineJob::compute); #endif state.startup_total = static_cast(state.warm_modules.size() + state.warm_pipelines.size() + m_restore_jobs.size()); @@ -3376,7 +3378,8 @@ bool PipelineCache::WaitForManifestCompletion(std::chrono::milliseconds timeout) state.module_jobs.empty() && state.pipeline_jobs.empty() && state.large_compute.empty() && m_restore_jobs.empty() && state.running == 0 && state.built + state.found + state.failed == state.warm_modules.size() && - state.pipelines + state.pipelines_known + state.pipelines_failed == state.warm_pipelines.size() && + state.pipelines + state.pipelines_known + state.pipelines_failed == + state.warm_pipelines.size() + state.restored_graphics && std::ranges::all_of(state.missing_code, [](uint8_t missing) { return missing == 0; }); if (complete) { return state.failed == 0 && state.pipelines_failed == 0 && state.compute_failed == 0 && @@ -3406,7 +3409,7 @@ void PipelineCache::ManifestProgress(bool force) { waiting += missing != 0 ? 1u : 0u; } const auto modules = state.warm_modules.size(); - const auto pipelines = state.warm_pipelines.size(); + const auto pipelines = state.warm_pipelines.size() + state.restored_graphics; if (!idle && !force) { ManifestLog("Pipeline manifest: {}/{} modules, {}/{} pipelines ({} modules wait for " "their shaders) at {:.1f} s", diff --git a/core/libs/prx/libSceAgcDriver/KytyShim/tests/CMakeLists.txt b/core/libs/prx/libSceAgcDriver/KytyShim/tests/CMakeLists.txt index 95e9f1e3ed2..acf75f05832 100644 --- a/core/libs/prx/libSceAgcDriver/KytyShim/tests/CMakeLists.txt +++ b/core/libs/prx/libSceAgcDriver/KytyShim/tests/CMakeLists.txt @@ -704,8 +704,12 @@ add_dependencies(kyty_shim_depth_target_alias_tests agc_frame_replay) add_test(NAME kyty_shim_depth_target_alias COMMAND kyty_shim_depth_target_alias_tests $) set_tests_properties(kyty_shim_depth_target_alias PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77 PASS_REGULAR_EXPRESSION "kyty_shim_depth_target_alias: ok") +add_test(NAME kyty_shim_restored_graphics_wait COMMAND kyty_shim_depth_target_alias_tests $ --restored) +set_tests_properties(kyty_shim_restored_graphics_wait PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77 + ENVIRONMENT "KYTY_PIPELINE_MANIFEST=1" + PASS_REGULAR_EXPRESSION "kyty_shim_restored_graphics_wait: ok") if(WIN32) - set_property(TEST kyty_shim_depth_target_alias APPEND PROPERTY + set_property(TEST kyty_shim_depth_target_alias kyty_shim_restored_graphics_wait APPEND PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$") endif() diff --git a/core/libs/prx/libSceAgcDriver/KytyShim/tests/DepthTargetAlias.cpp b/core/libs/prx/libSceAgcDriver/KytyShim/tests/DepthTargetAlias.cpp index 674970e97ec..7649aee0865 100644 --- a/core/libs/prx/libSceAgcDriver/KytyShim/tests/DepthTargetAlias.cpp +++ b/core/libs/prx/libSceAgcDriver/KytyShim/tests/DepthTargetAlias.cpp @@ -1,4 +1,5 @@ #include "prx/libSceAgcDriver/Execution/include/FrameCapture.hpp" +#include "../src/ShaderCachePolicy.hpp" #include #include @@ -334,14 +335,15 @@ struct Replay { std::string frame; }; -Replay replay(const std::filesystem::path& tool, const std::filesystem::path& root, const Case& test) { +Replay replay(const std::filesystem::path& tool, const std::filesystem::path& root, const Case& test, + std::string_view options = "--cold-pipelines") { const auto directory = root / test.name; std::filesystem::create_directories(directory); makeCapture(directory / "capture", test.variant); const auto log = directory / "replay.log"; const auto frames = directory / "frames"; const auto command = quote(tool) + " " + quote(directory / "capture") + - " --strict --no-synthesize --repeat 1 --cold-pipelines --frames " + quote(frames) + " > " + + " --strict --no-synthesize --repeat 1 " + std::string(options) + " --frames " + quote(frames) + " > " + quote(log) + " 2>&1"; std::fflush(nullptr); #ifdef _WIN32 @@ -379,12 +381,41 @@ void printVulkanDiagnostics(std::string_view log) { int main(int argc, char** argv) { try { - if (argc != 2) throw std::runtime_error("usage: kyty_shim_depth_target_alias_tests "); - const std::filesystem::path tool = argv[1]; + const bool restored = argc == 3 && std::string_view(argv[2]) == "--restored"; + if (argc != 2 && !restored) throw std::runtime_error("usage: kyty_shim_depth_target_alias_tests [--restored]"); + if (restored && !KytyShim::ResolveShaderCacheEnabled(true, std::getenv("ANYPS5_NO_SHADER_CACHE"))) { + std::cout << "kyty_shim_restored_graphics_wait requires the on-disk shader cache\n"; + return 77; + } + const auto tool = std::filesystem::absolute(argv[1]); const auto root = std::filesystem::temp_directory_path() / ("kyty-depth-target-alias-" + std::to_string(std::chrono::steady_clock::now().time_since_epoch().count())); std::filesystem::create_directories(root); const bool vulkan_required = std::getenv("ANYPS5_REQUIRE_VULKAN") != nullptr; + if (restored) { + const auto original = std::filesystem::current_path(); + std::filesystem::create_directories(root / "app0" / "sce_sys"); + std::ofstream(root / "app0" / "sce_sys" / "param.json") << "{\"titleId\":\"TEST00001\",\"appVersion\":\"01.00\"}\n"; + std::filesystem::current_path(root); + const auto seed = replay(tool, root / "seed", Cases.front(), ""); + printVulkanDiagnostics(seed.log); + if (!seed.completed) { + printTail(seed.log); + return vulkan_required ? 1 : 77; + } + const auto warm = replay(tool, root / "warm", Cases.front(), "--wait-manifest"); + printVulkanDiagnostics(warm.log); + std::filesystem::current_path(original); + if (!warm.completed || warm.frame != seed.frame || + warm.log.find("pipeline handles to resolve") == std::string::npos || + warm.log.find(", 0 pipeline handles to resolve") != std::string::npos) { + printTail(warm.log); + return 1; + } + std::filesystem::remove_all(root); + std::cout << "kyty_shim_restored_graphics_wait: ok\n"; + return 0; + } std::string control_frame; std::string stencil_filled_frame; std::string retiled_seed_frame; diff --git a/docs/dev/ENVIRONMENT.md b/docs/dev/ENVIRONMENT.md index aea22d9fce3..caeebc5980c 100644 --- a/docs/dev/ENVIRONMENT.md +++ b/docs/dev/ENVIRONMENT.md @@ -42,6 +42,7 @@ The code reads environment names through `getenv`, `IsEnvironmentSet`, `kibSetti | `ANYPS5_HOST_REPORT` | string | `core/libs/prx/libSceAgcDriver/KytyShim/src/EntryGpu.cpp` | 0 | prints the host report to stderr once when the Vulkan device is chosen: 1 prints it; 0, empty or unset prints nothing (with the Kyty backend, unset prints it and 0 or empty turns it off), and any other value stops the start with an error naming the variable | | `ANYPS5_KYTY_PRESTART` | string | `core/libs/prx/libSceAgcDriver/KytyShim/src/EntryGpu.cpp` | 1 | when the Kyty GPU starts: 1, empty or unset starts it on a host thread as soon as the video output is created, while the window is created; 0 starts it after the window exists, as before; any other value stops the game when its video output starts, with an error that names the variable | | `ANYPS5_KYTY_SPARSE_READS` | string | `core/libs/prx/libSceAgcDriver/KytyShim/src/MemoryBacking.cpp` | 1 | how the Kyty GPU reads guest memory of 64 KiB or more: 1, empty or unset asks the memory files where their data is (`SEEK_DATA`) and writes zeros for the never-written parts without touching them; 0 reads every byte, as before, which fills those parts with real zeroed pages; any other value stops the game when the guest memory view is enabled, with an error that names the variable. Linux only: on Windows the variable is not read, the view is always copied whole as with 0, and `DirectMemoryViewFiles_nid_no_patch` returns false because the view has no file descriptors there | +| `ANYPS5_NO_SHADER_CACHE` | string | `core/libs/prx/libSceAgcDriver/KytyShim/src/Config.cpp`, `core/libs/prx/libSceAgcDriver/KytyShim/tests/DepthTargetAlias.cpp` | unset | Any nonempty value other than `0` disables the Kyty on-disk shader cache. The restored graphics replay requires that cache. | | `ANYPS5_REQUIRE_VULKAN` | presence | `core/libs/prx/libSceAgcDriver/KytyShim/tests/BdaLoadForms.cpp` | | fails a test instead of skipping when no usable Vulkan device is present | | `ANYPS5_UPSCALE` | string | `core/kyty/graphics/presentation/window/swapchain.cpp` | | fsr scales the presentation with FSR 1 (EASU and RCAS) when the window is larger than the display buffer, cmaa2 applies Intel CMAA2 morphological anti-aliasing at 1:1 native resolution, rcas applies 1:1 native RCAS sharpening; unset or empty keeps the bilinear scaler, and any other value is refused | | `APS5_FORCE_SDR` | presence | `core/libs/prx/libSceAgcDriver/Execution/src/HostHdr.cpp` | unset | suppresses advertised HDR availability while retaining detected host capabilities; uses the existing SDR presentation path | diff --git a/tools/lavapipe_skip.txt b/tools/lavapipe_skip.txt index 58c66ad83a9..91f364535d7 100644 --- a/tools/lavapipe_skip.txt +++ b/tools/lavapipe_skip.txt @@ -1,5 +1,6 @@ kyty_shim_depth_target_alias replays a capture through the Kyty renderer, whose device selection requires VK_EXT_image_view_min_lod and subgroups of 32 or 64: llvmpipe has no such extension and a subgroup size of 8 kyty_shim_frame_capture_round_trip same device requirement as kyty_shim_depth_target_alias +kyty_shim_restored_graphics_wait same device requirement as kyty_shim_depth_target_alias kyty_shim_buffer_null_range same device requirement as kyty_shim_depth_target_alias kyty_shim_uniform_scalar_replay same device requirement as kyty_shim_depth_target_alias kyty_shim_empty_buffer_replay same device requirement as kyty_shim_depth_target_alias