Add functionality to copy captures to the remote server for replaying

This commit is contained in:
baldurk
2016-08-04 18:30:34 +02:00
parent ebea48260d
commit 87c978f71a
3 changed files with 121 additions and 7 deletions
+65
View File
@@ -137,6 +137,71 @@ namespace renderdocui.Code
}
}
public string[] GetRemoteSupport()
{
if (m_Remote != null)
return m_Remote.RemoteSupportedReplays();
return new string[0];
}
public string CopyCaptureToRemote(string localpath, Form window)
{
if (m_Remote != null)
{
bool copied = false;
float progress = 0.0f;
renderdocui.Windows.ProgressPopup modal =
new renderdocui.Windows.ProgressPopup(
(renderdocui.Windows.ModalCloseCallback)(() => { return copied; }),
true);
modal.SetModalText("Transferring...");
Thread progressThread = Helpers.NewThread(new ThreadStart(() =>
{
modal.LogfileProgressBegin();
while (!copied)
{
Thread.Sleep(2);
modal.LogfileProgress(progress);
}
}));
progressThread.Start();
string remotepath = "";
// we should never have the thread running at this point, but let's be safe.
if (Running)
{
BeginInvoke((ReplayRenderer r) =>
{
remotepath = m_Remote.CopyCaptureToRemote(localpath, ref progress);
copied = true;
});
}
else
{
Helpers.NewThread(new ThreadStart(() =>
{
remotepath = m_Remote.CopyCaptureToRemote(localpath, ref progress);
copied = true;
})).Start();
}
modal.ShowDialog(window);
return remotepath;
}
// if we don't have a remote connection we can't copy
throw new ApplicationException();
}
public void CopyCaptureFromRemote(string remotepath, string localpath, Form window)
{
if (m_Remote != null)
+1 -1
View File
@@ -950,7 +950,7 @@ namespace renderdoc
CustomMarshal.Free(filename_mem);
}
public string CopyCapture(string filename, ref float progress)
public string CopyCaptureToRemote(string filename, ref float progress)
{
IntPtr remotepath = CustomMarshal.Alloc(typeof(templated_array));
+55 -6
View File
@@ -627,30 +627,79 @@ namespace renderdocui.Windows
string driver = "";
bool support = false;
bool remoteReplay = !local || (m_Core.Renderer.Remote != null && m_Core.Renderer.Remote.Connected);
if (local)
{
support = StaticExports.SupportLocalReplay(filename, out driver);
if (remoteReplay)
{
support = false;
string[] remoteDrivers = m_Core.Renderer.GetRemoteSupport();
for (int i = 0; i < remoteDrivers.Length; i++)
{
if (driver == remoteDrivers[i])
support = true;
}
}
}
Thread thread = null;
// if driver is empty something went wrong loading the log, let it be handled as usual
// below. Otherwise indicate that support is missing.
if (driver.Length > 0 && !support && local)
if (driver.Length > 0 && !support)
{
string remoteMessage = String.Format("This log was captured with {0} and cannot be replayed locally.\n\n", driver);
if (remoteReplay)
{
string remoteMessage = String.Format("This log was captured with {0} and cannot be replayed on {1}.\n\n", driver, m_Core.Renderer.Remote.Hostname);
remoteMessage += "Try selecting a remote context in the status bar.";
remoteMessage += "Try selecting a different remote context in the status bar.";
MessageBox.Show(remoteMessage, "Unsupported logfile type", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
MessageBox.Show(remoteMessage, "Unsupported logfile type", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
else
{
string remoteMessage = String.Format("This log was captured with {0} and cannot be replayed locally.\n\n", driver);
remoteMessage += "Try selecting a remote context in the status bar.";
MessageBox.Show(remoteMessage, "Unsupported logfile type", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
}
else
{
if (remoteReplay)
{
try
{
filename = m_Core.Renderer.CopyCaptureToRemote(filename, this);
local = false;
// some error
if (filename == "")
throw new ApplicationException();
}
catch (Exception)
{
MessageBox.Show("Couldn't copy " + filename + " to remote host for replaying", "Error copying to remote",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
thread = Helpers.NewThread(new ThreadStart(() => m_Core.LoadLogfile(filename, temporary, local)));
}
thread.Start();
if(local)
if(!remoteReplay)
m_Core.Config.LastLogPath = Path.GetDirectoryName(filename);
statusText.Text = "Loading " + filename + "...";