mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-17 04:57:09 +00:00
ICaptureContextx APIs for externally referenced dependency files
void EmbedDependentFilesIntoCapture(); void RemoveDependentFilesFromCapture();
This commit is contained in:
@@ -945,6 +945,7 @@ void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const Repla
|
||||
const QString &origFilename, bool temporary, bool local)
|
||||
{
|
||||
m_CaptureFile = origFilename;
|
||||
m_RemoteFile = captureFile;
|
||||
|
||||
m_CaptureLocal = local;
|
||||
|
||||
@@ -1427,6 +1428,7 @@ void CaptureContext::CloseCapture()
|
||||
m_CaptureTemporary = false;
|
||||
|
||||
m_CaptureFile = QString();
|
||||
m_RemoteFile = QString();
|
||||
|
||||
m_APIProps = APIProperties();
|
||||
m_FrameInfo = FrameDescription();
|
||||
@@ -2859,3 +2861,63 @@ void CaptureContext::AddDockWindow(QWidget *newWindow, DockReference ref, QWidge
|
||||
manager->areaOf(refWindow), percentage);
|
||||
manager->addToolWindow(newWindow, areaRef);
|
||||
}
|
||||
|
||||
void CaptureContext::EmbedDependentFiles()
|
||||
{
|
||||
if(!m_Replay.GetCaptureAccess())
|
||||
return;
|
||||
|
||||
// Always operate on the capture access (local or remote)
|
||||
m_Replay.GetCaptureAccess()->EmbedDependenciesIntoCapture();
|
||||
|
||||
// Local replay
|
||||
if(m_Replay.GetCaptureFile())
|
||||
return;
|
||||
|
||||
// Remote capture : no local capture file
|
||||
if(IsCaptureTemporary())
|
||||
return;
|
||||
|
||||
// Local capture file being replayed remotely : copy back from the remote
|
||||
if(IsCaptureLocal())
|
||||
{
|
||||
Replay().CopyCaptureFromRemote(m_RemoteFile, m_CaptureFile, m_MainWindow);
|
||||
|
||||
if(!QFile::exists(m_CaptureFile))
|
||||
{
|
||||
RDDialog::critical(m_MainWindow, tr("Failed to save capture"),
|
||||
tr("Capture couldn't be copied from remote."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureContext::RemoveDependentFiles()
|
||||
{
|
||||
if(!m_Replay.GetCaptureAccess())
|
||||
return;
|
||||
|
||||
// Always operate on the capture access (local or remote)
|
||||
m_Replay.GetCaptureAccess()->RemoveDependenciesFromCapture();
|
||||
|
||||
// Local replay
|
||||
if(m_Replay.GetCaptureFile())
|
||||
return;
|
||||
|
||||
// Remote capture : no local capture file
|
||||
if(IsCaptureTemporary())
|
||||
return;
|
||||
|
||||
// Local capture file being replayed remotely : copy back from the remote
|
||||
if(IsCaptureLocal())
|
||||
{
|
||||
Replay().CopyCaptureFromRemote(m_RemoteFile, m_CaptureFile, m_MainWindow);
|
||||
|
||||
if(!QFile::exists(m_CaptureFile))
|
||||
{
|
||||
RDDialog::critical(m_MainWindow, tr("Failed to save capture"),
|
||||
tr("Capture couldn't be copied from remote."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,8 @@ public:
|
||||
rdcarray<EventBookmark> GetBookmarks() override { return m_Bookmarks; }
|
||||
void SetBookmark(const EventBookmark &mark) override;
|
||||
void RemoveBookmark(uint32_t EID) override;
|
||||
void EmbedDependentFiles() override;
|
||||
void RemoveDependentFiles() override;
|
||||
|
||||
void DelayedCallback(uint32_t milliseconds, std::function<void()> callback) override;
|
||||
|
||||
@@ -312,6 +314,7 @@ private:
|
||||
bool m_CaptureLoaded = false, m_LoadInProgress = false, m_CaptureLocal = false,
|
||||
m_CaptureTemporary = false;
|
||||
QString m_CaptureFile;
|
||||
QString m_RemoteFile;
|
||||
CaptureModifications m_CaptureMods = CaptureModifications::NoModifications;
|
||||
|
||||
rdcarray<DebugMessage> m_DebugMessages;
|
||||
|
||||
@@ -2420,6 +2420,36 @@ If no bookmark exists, this function will do nothing.
|
||||
)");
|
||||
virtual void RemoveBookmark(uint32_t eventId) = 0;
|
||||
|
||||
DOCUMENT(R"(Stores the dependent file data into the capture i.e. shader debug files.
|
||||
|
||||
This reads the contents of the dependent files and stores their file contents into the capture.
|
||||
This can help the capture to be more portable by embedding all externally referenced dependent files.
|
||||
Use :meth:`RemoveDependentFiles` to remove the embedded file data.
|
||||
|
||||
.. warning::
|
||||
Will remove all the existing embedded file data from the capture.
|
||||
Will directly modify the capture file on disk.
|
||||
|
||||
.. note::
|
||||
This will increase the size of the capture file.
|
||||
Externally referenced files which can't be found on disk are skipped.
|
||||
For remote replay the modifications are performed on the remote machine and copied back to the local host.
|
||||
)");
|
||||
virtual void EmbedDependentFiles() = 0;
|
||||
|
||||
DOCUMENT(R"(Removes the dependent files storage from the capture i.e. shader debug files.
|
||||
|
||||
The files will be still be considered to be referenced by the capture and could be re-embedded
|
||||
by calling :meth:`EmbedDependentFiles`.
|
||||
|
||||
.. warning::
|
||||
Will directly modify the capture file on disk.
|
||||
|
||||
.. note::
|
||||
For remote replay the modifications are performed on the remote machine and copied back to the local host.
|
||||
)");
|
||||
virtual void RemoveDependentFiles() = 0;
|
||||
|
||||
DOCUMENT(R"(Registers a delayed callback to be called after a certain number of milliseconds
|
||||
on the UI thread.
|
||||
|
||||
|
||||
@@ -647,6 +647,14 @@ struct CaptureContextInvoker : ObjectForwarder<ICaptureContext>
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::RemoveBookmark, EID);
|
||||
}
|
||||
virtual void EmbedDependentFiles() override
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::EmbedDependentFiles);
|
||||
}
|
||||
virtual void RemoveDependentFiles() override
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::RemoveDependentFiles);
|
||||
}
|
||||
virtual void DelayedCallback(uint32_t milliseconds, std::function<void()> callback) override
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::DelayedCallback, milliseconds, callback);
|
||||
|
||||
Reference in New Issue
Block a user