mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 08:40:55 +00:00
Add a debug option to embed the log file in captures
This commit is contained in:
@@ -1013,6 +1013,7 @@ rdcstr DoStringise(const SectionType &el)
|
||||
STRINGISE_ENUM_CLASS_NAMED(ResourceRenames, "renderdoc/ui/resrenames");
|
||||
STRINGISE_ENUM_CLASS_NAMED(AMDRGPProfile, "amd/rgp/profile");
|
||||
STRINGISE_ENUM_CLASS_NAMED(ExtendedThumbnail, "renderdoc/internal/exthumb");
|
||||
STRINGISE_ENUM_CLASS_NAMED(EmbeddedLogfile, "renderdoc/internal/logfile");
|
||||
}
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
@@ -86,6 +86,12 @@ version of RenderDoc that addes a new section type. They should be considered eq
|
||||
lossless.
|
||||
|
||||
The name for this section will be "renderdoc/internal/exthumb".
|
||||
|
||||
.. data:: EmbeddedLogfile
|
||||
|
||||
This section contains the log file at the time of capture, for debugging.
|
||||
|
||||
The name for this section will be "renderdoc/internal/logfile".
|
||||
)");
|
||||
enum class SectionType : uint32_t
|
||||
{
|
||||
@@ -98,6 +104,7 @@ enum class SectionType : uint32_t
|
||||
ResourceRenames,
|
||||
AMDRGPProfile,
|
||||
ExtendedThumbnail,
|
||||
EmbeddedLogfile,
|
||||
Count,
|
||||
};
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "api/replay/version.h"
|
||||
#include "common/common.h"
|
||||
#include "common/threading.h"
|
||||
#include "core/settings.h"
|
||||
#include "hooks/hooks.h"
|
||||
#include "maths/formatpacking.h"
|
||||
#include "replay/replay_driver.h"
|
||||
@@ -44,6 +45,9 @@
|
||||
|
||||
#include "replay/renderdoc_serialise.inl"
|
||||
|
||||
RDOC_DEBUG_CONFIG(bool, Capture_Debug_SnapshotDiagnosticLog, false,
|
||||
"Snapshot the diagnostic log at capture time and embed in the capture.");
|
||||
|
||||
void LogReplayOptions(const ReplayOptions &opts)
|
||||
{
|
||||
RDCLOG("%s API validation during replay", (opts.apiValidation ? "Enabling" : "Not enabling"));
|
||||
@@ -1681,6 +1685,22 @@ void RenderDoc::FinishCaptureWriting(RDCFile *rdc, uint32_t frameNumber)
|
||||
delete w;
|
||||
}
|
||||
|
||||
if(Capture_Debug_SnapshotDiagnosticLog())
|
||||
{
|
||||
rdcstr logcontents = FileIO::logfile_readall(RDCGETLOGFILE());
|
||||
|
||||
SectionProperties props = {};
|
||||
props.type = SectionType::EmbeddedLogfile;
|
||||
props.version = 1;
|
||||
StreamWriter *w = rdc->WriteSection(props);
|
||||
|
||||
w->Write(logcontents.data(), logcontents.size());
|
||||
|
||||
w->Finish();
|
||||
|
||||
delete w;
|
||||
}
|
||||
|
||||
RDCLOG("Written to disk: %s", m_CurrentLogFile.c_str());
|
||||
|
||||
CaptureData cap(m_CurrentLogFile, Timing::GetUnixTimestamp(), rdc->GetDriver(), frameNumber);
|
||||
|
||||
Reference in New Issue
Block a user