diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-06-13 13:02:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-13 13:02:12 -0700 |
| commit | f0d40ad5e1d0a0dec39fe8a141d3f81d88fc576a (patch) | |
| tree | 210a0a9b5bb2aea0e64776527c4ce04266709a43 /source/slang-capture-replay/slang-global-session.cpp | |
| parent | ecc6ecb3a25a28eb5e85cfdb2bf170448ab9a4e7 (diff) | |
capture/replay: implement infrastructure for capture (#4372)
* Define api call ID for each being captured methods
* Add parameter encoder interface
* Add outputStream and capture manager
Add infrastructure for output stream
This is the interface to record the method and parameter, and also
provide functionality to write all the serialized data into file.
Add capture manager:
Capture manager is associated to global session object, it will
provide the functionality to actual record all the APIs.
Implement some of parameter encoder functions.
* Fix some Windows & cmake build error
* remove unused headers
Diffstat (limited to 'source/slang-capture-replay/slang-global-session.cpp')
| -rw-r--r-- | source/slang-capture-replay/slang-global-session.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/slang-capture-replay/slang-global-session.cpp b/source/slang-capture-replay/slang-global-session.cpp index 05a2b93ec..45ea0b58d 100644 --- a/source/slang-capture-replay/slang-global-session.cpp +++ b/source/slang-capture-replay/slang-global-session.cpp @@ -1,5 +1,3 @@ - -#include <vector> #include "slang-global-session.h" #include "slang-session.h" #include "slang-filesystem.h" @@ -8,10 +6,21 @@ namespace SlangCapture { + // constructor is called in slang_createGlobalSession GlobalSessionCapture::GlobalSessionCapture(slang::IGlobalSession* session): m_actualGlobalSession(session) { SLANG_CAPTURE_ASSERT(m_actualGlobalSession != nullptr); + + m_thisHandle = reinterpret_cast<SlangCapture::AddressFormat>(this); + m_captureManager = std::make_unique<CaptureManager>(m_thisHandle); + + // We will use the address of the global session as the filename for the capture manager + // to make it unique for each global session. + // capture slang::createGlobalSession + ParameterEncoder* encoder = m_captureManager->beginMethodCapture(ApiCallId::ICreateGlobalSession, g_globalFunctionHandle); + encoder->encodeAddress(m_actualGlobalSession); + m_captureManager->endMethodCapture(); } GlobalSessionCapture::~GlobalSessionCapture() |
