예제 #1
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;
        }
예제 #2
0
        public void Render()
        {
            Delegate[]    Handlers = CommandListBuildHandler.GetInvocationList();
            CommandList[] List     = new CommandList[Handlers.Length];
            Parallel.For(0, Handlers.Length, Index =>
            {
                ((CommandListDelegate)Handlers[Index])(CommandPool[Index].CommandList, CommandPool[Index].Allocator);
                List[Index] = CommandPool[Index].CommandList;
            });
            GraphicCommandQueue.ExecuteCommandLists(CommandPool.Count, List);

            SwapChain.Present(1, 0);
            WaitForPreviousFrame();
        }