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/GraphicsEngine/interface/APIInfo.h | 2 +- .../include/SwapChainD3D11Impl.hpp | 2 +- .../interface/EngineFactoryD3D11.h | 12 +++++----- Graphics/GraphicsEngineD3D11/readme.md | 4 +++- .../GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp | 6 ++--- .../GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp | 4 ++-- .../include/SwapChainD3D12Impl.hpp | 2 +- .../interface/EngineFactoryD3D12.h | 12 +++++----- Graphics/GraphicsEngineD3D12/readme.md | 4 +++- .../GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp | 6 ++--- .../GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp | 4 ++-- .../include/SwapChainD3DBase.hpp | 10 ++++---- .../include/SwapChainVkImpl.hpp | 2 +- .../interface/EngineFactoryVk.h | 26 ++++++++++++++++----- .../GraphicsEngineVulkan/src/EngineFactoryVk.cpp | 27 +++------------------- .../GraphicsEngineVulkan/src/SwapChainVkImpl.cpp | 26 ++++++++------------- 16 files changed, 70 insertions(+), 79 deletions(-) (limited to 'Graphics') diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h index 3c19c2b8..85867de2 100644 --- a/Graphics/GraphicsEngine/interface/APIInfo.h +++ b/Graphics/GraphicsEngine/interface/APIInfo.h @@ -30,7 +30,7 @@ /// \file /// Diligent API information -#define DILIGENT_API_VERSION 240053 +#define DILIGENT_API_VERSION 240054 #include "../../../Primitives/interface/BasicTypes.h" 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 { 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 pImmediateContext; SwapChainDesc SwapChainDesc; RefCntAutoPtr 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(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(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, GetRawAllocator(), "Allocator for vector>")) // clang-format on diff --git a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp index b1088b4f..9479d72e 100644 --- a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp +++ b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp @@ -47,11 +47,11 @@ public: IDeviceContext* pDeviceContext, const SwapChainDesc& SCDesc, const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle) : + const NativeWindow& Window) : // clang-format off TBase{pRefCounters, pDevice, pDeviceContext, SCDesc}, m_FSDesc {FSDesc}, - m_pNativeWndHandle {pNativeWndHandle} + m_Window {Window} // clang-format on {} @@ -74,7 +74,7 @@ protected: void CreateDXGISwapChain(IUnknown* pD3D11DeviceOrD3D12CmdQueue) { #if PLATFORM_WIN32 - auto hWnd = reinterpret_cast(m_pNativeWndHandle); + auto hWnd = reinterpret_cast(m_Window.hWnd); if (m_SwapChainDesc.Width == 0 || m_SwapChainDesc.Height == 0) { RECT rc; @@ -194,7 +194,7 @@ protected: hr = factory->CreateSwapChainForCoreWindow( pD3D11DeviceOrD3D12CmdQueue, - reinterpret_cast(m_pNativeWndHandle), + reinterpret_cast(m_Window.pWindow), &swapChainDesc, nullptr, &pSwapChain1); @@ -242,7 +242,7 @@ protected: FullScreenModeDesc m_FSDesc; CComPtr m_pSwapChain; - void* m_pNativeWndHandle; + NativeWindow m_Window; }; } // namespace Diligent diff --git a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.hpp index 996817ca..e58c5f71 100644 --- a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.hpp @@ -49,7 +49,7 @@ public: const SwapChainDesc& SwapChainDesc, class RenderDeviceVkImpl* pRenderDeviceVk, class DeviceContextVkImpl* pDeviceContextVk, - void* pNativeWndHandle); + const NativeWindow& Window); ~SwapChainVkImpl(); virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; diff --git a/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h b/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h index eb9c1f58..be79c99f 100644 --- a/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h @@ -66,22 +66,36 @@ static const INTERFACE_ID IID_EngineFactoryVk = DILIGENT_BEGIN_INTERFACE(IEngineFactoryVk, IEngineFactory) { + /// Creates a render device and device contexts for Vulkan backend + + /// \param [in] EngineCI - Engine creation attributes. + /// \param [out] ppDevice - Address of the memory location where pointer to + /// the created device will be written + /// \param [out] ppContexts - Address of the memory location where pointers to + /// the contexts will be written. Immediate context goes at + /// position 0. If EngineCI.NumDeferredContexts > 0, + /// pointers to the deferred contexts are written afterwards. VIRTUAL void METHOD(CreateDeviceAndContextsVk)(THIS_ const EngineVkCreateInfo REF EngineCI, IRenderDevice** ppDevice, IDeviceContext** ppContexts) PURE; - //virtual void AttachToVulkanDevice(void *pVkNativeDevice, - // class ICommandQueueVk *pCommandQueue, - // const EngineVkCreateInfo& EngineCI, - // IRenderDevice **ppDevice, - // IDeviceContext **ppContexts) = 0; + /// Creates a swap chain for Vulkan-based engine implementation + + /// \param [in] pDevice - Pointer to the render device + /// \param [in] pImmediateContext - Pointer to the immediate device context + /// \param [in] SCDesc - Swap chain description + /// \param [in] Window - Platform-specific native window description that + /// the swap chain will be associated with. + /// + /// \param [out] ppSwapChain - Address of the memory location where pointer to the new + /// swap chain will be written VIRTUAL void METHOD(CreateSwapChainVk)(THIS_ IRenderDevice* pDevice, IDeviceContext* pImmediateContext, const SwapChainDesc REF SwapChainDesc, - void* pNativeWndHandle, + const NativeWindow REF Window, ISwapChain** ppSwapChain) PURE; }; DILIGENT_END_INTERFACE diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp index 77a6f49b..f695b372 100644 --- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp @@ -74,22 +74,14 @@ public: virtual void DILIGENT_CALL_TYPE CreateSwapChainVk(IRenderDevice* pDevice, IDeviceContext* pImmediateContext, const SwapChainDesc& SwapChainDesc, - void* pNativeWndHandle, + const NativeWindow& Window, ISwapChain** ppSwapChain) override final; private: std::function OnRenderDeviceCreated = nullptr; }; -/// Creates render device and device contexts for Vulkan backend -/// \param [in] EngineCI - Engine creation attributes. -/// \param [out] ppDevice - Address of the memory location where pointer to -/// the created device will be written -/// \param [out] ppContexts - Address of the memory location where pointers to -/// the contexts will be written. Immediate context goes at -/// position 0. If EngineCI.NumDeferredContexts > 0, -/// pointers to the deferred contexts are written afterwards. void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _EngineCI, IRenderDevice** ppDevice, IDeviceContext** ppContexts) @@ -317,23 +309,10 @@ void EngineFactoryVkImpl::AttachToVulkanDevice(std::shared_ptr(pImmediateContext); auto& RawMemAllocator = GetRawAllocator(); - auto* pSwapChainVk = NEW_RC_OBJ(RawMemAllocator, "SwapChainVkImpl instance", SwapChainVkImpl)(SCDesc, pDeviceVk, pDeviceContextVk, pNativeWndHandle); + auto* pSwapChainVk = NEW_RC_OBJ(RawMemAllocator, "SwapChainVkImpl instance", SwapChainVkImpl)(SCDesc, pDeviceVk, pDeviceContextVk, Window); pSwapChainVk->QueryInterface(IID_SwapChain, reinterpret_cast(ppSwapChain)); } catch (const std::runtime_error&) diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index 2a906a2b..d4282068 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -40,7 +40,7 @@ SwapChainVkImpl::SwapChainVkImpl(IReferenceCounters* pRefCounters, const SwapChainDesc& SCDesc, RenderDeviceVkImpl* pRenderDeviceVk, DeviceContextVkImpl* pDeviceContextVk, - void* pNativeWndHandle) : + const NativeWindow& Window) : // clang-format off TSwapChainBase {pRefCounters, pRenderDeviceVk, pDeviceContextVk, SCDesc}, m_VulkanInstance {pRenderDeviceVk->GetVulkanInstance()}, @@ -55,50 +55,44 @@ SwapChainVkImpl::SwapChainVkImpl(IReferenceCounters* pRefCounters, surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; surfaceCreateInfo.hinstance = GetModuleHandle(NULL); - surfaceCreateInfo.hwnd = (HWND)pNativeWndHandle; + surfaceCreateInfo.hwnd = (HWND)Window.hWnd; auto err = vkCreateWin32SurfaceKHR(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); #elif defined(VK_USE_PLATFORM_ANDROID_KHR) VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo = {}; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; - surfaceCreateInfo.window = (ANativeWindow*)pNativeWndHandle; + surfaceCreateInfo.window = (ANativeWindow*)Window.pAWindow; auto err = vkCreateAndroidSurfaceKHR(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, NULL, &m_VkSurface); #elif defined(VK_USE_PLATFORM_IOS_MVK) VkIOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; - surfaceCreateInfo.pView = pNativeWndHandle; + surfaceCreateInfo.pView = Window.pNSWindow; auto err = vkCreateIOSSurfaceMVK(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); #elif defined(VK_USE_PLATFORM_MACOS_MVK) VkMacOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; - surfaceCreateInfo.pView = pNativeWndHandle; + surfaceCreateInfo.pView = Window.pNSView; auto err = vkCreateMacOSSurfaceMVK(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, NULL, &m_VkSurface); #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) VkWaylandSurfaceCreateInfoKHR surfaceCreateInfo = {}; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; - surfaceCreateInfo.display = display; - surfaceCreatem_VkSurface = window; + surfaceCreateInfo.display = Window.pDisplay; + surfaceCreatem_VkSurface = Window.pWindow; err = vkCreateWaylandSurfaceKHR(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); #elif defined(VK_USE_PLATFORM_XCB_KHR) VkXcbSurfaceCreateInfoKHR surfaceCreateInfo = {}; - surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; - struct XCBInfo - { - xcb_connection_t* connection = nullptr; - uint32_t window = 0; - }; - XCBInfo& info = *reinterpret_cast(pNativeWndHandle); - surfaceCreateInfo.connection = info.connection; - surfaceCreateInfo.window = info.window; + surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; + surfaceCreateInfo.connection = Window.pXCBConnection; + surfaceCreateInfo.window = Window.pWindow; auto err = vkCreateXcbSurfaceKHR(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); #endif -- cgit v1.2.3