From 8dbff97486ce2315333d117b3bd4e60ffba5499b Mon Sep 17 00:00:00 2001 From: STL1te Date: Tue, 29 Sep 2026 16:18:45 +0300 Subject: [PATCH] chore(agc-driver): agc_shader_replay --spv writes the recompiled SPIR-V --spv saves .spv in the working directory for spirv-val; the usage line lists --asm and --mem too. Co-Authored-By: Claude Opus 5.5 --- .../libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp b/core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp index 80bc24880..1cdb7a93e 100644 --- a/core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp +++ b/core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp @@ -38,6 +38,7 @@ std::string FirstLine(const std::string& text) { bool g_disassemble = false; bool g_assembly = false; bool g_memory = false; +bool g_spirv = false; bool Replay(const char* path) { const auto request = ShaderRecompiler::RequestSerializer{}.Deserialize(ReadText(path)); @@ -78,6 +79,12 @@ bool Replay(const char* path) { try { const auto result = ShaderRecompiler::Recompile(request.request); std::printf(" recompiled: %zu SPIR-V words\n", result.spirv.size()); + if (g_spirv) { + // For spirv-val: .spv in the working directory. + std::string name(path); + name = name.substr(name.find_last_of("/\\") + 1) + ".spv"; + std::ofstream(name, std::ios::binary).write(reinterpret_cast(result.spirv.data()), static_cast(result.spirv.size() * sizeof(result.spirv[0]))); + } if (g_memory) { for (const auto& binding : result.bindings) { if (binding.role != ShaderRecompiler::DescriptorRole::GuestBuffers) continue; @@ -108,7 +115,7 @@ bool Replay(const char* path) { int main(int argc, char** argv) { if (argc < 2) { - std::fprintf(stderr, "usage: agc_shader_replay [--dis] ...\n the driver writes shader_
.req files when APS5_DUMP_SHADERS is set\n"); + std::fprintf(stderr, "usage: agc_shader_replay [--dis] [--asm] [--mem] [--spv] ...\n the driver writes shader_
.req files when APS5_DUMP_SHADERS is set\n"); return 2; } int failures = 0; @@ -125,6 +132,10 @@ int main(int argc, char** argv) { g_memory = true; continue; } + if (std::string(argv[i]) == "--spv") { + g_spirv = true; + continue; + } try { if (!Replay(argv[i])) ++failures; } catch (const std::exception& error) {