From c6c5bb5ed3d4e3296e6f65e4072db5cf8bf2452c Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 7 Feb 2021 12:50:39 -0800 Subject: Reworked ExecuteCommandList(s) to take multiple command lists instead of one --- .../include/DeviceContextD3D11Impl.hpp | 5 ++-- .../src/DeviceContextD3D11Impl.cpp | 30 ++++++++++++++-------- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp index 74f5dd49..3c7bf09c 100644 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp @@ -229,8 +229,9 @@ public: /// Implementation of IDeviceContext::FinishCommandList() in Direct3D11 backend. void DILIGENT_CALL_TYPE FinishCommandList(class ICommandList** ppCommandList) override final; - /// Implementation of IDeviceContext::ExecuteCommandList() in Direct3D11 backend. - virtual void DILIGENT_CALL_TYPE ExecuteCommandList(class ICommandList* pCommandList) override final; + /// Implementation of IDeviceContext::ExecuteCommandLists() in Direct3D11 backend. + virtual void DILIGENT_CALL_TYPE ExecuteCommandLists(Uint32 NumCommandLists, + ICommandList* const* ppCommandLists) override final; /// Implementation of IDeviceContext::SignalFence() in Direct3D11 backend. virtual void DILIGENT_CALL_TYPE SignalFence(IFence* pFence, Uint64 Value) override final; diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index b4fa4c32..7c1ae564 100755 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -1925,7 +1925,8 @@ void DeviceContextD3D11Impl::FinishCommandList(ICommandList** ppCommandList) #endif } -void DeviceContextD3D11Impl::ExecuteCommandList(ICommandList* pCommandList) +void DeviceContextD3D11Impl::ExecuteCommandLists(Uint32 NumCommandLists, + ICommandList* const* ppCommandLists) { if (m_bIsDeferred) { @@ -1933,16 +1934,23 @@ void DeviceContextD3D11Impl::ExecuteCommandList(ICommandList* pCommandList) return; } - CommandListD3D11Impl* pCmdListD3D11 = ValidatedCast(pCommandList); - auto* pd3d11CmdList = pCmdListD3D11->GetD3D11CommandList(); - m_pd3d11DeviceContext->ExecuteCommandList(pd3d11CmdList, - FALSE // A Boolean flag that determines whether the target context state is - // saved prior to and restored after the execution of a command list. - // * TRUE indicates that the runtime needs to save and restore the state. - // * FALSE indicate that no state shall be saved or restored, which causes the - // target context to return to its default state after the command list executes as if - // ID3D11DeviceContext::ClearState() was called. - ); + if (NumCommandLists == 0) + return; + DEV_CHECK_ERR(ppCommandLists != nullptr, "ppCommandLists must not be null when NumCommandLists is not zero"); + + for (Uint32 i = 0; i < NumCommandLists; ++i) + { + auto* pCmdListD3D11 = ValidatedCast(ppCommandLists[i]); + auto* pd3d11CmdList = pCmdListD3D11->GetD3D11CommandList(); + m_pd3d11DeviceContext->ExecuteCommandList(pd3d11CmdList, + FALSE // A Boolean flag that determines whether the target context state is + // saved prior to and restored after the execution of a command list. + // * TRUE indicates that the runtime needs to save and restore the state. + // * FALSE indicate that no state shall be saved or restored, which causes the + // target context to return to its default state after the command list executes as if + // ID3D11DeviceContext::ClearState() was called. + ); + } // Device context is now in default state InvalidateState(); -- cgit v1.2.3