diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-07-23 10:45:26 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-23 08:45:26 -0700 |
| commit | 986256ffb92ab7c8fc7cf9f2c424919a439a824f (patch) | |
| tree | 260e37bd439275e3398d16fe238b20cd00d08cb7 /source/slang-capture-replay/parameter-encoder.h | |
| parent | c28d8b6aec721fa3350fc52647f1572a353f6151 (diff) | |
Feature/capture (#4625)
* Add decoder
* Add a replay executable to consume the decoded content
Add file-processor.cpp/h where we implement the logic to process
the captured file block by block. Each block is:
function header + parameter buffer + function tailer + function
output[optional].
After reading one block, the block of data is sent to decoder module
to dispatch the corresponding API.
Add slang-decoder.cpp/h where we implement the logic to dispatch
the slang API according to the input block data.
- Rename api_callId.h to capture-format.h
- Renmae capture_utility.cpp to capture-utility.cpp
- Renmae capture_utility.h to capture-utility.h
- Change the #include file name accordingly.
* Reorganize source files structure
Move all the capture logic code into `capture` directory.
- the capture code will be build with slang dll.
Move all the replay logic code into `relay` directoy.
- the replay code is not part of slang dll, it will be built
as a stand alone binary and link against slang dll.
Change the #include file names accordingly.
Add tools/slang-replay/main.cpp for the slang-replay stand alone
binary place holder. Will implement it later.
Update premake5.lua accordingly.
* Update cmake files
Update cmake files to change the build process for
capture and relay system.
- capture component should be build with slang dll, so we
should not include replay component.
- replay component should be a separate executable tool, which
should not include capture component.
- In order to easy use our current cmake infrastructure, move
the shared files to a `util` folder
- change the header include path
* Redesgin the interfaces of consumers
Fix some issues in capture
Finish implementing all slang-decoder functions
* Fix the AppleClang build issue
* Address few comments
- Fix the weird indent issues.
- Correct the function name for CreateGlobalSession()
- Rename file-processor to captureFile-processor to be more specific.
- Use Slang::List instead of std::vector
* record/replay: name refactor change
Refactor the naming.
Change the name "encoder/capture" to "record".
Diffstat (limited to 'source/slang-capture-replay/parameter-encoder.h')
| -rw-r--r-- | source/slang-capture-replay/parameter-encoder.h | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/source/slang-capture-replay/parameter-encoder.h b/source/slang-capture-replay/parameter-encoder.h deleted file mode 100644 index d5a6ea510..000000000 --- a/source/slang-capture-replay/parameter-encoder.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef PARAMETER_ENCODER_H -#define PARAMETER_ENCODER_H - -#include <cstdio> -#include <cinttypes> -#include <cstdint> - -#include "output-stream.h" - -namespace SlangCapture -{ - class ParameterEncoder - { - public: - ParameterEncoder(OutputStream* stream) : m_stream(stream) {}; - void encodeInt8(int8_t value) { encodeValue(value); } - void encodeUint8(uint8_t value) { encodeValue(value); } - void encodeInt16(int16_t value) { encodeValue(value); } - void encodeUint16(uint16_t value) { encodeValue(value); } - void encodeInt32(int32_t value) { encodeValue(value); } - void encodeUint32(uint32_t value) { encodeValue(value); } - void encodeInt64(int64_t value) { encodeValue(value); } - void encodeUint64(uint64_t value) { encodeValue(value); } - void encodeFloat(float value) { encodeValue(value); } - void encodeDouble(double value) { encodeValue(value); } - void encodeBool(bool value) { encodeValue(value); } - - template<typename T> - void encodeEnumValue(T value) { encodeValue(static_cast<uint32_t>(value)); } - - void encodeString(const char* value); - void encodePointer(const void* value, bool omitData = false, size_t size = 0); - void encodePointer(ISlangBlob* blob); - void encodeAddress(const void* value) { encodeValue(reinterpret_cast<uint64_t>(value)); } - - void encodeStruct(slang::SessionDesc const& desc); - void encodeStruct(slang::PreprocessorMacroDesc const& desc); - void encodeStruct(slang::CompilerOptionEntry const& entry); - void encodeStruct(slang::CompilerOptionValue const& value); - void encodeStruct(slang::TargetDesc const& targetDesc); - void encodeStruct(slang::SpecializationArg const& specializationArg); - - template <typename T> - void encodeValueArray(const T* array, size_t count) - { - for (size_t i = 0; i < count; ++i) - { - encodeValue(array[i]); - } - } - - void encodeStringArray(const char* const* array, size_t count) - { - for (size_t i = 0; i < count; ++i) - { - encodeString(array[i]); - } - } - - template <typename T> - void encodeStructArray(T const* array, size_t count) - { - for (size_t i = 0; i < count; ++i) - { - encodeStruct(array[i]); - } - } - - template <typename T> - void encodeAddressArray(T* const* array, size_t count) - { - for (size_t i = 0; i < count; ++i) - { - encodeAddress(array[i]); - } - } - - - private: - template <typename T> - void encodeValue(T value) - { - m_stream->write(&value, sizeof(T)); - } - OutputStream* m_stream; - }; -} // namespace SlangCapture - -#endif // PARAMETER_ENCODER_H |
