summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-02-02 23:07:25 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-02-02 23:07:25 +0000
commit4c73f2d3fd5305b82d3413ebeab74cc566b57f33 (patch)
treea74cd97e9015a753b706e7305e3336430b634aa6 /Graphics/GraphicsEngineD3D12
parentCleaned-up NativeWindow PR (diff)
downloadDiligentCore-4c73f2d3fd5305b82d3413ebeab74cc566b57f33.tar.gz
DiligentCore-4c73f2d3fd5305b82d3413ebeab74cc566b57f33.zip
Updated swap chain creation functions to use NativeWindow struct
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h12
-rw-r--r--Graphics/GraphicsEngineD3D12/readme.md4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp6
-rw-r--r--Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp4
5 files changed, 15 insertions, 13 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp
index 42889126..2f32c6d7 100644
--- a/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp
@@ -48,7 +48,7 @@ public:
const FullScreenModeDesc& FSDesc,
class RenderDeviceD3D12Impl* pRenderDeviceD3D12,
class DeviceContextD3D12Impl* pDeviceContextD3D12,
- void* pNativeWndHandle);
+ const NativeWindow& Window);
~SwapChainD3D12Impl();
virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
diff --git a/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h b/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h
index 205c8ffe..d5fb356e 100644
--- a/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h
+++ b/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h
@@ -114,11 +114,11 @@ DILIGENT_BEGIN_INTERFACE(IEngineFactoryD3D12, IEngineFactory)
/// \param [in] pImmediateContext - Pointer to the immediate device context.
/// \param [in] SCDesc - Swap chain description.
/// \param [in] FSDesc - Fullscreen mode description.
- /// \param [in] pNativeWndHandle - Platform-specific native handle of the window
- /// the swap chain will be associated with:
- /// * On Win32 platform, this should be the window handle (HWND)
- /// * On Universal Windows Platform, this should be the reference
- /// to the core window (Windows::UI::Core::CoreWindow)
+ /// \param [in] Window - Platform-specific native window description that
+ /// the swap chain will be associated with:
+ /// * On Win32 platform, this is the window handle (HWND)
+ /// * On Universal Windows Platform, this is the reference
+ /// to the core window (Windows::UI::Core::CoreWindow)
///
/// \param [out] ppSwapChain - Address of the memory location where pointer to the new
/// swap chain will be written
@@ -127,7 +127,7 @@ DILIGENT_BEGIN_INTERFACE(IEngineFactoryD3D12, IEngineFactory)
IDeviceContext* pImmediateContext,
const SwapChainDesc REF SwapChainDesc,
const FullScreenModeDesc REF FSDesc,
- void* pNativeWndHandle,
+ const NativeWindow REF Window,
ISwapChain** ppSwapChain) PURE;
diff --git a/Graphics/GraphicsEngineD3D12/readme.md b/Graphics/GraphicsEngineD3D12/readme.md
index 84d747c7..4dd26b91 100644
--- a/Graphics/GraphicsEngineD3D12/readme.md
+++ b/Graphics/GraphicsEngineD3D12/readme.md
@@ -28,7 +28,9 @@ RefCntAutoPtr<IDeviceContext> pImmediateContext;
SwapChainDesc SwapChainDesc;
RefCntAutoPtr<ISwapChain> pSwapChain;
pFactoryD3D12->CreateDeviceAndContextsD3D12(EngineCI, &pRenderDevice, &pImmediateContext);
-pFactoryD3D12->CreateSwapChainD3D12(pRenderDevice, pImmediateContext, SwapChainDesc, hWnd, &pSwapChain);
+NativeWindow Window;
+Window.hWnd = hWnd;
+pFactoryD3D12->CreateSwapChainD3D12(pRenderDevice, pImmediateContext, SwapChainDesc, Window, &pSwapChain);
```
Alternatively, the engine can be initialized by attaching to existing Direct3D12 device (see below).
diff --git a/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
index b313461d..1b61a393 100644
--- a/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
@@ -85,7 +85,7 @@ public:
IDeviceContext* pImmediateContext,
const SwapChainDesc& SwapChainDesc,
const FullScreenModeDesc& FSDesc,
- void* pNativeWndHandle,
+ const NativeWindow& Window,
ISwapChain** ppSwapChain) override final;
virtual void DILIGENT_CALL_TYPE EnumerateAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel,
@@ -447,7 +447,7 @@ void EngineFactoryD3D12Impl::CreateSwapChainD3D12(IRenderDevice* pDev
IDeviceContext* pImmediateContext,
const SwapChainDesc& SCDesc,
const FullScreenModeDesc& FSDesc,
- void* pNativeWndHandle,
+ const NativeWindow& Window,
ISwapChain** ppSwapChain)
{
VERIFY(ppSwapChain, "Null pointer provided");
@@ -462,7 +462,7 @@ void EngineFactoryD3D12Impl::CreateSwapChainD3D12(IRenderDevice* pDev
auto* pDeviceContextD3D12 = ValidatedCast<DeviceContextD3D12Impl>(pImmediateContext);
auto& RawMemAllocator = GetRawAllocator();
- auto* pSwapChainD3D12 = NEW_RC_OBJ(RawMemAllocator, "SwapChainD3D12Impl instance", SwapChainD3D12Impl)(SCDesc, FSDesc, pDeviceD3D12, pDeviceContextD3D12, pNativeWndHandle);
+ auto* pSwapChainD3D12 = NEW_RC_OBJ(RawMemAllocator, "SwapChainD3D12Impl instance", SwapChainD3D12Impl)(SCDesc, FSDesc, pDeviceD3D12, pDeviceContextD3D12, Window);
pSwapChainD3D12->QueryInterface(IID_SwapChain, reinterpret_cast<IObject**>(ppSwapChain));
}
catch (const std::runtime_error&)
diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
index ef133c48..1703f4e9 100644
--- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
@@ -41,7 +41,7 @@ SwapChainD3D12Impl::SwapChainD3D12Impl(IReferenceCounters* pRefCounters,
const FullScreenModeDesc& FSDesc,
RenderDeviceD3D12Impl* pRenderDeviceD3D12,
DeviceContextD3D12Impl* pDeviceContextD3D12,
- void* pNativeWndHandle) :
+ const NativeWindow& Window) :
// clang-format off
TSwapChainBase
{
@@ -50,7 +50,7 @@ SwapChainD3D12Impl::SwapChainD3D12Impl(IReferenceCounters* pRefCounters,
pDeviceContextD3D12,
SCDesc,
FSDesc,
- pNativeWndHandle
+ Window
},
m_pBackBufferRTV(STD_ALLOCATOR_RAW_MEM(RefCntAutoPtr<ITextureView>, GetRawAllocator(), "Allocator for vector<RefCntAutoPtr<ITextureView>>"))
// clang-format on