From d06553e2b4700aa026acd4445a598eadf10dfb35 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 8 Sep 2019 17:42:51 -0700 Subject: Added IDeviceContext::WaitForIdle() method (updated API version to 240028) --- Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h | 6 ++++-- Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp | 6 ++++++ Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h index b9f57598..0d973062 100644 --- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h @@ -104,8 +104,6 @@ public: virtual void ClearRenderTarget( ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final; - virtual void Flush()override final; - virtual void UpdateBuffer(IBuffer* pBuffer, Uint32 Offset, Uint32 Size, @@ -156,6 +154,10 @@ public: virtual void WaitForFence(IFence* pFence, Uint64 Value, bool FlushContext)override final; + virtual void WaitForIdle()override final; + + virtual void Flush()override final; + virtual void TransitionTextureState(ITexture *pTexture, D3D12_RESOURCE_STATES State)override final; virtual void TransitionBufferState(IBuffer *pBuffer, D3D12_RESOURCE_STATES State)override final; diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index b31bedef..78e81459 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -1580,6 +1580,12 @@ namespace Diligent pFenceD3D12->WaitForCompletion(Value); } + void DeviceContextD3D12Impl::WaitForIdle() + { + VERIFY(!m_bIsDeferred, "Only immediate contexts can be idled"); + Flush(); + m_pDevice.RawPtr()->IdleCommandQueue(m_CommandQueueId, true); + } void DeviceContextD3D12Impl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) { diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index e34b637a..22ed2bc8 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -202,7 +202,7 @@ void RenderDeviceD3D12Impl::SignalFences(Uint32 QueueIndex, std::vector