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.cpp | |
| 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.cpp')
| -rw-r--r-- | source/slang-capture-replay/parameter-encoder.cpp | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/source/slang-capture-replay/parameter-encoder.cpp b/source/slang-capture-replay/parameter-encoder.cpp deleted file mode 100644 index c73a97b08..000000000 --- a/source/slang-capture-replay/parameter-encoder.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#include "parameter-encoder.h" -#include "api_callId.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); - encodeEnumValue(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) - { - encodeEnumValue(entry.name); - encodeStruct(entry.value); - } - - void ParameterEncoder::encodeStruct(slang::CompilerOptionValue const& value) - { - encodeEnumValue(value.kind); - encodeInt32(value.intValue0); - encodeString(value.stringValue0); - encodeString(value.stringValue1); - } - - void ParameterEncoder::encodeStruct(slang::TargetDesc const& targetDesc) - { - encodeUint64(targetDesc.structureSize); - encodeEnumValue(targetDesc.format); - encodeEnumValue(targetDesc.profile); - encodeEnumValue(targetDesc.flags); - encodeEnumValue(targetDesc.floatingPointMode); - encodeEnumValue(targetDesc.lineDirectiveMode); - encodeBool(targetDesc.forceGLSLScalarBufferLayout); - encodeUint32(targetDesc.compilerOptionEntryCount); - for (uint32_t i = 0; i < targetDesc.compilerOptionEntryCount; i++) - { - encodeStruct(targetDesc.compilerOptionEntries[i]); - } - } - - void ParameterEncoder::encodeStruct(slang::SpecializationArg const& specializationArg) - { - encodeEnumValue(specializationArg.kind); - encodeAddress(specializationArg.type); - } - - void ParameterEncoder::encodePointer(const void* value, bool omitData, size_t size) - { - encodeAddress(value); - if (omitData) - { - return; - } - - encodeUint64(size); - if (size) - { - m_stream->write(value, size); - } - } - - void ParameterEncoder::encodePointer(ISlangBlob* blob) - { - encodeAddress(static_cast<const void*>(blob)); - - if (blob) - { - size_t size = blob->getBufferSize(); - const void* buffer = blob->getBufferPointer(); - encodePointer(buffer, false, size); - } - } - - // first 4-bytes is the length of the string - void ParameterEncoder::encodeString(const char* value) - { - if (value == nullptr) - { - encodeUint32(0); - } - else - { - uint32_t size = (uint32_t)strlen(value); - encodeUint32(size); - m_stream->write(value, size); - } - } -} |
