Esempio n. 1
0
        public void GetBasis(out Vec3f pos, out Vec3f fwd, out Vec3f right, out Vec3f up)
        {
            IntPtr p = CustomMarshal.Alloc(typeof(FloatVector));
            IntPtr f = CustomMarshal.Alloc(typeof(FloatVector));
            IntPtr r = CustomMarshal.Alloc(typeof(FloatVector));
            IntPtr u = CustomMarshal.Alloc(typeof(FloatVector));

            Camera_GetBasis(m_Real, p, f, r, u);

            pos   = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(p, typeof(FloatVector), false));
            fwd   = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(f, typeof(FloatVector), false));
            right = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(r, typeof(FloatVector), false));
            up    = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(u, typeof(FloatVector), false));

            CustomMarshal.Free(p);
            CustomMarshal.Free(f);
            CustomMarshal.Free(r);
            CustomMarshal.Free(u);
        }
Esempio n. 2
0
        public string[] GetResolve(UInt64[] callstack)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            UInt32 len = (UInt32)callstack.Length;

            bool success = ReplayRenderer_GetResolve(m_Real, callstack, len, mem);

            string[] ret = null;

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

            CustomMarshal.Free(mem);

            return(ret);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public MeshFormat GetPostVSData(UInt32 instID, MeshDataStage stage)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(MeshFormat));

            MeshFormat ret = new MeshFormat();

            ret.buf = ResourceId.Null;

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

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

            CustomMarshal.Free(mem);

            return(ret);
        }
Esempio n. 5
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;

            bool success = ReplayRenderer_BuildTargetShader(m_Real, entry, source, compileFlags, type, ref ret, mem);

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

            errors = CustomMarshal.TemplatedArrayToUniString(mem, true);

            CustomMarshal.Free(mem);

            return(ret);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        public bool GetHistogram(ResourceId tex, UInt32 sliceFace, UInt32 mip, UInt32 sample, float minval, float maxval,
                                 bool Red, bool Green, bool Blue, bool Alpha,
                                 out UInt32[] histogram)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            bool[] channels = new bool[] { Red, Green, Blue, Alpha };

            bool success = ReplayRenderer_GetHistogram(m_Real, tex, sliceFace, mip, sample, minval, maxval, channels, mem);

            histogram = null;

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

            CustomMarshal.Free(mem);

            return(success);
        }
Esempio n. 9
0
        public Dictionary <uint, List <CounterResult> > FetchCounters(UInt32 frameID, UInt32 minEventID, UInt32 maxEventID, UInt32[] counters)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            IntPtr countersmem = CustomMarshal.Alloc(typeof(UInt32), counters.Length);

            // there's no Marshal.Copy for uint[], which is stupid.
            for (int i = 0; i < counters.Length; i++)
            {
                Marshal.WriteInt32(countersmem, sizeof(UInt32) * i, (int)counters[i]);
            }

            bool success = ReplayRenderer_FetchCounters(m_Real, frameID, minEventID, maxEventID, countersmem, (uint)counters.Length, mem);

            CustomMarshal.Free(countersmem);

            Dictionary <uint, List <CounterResult> > ret = null;

            if (success)
            {
                CounterResult[] resultArray = (CounterResult[])CustomMarshal.GetTemplatedArray(mem, typeof(CounterResult), true);

                // fixup previous/next/parent pointers
                ret = new Dictionary <uint, List <CounterResult> >();

                foreach (var result in resultArray)
                {
                    if (!ret.ContainsKey(result.eventID))
                    {
                        ret.Add(result.eventID, new List <CounterResult>());
                    }

                    ret[result.eventID].Add(result);
                }
            }

            CustomMarshal.Free(mem);

            return(ret);
        }
Esempio n. 10
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);
        }
Esempio n. 11
0
        public FetchDrawcall[] GetDrawcalls(UInt32 frameID, bool includeTimes)
        {
            IntPtr mem = CustomMarshal.Alloc(typeof(templated_array));

            bool success = ReplayRenderer_GetDrawcalls(m_Real, frameID, includeTimes, mem);

            FetchDrawcall[] ret = null;

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

                // fixup previous/next/parent pointers
                var map = new Dictionary <Int64, FetchDrawcall>();
                PopulateDraws(ref map, ret);
                FixupDraws(map, ret);
            }

            CustomMarshal.Free(mem);

            return(ret);
        }
Esempio n. 12
0
        public bool GetMinMax(ResourceId tex, UInt32 sliceFace, UInt32 mip, UInt32 sample, out PixelValue minval, out PixelValue maxval)
        {
            IntPtr mem1 = CustomMarshal.Alloc(typeof(PixelValue));
            IntPtr mem2 = CustomMarshal.Alloc(typeof(PixelValue));

            bool success = ReplayRenderer_GetMinMax(m_Real, tex, sliceFace, mip, sample, mem1, mem2);

            if (success)
            {
                minval = (PixelValue)CustomMarshal.PtrToStructure(mem1, typeof(PixelValue), true);
                maxval = (PixelValue)CustomMarshal.PtrToStructure(mem2, typeof(PixelValue), true);
            }
            else
            {
                minval = null;
                maxval = null;
            }

            CustomMarshal.Free(mem1);
            CustomMarshal.Free(mem2);

            return(success);
        }
Esempio n. 13
0
        public void fpsLook(Vec3f lookpos, Vec3f lookrot)
        {
            IntPtr p = CustomMarshal.Alloc(typeof(FloatVector));
            IntPtr f = CustomMarshal.Alloc(typeof(FloatVector));
            IntPtr r = CustomMarshal.Alloc(typeof(FloatVector));

            isarc    = false;
            parampos = new Vec3f(lookpos);
            paramrot = new Vec3f(lookrot);

            var ps = new FloatVector(lookpos);
            var rt = new FloatVector(lookrot);

            Maths_CameraFPSLook(ref ps, ref rt, p, f, r);

            pos   = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(p, typeof(FloatVector), false));
            fwd   = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(f, typeof(FloatVector), false));
            right = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(r, typeof(FloatVector), false));

            CustomMarshal.Free(p);
            CustomMarshal.Free(f);
            CustomMarshal.Free(r);
        }
Esempio n. 14
0
        public void Arcball(float dist, Vec3f rot)
        {
            IntPtr p = CustomMarshal.Alloc(typeof(FloatVector));
            IntPtr f = CustomMarshal.Alloc(typeof(FloatVector));
            IntPtr r = CustomMarshal.Alloc(typeof(FloatVector));

            isarc      = true;
            parampos.x = dist;
            parampos.y = 0.0f;
            parampos.z = 0.0f;
            paramrot   = new Vec3f(rot);

            var rt = new FloatVector(rot);

            Maths_CameraArcball(dist, ref rt, p, f, r);

            pos   = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(p, typeof(FloatVector), false));
            fwd   = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(f, typeof(FloatVector), false));
            right = new Vec3f((FloatVector)CustomMarshal.PtrToStructure(r, typeof(FloatVector), false));

            CustomMarshal.Free(p);
            CustomMarshal.Free(f);
            CustomMarshal.Free(r);
        }