mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Change by-ref passed float or bool parameters to callbacks in public API
* Mostly used for passing a progress float back during a long blocking call like opening a capture or doing a copy. * This is much more feasible for python to bind to. * In several cases we just use a tiny lambda that updates a float anyway since we can't push the progress directly into a progress dialog, but need to let it query from a temporary in-between float.
This commit is contained in:
@@ -42,7 +42,7 @@ ReplayManager::~ReplayManager()
|
||||
RENDERDOC_UnregisterMemoryRegion(this);
|
||||
}
|
||||
|
||||
void ReplayManager::OpenCapture(const QString &capturefile, float *progress)
|
||||
void ReplayManager::OpenCapture(const QString &capturefile, RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
if(m_Running)
|
||||
return;
|
||||
@@ -50,8 +50,6 @@ void ReplayManager::OpenCapture(const QString &capturefile, float *progress)
|
||||
// TODO maybe we could expose this choice to the user?
|
||||
int proxyRenderer = -1;
|
||||
|
||||
*progress = 0.0f;
|
||||
|
||||
m_Thread = new LambdaThread([this, proxyRenderer, capturefile, progress]() {
|
||||
run(proxyRenderer, capturefile, progress);
|
||||
});
|
||||
@@ -171,7 +169,8 @@ rdcstr ReplayManager::CopyCaptureToRemote(const rdcstr &localpath, QWidget *wind
|
||||
|
||||
auto lambda = [this, localpath, &remotepath, &progress, &copied](IReplayController *r) {
|
||||
QMutexLocker autolock(&m_RemoteLock);
|
||||
remotepath = m_Remote->CopyCaptureToRemote(localpath.c_str(), &progress);
|
||||
remotepath =
|
||||
m_Remote->CopyCaptureToRemote(localpath.c_str(), [&progress](float p) { progress = p; });
|
||||
copied = true;
|
||||
};
|
||||
|
||||
@@ -204,7 +203,8 @@ void ReplayManager::CopyCaptureFromRemote(const rdcstr &remotepath, const rdcstr
|
||||
|
||||
auto lambda = [this, localpath, remotepath, &progress, &copied](IReplayController *r) {
|
||||
QMutexLocker autolock(&m_RemoteLock);
|
||||
m_Remote->CopyCaptureFromRemote(remotepath.c_str(), localpath.c_str(), &progress);
|
||||
m_Remote->CopyCaptureFromRemote(remotepath.c_str(), localpath.c_str(),
|
||||
[&progress](float p) { progress = p; });
|
||||
copied = true;
|
||||
};
|
||||
|
||||
@@ -408,7 +408,8 @@ void ReplayManager::PushInvoke(ReplayManager::InvokeHandle *cmd)
|
||||
m_RenderCondition.wakeAll();
|
||||
}
|
||||
|
||||
void ReplayManager::run(int proxyRenderer, const QString &capturefile, float *progress)
|
||||
void ReplayManager::run(int proxyRenderer, const QString &capturefile,
|
||||
RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
m_Renderer = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user