Exemplo n.º 1
0
        ////////////////////////////////////////////
        // Internals

        private void CreateReplayRenderer(ref ReplayRenderer renderer, ref RemoteRenderer remote)
        {
            if (m_ProxyRenderer < 0)
            {
                renderer = StaticExports.CreateReplayRenderer(m_Logfile, ref LoadProgress);
                return;
            }

            remote = StaticExports.CreateRemoteReplayConnection(m_ReplayHost);

            if (remote == null)
            {
                var e = new System.ApplicationException("Failed to connect to remote replay host");
                e.Data.Add("status", ReplayCreateStatus.UnknownError);
                throw e;
            }

            renderer = remote.CreateProxyRenderer(m_ProxyRenderer, m_Logfile, ref LoadProgress);

            if (renderer == null)
            {
                remote.Shutdown();

                var e = new System.ApplicationException("Failed to connect to remote replay host");
                e.Data.Add("status", ReplayCreateStatus.UnknownError);
                throw e;
            }
        }
Exemplo n.º 2
0
 private void DestroyReplayRenderer(ReplayRenderer renderer)
 {
     if (m_Remote != null)
     {
         m_Remote.CloseCapture(renderer);
     }
     else
     {
         renderer.Shutdown();
     }
 }
Exemplo n.º 3
0
        public void TimeDrawcalls(ReplayRenderer r)
        {
            if (m_TimedDrawcalls)
            {
                return;
            }
            m_TimedDrawcalls = true;

            for (int i = 0; i < m_FrameInfo.Length; i++)
            {
                m_DrawCalls[i] = FakeProfileMarkers(i, r.GetDrawcalls((UInt32)i, true));
            }
        }
Exemplo n.º 4
0
        private void RunThread()
        {
            try
            {
                ReplayRenderer renderer = null;
                RemoteRenderer remote   = null;
                CreateReplayRenderer(ref renderer, ref remote);
                if (renderer != null)
                {
                    System.Diagnostics.Debug.WriteLine("Renderer created");

                    Running = true;

                    while (Running)
                    {
                        List <InvokeHandle> queue = new List <InvokeHandle>();
                        lock (m_renderQueue)
                        {
                            foreach (var cmd in m_renderQueue)
                            {
                                queue.Add(cmd);
                            }

                            m_renderQueue.Clear();
                        }

                        foreach (var cmd in queue)
                        {
                            if (cmd.method != null)
                            {
                                cmd.method(renderer);
                            }

                            cmd.processed = true;
                        }

                        m_WakeupEvent.WaitOne(10);
                    }

                    lock (m_renderQueue)
                    {
                        foreach (var cmd in m_renderQueue)
                        {
                            cmd.processed = true;
                        }

                        m_renderQueue.Clear();
                    }

                    renderer.Shutdown();
                    if (remote != null)
                    {
                        remote.Shutdown();
                    }
                }
            }
            catch (ApplicationException ex)
            {
                InitException = ex;
            }
        }
Exemplo n.º 5
0
        private void RunThread()
        {
            try
            {
                ReplayRenderer renderer = CreateReplayRenderer();
                if (renderer != null)
                {
                    System.Diagnostics.Debug.WriteLine("Renderer created");

                    Running = true;

                    m_current = null;

                    while (Running)
                    {
                        lock (m_renderQueue)
                        {
                            if (m_renderQueue.Count > 0)
                            {
                                m_current = m_renderQueue[0];
                                m_renderQueue.RemoveAt(0);
                            }
                        }

                        if (m_current == null)
                        {
                            m_WakeupEvent.WaitOne(10);
                            continue;
                        }

                        if (m_current.method != null)
                        {
                            if (CatchExceptions)
                            {
                                try
                                {
                                    m_current.method(renderer);
                                }
                                catch (Exception ex)
                                {
                                    m_current.ex = ex;
                                }
                            }
                            else
                            {
                                m_current.method(renderer);
                            }
                        }

                        m_current.processed = true;
                        m_current           = null;
                    }

                    lock (m_renderQueue)
                    {
                        foreach (var cmd in m_renderQueue)
                        {
                            cmd.processed = true;
                        }

                        m_renderQueue.Clear();
                    }

                    DestroyReplayRenderer(renderer);
                }
            }
            catch (ReplayCreateException ex)
            {
                InitException = ex;
            }
        }