コード例 #1
0
        internal void Present(bool vsync)
        {
            Result hr;

            if (vsync)
            {
                hr = m_swapChain.Present(1, 0);
            }
            else
            {
                hr = m_swapChain.Present(0, PresentFlags.AllowTearing);
            }

            ThrowIfFailed(hr);
        }
コード例 #2
0
        public void Present()
        {
            NativeSwapChain.Present(1, PresentFlags.None);
            BackBufferIndex = NativeSwapChain.GetCurrentBackBufferIndex();

            BackBuffer.Resource.Dispose();
            BackBuffer.InitializeFromImpl(NativeSwapChain.GetBuffer <ID3D12Resource>(BackBufferIndex));
        }
コード例 #3
0
        private void EndFrame(int rtvIndex)
        {
            InsertTransitionResourceBarrier(frameObjects[rtvIndex].swapChainBuffer, ResourceStates.CopyDestination, ResourceStates.Present);
            SubmitCommandList();

            swapChain.Present(0, PresentFlags.None);

            var bufferIndex = swapChain.GetCurrentBackBufferIndex();

            if (fenceValue > DefaultSwapChainBuffers)
            {
                fence.SetEventOnCompletion(fenceValue - DefaultSwapChainBuffers + 1, fenceEvent);
                fenceEvent.WaitOne();
            }

            frameObjects[bufferIndex].cmdAllocator.Reset();
            commandList.Reset(frameObjects[bufferIndex].cmdAllocator, null);
        }
コード例 #4
0
        private void EndFrame(int rtvIndex)
        {
            context.ResourceBarrier(mpCmdList, mFrameObjects[rtvIndex].pSwapChainBuffer, ResourceStates.CopyDestination, ResourceStates.Present);
            mFenceValue = context.SubmitCommandList(mpCmdList, mpCmdQueue, mpFence, mFenceValue);
            mpSwapChain.Present(0, 0);

            // Prepare the command list for the next frame
            int bufferIndex = mpSwapChain.GetCurrentBackBufferIndex();

            // Make sure we have the new back-buffer is ready
            if (mFenceValue > context.kDefaultSwapChainBuffers)
            {
                mpFence.SetEventOnCompletion(mFenceValue - context.kDefaultSwapChainBuffers + 1, mFenceEvent);
                this.mFenceEvent.WaitOne();
            }

            mFrameObjects[bufferIndex].pCmdAllocator.Reset();
            mpCmdList.Reset(mFrameObjects[bufferIndex].pCmdAllocator, null);
        }