From d349fd9e1f65fd32b2f4ea0e38c5084256d0dd04 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Thu, 20 Jun 2024 20:59:33 -0700 Subject: Add capture logic to other interfaces. (#4412) * Add capture logic to other interfaces. Add capture logics to ISession, IModule, ITypeConformance, IEntryPoint ICompositeComponentType. Add few encode methods to encode the array. Fix some capture logic in global session. We will not need to encode the null_ptr output before actual actual of the captured APIs. Previously we used this as a place holder, but it's actually not necessary, it can be detected if the output is not captured during replay. * capture/replay: dump the shader files to disk Dump the shader files to disk. Also set a default directory for the capture files. --- source/slang-capture-replay/capture-manager.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'source/slang-capture-replay/capture-manager.cpp') diff --git a/source/slang-capture-replay/capture-manager.cpp b/source/slang-capture-replay/capture-manager.cpp index 2d04b077a..5ab40d93c 100644 --- a/source/slang-capture-replay/capture-manager.cpp +++ b/source/slang-capture-replay/capture-manager.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "capture_utility.h" #include "capture-manager.h" namespace SlangCapture @@ -11,7 +12,21 @@ namespace SlangCapture { std::stringstream ss; ss << "gs-"<< globalSessionHandle <<"-t-"<(ss.str()); + + m_captureFileDirectory = m_captureFileDirectory / "slang-capture"; + + if (!std::filesystem::exists(m_captureFileDirectory)) + { + std::error_code ec; + if (!std::filesystem::create_directory(m_captureFileDirectory, ec)) + { + slangCaptureLog(LogLevel::Error, "Fail to create directory: %s, error (%d): %s\n", + m_captureFileDirectory.string().c_str(), ec.value(), ec.message().c_str()); + } + } + + std::filesystem::path captureFilePath = m_captureFileDirectory / ss.str(); + m_fileStream = std::make_unique(captureFilePath.string()); } void CaptureManager::clearWithHeader(const ApiCallId& callId, uint64_t handleId) -- cgit v1.2.3