From f0d40ad5e1d0a0dec39fe8a141d3f81d88fc576a Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Thu, 13 Jun 2024 13:02:12 -0700 Subject: 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 --- source/slang-capture-replay/parameter-encoder.cpp | 72 +++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 source/slang-capture-replay/parameter-encoder.cpp (limited to 'source/slang-capture-replay/parameter-encoder.cpp') diff --git a/source/slang-capture-replay/parameter-encoder.cpp b/source/slang-capture-replay/parameter-encoder.cpp new file mode 100644 index 000000000..5167cc2ab --- /dev/null +++ b/source/slang-capture-replay/parameter-encoder.cpp @@ -0,0 +1,72 @@ +#include "parameter-encoder.h" + +namespace SlangCapture +{ + void ParameterEncoder::encodeStruct(slang::SessionDesc const& desc) + { + encodeUint64(desc.structureSize); + encodeInt64(desc.targetCount); + + for (SlangInt i = 0; i < desc.targetCount; i++) + { + encodeStruct(desc.targets[i]); + } + + encodeUint32(desc.flags); + encodeUint32(desc.defaultMatrixLayoutMode); + encodeInt64(desc.searchPathCount); + for (SlangInt i = 0; i < desc.searchPathCount; i++) + { + encodeString(desc.searchPaths[i]); + } + + encodeInt64(desc.preprocessorMacroCount); + for (SlangInt i = 0; i < desc.preprocessorMacroCount; i++) + { + encodeStruct(desc.preprocessorMacros[i]); + } + + encodeBool(desc.enableEffectAnnotations); + encodeBool(desc.allowGLSLSyntax); + + encodeUint32(desc.compilerOptionEntryCount); + for (uint32_t i = 0; i < desc.compilerOptionEntryCount; i++) + { + encodeStruct(desc.compilerOptionEntries[i]); + } + } + + void ParameterEncoder::encodeStruct(slang::PreprocessorMacroDesc const& desc) + { + encodeString(desc.name); + encodeString(desc.value); + } + + void ParameterEncoder::encodeStruct(slang::CompilerOptionEntry const& entry) + { + encodeInt32((int32_t)(entry.name)); + encodeStruct(entry.value); + } + + void ParameterEncoder::encodeStruct(slang::CompilerOptionValue const& value) + { + (void)value; + } + + void ParameterEncoder::encodeStruct(slang::TargetDesc const& targetDesc) + { + (void)targetDesc; + } + + void ParameterEncoder::encodePointer(const void* value, bool omitData, size_t size) + { + (void)value; + (void)omitData; + (void)size; + } + // first 4-bytes is the length of the string + void ParameterEncoder::encodeString(const char* value) + { + (void)value; + } +} -- cgit v1.2.3