mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 08:26:50 +00:00
Pass through child processes via remote access to UI. Refs #78
This commit is contained in:
@@ -384,6 +384,7 @@ namespace renderdoc
|
||||
NewCapture,
|
||||
CaptureCopied,
|
||||
RegisterAPI,
|
||||
NewChild,
|
||||
};
|
||||
|
||||
public static class EnumString
|
||||
|
||||
@@ -64,6 +64,15 @@ namespace renderdoc
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public BusyData Busy;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NewChildData
|
||||
{
|
||||
public UInt32 PID;
|
||||
public UInt32 ident;
|
||||
};
|
||||
[CustomMarshalAs(CustomUnmanagedType.CustomClass)]
|
||||
public NewChildData NewChild;
|
||||
};
|
||||
|
||||
public class ReplayOutput
|
||||
@@ -749,6 +758,8 @@ namespace renderdoc
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr RemoteAccess_GetAPI(IntPtr real);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern UInt32 RemoteAccess_GetPID(IntPtr real);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr RemoteAccess_GetBusyClient(IntPtr real);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
@@ -783,6 +794,7 @@ namespace renderdoc
|
||||
m_Connected = true;
|
||||
Target = Marshal.PtrToStringUni(RemoteAccess_GetTarget(m_Real));
|
||||
API = Marshal.PtrToStringUni(RemoteAccess_GetAPI(m_Real));
|
||||
PID = RemoteAccess_GetPID(m_Real);
|
||||
BusyClient = Marshal.PtrToStringUni(RemoteAccess_GetBusyClient(m_Real));
|
||||
}
|
||||
|
||||
@@ -851,11 +863,7 @@ namespace renderdoc
|
||||
}
|
||||
else if (msg.Type == RemoteMessageType.NewCapture)
|
||||
{
|
||||
CaptureFile.ID = msg.NewCapture.ID;
|
||||
CaptureFile.timestamp = msg.NewCapture.timestamp;
|
||||
CaptureFile.localpath = msg.NewCapture.localpath;
|
||||
CaptureFile.thumbnail = msg.NewCapture.thumbnail;
|
||||
|
||||
CaptureFile = msg.NewCapture;
|
||||
CaptureExists = true;
|
||||
}
|
||||
else if (msg.Type == RemoteMessageType.CaptureCopied)
|
||||
@@ -869,24 +877,26 @@ namespace renderdoc
|
||||
API = msg.RegisterAPI.APIName;
|
||||
InfoUpdated = true;
|
||||
}
|
||||
else if (msg.Type == RemoteMessageType.NewChild)
|
||||
{
|
||||
NewChild = msg.NewChild;
|
||||
ChildAdded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string BusyClient;
|
||||
public string Target;
|
||||
public string API;
|
||||
public UInt32 PID;
|
||||
|
||||
public bool CaptureExists;
|
||||
public bool ChildAdded;
|
||||
public bool CaptureCopied;
|
||||
public bool InfoUpdated;
|
||||
|
||||
public struct CaptureInfo
|
||||
{
|
||||
public UInt32 ID;
|
||||
public UInt64 timestamp;
|
||||
public byte[] thumbnail;
|
||||
public string localpath;
|
||||
};
|
||||
public CaptureInfo CaptureFile = new CaptureInfo();
|
||||
public RemoteMessage.NewCaptureData CaptureFile = new RemoteMessage.NewCaptureData();
|
||||
|
||||
public RemoteMessage.NewChildData NewChild = new RemoteMessage.NewChildData();
|
||||
};
|
||||
};
|
||||
|
||||
@@ -39,6 +39,8 @@ using System.IO;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
using Process = System.Diagnostics.Process;
|
||||
|
||||
namespace renderdocui.Windows
|
||||
{
|
||||
public partial class LiveCapture : DockContent
|
||||
@@ -213,6 +215,23 @@ namespace renderdocui.Windows
|
||||
});
|
||||
m_Connection.CaptureCopied = false;
|
||||
}
|
||||
|
||||
if (m_Connection.ChildAdded)
|
||||
{
|
||||
try
|
||||
{
|
||||
var p = Process.GetProcessById((int)m_Connection.NewChild.PID);
|
||||
|
||||
System.Diagnostics.Trace.WriteLine(String.Format("Add new child PID {0} name {1} ident {2} to UI",
|
||||
m_Connection.NewChild.PID, p.ProcessName, m_Connection.NewChild.ident));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// process expired/doesn't exist anymore
|
||||
}
|
||||
|
||||
m_Connection.ChildAdded = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.BeginInvoke((MethodInvoker)delegate
|
||||
|
||||
Reference in New Issue
Block a user