Ejemplo n.º 1
0
 public void WaitForGpu()
 {
     CommandQueue.Signal(Fence, FenceValues[FrameIndex]);
     Fence.SetEventOnCompletion(FenceValues[FrameIndex], FenceEvent.SafeWaitHandle.DangerousGetHandle());
     FenceEvent.WaitOne();
     FenceValues[FrameIndex] += 1;
 }
Ejemplo n.º 2
0
        private void WaitForPreviousFrame()
        {
            int LocalFence = FenceValue;

            GraphicCommandQueue.Signal(Fence, LocalFence);
            FenceValue++;
            if (Fence.CompletedValue < LocalFence)
            {
                Fence.SetEventOnCompletion(LocalFence, FenceEvent.SafeWaitHandle.DangerousGetHandle());
                FenceEvent.WaitOne();
            }
            FrameIndex = SwapChain.CurrentBackBufferIndex;
        }
Ejemplo n.º 3
0
        public void MoveToNextFrame()
        {
            var currentFenceValue = FenceValues[FrameIndex];

            CommandQueue.Signal(Fence, currentFenceValue);
            FrameIndex = SwapChain3.CurrentBackBufferIndex;
            if (Fence.CompletedValue < FenceValues[FrameIndex])
            {
                Fence.SetEventOnCompletion(FenceValues[FrameIndex], FenceEvent.SafeWaitHandle.DangerousGetHandle());
                FenceEvent.WaitOne();
            }
            FenceValues[FrameIndex] = currentFenceValue + 1;
        }