Exemplo n.º 1
0
        sealed protected override void Draw(GameTime gameTime)
        {
            RenderCoordinator.WorkStopwatch.Restart();

            var priorIndex = Batch.LifetimeCount;

            NextFrameTiming.PriorPrimitiveCount = NativeBatch.LifetimePrimitiveCount;
            NextFrameTiming.PriorCommandCount   = NativeBatch.LifetimeCommandCount;

            // ????
            RenderCoordinator.WaitForActiveDraws();

            try {
                OnBeforeDraw(gameTime);
                var frame = RenderCoordinator.BeginFrame(true);
                Squared.Threading.Profiling.Superluminal.BeginEventFormat("Build Frame", "SRFrame #{0}", frame.Index, color: 0x1010CF);
                Draw(gameTime, frame);
            } finally {
                Squared.Threading.Profiling.Superluminal.EndEvent();
                RenderCoordinator.SynchronousDrawsEnabled = true;
                RenderCoordinator.WorkStopwatch.Stop();
                NextFrameTiming.Draw       = RenderCoordinator.WorkStopwatch.Elapsed;
                NextFrameTiming.BatchCount = (int)(Batch.LifetimeCount - priorIndex);
            }
        }
Exemplo n.º 2
0
        sealed protected override void Draw(GameTime gameTime)
        {
            RenderCoordinator.WorkStopwatch.Restart();

            var priorIndex = Batch.LifetimeCount;

            NextFrameTiming.PriorPrimitiveCount = NativeBatch.LifetimePrimitiveCount;

            try {
                OnBeforeDraw(gameTime);
                var frame = RenderCoordinator.BeginFrame();
                RenderCoordinator.SynchronousDrawsEnabled = false;
                Draw(gameTime, frame);
            } finally {
                RenderCoordinator.SynchronousDrawsEnabled = true;
                RenderCoordinator.WorkStopwatch.Stop();
                NextFrameTiming.Draw       = RenderCoordinator.WorkStopwatch.Elapsed;
                NextFrameTiming.BatchCount = (int)(Batch.LifetimeCount - priorIndex);
            }
        }