mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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">
|
||||
|
||||
+604
-1811
File diff suppressed because it is too large
Load Diff
+1791
-755
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user