mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-01 03:28:36 +00:00
Fix access invoke callbacks relying on replay thread
* Some CaptureAccess uses like enumerating GPUs happen before the replay thread is running, in this case we can safely run on the UI thread as we know there will be nothing to conflict with.
This commit is contained in:
4 files changed
+43
-21
No files matched your search
@@ -303,6 +303,37 @@ void ReplayManager::BlockInvoke(ReplayManager::ReplayInvokeCallback m)
|
||||
delete cmd;
|
||||
}
|
||||
|
||||
bool ReplayManager::AccessInvoke(std::function<void(ICaptureAccess *)> callback, bool blocking,
|
||||
bool forceReplay, rdcstr tag)
|
||||
{
|
||||
if(!GetCaptureAccess())
|
||||
return false;
|
||||
|
||||
// some long running processes may be better to put on the replay thread even when local, so
|
||||
// that we can keep the UI thread unblocked
|
||||
if(CurrentRemote().IsConnected() || forceReplay)
|
||||
{
|
||||
if(!IsRunning())
|
||||
{
|
||||
// if the replay thread isn't running, we won't be able to invoke so just treat this as-if
|
||||
// it's a local capture and block
|
||||
callback(GetCaptureAccess());
|
||||
return true;
|
||||
}
|
||||
|
||||
if(blocking)
|
||||
BlockInvoke([this, callback](IReplayController *) { callback(GetCaptureAccess()); });
|
||||
else
|
||||
AsyncInvoke([this, callback](IReplayController *) { callback(GetCaptureAccess()); }, tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(GetCaptureAccess());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReplayManager::CancelReplayLoop()
|
||||
{
|
||||
m_Renderer->CancelReplayLoop();
|
||||
|
||||
Reference in new issue
Block a user