Add ReplayOptions struct to contain replay-time configuration

* Not currently exposed to the UI or used by the drivers, we just pass the
  default object through
This commit is contained in:
baldurk
2019-08-26 19:09:50 +01:00
parent 878acd4ad9
commit 20be9f3d52
27 changed files with 250 additions and 71 deletions
+9 -8
View File
@@ -681,8 +681,8 @@ void CaptureContext::CleanMenu(QAction *action)
delete menu;
}
void CaptureContext::LoadCapture(const rdcstr &captureFile, const rdcstr &origFilename,
bool temporary, bool local)
void CaptureContext::LoadCapture(const rdcstr &captureFile, const ReplayOptions &opts,
const rdcstr &origFilename, bool temporary, bool local)
{
CloseCapture();
@@ -696,9 +696,10 @@ void CaptureContext::LoadCapture(const rdcstr &captureFile, const rdcstr &origFi
bool newCapture = (!temporary && !Config().RecentCaptureFiles.contains(origFilename));
LambdaThread *thread = new LambdaThread([this, captureFile, origFilename, temporary, local]() {
LoadCaptureThreaded(captureFile, origFilename, temporary, local);
});
LambdaThread *thread =
new LambdaThread([this, captureFile, opts, origFilename, temporary, local]() {
LoadCaptureThreaded(captureFile, opts, origFilename, temporary, local);
});
thread->selfDelete(true);
thread->start();
@@ -775,8 +776,8 @@ float CaptureContext::UpdateLoadProgress()
return val;
}
void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const QString &origFilename,
bool temporary, bool local)
void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const ReplayOptions &opts,
const QString &origFilename, bool temporary, bool local)
{
m_CaptureFile = origFilename;
@@ -788,7 +789,7 @@ void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const QStri
m_PostloadProgress = 0.0f;
// this function call will block until the capture is either loaded, or there's some failure
m_Replay.OpenCapture(captureFile, [this](float p) { m_LoadProgress = p; });
m_Replay.OpenCapture(captureFile, opts, [this](float p) { m_LoadProgress = p; });
// if the renderer isn't running, we hit a failure case so display an error message
if(!m_Replay.IsRunning())
+4 -4
View File
@@ -102,8 +102,8 @@ public:
//////////////////////////////////////////////////////////////////////////////
// Control functions
void LoadCapture(const rdcstr &captureFile, const rdcstr &origFilename, bool temporary,
bool local) override;
void LoadCapture(const rdcstr &captureFile, const ReplayOptions &opts, const rdcstr &origFilename,
bool temporary, bool local) override;
bool SaveCaptureTo(const rdcstr &captureFile) override;
void RecompressCapture() override;
void CloseCapture() override;
@@ -305,8 +305,8 @@ private:
float m_PostloadProgress = 0.0f;
float UpdateLoadProgress();
void LoadCaptureThreaded(const QString &captureFile, const QString &origFilename, bool temporary,
bool local);
void LoadCaptureThreaded(const QString &captureFile, const ReplayOptions &opts,
const QString &origFilename, bool temporary, bool local);
void AddSortedMenuItem(QMenu *menu, bool rootMenu, const rdcarray<rdcstr> &items,
std::function<void()> callback);
+3 -2
View File
@@ -1083,13 +1083,14 @@ data.
DOCUMENT(R"(Open a capture file for replay.
:param str captureFile: The actual path to the capture file.
:param ReplayOptions opts: The options controlling how the capture should be replayed.
:param str origFilename: The original filename, if the capture was copied remotely for replay.
:param bool temporary: ``True`` if this is a temporary capture which should prompt the user for
either save or delete on close.
:param bool local: ``True`` if ``captureFile`` refers to a file on the local machine.
)");
virtual void LoadCapture(const rdcstr &captureFile, const rdcstr &origFilename, bool temporary,
bool local) = 0;
virtual void LoadCapture(const rdcstr &captureFile, const ReplayOptions &opts,
const rdcstr &origFilename, bool temporary, bool local) = 0;
DOCUMENT(R"(Saves the current capture file to a given path.
+7 -6
View File
@@ -42,7 +42,8 @@ ReplayManager::~ReplayManager()
RENDERDOC_UnregisterMemoryRegion(this);
}
void ReplayManager::OpenCapture(const QString &capturefile, RENDERDOC_ProgressCallback progress)
void ReplayManager::OpenCapture(const QString &capturefile, const ReplayOptions &opts,
RENDERDOC_ProgressCallback progress)
{
if(m_Running)
return;
@@ -50,8 +51,8 @@ void ReplayManager::OpenCapture(const QString &capturefile, RENDERDOC_ProgressCa
// TODO maybe we could expose this choice to the user?
int proxyRenderer = -1;
m_Thread = new LambdaThread([this, proxyRenderer, capturefile, progress]() {
run(proxyRenderer, capturefile, progress);
m_Thread = new LambdaThread([this, proxyRenderer, capturefile, opts, progress]() {
run(proxyRenderer, capturefile, opts, progress);
});
m_Thread->start(QThread::HighestPriority);
@@ -416,7 +417,7 @@ void ReplayManager::PushInvoke(ReplayManager::InvokeHandle *cmd)
m_RenderCondition.wakeAll();
}
void ReplayManager::run(int proxyRenderer, const QString &capturefile,
void ReplayManager::run(int proxyRenderer, const QString &capturefile, const ReplayOptions &opts,
RENDERDOC_ProgressCallback progress)
{
m_Renderer = NULL;
@@ -424,7 +425,7 @@ void ReplayManager::run(int proxyRenderer, const QString &capturefile,
if(m_Remote)
{
rdctie(m_CreateStatus, m_Renderer) =
m_Remote->OpenCapture(proxyRenderer, capturefile.toUtf8().data(), progress);
m_Remote->OpenCapture(proxyRenderer, capturefile.toUtf8().data(), opts, progress);
}
else
{
@@ -433,7 +434,7 @@ void ReplayManager::run(int proxyRenderer, const QString &capturefile,
m_CreateStatus = m_CaptureFile->OpenFile(capturefile.toUtf8().data(), "rdc", NULL);
if(m_CreateStatus == ReplayStatus::Succeeded)
rdctie(m_CreateStatus, m_Renderer) = m_CaptureFile->OpenCapture(progress);
rdctie(m_CreateStatus, m_Renderer) = m_CaptureFile->OpenCapture(opts, progress);
}
if(m_Renderer == NULL)
+4 -2
View File
@@ -48,7 +48,8 @@ public:
ReplayManager();
~ReplayManager();
void OpenCapture(const QString &capturefile, RENDERDOC_ProgressCallback progress);
void OpenCapture(const QString &capturefile, const ReplayOptions &opts,
RENDERDOC_ProgressCallback progress);
void DeleteCapture(const rdcstr &capturefile, bool local);
bool IsRunning();
@@ -113,7 +114,8 @@ private:
bool selfdelete;
};
void run(int proxyRenderer, const QString &capturefile, RENDERDOC_ProgressCallback progress);
void run(int proxyRenderer, const QString &capturefile, const ReplayOptions &opts,
RENDERDOC_ProgressCallback progress);
QMutex m_TimerLock;
QElapsedTimer m_CommandTimer;
+1 -1
View File
@@ -760,7 +760,7 @@ void LiveCapture::openCapture(Capture *cap)
return;
}
m_Main->LoadCapture(cap->path, !cap->saved, cap->local);
m_Main->LoadCapture(cap->path, ReplayOptions(), !cap->saved, cap->local);
}
bool LiveCapture::saveCapture(Capture *cap, QString path)
+6 -5
View File
@@ -487,7 +487,7 @@ void MainWindow::LoadFromFilename(const QString &filename, bool temporary)
if(ext == lit("rdc"))
{
LoadCapture(filename, temporary, true);
LoadCapture(filename, ReplayOptions(), temporary, true);
}
else if(ext == lit("cap"))
{
@@ -500,7 +500,7 @@ void MainWindow::LoadFromFilename(const QString &filename, bool temporary)
else
{
// not a recognised filetype, see if we can load it anyway
LoadCapture(filename, temporary, true);
LoadCapture(filename, ReplayOptions(), temporary, true);
}
}
@@ -633,7 +633,8 @@ void MainWindow::OnInjectTrigger(uint32_t PID, const rdcarray<EnvironmentModific
th->deleteLater();
}
void MainWindow::LoadCapture(const QString &filename, bool temporary, bool local)
void MainWindow::LoadCapture(const QString &filename, const ReplayOptions &opts, bool temporary,
bool local)
{
if(PromptCloseCapture())
{
@@ -800,7 +801,7 @@ void MainWindow::LoadCapture(const QString &filename, bool temporary, bool local
ANALYTIC_SET(UIFeatures.ImageViewer, true);
}
m_Ctx.LoadCapture(fileToLoad, origFilename, temporary, local);
m_Ctx.LoadCapture(fileToLoad, opts, origFilename, temporary, local);
}
if(local && !temporary)
@@ -1506,7 +1507,7 @@ void MainWindow::recentCaptureFile(const QString &filename)
{
if(QFileInfo::exists(filename))
{
LoadCapture(filename, false, true);
LoadCapture(filename, ReplayOptions(), false, true);
}
else
{
+1 -1
View File
@@ -77,7 +77,7 @@ public:
void takeCaptureOwnership() { m_OwnTempCapture = true; }
void captureModified();
void LoadFromFilename(const QString &filename, bool temporary);
void LoadCapture(const QString &filename, bool temporary, bool local);
void LoadCapture(const QString &filename, const ReplayOptions &opts, bool temporary, bool local);
void CloseCapture();
QString GetSavePath(QString title = QString(), QString filter = QString());
+3 -3
View File
@@ -173,10 +173,10 @@ struct CaptureContextInvoker : ICaptureContext
{
return InvokeRetFunction<WindowingData>(&ICaptureContext::CreateWindowingData, window);
}
virtual void LoadCapture(const rdcstr &capture, const rdcstr &origFilename, bool temporary,
bool local) override
virtual void LoadCapture(const rdcstr &capture, const ReplayOptions &opts,
const rdcstr &origFilename, bool temporary, bool local) override
{
InvokeVoidFunction(&ICaptureContext::LoadCapture, capture, origFilename, temporary, local);
InvokeVoidFunction(&ICaptureContext::LoadCapture, capture, opts, origFilename, temporary, local);
}
virtual bool SaveCaptureTo(const rdcstr &capture) override
{