public void Intialize()
        {
            // create device
            m_Device = new H1DX12Device();
            // @TODO - organize command list pools
            H1CommandListPool mainCommandListPool = new H1CommandListPool(m_Device);

            mainCommandListPool.Initialize(H1GlobalDX12Definitions.CMDQUEUE_GRAPHICS);
            m_CmdListPools.Add(mainCommandListPool);

            // create command list fence set
            m_CmdFenceSet = new H1CommandListFenceSet(m_Device);
            m_CmdFenceSet.Initialize();
        }
Exemplo n.º 2
0
        private void WaitForPrevFrame()
        {
            // waiting for the frame to complete before continuing is not best practice
            // this is code implemented as such for simplicity
            Direct3D12.H1CommandListFenceSet cmdFenceSet = m_DeviceContext.CommandListFenceSet;
            Int32 id             = Convert.ToInt32(Direct3D12.H1GlobalDX12Definitions.CMDQUEUE_GRAPHICS);
            Int64 currFenceValue = cmdFenceSet.GetCurrentValue(id);
            Fence currFence      = cmdFenceSet.GetFence(id);

            // get command queue to signal currFenceValue
            m_DeviceContext.MainCommandListPool.CommandQueue.Signal(currFence, currFenceValue);

            if (currFence.CompletedValue < currFenceValue)
            {
                cmdFenceSet.WaitForFence(currFenceValue, id);
            }

            // update fence value
            cmdFenceSet.SetCurrentValue(currFenceValue + 1, id);
            // update back buffer index
            m_FrameIndex = m_SwapChainDX12.SwapChain.CurrentBackBufferIndex;
        }