diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-06-20 20:59:33 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-20 20:59:33 -0700 |
| commit | d349fd9e1f65fd32b2f4ea0e38c5084256d0dd04 (patch) | |
| tree | 3e4869c01b041830f06b953abbb835284abcb89f /source/slang-capture-replay/parameter-encoder.h | |
| parent | c3c1cb6776eacdc01ea5bc197b635471960994e4 (diff) | |
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.
Diffstat (limited to 'source/slang-capture-replay/parameter-encoder.h')
| -rw-r--r-- | source/slang-capture-replay/parameter-encoder.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/source/slang-capture-replay/parameter-encoder.h b/source/slang-capture-replay/parameter-encoder.h index 2b7abab45..d5a6ea510 100644 --- a/source/slang-capture-replay/parameter-encoder.h +++ b/source/slang-capture-replay/parameter-encoder.h @@ -29,7 +29,6 @@ namespace SlangCapture void encodeEnumValue(T value) { encodeValue(static_cast<uint32_t>(value)); } void encodeString(const char* value); - void encodeStringArray(const char* const* strArray, size_t count); 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)); } @@ -39,6 +38,43 @@ namespace SlangCapture 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> |
