From 56df893667a484c8e2e4057871f55804fca30f9f Mon Sep 17 00:00:00 2001 From: danzaio Date: Mon, 12 Oct 2026 00:46:50 -0300 Subject: [PATCH] fix(agc): preserve dumps for non-standard shader failures Capture the request once before rethrowing from the shared handler. Standard exceptions keep the shader address, stage, optional dump filename and full message; non-standard exceptions remain unchanged after capture. AI-assisted: yes. --- .../src/Driver/Shaders/ShaderRegistry.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp index 457ce1b55..e31f423ba 100644 --- a/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp +++ b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -30,23 +31,24 @@ namespace AgcDriver::DriverDetail { std::shared_ptr PrepareShaderWithDiagnostics(const ShaderRecompiler::RecompileRequest& request, ShaderRecompiler::ShaderPreparationContext* preparation) { + std::exception_ptr failure; + std::string dump; try { return ShaderRecompiler::PrepareShader(request, preparation); - } catch (const std::exception& error) { - std::string dump; + } catch (...) { + failure = std::current_exception(); try { if (std::getenv("APS5_DUMP_SHADERS") != nullptr) dump = Driver::dumpRequest(request.shader.codeAddress, request); } catch (...) {} + } + try { + std::rethrow_exception(failure); + } catch (const std::exception& error) { std::ostringstream where; where << "shader 0x" << std::hex << request.shader.codeAddress << " stage " << static_cast(request.shader.stage); if (!dump.empty()) where << " (" << dump << ")"; where << ": "; throw std::runtime_error(where.str() + error.what()); - } catch (...) { - try { - if (std::getenv("APS5_DUMP_SHADERS") != nullptr) static_cast(Driver::dumpRequest(request.shader.codeAddress, request)); - } catch (...) {} - throw; } }