From 89ddb50eaccc1b7b590dbde55032721762711fb2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 24 Oct 2019 17:58:24 -0400 Subject: OffsetContainer serialization (#1093) * OffsetContainer with unit tests. * State serialization working with OffsetContainer. * Fixes to make work with OffsetContainer. * Added OffsetContainer documentation. * Remove RelativeContainer. * Fix problem with + on Offset32Ptr on windows x86 target. * * Made OffsetBase a base class of OffsetContainer. * Added MemoryOffsetBase to just handle being a chunk of memory. * * Use operator[] to access contents of OffsetContainer * Fix the type hash to work across different size_t sizes. * Fixed some Offset type related comments. * Fix bug around using asBase, because it returns a reference just using 'auto' will means it becomes a value type. Remove assignment and copy ctor from OffsetBase. * Evaluation order of assignment can lead to wrong behavior with Offset32Ptr/raw pointers. Document the fact, and fix in StateSerializeUtil. --- source/slang/slang-options.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-options.cpp') diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index 3e2bec07d..c76993ca4 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -514,6 +514,8 @@ struct OptionsParser SLANG_RETURN_ON_FAIL(StateSerializeUtil::loadState(reproName, buffer)); auto requestState = StateSerializeUtil::getRequest(buffer); + MemoryOffsetBase base; + base.set(buffer.getBuffer(), buffer.getCount()); // If we can find a directory, that exists, we will set up a file system to load from that directory ComPtr fileSystem; @@ -527,7 +529,7 @@ struct OptionsParser } } - SLANG_RETURN_ON_FAIL(StateSerializeUtil::load(requestState, fileSystem, requestImpl)); + SLANG_RETURN_ON_FAIL(StateSerializeUtil::load(base, requestState, fileSystem, requestImpl)); if (argCursor < argEnd) { -- cgit v1.2.3