Beispiel #1
0
        /// <summary>
        /// Waits until only Desc.MaxFramesInFlight-1 frames are inflight and will then trigger the OnBeginRendering event.
        /// If an application is highly GPU bound, it will wait for the GPU to complete the rendering for this swapChain in this function.
        /// </summary>
        public void BeginFrame()
        {
            // Fullfill the MaxFramesInFlight constraint.
            Assert.Debug(NumFramesInFlight <= Desc.MaxFramesInFlight, "It should be impossible to have more than Desc.MaxFramesInFlight frames in flight.");
            if (NumFramesInFlight == Desc.MaxFramesInFlight)
            {
                FrameFence.WaitForCompletion(NumCompletedFramesGPU + 1, TimeSpan.MaxValue);
            }

            // Anounce frame start to all listeners.
            OnBeginFrame?.Invoke(activeInFlightFrameIndex);
        }
Beispiel #2
0
 internal void CallOnBeginFrame()
 {
     OnBeginFrame?.Invoke();
 }