From 4c73f2d3fd5305b82d3413ebeab74cc566b57f33 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 2 Feb 2020 15:07:25 -0800 Subject: Updated swap chain creation functions to use NativeWindow struct --- Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.hpp | 2 +- Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h | 12 ++++++------ Graphics/GraphicsEngineD3D11/readme.md | 4 +++- Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp | 6 +++--- Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.hpp index 945a57f2..fbc3fd01 100644 --- a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.hpp @@ -47,7 +47,7 @@ public: const FullScreenModeDesc& FSDesc, class RenderDeviceD3D11Impl* pRenderDeviceD3D11, class DeviceContextD3D11Impl* pDeviceContextD3D11, - void* pNativeWndHandle); + const NativeWindow& Window); ~SwapChainD3D11Impl(); virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; diff --git a/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h b/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h index 406e7a7b..34ddc552 100644 --- a/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h @@ -78,11 +78,11 @@ DILIGENT_BEGIN_INTERFACE(IEngineFactoryD3D11, 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. @@ -91,7 +91,7 @@ DILIGENT_BEGIN_INTERFACE(IEngineFactoryD3D11, IEngineFactory) IDeviceContext* pImmediateContext, const SwapChainDesc REF SCDesc, const FullScreenModeDesc REF FSDesc, - void* pNativeWndHandle, + const NativeWindow REF Window, ISwapChain** ppSwapChain) PURE; diff --git a/Graphics/GraphicsEngineD3D11/readme.md b/Graphics/GraphicsEngineD3D11/readme.md index 7d3a7dc2..87dc075d 100644 --- a/Graphics/GraphicsEngineD3D11/readme.md +++ b/Graphics/GraphicsEngineD3D11/readme.md @@ -29,7 +29,9 @@ RefCntAutoPtr pImmediateContext; SwapChainDesc SwapChainDesc; RefCntAutoPtr pSwapChain; pFactoryD3D11->CreateDeviceAndContextsD3D11(EngineCI, &pRenderDevice, &pImmediateContext); -pFactoryD3D11->CreateSwapChainD3D11(pRenderDevice, pImmediateContext, SwapChainDesc, hWnd, &pSwapChain); +NativeWindow Window; +Window.hWnd = hWnd; +pFactoryD3D11->CreateSwapChainD3D11(pRenderDevice, pImmediateContext, SwapChainDesc, Window, &pSwapChain); ``` Alternatively, the engine can be initialized by attaching to existing D3D11 device and immediate context (see below). diff --git a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp index 4cddbf6f..6dd980a6 100644 --- a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp @@ -66,7 +66,7 @@ public: IDeviceContext* pImmediateContext, const SwapChainDesc& SCDesc, const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle, + const NativeWindow& Window, ISwapChain** ppSwapChain) override final; virtual void DILIGENT_CALL_TYPE AttachToD3D11Device(void* pd3d11NativeDevice, @@ -284,7 +284,7 @@ void EngineFactoryD3D11Impl::CreateSwapChainD3D11(IRenderDevice* pDev IDeviceContext* pImmediateContext, const SwapChainDesc& SCDesc, const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle, + const NativeWindow& Window, ISwapChain** ppSwapChain) { VERIFY(ppSwapChain, "Null pointer provided"); @@ -299,7 +299,7 @@ void EngineFactoryD3D11Impl::CreateSwapChainD3D11(IRenderDevice* pDev auto* pDeviceContextD3D11 = ValidatedCast(pImmediateContext); auto& RawMemAllocator = GetRawAllocator(); - auto* pSwapChainD3D11 = NEW_RC_OBJ(RawMemAllocator, "SwapChainD3D11Impl instance", SwapChainD3D11Impl)(SCDesc, FSDesc, pDeviceD3D11, pDeviceContextD3D11, pNativeWndHandle); + auto* pSwapChainD3D11 = NEW_RC_OBJ(RawMemAllocator, "SwapChainD3D11Impl instance", SwapChainD3D11Impl)(SCDesc, FSDesc, pDeviceD3D11, pDeviceContextD3D11, Window); pSwapChainD3D11->QueryInterface(IID_SwapChain, reinterpret_cast(ppSwapChain)); } catch (const std::runtime_error&) diff --git a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp index 2dceffc7..0d833427 100644 --- a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp @@ -39,7 +39,7 @@ SwapChainD3D11Impl::SwapChainD3D11Impl(IReferenceCounters* pRefCounters, const FullScreenModeDesc& FSDesc, RenderDeviceD3D11Impl* pRenderDeviceD3D11, DeviceContextD3D11Impl* pDeviceContextD3D11, - void* pNativeWndHandle) : + const NativeWindow& Window) : // clang-format off TSwapChainBase { @@ -48,7 +48,7 @@ SwapChainD3D11Impl::SwapChainD3D11Impl(IReferenceCounters* pRefCounters, pDeviceContextD3D11, SCDesc, FSDesc, - pNativeWndHandle + Window } // clang-format on { -- cgit v1.2.3