Move section data types into the public replay interface

This commit is contained in:
baldurk
2017-11-15 19:25:12 +00:00
parent 0f38c4770b
commit a238d3022a
6 changed files with 160 additions and 33 deletions
+24
View File
@@ -69,6 +69,30 @@ struct PathEntry
DECLARE_REFLECTION_STRUCT(PathEntry);
DOCUMENT("Properties of a section in a renderdoc capture file.");
struct SectionProperties
{
DOCUMENT("The name of this section.");
rdcstr name;
DOCUMENT("The type of this section, if it is a known pre-defined section.");
SectionType type = SectionType::Unknown;
DOCUMENT("The flags describing how this section is stored.");
SectionFlags flags = SectionFlags::NoFlags;
DOCUMENT("The version of this section - the meaning of which is up to the type.");
uint64_t version = 0;
DOCUMENT("The number of bytes of data contained in this section, once uncompressed.");
uint64_t uncompressedSize = 0;
DOCUMENT("The number of bytes of data in this section when compressed on disk.");
uint64_t compressedSize = 0;
};
DECLARE_REFLECTION_STRUCT(SectionProperties);
struct ResourceFormat;
DOCUMENT("Internal function for getting the name for a resource format.");
+28
View File
@@ -774,6 +774,20 @@ std::string DoStringise(const GraphicsAPI &el)
END_ENUM_STRINGISE();
}
template <>
std::string DoStringise(const SectionType &el)
{
BEGIN_ENUM_STRINGISE(SectionType);
{
STRINGISE_ENUM_CLASS_NAMED(FrameCapture, "Frame Capture");
STRINGISE_ENUM_CLASS_NAMED(ResolveDatabase, "Callstack Resolve Database");
STRINGISE_ENUM_CLASS_NAMED(Bookmarks, "Bookmarks");
STRINGISE_ENUM_CLASS_NAMED(Notes, "Notes");
STRINGISE_ENUM_CLASS_NAMED(ResourceRenames, "Resource Renames");
}
END_ENUM_STRINGISE();
}
template <>
std::string DoStringise(const D3DBufferViewFlags &el)
{
@@ -805,6 +819,20 @@ std::string DoStringise(const PathProperty &el)
END_BITFIELD_STRINGISE();
}
template <>
std::string DoStringise(const SectionFlags &el)
{
BEGIN_BITFIELD_STRINGISE(SectionFlags);
{
STRINGISE_BITFIELD_CLASS_VALUE_NAMED(NoFlags, "No Flags");
STRINGISE_BITFIELD_CLASS_BIT_NAMED(ASCIIStored, "Stored as ASCII");
STRINGISE_BITFIELD_CLASS_BIT_NAMED(LZ4Compressed, "Compressed with LZ4");
STRINGISE_BITFIELD_CLASS_BIT_NAMED(ZstdCompressed, "Compressed with Zstd");
}
END_BITFIELD_STRINGISE();
}
template <>
std::string DoStringise(const ShaderEvents &el)
{
+92
View File
@@ -71,6 +71,98 @@ enum class PathProperty : uint32_t
BITMASK_OPERATORS(PathProperty);
DECLARE_REFLECTION_ENUM(PathProperty);
DOCUMENT(R"(A set of flags describing the properties of a section in a renderdoc capture.
.. data:: NoFlags
No special section properties.
.. data:: ASCIIStored
This section was stored as pure ASCII. This can be useful since it is possible to generate
an ASCII section in a text editor by hand or with any simple printf style script, and then
concatenate it to a .rdc and have a valid section.
.. data:: LZ4Compressed
This section is compressed with LZ4 on disk.
.. data:: ZstdCompressed
This section is compressed with Zstd on disk.
)");
enum class SectionFlags : uint32_t
{
NoFlags = 0x0,
ASCIIStored = 0x1,
LZ4Compressed = 0x2,
ZstdCompressed = 0x4,
};
BITMASK_OPERATORS(SectionFlags);
DECLARE_REFLECTION_ENUM(SectionFlags);
DOCUMENT(R"(The types of several pre-defined and known sections. This allows consumers of the API
to recognise and understand the contents of the section.
Note that sections above the highest value here may be encountered if they were written in a new
version of RenderDoc that addes a new section type. They should be considered equal to
:data:`Unknown` by any processing.
.. data:: Unknown
An unknown section - any custom or non-predefined section will have this type.
.. data:: FrameCapture
This section contains the actual captured frame, in RenderDoc's internal chunked representation.
The contents can be fetched as structured data with or without replaying the frame.
The name for this section will be "renderdoc/internal/framecapture".
.. data:: ResolveDatabase
This section contains platform-specific data used to resolve callstacks.
The name for this section will be "renderdoc/internal/resolvedb".
.. data:: Bookmarks
This section contains a JSON document with bookmarks added to the capture to highlight important
events.
The name for this section will be "renderdoc/ui/bookmarks".
.. data:: Notes
This section contains a JSON document with free-form information added for human consumption, e.g.
details about how the capture was obtained with repro steps in the original program, or with
driver and machine info.
The name for this section will be "renderdoc/ui/notes".
.. data:: ResourceRenames
This section contains a JSON document with custom names applied to resources in the UI, over and
above any friendly names specified in the capture itself.
The name for this section will be "renderdoc/ui/resrenames".
)");
enum class SectionType : uint32_t
{
Unknown = 0,
First = Unknown,
FrameCapture,
ResolveDatabase,
Bookmarks,
Notes,
ResourceRenames,
Count,
};
ITERABLE_OPERATORS(SectionType);
DECLARE_REFLECTION_ENUM(SectionType);
// replay_shader.h
DOCUMENT(R"(Represents the base type of a shader variable in debugging or constant blocks.
+14
View File
@@ -64,6 +64,19 @@ void DoSerialise(SerialiserType &ser, PathEntry &el)
SIZE_CHECK(32);
}
template <class SerialiserType>
void DoSerialise(SerialiserType &ser, SectionProperties &el)
{
SERIALISE_MEMBER(name);
SERIALISE_MEMBER(type);
SERIALISE_MEMBER(flags);
SERIALISE_MEMBER(version);
SERIALISE_MEMBER(uncompressedSize);
SERIALISE_MEMBER(compressedSize);
SIZE_CHECK(48);
}
template <class SerialiserType>
void DoSerialise(SerialiserType &ser, EnvironmentModification &el)
{
@@ -2171,6 +2184,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::State &el)
#pragma endregion Vulkan pipeline state
INSTANTIATE_SERIALISE_TYPE(PathEntry)
INSTANTIATE_SERIALISE_TYPE(SectionProperties)
INSTANTIATE_SERIALISE_TYPE(EnvironmentModification)
INSTANTIATE_SERIALISE_TYPE(CaptureOptions)
INSTANTIATE_SERIALISE_TYPE(ResourceFormat)
+2
View File
@@ -41,6 +41,8 @@ const char *SectionTypeNames[] = {
"renderdoc/ui/bookmarks",
// Notes
"renderdoc/ui/notes",
// Resource Renames
"renderdoc/ui/resrenames",
};
RDCCOMPILE_ASSERT(ARRAY_COUNT(SectionTypeNames) == (size_t)SectionType::Count,
-33
View File
@@ -36,41 +36,8 @@ enum class ContainerError
UnsupportedVersion,
};
enum class SectionFlags : uint32_t
{
NoFlags = 0x0,
ASCIIStored = 0x1,
LZ4Compressed = 0x2,
ZstdCompressed = 0x4,
};
BITMASK_OPERATORS(SectionFlags);
enum class SectionType : uint32_t
{
Unknown = 0,
First = Unknown,
FrameCapture, // renderdoc/internal/framecapture
ResolveDatabase, // renderdoc/internal/resolvedb
FrameBookmarks, // renderdoc/ui/bookmarks
Notes, // renderdoc/ui/notes
Count,
};
ITERABLE_OPERATORS(SectionType);
extern const char *SectionTypeNames[];
struct SectionProperties
{
std::string name;
SectionType type = SectionType::Count;
SectionFlags flags = SectionFlags::NoFlags;
uint64_t version = 0;
uint64_t uncompressedSize = 0;
uint64_t compressedSize = 0;
};
struct RDCThumb
{
const byte *pixels = NULL;