From 93a08dc744daff2e7150bdf5775645d94567ace1 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 7 Feb 2021 18:37:03 -0800 Subject: Reworked ExecuteCommandList(+s) to take an array of command lists instead of one --- .../UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp | 6 +++--- unityplugin/UnityEmulator/src/UnityGraphicsD3D12Emulator.cpp | 12 ++++++++---- unityplugin/UnityEmulator/src/UnityGraphicsD3D12Impl.h | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'unityplugin/UnityEmulator') diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp index e859af2..d871e3e 100644 --- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp +++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp @@ -45,10 +45,10 @@ public: return m_GraphicsD3D12Impl.GetNextFenceValue(); } - // Executes a given command list - virtual Uint64 DILIGENT_CALL_TYPE Submit(ID3D12GraphicsCommandList* commandList) override final + // Executes command lists + virtual Uint64 DILIGENT_CALL_TYPE Submit(Uint32 NumCommandLists, ID3D12CommandList* const* ppCommandLists) override final { - return m_GraphicsD3D12Impl.ExecuteCommandList(commandList); + return m_GraphicsD3D12Impl.ExecuteCommandLists(NumCommandLists, ppCommandLists); } // Returns D3D12 command queue. May return null if queue is anavailable diff --git a/unityplugin/UnityEmulator/src/UnityGraphicsD3D12Emulator.cpp b/unityplugin/UnityEmulator/src/UnityGraphicsD3D12Emulator.cpp index 9e52bc1..76c1e2b 100644 --- a/unityplugin/UnityEmulator/src/UnityGraphicsD3D12Emulator.cpp +++ b/unityplugin/UnityEmulator/src/UnityGraphicsD3D12Emulator.cpp @@ -398,12 +398,16 @@ UINT64 UnityGraphicsD3D12Impl::IdleGPU() return SignaledValue; } -UINT64 UnityGraphicsD3D12Impl::ExecuteCommandList(ID3D12CommandList *pCmdList) +UINT64 UnityGraphicsD3D12Impl::ExecuteCommandList(ID3D12CommandList* pCommandList) { - if (pCmdList != nullptr) + return ExecuteCommandLists(pCommandList != nullptr ? 1 : 0, &pCommandList); +} + +UINT64 UnityGraphicsD3D12Impl::ExecuteCommandLists(UINT NumCommandLists, ID3D12CommandList* const* ppCommandLists) +{ + if (NumCommandLists !=0 && ppCommandLists != nullptr) { - ID3D12CommandList *CmdLists[] = { pCmdList }; - m_D3D12CmdQueue->ExecuteCommandLists(1, CmdLists); + m_D3D12CmdQueue->ExecuteCommandLists(NumCommandLists, ppCommandLists); } auto FenceValue = m_NextFenceValue; m_D3D12CmdQueue->Signal(m_D3D12FrameFence, m_NextFenceValue++); diff --git a/unityplugin/UnityEmulator/src/UnityGraphicsD3D12Impl.h b/unityplugin/UnityEmulator/src/UnityGraphicsD3D12Impl.h index a5ad50b..e7cc4df 100644 --- a/unityplugin/UnityEmulator/src/UnityGraphicsD3D12Impl.h +++ b/unityplugin/UnityEmulator/src/UnityGraphicsD3D12Impl.h @@ -54,7 +54,8 @@ public: } UINT64 GetNextFenceValue() { return m_NextFenceValue; } UINT64 GetCompletedFenceValue() { return m_D3D12FrameFence->GetCompletedValue(); } - UINT64 ExecuteCommandList(ID3D12CommandList *pCmdList); + UINT64 ExecuteCommandLists(UINT NumCommandLists, ID3D12CommandList* const* ppCommandLists); + UINT64 ExecuteCommandList(ID3D12CommandList* pCmdList); void SetTransitionHandler(IResourceStateTransitionHandler *pTransitionHandler) { m_pStateTransitionHandler = pTransitionHandler; } void TransitonResourceStates(int stateCount, UnityGraphicsD3D12ResourceState* states); IDXGISwapChain3* GetSwapChain(){ return m_SwapChain; } -- cgit v1.2.3