From 13440e98e8cd926620d9913aa72780ceaca4f668 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Wed, 30 Oct 2019 10:46:28 -0700 Subject: Some code refactoring --- Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h | 5 ++++- Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h index 9da2c23e..8dbd53ff 100755 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h @@ -40,11 +40,14 @@ namespace Diligent { +class RenderDeviceD3D11Impl; + struct DeviceContextD3D11ImplTraits { using BufferType = BufferD3D11Impl; using TextureType = TextureBaseD3D11; using PipelineStateType = PipelineStateD3D11Impl; + using DeviceType = RenderDeviceD3D11Impl; }; /// Implementation of the Diligent::IDeviceContextD3D11 interface @@ -55,7 +58,7 @@ public: DeviceContextD3D11Impl(IReferenceCounters* pRefCounters, IMemoryAllocator& Allocator, - IRenderDevice* pDevice, + RenderDeviceD3D11Impl* pDevice, ID3D11DeviceContext* pd3d11DeviceContext, const struct EngineD3D11CreateInfo& EngineAttribs, bool bIsDeferred); diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index 9bcf8152..587aaee5 100755 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -43,7 +43,7 @@ namespace Diligent { DeviceContextD3D11Impl::DeviceContextD3D11Impl( IReferenceCounters* pRefCounters, IMemoryAllocator& Allocator, - IRenderDevice* pDevice, + RenderDeviceD3D11Impl* pDevice, ID3D11DeviceContext* pd3d11DeviceContext, const struct EngineD3D11CreateInfo& EngineAttribs, bool bIsDeferred ) : @@ -1729,8 +1729,7 @@ namespace Diligent // ID3D11DeviceContext::ClearState() was called. &pd3d11CmdList); - auto* pDeviceD3D11Impl = m_pDevice.RawPtr(); - CommandListD3D11Impl* pCmdListD3D11( NEW_RC_OBJ(m_CmdListAllocator, "CommandListD3D11Impl instance", CommandListD3D11Impl)(pDeviceD3D11Impl, pd3d11CmdList) ); + CommandListD3D11Impl* pCmdListD3D11( NEW_RC_OBJ(m_CmdListAllocator, "CommandListD3D11Impl instance", CommandListD3D11Impl)(m_pDevice, pd3d11CmdList) ); pCmdListD3D11->QueryInterface( IID_CommandList, reinterpret_cast(ppCommandList) ); // Device context is now in default state @@ -1808,7 +1807,7 @@ namespace Diligent void DeviceContextD3D11Impl::SignalFence(IFence* pFence, Uint64 Value) { VERIFY(!m_bIsDeferred, "Fence can only be signaled from immediate context"); - auto* pd3d11Device = m_pDevice.RawPtr()->GetD3D11Device(); + auto* pd3d11Device = m_pDevice->GetD3D11Device(); CComPtr pd3d11Query = CreateD3D11QueryEvent(pd3d11Device); m_pd3d11DeviceContext->End(pd3d11Query); auto* pFenceD3D11Impl = ValidatedCast(pFence); @@ -1828,7 +1827,7 @@ namespace Diligent { VERIFY(!m_bIsDeferred, "Only immediate contexts can be idled"); Flush(); - auto* pd3d11Device = m_pDevice.RawPtr()->GetD3D11Device(); + auto* pd3d11Device = m_pDevice->GetD3D11Device(); CComPtr pd3d11Query = CreateD3D11QueryEvent(pd3d11Device); m_pd3d11DeviceContext->End(pd3d11Query); BOOL Data; -- cgit v1.2.3