Add refactored serialisation system

* The new system contains the ability to export serialised data to a
  structured form in memory - and conversion back to serialised bytes.
* This will allow offline transformations/visualisation of capture files
  as well as more rich representations of API calls in the UI.
* Likewise it enables a number of optimisations such as the ability to
  write straight from mapped API memory to disk via a compressor,
  without any intermediate copies.
This commit is contained in:
baldurk
2017-09-27 13:40:55 +01:00
parent 7562da9a20
commit 327fda94a0
10 changed files with 3756 additions and 2575 deletions
+1
View File
@@ -12,6 +12,7 @@
// swig's pre-processor trips up on this definition, and it's only needed for template expansions
// in the conversion code
#define DECLARE_REFLECTION_STRUCT(t)
#define DECLARE_REFLECTION_ENUM(t)
// use documentation for docstrings
#define DOCUMENT(text) %feature("docstring") text
+1
View File
@@ -134,6 +134,7 @@ set(sources
serialise/rdcfile.h
serialise/codecs/xml_codec.cpp
serialise/comp_io_tests.cpp
serialise/serialiser_tests.cpp
serialise/streamio_tests.cpp
strings/grisu2.cpp
strings/string_utils.cpp
-9
View File
@@ -336,15 +336,6 @@ inline enum_name operator++(enum_name &a) \
#include "basic_types.h"
#include "stringise.h"
#ifndef DECLARE_REFLECTION_STRUCT
#define DECLARE_REFLECTION_STRUCT(type) DECLARE_STRINGISE_TYPE(type)
#endif
#ifndef DECLARE_REFLECTION_ENUM
#define DECLARE_REFLECTION_ENUM(type) DECLARE_STRINGISE_TYPE(type)
#endif
#include "structured_data.h"
#ifdef RENDERDOC_EXPORTS
+28
View File
@@ -153,3 +153,31 @@ inline const char *TypeName();
{ \
return #type; \
}
// This is a little bit ugly, but not *too* much. We declare the macro for serialised types to
// forward-declare the template used by the serialiser. This will be visible externally, but it will
// do nothing as the template won't be invoked externally. It means we can use the correct macro in
// the external interface headers to pre-declare them as serialisable, without having to have the
// public interface include serialiser.h which leads to horrible circular dependencies.
// main serialisation templated function that is specialised for any type
// that needs to be serialised. Implementations will either be a struct type,
// in which case they'll call Serialise() on each of their members, or
// they'll be some custom leaf type (most basic types are specialised in this
// header) which will call SerialiseValue().
template <class SerialiserType, class T>
void DoSerialise(SerialiserType &ser, T &el);
#ifndef DECLARE_REFLECTION_STRUCT
#define DECLARE_REFLECTION_STRUCT(type) \
DECLARE_STRINGISE_TYPE(type) \
template <class SerialiserType> \
void DoSerialise(SerialiserType &ser, type &el);
#endif
// enums don't have anything special to do to serialise, they're all handled automagically once they
// have a DoStringise function
#ifndef DECLARE_REFLECTION_ENUM
#define DECLARE_REFLECTION_ENUM(type) DECLARE_STRINGISE_TYPE(type)
#endif
+7
View File
@@ -97,6 +97,13 @@
#endif
// is size_t a real separate type, not just typedef'd to uint32_t or uint64_t (or equivalent)?
#if defined(RENDERDOC_PLATFORM_APPLE)
#define RDOC_SIZET_SEP_TYPE OPTION_ON
#else
#define RDOC_SIZET_SEP_TYPE OPTION_OFF
#endif
#if defined(RENDERDOC_WINDOWING_XLIB)
#define RDOC_XLIB OPTION_ON
#else
+1
View File
@@ -402,6 +402,7 @@
<ClCompile Include="serialise\lz4io.cpp" />
<ClCompile Include="serialise\rdcfile.cpp" />
<ClCompile Include="serialise\serialiser.cpp" />
<ClCompile Include="serialise\serialiser_tests.cpp" />
<ClCompile Include="serialise\streamio.cpp" />
<ClCompile Include="serialise\streamio_tests.cpp" />
<ClCompile Include="serialise\zstdio.cpp" />
+3
View File
@@ -632,6 +632,9 @@
<ClCompile Include="serialise\codecs\xml_codec.cpp">
<Filter>Common\Serialise\Codecs</Filter>
</ClCompile>
<ClCompile Include="serialise\serialiser_tests.cpp">
<Filter>Common\Serialise</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="os\win32\comexport.def">
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff