diff --git a/renderdocui/Code/RenderManager.cs b/renderdocui/Code/RenderManager.cs index 7967285ab..9bb790b4b 100644 --- a/renderdocui/Code/RenderManager.cs +++ b/renderdocui/Code/RenderManager.cs @@ -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) diff --git a/renderdocui/Interop/ReplayRenderer.cs b/renderdocui/Interop/ReplayRenderer.cs index 58dc2d25b..f3a0d18f1 100644 --- a/renderdocui/Interop/ReplayRenderer.cs +++ b/renderdocui/Interop/ReplayRenderer.cs @@ -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)); diff --git a/renderdocui/Windows/MainWindow.cs b/renderdocui/Windows/MainWindow.cs index bf162463c..61d511358 100644 --- a/renderdocui/Windows/MainWindow.cs +++ b/renderdocui/Windows/MainWindow.cs @@ -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 + "...";