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/parameter-encoder.h | 38 ++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'source/slang-capture-replay/parameter-encoder.h') 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(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(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 + 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 + void encodeStructArray(T const* array, size_t count) + { + for (size_t i = 0; i < count; ++i) + { + encodeStruct(array[i]); + } + } + + template + void encodeAddressArray(T* const* array, size_t count) + { + for (size_t i = 0; i < count; ++i) + { + encodeAddress(array[i]); + } + } + private: template -- cgit v1.2.3