Add easy support for self-hosted captures on windows only

* By renaming the renderdoc and renderdoccmd projects to something else
  (say 'selfhost' and 'selfhostcmd') then they can be used to capture
  renderdocui and the replaying that's happening.
* Only supported on development builds and might break down, but it's
  handy to have as an easy to enable option.
* There's also a couple of handy python functions exposed -
  renderdoc.StaticExports.StartSelfHostCapture(string dllname)
  renderdoc.StaticExports.EndSelfHostCapture(string dllname)
  which can be used to start and stop the capture around e.g. a shader
  debug operation or a pixel history operation or something similar.
This commit is contained in:
baldurk
2016-10-25 19:37:37 +02:00
parent aa5c55e4e4
commit f368a65843
8 changed files with 93 additions and 19 deletions
+25 -1
View File
@@ -46,7 +46,7 @@ namespace renderdoc
public ReplayCreateStatus Status;
}
class StaticExports
public class StaticExports
{
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
private static extern ReplaySupport RENDERDOC_SupportLocalReplay(IntPtr logfile, IntPtr outdriver, IntPtr outident);
@@ -110,6 +110,30 @@ namespace renderdoc
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
private static extern void RENDERDOC_FreeEnvironmentModificationList(IntPtr mem);
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
private static extern void RENDERDOC_StartSelfHostCapture(IntPtr dllname);
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
private static extern void RENDERDOC_EndSelfHostCapture(IntPtr dllname);
public static void StartSelfHostCapture(string dllname)
{
IntPtr mem = CustomMarshal.MakeUTF8String(dllname);
RENDERDOC_StartSelfHostCapture(mem);
CustomMarshal.Free(mem);
}
public static void EndSelfHostCapture(string dllname)
{
IntPtr mem = CustomMarshal.MakeUTF8String(dllname);
RENDERDOC_EndSelfHostCapture(mem);
CustomMarshal.Free(mem);
}
public static ReplaySupport SupportLocalReplay(string logfile, out string driverName, out string recordMachineIdent)
{
IntPtr name_mem = CustomMarshal.Alloc(typeof(templated_array));