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-27 18:51:56 +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;