private void SubmitCommandList() { commandList.Close(); commandQueue.ExecuteCommandList(commandList); fenceValue++; commandQueue.Signal(fence, fenceValue); }
public void Tick() { _commandAllocator.Reset(); _commandList.Reset(_commandAllocator, null); // Indicate that the back buffer will be used as a render target. _commandList.ResourceBarrierTransition(_renderTargets[_frameIndex], ResourceStates.Present, ResourceStates.RenderTarget); var rtvHandle = _rtvHeap.GetCPUDescriptorHandleForHeapStart(); rtvHandle += _frameIndex * _rtvDescriptorSize; // Record commands. Color4 clearColor = new Color4(0.0f, 0.2f, 0.4f, 1.0f); _commandList.ClearRenderTargetView(rtvHandle, clearColor); // Indicate that the back buffer will now be used to present. _commandList.ResourceBarrierTransition(_renderTargets[_frameIndex], ResourceStates.RenderTarget, ResourceStates.Present); _commandList.Close(); // Execute the command list. _d3d12CommandQueue.ExecuteCommandList(_commandList); var result = SwapChain.Present(1, PresentFlags.None); if (result.Failure && result.Code == Vortice.DXGI.ResultCode.DeviceRemoved.Code) { } WaitForPreviousFrame(); }
public uint SubmitCommandList(ID3D12GraphicsCommandList4 pCmdList, ID3D12CommandQueue pCmdQueue, ID3D12Fence pFence, uint fenceValue) { pCmdList.Close(); pCmdQueue.ExecuteCommandList(pCmdList); fenceValue++; pCmdQueue.Signal(pFence, fenceValue); return(fenceValue); }
public void CloseExecuteResetWait() { D3D12CommandList.Close(); D3D12CommandQueue.ExecuteCommandList(D3D12CommandList); using var fence = D3D12Device.CreateFence(); var waitHandle = new AutoResetEvent(false); fence.SetEventOnCompletion(1, waitHandle); D3D12CommandQueue.Signal(fence, 1); waitHandle.WaitOne(); D3D12CommandAllocator.Reset(); D3D12CommandList.Reset(D3D12CommandAllocator); }