示例#1
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));
        }
示例#2
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));
        }
示例#3
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));
        }
示例#4
0
        public static ReplaySupport SupportLocalReplay(string logfile, out string driverName, out string recordMachineIdent)
        {
            IntPtr name_mem  = CustomMarshal.Alloc(typeof(templated_array));
            IntPtr ident_mem = CustomMarshal.Alloc(typeof(templated_array));

            IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile);

            ReplaySupport ret = RENDERDOC_SupportLocalReplay(logfile_mem, name_mem, ident_mem);

            CustomMarshal.Free(logfile_mem);

            driverName         = CustomMarshal.TemplatedArrayToString(name_mem, true);
            recordMachineIdent = CustomMarshal.TemplatedArrayToString(ident_mem, true);

            CustomMarshal.Free(name_mem);
            CustomMarshal.Free(ident_mem);

            return(ret);
        }
示例#5
0
        public ReplayRenderer CreateProxyRenderer(int proxyid, string logfile, ref float progress)
        {
            IntPtr rendPtr = IntPtr.Zero;

            IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile);

            ReplayCreateStatus ret = RemoteRenderer_CreateProxyRenderer(m_Real, (UInt32)proxyid, logfile_mem, ref progress, ref rendPtr);

            CustomMarshal.Free(logfile_mem);

            if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success)
            {
                var e = new System.ApplicationException("Failed to set up local proxy replay with remote connection");
                e.Data.Add("status", ret);
                throw e;
            }

            return(new ReplayRenderer(rendPtr));
        }
示例#6
0
        public static RemoteRenderer CreateRemoteReplayConnection(string host)
        {
            IntPtr rendPtr = IntPtr.Zero;

            IntPtr host_mem = CustomMarshal.MakeUTF8String(host);

            ReplayCreateStatus ret = RENDERDOC_CreateRemoteReplayConnection(host_mem, ref rendPtr);

            CustomMarshal.Free(host_mem);

            if (rendPtr == IntPtr.Zero || ret != ReplayCreateStatus.Success)
            {
                var e = new System.ApplicationException("Failed to connect to remote replay host");
                e.Data.Add("status", ret);
                throw e;
            }

            return(new RemoteRenderer(rendPtr));
        }
示例#7
0
        public static RemoteAccess CreateRemoteAccessConnection(string host, UInt32 ident, string clientName, bool forceConnection)
        {
            IntPtr host_mem       = CustomMarshal.MakeUTF8String(host);
            IntPtr clientName_mem = CustomMarshal.MakeUTF8String(clientName);

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

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

            if (rendPtr == IntPtr.Zero)
            {
                var e = new System.ApplicationException("Failed to open remote access connection");
                e.Data.Add("status", ReplayCreateStatus.UnknownError);
                throw e;
            }

            return(new RemoteAccess(rendPtr));
        }
示例#8
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);

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

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

            errors = CustomMarshal.TemplatedArrayToString(mem, true);

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#9
0
        public static UInt32[] EnumerateRemoteConnections(string host)
        {
            IntPtr host_mem = CustomMarshal.MakeUTF8String(host);

            UInt32 numIdents = RENDERDOC_EnumerateRemoteConnections(host_mem, null);

            if (numIdents == 0)
            {
                CustomMarshal.Free(host_mem);
                return(null);
            }

            UInt32[] ret = new UInt32[numIdents];

            RENDERDOC_EnumerateRemoteConnections(host_mem, ret);

            CustomMarshal.Free(host_mem);

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

            IntPtr entry_mem = CustomMarshal.MakeUTF8String(entryPoint);

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

            ShaderVariable[] ret = null;

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

            CustomMarshal.Free(entry_mem);
            CustomMarshal.Free(mem);

            return(ret);
        }
示例#11
0
        public static byte[] GetThumbnail(string filename, FileType type, UInt32 maxsize)
        {
            UInt32 len = 0;

            IntPtr filename_mem = CustomMarshal.MakeUTF8String(filename);

            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            bool success = RENDERDOC_GetThumbnail(filename_mem, type, maxsize, mem);

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

            byte[] ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true);

            CustomMarshal.Free(mem);

            return(ret);
        }
示例#12
0
        public static void EnumerateRemoteTargets(string host, RemoteConnectionFound callback)
        {
            IntPtr host_mem = CustomMarshal.MakeUTF8String(host);

            UInt32 nextIdent = 0;

            while (true)
            {
                // just a sanity check to make sure we don't hit some unexpected case
                UInt32 prevIdent = nextIdent;

                nextIdent = RENDERDOC_EnumerateRemoteTargets(host_mem, nextIdent);

                if (nextIdent == UInt32.MaxValue || prevIdent >= nextIdent)
                {
                    break;
                }

                callback(nextIdent);
            }

            CustomMarshal.Free(host_mem);
        }