summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-02-08 02:37:03 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-02-08 02:37:03 +0000
commit93a08dc744daff2e7150bdf5775645d94567ace1 (patch)
treefdf6e39caf973cdaecb82ad37c1a0ccf55d887c6
parentUpdated tools module (diff)
downloadDiligentEngine-93a08dc744daff2e7150bdf5775645d94567ace1.tar.gz
DiligentEngine-93a08dc744daff2e7150bdf5775645d94567ace1.zip
Reworked ExecuteCommandList(+s) to take an array of command lists instead of one
m---------DiligentCore0
m---------DiligentSamples0
-rw-r--r--Projects/Asteroids/src/asteroids_DE.cpp6
-rw-r--r--Projects/Asteroids/src/asteroids_DE.h1
-rw-r--r--unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp13
-rw-r--r--unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp6
-rw-r--r--unityplugin/UnityEmulator/src/UnityGraphicsD3D12Emulator.cpp12
-rw-r--r--unityplugin/UnityEmulator/src/UnityGraphicsD3D12Impl.h3
8 files changed, 27 insertions, 14 deletions
diff --git a/DiligentCore b/DiligentCore
-Subproject 33a7d7ef17a3db7497ddc28ab79531b3752d8b5
+Subproject 1b12c2195f219844f186f20b98b5210944b38f6
diff --git a/DiligentSamples b/DiligentSamples
-Subproject 0a177d689b578baf5bf5a820d85e5fb56fcba22
+Subproject f9958f5c1e52712efbc47a8f9ae093664256ef8
diff --git a/Projects/Asteroids/src/asteroids_DE.cpp b/Projects/Asteroids/src/asteroids_DE.cpp
index 64fdc43..4e7a98c 100644
--- a/Projects/Asteroids/src/asteroids_DE.cpp
+++ b/Projects/Asteroids/src/asteroids_DE.cpp
@@ -1024,9 +1024,13 @@ void Asteroids::Render(float frameTime, const OrbitCamera& camera, const Setting
// Reset mRenderSubsetsSignal while all threads are waiting for mUpdateSubsetsSignal
mRenderSubsetsSignal.Reset();
+ mCmdListPtrs.resize(mCmdLists.size());
+ for(size_t i=0; i < mCmdLists.size(); ++i)
+ mCmdListPtrs[i] = mCmdLists[i];
+ mDeviceCtxt->ExecuteCommandLists(static_cast<Uint32>(mCmdListPtrs.size()), mCmdListPtrs.data());
+
for (auto& cmdList : mCmdLists)
{
- mDeviceCtxt->ExecuteCommandList(cmdList);
// Release command lists now to release all outstanding references
// In d3d11 mode, command lists hold references to the swap chain's back buffer
// that cause swap chain resize to fail
diff --git a/Projects/Asteroids/src/asteroids_DE.h b/Projects/Asteroids/src/asteroids_DE.h
index afa9d49..fe763d7 100644
--- a/Projects/Asteroids/src/asteroids_DE.h
+++ b/Projects/Asteroids/src/asteroids_DE.h
@@ -62,6 +62,7 @@ private:
Diligent::RefCntAutoPtr<Diligent::IDeviceContext> mDeviceCtxt;
std::vector< Diligent::RefCntAutoPtr<Diligent::IDeviceContext> > mDeferredCtxt;
std::vector< Diligent::RefCntAutoPtr<Diligent::ICommandList> > mCmdLists;
+ std::vector< Diligent::ICommandList* > mCmdListPtrs;
Diligent::Uint32 mBackBufferWidth, mBackBufferHeight;
Diligent::Uint32 mNumSubsets = 0;
diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
index d37b42f..d51a670 100644
--- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
+++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
@@ -48,13 +48,16 @@ public:
return m_pUnityGraphicsD3D12->GetNextFrameFenceValue();
}
- // 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
{
auto NextFenceValue = m_pUnityGraphicsD3D12->GetNextFrameFenceValue();
- m_CurrentFenceValue = m_pUnityGraphicsD3D12->ExecuteCommandList(commandList, static_cast<int>(m_ResourcesToTransition.size()), m_ResourcesToTransition.empty() ? nullptr : m_ResourcesToTransition.data());
- VERIFY(m_CurrentFenceValue >= NextFenceValue, "Current fence value returned by ExecuteCommandList() is less than the next fence value previously queried through GetNextFrameFenceValue()");
- m_ResourcesToTransition.clear();
+ for(Uint32 i=0; i < NumCommandLists; ++i)
+ {
+ m_CurrentFenceValue = m_pUnityGraphicsD3D12->ExecuteCommandList(static_cast<ID3D12GraphicsCommandList*>(ppCommandLists[i]), static_cast<int>(m_ResourcesToTransition.size()), m_ResourcesToTransition.empty() ? nullptr : m_ResourcesToTransition.data());
+ VERIFY(m_CurrentFenceValue >= NextFenceValue, "Current fence value returned by ExecuteCommandList() is less than the next fence value previously queried through GetNextFrameFenceValue()");
+ m_ResourcesToTransition.clear();
+ }
return std::max(m_CurrentFenceValue, NextFenceValue);
}
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; }