示例#1
0
        public static UInt32 ExecuteAndInject(string app, string workingDir, string cmdLine, EnvironmentModification[] env, string logfile, CaptureOptions opts)
        {
            IntPtr app_mem        = CustomMarshal.MakeUTF8String(app);
            IntPtr workingDir_mem = CustomMarshal.MakeUTF8String(workingDir);
            IntPtr cmdLine_mem    = CustomMarshal.MakeUTF8String(cmdLine);
            IntPtr logfile_mem    = CustomMarshal.MakeUTF8String(logfile);

            IntPtr env_mem = RENDERDOC_MakeEnvironmentModificationList(env.Length);

            for (int i = 0; i < env.Length; i++)
            {
                IntPtr var_mem = CustomMarshal.MakeUTF8String(env[i].variable);
                IntPtr val_mem = CustomMarshal.MakeUTF8String(env[i].value);

                RENDERDOC_SetEnvironmentModification(env_mem, i, var_mem, val_mem, env[i].type, env[i].separator);

                CustomMarshal.Free(var_mem);
                CustomMarshal.Free(val_mem);
            }

            UInt32 ret = RENDERDOC_ExecuteAndInject(app_mem, workingDir_mem, cmdLine_mem, env_mem, logfile_mem, opts, false);

            RENDERDOC_FreeEnvironmentModificationList(env_mem);

            CustomMarshal.Free(app_mem);
            CustomMarshal.Free(workingDir_mem);
            CustomMarshal.Free(cmdLine_mem);
            CustomMarshal.Free(logfile_mem);

            return(ret);
        }
示例#2
0
        public static byte[] GetThumbnail(string filename)
        {
            UInt32 len = 0;

            IntPtr filename_mem = CustomMarshal.MakeUTF8String(filename);

            bool success = RENDERDOC_GetThumbnail(filename_mem, null, ref len);

            if (!success || len == 0)
            {
                CustomMarshal.Free(filename_mem);
                return(null);
            }

            byte[] ret = new byte[len];

            success = RENDERDOC_GetThumbnail(filename_mem, ret, ref len);

            CustomMarshal.Free(filename_mem);

            if (!success || len == 0)
            {
                return(null);
            }

            return(ret);
        }
示例#3
0
        public ResourceId BuildTargetShader(string entry, string source, UInt32 compileFlags, ShaderStageType type, out string errors)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            ResourceId ret = ResourceId.Null;

            IntPtr entry_mem  = CustomMarshal.MakeUTF8String(entry);
            IntPtr source_mem = CustomMarshal.MakeUTF8String(source);

            bool success = ReplayRenderer_BuildTargetShader(m_Real, entry_mem, source_mem, compileFlags, type, ref ret, mem);

            CustomMarshal.Free(entry_mem);
            CustomMarshal.Free(source_mem);

            if (!success)
            {
                ret = ResourceId.Null;
            }

            errors = CustomMarshal.TemplatedArrayToString(mem, true);

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#4
0
        public static UInt32 InjectIntoProcess(UInt32 pid, EnvironmentModification[] env, string logfile, CaptureOptions opts)
        {
            IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile);

            IntPtr env_mem = RENDERDOC_MakeEnvironmentModificationList(env.Length);

            for (int i = 0; i < env.Length; i++)
            {
                IntPtr var_mem = CustomMarshal.MakeUTF8String(env[i].variable);
                IntPtr val_mem = CustomMarshal.MakeUTF8String(env[i].value);

                RENDERDOC_SetEnvironmentModification(env_mem, i, var_mem, val_mem, env[i].type, env[i].separator);

                CustomMarshal.Free(var_mem);
                CustomMarshal.Free(val_mem);
            }

            UInt32 ret = RENDERDOC_InjectIntoProcess(pid, env_mem, logfile_mem, opts, false);

            RENDERDOC_FreeEnvironmentModificationList(env_mem);

            CustomMarshal.Free(logfile_mem);

            return(ret);
        }
示例#5
0
        public void CopyCapture(UInt32 id, string localpath)
        {
            IntPtr localpath_mem = CustomMarshal.MakeUTF8String(localpath);

            RemoteAccess_CopyCapture(m_Real, id, localpath_mem);

            CustomMarshal.Free(localpath_mem);
        }
示例#6
0
        public static void StartAndroidRemoteServer(string device)
        {
            IntPtr device_mem = CustomMarshal.MakeUTF8String(device);

            RENDERDOC_StartAndroidRemoteServer(device_mem);

            CustomMarshal.Free(device_mem);
        }
示例#7
0
        public static void LogText(string text)
        {
            IntPtr text_mem = CustomMarshal.MakeUTF8String(text);

            RENDERDOC_LogText(text_mem);

            CustomMarshal.Free(text_mem);
        }
示例#8
0
        public static void BecomeRemoteServer(string host, uint port, ref bool killReplay)
        {
            IntPtr host_mem = CustomMarshal.MakeUTF8String(host);

            RENDERDOC_BecomeRemoteServer(host_mem, port, ref killReplay);

            CustomMarshal.Free(host_mem);
        }
示例#9
0
        public static void EndSelfHostCapture(string dllname)
        {
            IntPtr mem = CustomMarshal.MakeUTF8String(dllname);

            RENDERDOC_EndSelfHostCapture(mem);

            CustomMarshal.Free(mem);
        }
示例#10
0
        public static void StartGlobalHook(string pathmatch, string logfile, CaptureOptions opts)
        {
            IntPtr pathmatch_mem = CustomMarshal.MakeUTF8String(pathmatch);
            IntPtr logfile_mem   = CustomMarshal.MakeUTF8String(logfile);

            RENDERDOC_StartGlobalHook(pathmatch_mem, logfile_mem, opts);

            CustomMarshal.Free(logfile_mem);
            CustomMarshal.Free(pathmatch_mem);
        }
示例#11
0
        public static bool SupportLocalReplay(string logfile, out string driverName)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));
            bool   ret = RENDERDOC_SupportLocalReplay(logfile, mem);

            driverName = CustomMarshal.TemplatedArrayToUniString(mem, true);

            CustomMarshal.Free(mem);
            return(ret);
        }
示例#12
0
        public static UInt32 InjectIntoProcess(UInt32 pid, string logfile, CaptureOptions opts)
        {
            IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile);

            UInt32 ret = RENDERDOC_InjectIntoProcess(pid, logfile_mem, opts, false);

            CustomMarshal.Free(logfile_mem);

            return(ret);
        }
示例#13
0
        public bool SaveTexture(TextureSave saveData, string path)
        {
            IntPtr path_mem = CustomMarshal.MakeUTF8String(path);

            bool ret = ReplayRenderer_SaveTexture(m_Real, saveData, path_mem);

            CustomMarshal.Free(path_mem);

            return(ret);
        }
示例#14
0
        public static string GetConfigSetting(string name)
        {
            IntPtr name_mem = CustomMarshal.MakeUTF8String(name);

            string ret = CustomMarshal.PtrToStringUTF8(RENDERDOC_GetConfigSetting(name_mem));

            CustomMarshal.Free(name_mem);

            return(ret);
        }
示例#15
0
        public static void SetConfigSetting(string name, string value)
        {
            IntPtr name_mem  = CustomMarshal.MakeUTF8String(name);
            IntPtr value_mem = CustomMarshal.MakeUTF8String(value);

            RENDERDOC_SetConfigSetting(name_mem, value_mem);

            CustomMarshal.Free(name_mem);
            CustomMarshal.Free(value_mem);
        }
示例#16
0
        public static string[] EnumerateAndroidDevices()
        {
            IntPtr driverListInt = CustomMarshal.Alloc(typeof(templated_array));

            RENDERDOC_EnumerateAndroidDevices(driverListInt);

            string driverList = CustomMarshal.TemplatedArrayToString(driverListInt, true);

            CustomMarshal.Free(driverListInt);

            return(driverList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
        }
示例#17
0
        public APIProperties GetAPIProperties()
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(APIProperties));

            ReplayRenderer_GetAPIProperties(m_Real, mem);

            APIProperties ret = (APIProperties)CustomMarshal.PtrToStructure(mem, typeof(APIProperties), true);

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#18
0
        public static CaptureOptions GetDefaultCaptureOptions()
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(CaptureOptions));

            RENDERDOC_GetDefaultCaptureOptions(mem);

            CaptureOptions ret = (CaptureOptions)CustomMarshal.PtrToStructure(mem, typeof(CaptureOptions), true);

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#19
0
        public static UInt32[] GetRemoteIdents(string host)
        {
            UInt32 numIdents = RENDERDOC_EnumerateRemoteConnections(IntPtr.Zero, null);

            UInt32[] idents = new UInt32[numIdents];

            IntPtr host_mem = CustomMarshal.MakeUTF8String(host);

            RENDERDOC_EnumerateRemoteConnections(host_mem, idents);

            CustomMarshal.Free(host_mem);

            return(idents);
        }
示例#20
0
        public void ReceiveMessage()
        {
            if (m_Real != IntPtr.Zero)
            {
                RemoteMessage msg = null;

                {
                    IntPtr mem = CustomMarshal.Alloc(typeof(RemoteMessage));

                    RemoteAccess_ReceiveMessage(m_Real, mem);

                    if (mem != IntPtr.Zero)
                    {
                        msg = (RemoteMessage)CustomMarshal.PtrToStructure(mem, typeof(RemoteMessage), true);
                    }

                    CustomMarshal.Free(mem);
                }

                if (msg.Type == RemoteMessageType.Disconnected)
                {
                    m_Connected = false;
                    RemoteAccess_Shutdown(m_Real);
                    m_Real = IntPtr.Zero;
                }
                else if (msg.Type == RemoteMessageType.NewCapture)
                {
                    CaptureFile   = msg.NewCapture;
                    CaptureExists = true;
                }
                else if (msg.Type == RemoteMessageType.CaptureCopied)
                {
                    CaptureFile.ID        = msg.NewCapture.ID;
                    CaptureFile.localpath = msg.NewCapture.localpath;
                    CaptureCopied         = true;
                }
                else if (msg.Type == RemoteMessageType.RegisterAPI)
                {
                    API         = msg.RegisterAPI.APIName;
                    InfoUpdated = true;
                }
                else if (msg.Type == RemoteMessageType.NewChild)
                {
                    NewChild   = msg.NewChild;
                    ChildAdded = true;
                }
            }
        }
示例#21
0
        public string[] RemoteSupportedReplays()
        {
            IntPtr mem     = CustomMarshal.Alloc(typeof(templated_array));
            bool   success = RemoteRenderer_RemoteSupportedReplays(m_Real, mem);

            string[] ret = null;

            if (success)
            {
                ret = CustomMarshal.TemplatedArrayToStringArray(mem, true);
            }

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#22
0
        public static UInt32 ExecuteAndInject(string app, string workingDir, string cmdLine, string logfile, CaptureOptions opts)
        {
            IntPtr app_mem        = CustomMarshal.MakeUTF8String(app);
            IntPtr workingDir_mem = CustomMarshal.MakeUTF8String(workingDir);
            IntPtr cmdLine_mem    = CustomMarshal.MakeUTF8String(cmdLine);
            IntPtr logfile_mem    = CustomMarshal.MakeUTF8String(logfile);

            UInt32 ret = RENDERDOC_ExecuteAndInject(app_mem, workingDir_mem, cmdLine_mem, logfile_mem, opts, false);

            CustomMarshal.Free(app_mem);
            CustomMarshal.Free(workingDir_mem);
            CustomMarshal.Free(cmdLine_mem);
            CustomMarshal.Free(logfile_mem);

            return(ret);
        }
示例#23
0
        public static ReplayRenderer CreateReplayRenderer(string logfile, ref float progress)
        {
            IntPtr rendPtr = IntPtr.Zero;

            IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile);

            ReplayCreateStatus ret = RENDERDOC_CreateReplayRenderer(logfile_mem, ref progress, ref rendPtr);

            CustomMarshal.Free(logfile_mem);

            if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success)
            {
                throw new ReplayCreateException(ret, "Failed to load log for local replay");
            }

            return(new ReplayRenderer(rendPtr));
        }
示例#24
0
        public EventUsage[] GetUsage(ResourceId id)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            bool success = ReplayRenderer_GetUsage(m_Real, id, mem);

            EventUsage[] ret = null;

            if (success)
            {
                ret = (EventUsage[])CustomMarshal.GetTemplatedArray(mem, typeof(EventUsage), true);
            }

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#25
0
        public ShaderVariable[] GetCBufferVariableContents(ResourceId shader, UInt32 cbufslot, ResourceId buffer, UInt32 offs)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            bool success = ReplayRenderer_GetCBufferVariableContents(m_Real, shader, cbufslot, buffer, offs, mem);

            ShaderVariable[] ret = null;

            if (success)
            {
                ret = (ShaderVariable[])CustomMarshal.GetTemplatedArray(mem, typeof(ShaderVariable), true);
            }

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#26
0
        public PostVSMeshData GetPostVSData(MeshDataStage stage)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(PostVSMeshData));

            PostVSMeshData ret = null;

            bool success = ReplayRenderer_GetPostVSData(m_Real, stage, mem);

            if (success)
            {
                ret = (PostVSMeshData)CustomMarshal.PtrToStructure(mem, typeof(PostVSMeshData), true);
            }

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#27
0
        public byte[] GetBufferData(ResourceId buff, UInt32 offset, UInt32 len)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            bool success = ReplayRenderer_GetBufferData(m_Real, buff, offset, len, mem);

            byte[] ret = null;

            if (success)
            {
                ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true);
            }

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#28
0
        public static RemoteServer CreateRemoteServer(string host, uint port)
        {
            IntPtr rendPtr = IntPtr.Zero;

            IntPtr host_mem = CustomMarshal.MakeUTF8String(host);

            ReplayCreateStatus ret = RENDERDOC_CreateRemoteServerConnection(host_mem, port, ref rendPtr);

            CustomMarshal.Free(host_mem);

            if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success)
            {
                throw new ReplayCreateException(ret, "Failed to connect to remote replay host");
            }

            return(new RemoteServer(rendPtr));
        }
示例#29
0
        public static TargetControl CreateTargetControl(string host, UInt32 ident, string clientName, bool forceConnection)
        {
            IntPtr host_mem       = CustomMarshal.MakeUTF8String(host);
            IntPtr clientName_mem = CustomMarshal.MakeUTF8String(clientName);

            IntPtr rendPtr = RENDERDOC_CreateTargetControl(host_mem, ident, clientName_mem, forceConnection);

            CustomMarshal.Free(host_mem);
            CustomMarshal.Free(clientName_mem);

            if (rendPtr == IntPtr.Zero)
            {
                throw new ReplayCreateException(ReplayCreateStatus.NetworkIOFailed, "Failed to open remote access connection");
            }

            return(new TargetControl(rendPtr));
        }
示例#30
0
        public ShaderDebugTrace DebugThread(UInt32[] groupid, UInt32[] threadid)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace));

            bool success = ReplayRenderer_DebugThread(m_Real, groupid, threadid, mem);

            ShaderDebugTrace ret = null;

            if (success)
            {
                ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true);
            }

            CustomMarshal.Free(mem);

            return(ret);
        }