summaryrefslogtreecommitdiff
path: root/source/slang-record-replay/record/parameter-recorder.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /source/slang-record-replay/record/parameter-recorder.cpp
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'source/slang-record-replay/record/parameter-recorder.cpp')
-rw-r--r--source/slang-record-replay/record/parameter-recorder.cpp184
1 files changed, 92 insertions, 92 deletions
diff --git a/source/slang-record-replay/record/parameter-recorder.cpp b/source/slang-record-replay/record/parameter-recorder.cpp
index 1c2fd9609..af4488f81 100644
--- a/source/slang-record-replay/record/parameter-recorder.cpp
+++ b/source/slang-record-replay/record/parameter-recorder.cpp
@@ -2,122 +2,122 @@
namespace SlangRecord
{
- void ParameterRecorder::recordStruct(slang::SessionDesc const& desc)
+void ParameterRecorder::recordStruct(slang::SessionDesc const& desc)
+{
+ recordUint64(desc.structureSize);
+ recordInt64(desc.targetCount);
+
+ for (SlangInt i = 0; i < desc.targetCount; i++)
{
- recordUint64(desc.structureSize);
- recordInt64(desc.targetCount);
-
- for (SlangInt i = 0; i < desc.targetCount; i++)
- {
- recordStruct(desc.targets[i]);
- }
-
- recordUint32(desc.flags);
- recordEnumValue(desc.defaultMatrixLayoutMode);
- recordInt64(desc.searchPathCount);
- for (SlangInt i = 0; i < desc.searchPathCount; i++)
- {
- recordString(desc.searchPaths[i]);
- }
-
- recordInt64(desc.preprocessorMacroCount);
- for (SlangInt i = 0; i < desc.preprocessorMacroCount; i++)
- {
- recordStruct(desc.preprocessorMacros[i]);
- }
-
- recordBool(desc.enableEffectAnnotations);
- recordBool(desc.allowGLSLSyntax);
-
- recordUint32(desc.compilerOptionEntryCount);
- for (uint32_t i = 0; i < desc.compilerOptionEntryCount; i++)
- {
- recordStruct(desc.compilerOptionEntries[i]);
- }
+ recordStruct(desc.targets[i]);
}
- void ParameterRecorder::recordStruct(slang::PreprocessorMacroDesc const& desc)
+ recordUint32(desc.flags);
+ recordEnumValue(desc.defaultMatrixLayoutMode);
+ recordInt64(desc.searchPathCount);
+ for (SlangInt i = 0; i < desc.searchPathCount; i++)
{
- recordString(desc.name);
- recordString(desc.value);
+ recordString(desc.searchPaths[i]);
}
- void ParameterRecorder::recordStruct(slang::CompilerOptionEntry const& entry)
+ recordInt64(desc.preprocessorMacroCount);
+ for (SlangInt i = 0; i < desc.preprocessorMacroCount; i++)
{
- recordEnumValue(entry.name);
- recordStruct(entry.value);
+ recordStruct(desc.preprocessorMacros[i]);
}
- void ParameterRecorder::recordStruct(slang::CompilerOptionValue const& value)
+ recordBool(desc.enableEffectAnnotations);
+ recordBool(desc.allowGLSLSyntax);
+
+ recordUint32(desc.compilerOptionEntryCount);
+ for (uint32_t i = 0; i < desc.compilerOptionEntryCount; i++)
{
- recordEnumValue(value.kind);
- recordInt32(value.intValue0);
- recordString(value.stringValue0);
- recordString(value.stringValue1);
+ recordStruct(desc.compilerOptionEntries[i]);
}
+}
+
+void ParameterRecorder::recordStruct(slang::PreprocessorMacroDesc const& desc)
+{
+ recordString(desc.name);
+ recordString(desc.value);
+}
+
+void ParameterRecorder::recordStruct(slang::CompilerOptionEntry const& entry)
+{
+ recordEnumValue(entry.name);
+ recordStruct(entry.value);
+}
+
+void ParameterRecorder::recordStruct(slang::CompilerOptionValue const& value)
+{
+ recordEnumValue(value.kind);
+ recordInt32(value.intValue0);
+ recordString(value.stringValue0);
+ recordString(value.stringValue1);
+}
- void ParameterRecorder::recordStruct(slang::TargetDesc const& targetDesc)
+void ParameterRecorder::recordStruct(slang::TargetDesc const& targetDesc)
+{
+ recordUint64(targetDesc.structureSize);
+ recordEnumValue(targetDesc.format);
+ recordEnumValue(targetDesc.profile);
+ recordEnumValue(targetDesc.flags);
+ recordEnumValue(targetDesc.floatingPointMode);
+ recordEnumValue(targetDesc.lineDirectiveMode);
+ recordBool(targetDesc.forceGLSLScalarBufferLayout);
+ recordUint32(targetDesc.compilerOptionEntryCount);
+ for (uint32_t i = 0; i < targetDesc.compilerOptionEntryCount; i++)
{
- recordUint64(targetDesc.structureSize);
- recordEnumValue(targetDesc.format);
- recordEnumValue(targetDesc.profile);
- recordEnumValue(targetDesc.flags);
- recordEnumValue(targetDesc.floatingPointMode);
- recordEnumValue(targetDesc.lineDirectiveMode);
- recordBool(targetDesc.forceGLSLScalarBufferLayout);
- recordUint32(targetDesc.compilerOptionEntryCount);
- for (uint32_t i = 0; i < targetDesc.compilerOptionEntryCount; i++)
- {
- recordStruct(targetDesc.compilerOptionEntries[i]);
- }
+ recordStruct(targetDesc.compilerOptionEntries[i]);
}
+}
- void ParameterRecorder::recordStruct(slang::SpecializationArg const& specializationArg)
+void ParameterRecorder::recordStruct(slang::SpecializationArg const& specializationArg)
+{
+ recordEnumValue(specializationArg.kind);
+ recordAddress(specializationArg.type);
+}
+
+void ParameterRecorder::recordPointer(const void* value, bool omitData, size_t size)
+{
+ recordAddress(value);
+ if (omitData)
{
- recordEnumValue(specializationArg.kind);
- recordAddress(specializationArg.type);
+ recordUint64(0llu);
+ return;
}
- void ParameterRecorder::recordPointer(const void* value, bool omitData, size_t size)
+ recordUint64(size);
+ if (size)
{
- recordAddress(value);
- if (omitData)
- {
- recordUint64(0llu);
- return;
- }
-
- recordUint64(size);
- if (size)
- {
- m_stream->write(value, size);
- }
+ m_stream->write(value, size);
}
+}
- void ParameterRecorder::recordPointer(ISlangBlob* blob)
+void ParameterRecorder::recordPointer(ISlangBlob* blob)
+{
+ recordAddress(static_cast<const void*>(blob));
+
+ if (blob)
{
- recordAddress(static_cast<const void*>(blob));
-
- if (blob)
- {
- size_t size = blob->getBufferSize();
- const void* buffer = blob->getBufferPointer();
- recordPointer(buffer, false, size);
- }
+ size_t size = blob->getBufferSize();
+ const void* buffer = blob->getBufferPointer();
+ recordPointer(buffer, false, size);
}
+}
- // first 4-bytes is the length of the string
- void ParameterRecorder::recordString(const char* value)
+// first 4-bytes is the length of the string
+void ParameterRecorder::recordString(const char* value)
+{
+ if (value == nullptr)
+ {
+ recordUint32(0);
+ }
+ else
{
- if (value == nullptr)
- {
- recordUint32(0);
- }
- else
- {
- uint32_t size = (uint32_t)strlen(value);
- recordUint32(size);
- m_stream->write(value, size);
- }
+ uint32_t size = (uint32_t)strlen(value);
+ recordUint32(size);
+ m_stream->write(value, size);
}
}
+} // namespace SlangRecord