Updated swap chain creation functions to use NativeWindow struct
assiduous
3 years ago
29 | 29 | /// \file |
30 | 30 | /// Diligent API information |
31 | 31 | |
32 | #define DILIGENT_API_VERSION 240053 | |
32 | #define DILIGENT_API_VERSION 240054 | |
33 | 33 | |
34 | 34 | #include "../../../Primitives/interface/BasicTypes.h" |
35 | 35 |
46 | 46 | const FullScreenModeDesc& FSDesc, |
47 | 47 | class RenderDeviceD3D11Impl* pRenderDeviceD3D11, |
48 | 48 | class DeviceContextD3D11Impl* pDeviceContextD3D11, |
49 | void* pNativeWndHandle); | |
49 | const NativeWindow& Window); | |
50 | 50 | ~SwapChainD3D11Impl(); |
51 | 51 | |
52 | 52 | virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; |
77 | 77 | /// \param [in] pImmediateContext - Pointer to the immediate device context. |
78 | 78 | /// \param [in] SCDesc - Swap chain description. |
79 | 79 | /// \param [in] FSDesc - Fullscreen mode description. |
80 | /// \param [in] pNativeWndHandle - Platform-specific native handle of the window | |
81 | /// the swap chain will be associated with: | |
82 | /// * On Win32 platform, this should be the window handle (HWND) | |
83 | /// * On Universal Windows Platform, this should be the reference | |
84 | /// to the core window (Windows::UI::Core::CoreWindow) | |
80 | /// \param [in] Window - Platform-specific native window description that | |
81 | /// the swap chain will be associated with: | |
82 | /// * On Win32 platform, this is the window handle (HWND) | |
83 | /// * On Universal Windows Platform, this is the reference | |
84 | /// to the core window (Windows::UI::Core::CoreWindow) | |
85 | 85 | /// |
86 | 86 | /// \param [out] ppSwapChain - Address of the memory location where pointer to the new |
87 | 87 | /// swap chain will be written. |
90 | 90 | IDeviceContext* pImmediateContext, |
91 | 91 | const SwapChainDesc REF SCDesc, |
92 | 92 | const FullScreenModeDesc REF FSDesc, |
93 | void* pNativeWndHandle, | |
93 | const NativeWindow REF Window, | |
94 | 94 | ISwapChain** ppSwapChain) PURE; |
95 | 95 | |
96 | 96 |
28 | 28 | SwapChainDesc SwapChainDesc; |
29 | 29 | RefCntAutoPtr<ISwapChain> pSwapChain; |
30 | 30 | pFactoryD3D11->CreateDeviceAndContextsD3D11(EngineCI, &pRenderDevice, &pImmediateContext); |
31 | pFactoryD3D11->CreateSwapChainD3D11(pRenderDevice, pImmediateContext, SwapChainDesc, hWnd, &pSwapChain); | |
31 | NativeWindow Window; | |
32 | Window.hWnd = hWnd; | |
33 | pFactoryD3D11->CreateSwapChainD3D11(pRenderDevice, pImmediateContext, SwapChainDesc, Window, &pSwapChain); | |
32 | 34 | ``` |
33 | 35 | |
34 | 36 | Alternatively, the engine can be initialized by attaching to existing D3D11 device and immediate context (see below). |
65 | 65 | IDeviceContext* pImmediateContext, |
66 | 66 | const SwapChainDesc& SCDesc, |
67 | 67 | const FullScreenModeDesc& FSDesc, |
68 | void* pNativeWndHandle, | |
68 | const NativeWindow& Window, | |
69 | 69 | ISwapChain** ppSwapChain) override final; |
70 | 70 | |
71 | 71 | virtual void DILIGENT_CALL_TYPE AttachToD3D11Device(void* pd3d11NativeDevice, |
283 | 283 | IDeviceContext* pImmediateContext, |
284 | 284 | const SwapChainDesc& SCDesc, |
285 | 285 | const FullScreenModeDesc& FSDesc, |
286 | void* pNativeWndHandle, | |
286 | const NativeWindow& Window, | |
287 | 287 | ISwapChain** ppSwapChain) |
288 | 288 | { |
289 | 289 | VERIFY(ppSwapChain, "Null pointer provided"); |
298 | 298 | auto* pDeviceContextD3D11 = ValidatedCast<DeviceContextD3D11Impl>(pImmediateContext); |
299 | 299 | auto& RawMemAllocator = GetRawAllocator(); |
300 | 300 | |
301 | auto* pSwapChainD3D11 = NEW_RC_OBJ(RawMemAllocator, "SwapChainD3D11Impl instance", SwapChainD3D11Impl)(SCDesc, FSDesc, pDeviceD3D11, pDeviceContextD3D11, pNativeWndHandle); | |
301 | auto* pSwapChainD3D11 = NEW_RC_OBJ(RawMemAllocator, "SwapChainD3D11Impl instance", SwapChainD3D11Impl)(SCDesc, FSDesc, pDeviceD3D11, pDeviceContextD3D11, Window); | |
302 | 302 | pSwapChainD3D11->QueryInterface(IID_SwapChain, reinterpret_cast<IObject**>(ppSwapChain)); |
303 | 303 | } |
304 | 304 | catch (const std::runtime_error&) |
38 | 38 | const FullScreenModeDesc& FSDesc, |
39 | 39 | RenderDeviceD3D11Impl* pRenderDeviceD3D11, |
40 | 40 | DeviceContextD3D11Impl* pDeviceContextD3D11, |
41 | void* pNativeWndHandle) : | |
41 | const NativeWindow& Window) : | |
42 | 42 | // clang-format off |
43 | 43 | TSwapChainBase |
44 | 44 | { |
47 | 47 | pDeviceContextD3D11, |
48 | 48 | SCDesc, |
49 | 49 | FSDesc, |
50 | pNativeWndHandle | |
50 | Window | |
51 | 51 | } |
52 | 52 | // clang-format on |
53 | 53 | { |
47 | 47 | const FullScreenModeDesc& FSDesc, |
48 | 48 | class RenderDeviceD3D12Impl* pRenderDeviceD3D12, |
49 | 49 | class DeviceContextD3D12Impl* pDeviceContextD3D12, |
50 | void* pNativeWndHandle); | |
50 | const NativeWindow& Window); | |
51 | 51 | ~SwapChainD3D12Impl(); |
52 | 52 | |
53 | 53 | virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; |
113 | 113 | /// \param [in] pImmediateContext - Pointer to the immediate device context. |
114 | 114 | /// \param [in] SCDesc - Swap chain description. |
115 | 115 | /// \param [in] FSDesc - Fullscreen mode description. |
116 | /// \param [in] pNativeWndHandle - Platform-specific native handle of the window | |
117 | /// the swap chain will be associated with: | |
118 | /// * On Win32 platform, this should be the window handle (HWND) | |
119 | /// * On Universal Windows Platform, this should be the reference | |
120 | /// to the core window (Windows::UI::Core::CoreWindow) | |
116 | /// \param [in] Window - Platform-specific native window description that | |
117 | /// the swap chain will be associated with: | |
118 | /// * On Win32 platform, this is the window handle (HWND) | |
119 | /// * On Universal Windows Platform, this is the reference | |
120 | /// to the core window (Windows::UI::Core::CoreWindow) | |
121 | 121 | /// |
122 | 122 | /// \param [out] ppSwapChain - Address of the memory location where pointer to the new |
123 | 123 | /// swap chain will be written |
126 | 126 | IDeviceContext* pImmediateContext, |
127 | 127 | const SwapChainDesc REF SwapChainDesc, |
128 | 128 | const FullScreenModeDesc REF FSDesc, |
129 | void* pNativeWndHandle, | |
129 | const NativeWindow REF Window, | |
130 | 130 | ISwapChain** ppSwapChain) PURE; |
131 | 131 | |
132 | 132 |
27 | 27 | SwapChainDesc SwapChainDesc; |
28 | 28 | RefCntAutoPtr<ISwapChain> pSwapChain; |
29 | 29 | pFactoryD3D12->CreateDeviceAndContextsD3D12(EngineCI, &pRenderDevice, &pImmediateContext); |
30 | pFactoryD3D12->CreateSwapChainD3D12(pRenderDevice, pImmediateContext, SwapChainDesc, hWnd, &pSwapChain); | |
30 | NativeWindow Window; | |
31 | Window.hWnd = hWnd; | |
32 | pFactoryD3D12->CreateSwapChainD3D12(pRenderDevice, pImmediateContext, SwapChainDesc, Window, &pSwapChain); | |
31 | 33 | ``` |
32 | 34 | |
33 | 35 | Alternatively, the engine can be initialized by attaching to existing Direct3D12 device (see below). |
84 | 84 | IDeviceContext* pImmediateContext, |
85 | 85 | const SwapChainDesc& SwapChainDesc, |
86 | 86 | const FullScreenModeDesc& FSDesc, |
87 | void* pNativeWndHandle, | |
87 | const NativeWindow& Window, | |
88 | 88 | ISwapChain** ppSwapChain) override final; |
89 | 89 | |
90 | 90 | virtual void DILIGENT_CALL_TYPE EnumerateAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, |
446 | 446 | IDeviceContext* pImmediateContext, |
447 | 447 | const SwapChainDesc& SCDesc, |
448 | 448 | const FullScreenModeDesc& FSDesc, |
449 | void* pNativeWndHandle, | |
449 | const NativeWindow& Window, | |
450 | 450 | ISwapChain** ppSwapChain) |
451 | 451 | { |
452 | 452 | VERIFY(ppSwapChain, "Null pointer provided"); |
461 | 461 | auto* pDeviceContextD3D12 = ValidatedCast<DeviceContextD3D12Impl>(pImmediateContext); |
462 | 462 | auto& RawMemAllocator = GetRawAllocator(); |
463 | 463 | |
464 | auto* pSwapChainD3D12 = NEW_RC_OBJ(RawMemAllocator, "SwapChainD3D12Impl instance", SwapChainD3D12Impl)(SCDesc, FSDesc, pDeviceD3D12, pDeviceContextD3D12, pNativeWndHandle); | |
464 | auto* pSwapChainD3D12 = NEW_RC_OBJ(RawMemAllocator, "SwapChainD3D12Impl instance", SwapChainD3D12Impl)(SCDesc, FSDesc, pDeviceD3D12, pDeviceContextD3D12, Window); | |
465 | 465 | pSwapChainD3D12->QueryInterface(IID_SwapChain, reinterpret_cast<IObject**>(ppSwapChain)); |
466 | 466 | } |
467 | 467 | catch (const std::runtime_error&) |
40 | 40 | const FullScreenModeDesc& FSDesc, |
41 | 41 | RenderDeviceD3D12Impl* pRenderDeviceD3D12, |
42 | 42 | DeviceContextD3D12Impl* pDeviceContextD3D12, |
43 | void* pNativeWndHandle) : | |
43 | const NativeWindow& Window) : | |
44 | 44 | // clang-format off |
45 | 45 | TSwapChainBase |
46 | 46 | { |
49 | 49 | pDeviceContextD3D12, |
50 | 50 | SCDesc, |
51 | 51 | FSDesc, |
52 | pNativeWndHandle | |
52 | Window | |
53 | 53 | }, |
54 | 54 | m_pBackBufferRTV(STD_ALLOCATOR_RAW_MEM(RefCntAutoPtr<ITextureView>, GetRawAllocator(), "Allocator for vector<RefCntAutoPtr<ITextureView>>")) |
55 | 55 | // clang-format on |
46 | 46 | IDeviceContext* pDeviceContext, |
47 | 47 | const SwapChainDesc& SCDesc, |
48 | 48 | const FullScreenModeDesc& FSDesc, |
49 | void* pNativeWndHandle) : | |
49 | const NativeWindow& Window) : | |
50 | 50 | // clang-format off |
51 | 51 | TBase{pRefCounters, pDevice, pDeviceContext, SCDesc}, |
52 | 52 | m_FSDesc {FSDesc}, |
53 | m_pNativeWndHandle {pNativeWndHandle} | |
53 | m_Window {Window} | |
54 | 54 | // clang-format on |
55 | 55 | {} |
56 | 56 | |
73 | 73 | void CreateDXGISwapChain(IUnknown* pD3D11DeviceOrD3D12CmdQueue) |
74 | 74 | { |
75 | 75 | #if PLATFORM_WIN32 |
76 | auto hWnd = reinterpret_cast<HWND>(m_pNativeWndHandle); | |
76 | auto hWnd = reinterpret_cast<HWND>(m_Window.hWnd); | |
77 | 77 | if (m_SwapChainDesc.Width == 0 || m_SwapChainDesc.Height == 0) |
78 | 78 | { |
79 | 79 | RECT rc; |
193 | 193 | |
194 | 194 | hr = factory->CreateSwapChainForCoreWindow( |
195 | 195 | pD3D11DeviceOrD3D12CmdQueue, |
196 | reinterpret_cast<IUnknown*>(m_pNativeWndHandle), | |
196 | reinterpret_cast<IUnknown*>(m_Window.pWindow), | |
197 | 197 | &swapChainDesc, |
198 | 198 | nullptr, |
199 | 199 | &pSwapChain1); |
241 | 241 | |
242 | 242 | FullScreenModeDesc m_FSDesc; |
243 | 243 | CComPtr<DXGISwapChainType> m_pSwapChain; |
244 | void* m_pNativeWndHandle; | |
244 | NativeWindow m_Window; | |
245 | 245 | }; |
246 | 246 | |
247 | 247 | } // namespace Diligent |
48 | 48 | const SwapChainDesc& SwapChainDesc, |
49 | 49 | class RenderDeviceVkImpl* pRenderDeviceVk, |
50 | 50 | class DeviceContextVkImpl* pDeviceContextVk, |
51 | void* pNativeWndHandle); | |
51 | const NativeWindow& Window); | |
52 | 52 | ~SwapChainVkImpl(); |
53 | 53 | |
54 | 54 | virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; |
65 | 65 | |
66 | 66 | DILIGENT_BEGIN_INTERFACE(IEngineFactoryVk, IEngineFactory) |
67 | 67 | { |
68 | /// Creates a render device and device contexts for Vulkan backend | |
69 | ||
70 | /// \param [in] EngineCI - Engine creation attributes. | |
71 | /// \param [out] ppDevice - Address of the memory location where pointer to | |
72 | /// the created device will be written | |
73 | /// \param [out] ppContexts - Address of the memory location where pointers to | |
74 | /// the contexts will be written. Immediate context goes at | |
75 | /// position 0. If EngineCI.NumDeferredContexts > 0, | |
76 | /// pointers to the deferred contexts are written afterwards. | |
68 | 77 | VIRTUAL void METHOD(CreateDeviceAndContextsVk)(THIS_ |
69 | 78 | const EngineVkCreateInfo REF EngineCI, |
70 | 79 | IRenderDevice** ppDevice, |
71 | 80 | IDeviceContext** ppContexts) PURE; |
72 | 81 | |
73 | //virtual void AttachToVulkanDevice(void *pVkNativeDevice, | |
74 | // class ICommandQueueVk *pCommandQueue, | |
75 | // const EngineVkCreateInfo& EngineCI, | |
76 | // IRenderDevice **ppDevice, | |
77 | // IDeviceContext **ppContexts) = 0; | |
78 | 82 | |
83 | /// Creates a swap chain for Vulkan-based engine implementation | |
84 | ||
85 | /// \param [in] pDevice - Pointer to the render device | |
86 | /// \param [in] pImmediateContext - Pointer to the immediate device context | |
87 | /// \param [in] SCDesc - Swap chain description | |
88 | /// \param [in] Window - Platform-specific native window description that | |
89 | /// the swap chain will be associated with. | |
90 | /// | |
91 | /// \param [out] ppSwapChain - Address of the memory location where pointer to the new | |
92 | /// swap chain will be written | |
79 | 93 | VIRTUAL void METHOD(CreateSwapChainVk)(THIS_ |
80 | 94 | IRenderDevice* pDevice, |
81 | 95 | IDeviceContext* pImmediateContext, |
82 | 96 | const SwapChainDesc REF SwapChainDesc, |
83 | void* pNativeWndHandle, | |
97 | const NativeWindow REF Window, | |
84 | 98 | ISwapChain** ppSwapChain) PURE; |
85 | 99 | }; |
86 | 100 | DILIGENT_END_INTERFACE |
73 | 73 | virtual void DILIGENT_CALL_TYPE CreateSwapChainVk(IRenderDevice* pDevice, |
74 | 74 | IDeviceContext* pImmediateContext, |
75 | 75 | const SwapChainDesc& SwapChainDesc, |
76 | void* pNativeWndHandle, | |
76 | const NativeWindow& Window, | |
77 | 77 | ISwapChain** ppSwapChain) override final; |
78 | 78 | |
79 | 79 | private: |
80 | 80 | std::function<void(RenderDeviceVkImpl*)> OnRenderDeviceCreated = nullptr; |
81 | 81 | }; |
82 | 82 | |
83 | /// Creates render device and device contexts for Vulkan backend | |
84 | ||
85 | /// \param [in] EngineCI - Engine creation attributes. | |
86 | /// \param [out] ppDevice - Address of the memory location where pointer to | |
87 | /// the created device will be written | |
88 | /// \param [out] ppContexts - Address of the memory location where pointers to | |
89 | /// the contexts will be written. Immediate context goes at | |
90 | /// position 0. If EngineCI.NumDeferredContexts > 0, | |
91 | /// pointers to the deferred contexts are written afterwards. | |
83 | ||
92 | 84 | void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _EngineCI, |
93 | 85 | IRenderDevice** ppDevice, |
94 | 86 | IDeviceContext** ppContexts) |
316 | 308 | } |
317 | 309 | |
318 | 310 | |
319 | /// Creates a swap chain for Direct3D12-based engine implementation | |
320 | ||
321 | /// \param [in] pDevice - Pointer to the render device | |
322 | /// \param [in] pImmediateContext - Pointer to the immediate device context | |
323 | /// \param [in] SCDesc - Swap chain description | |
324 | /// \param [in] pNativeWndHandle - Platform-specific native handle of the window | |
325 | /// the swap chain will be associated with: | |
326 | /// * On Win32 platform, this should be window handle (HWND) | |
327 | /// * On Universal Windows Platform, this should be reference to the | |
328 | /// core window (Windows::UI::Core::CoreWindow) | |
329 | /// | |
330 | /// \param [out] ppSwapChain - Address of the memory location where pointer to the new | |
331 | /// swap chain will be written | |
332 | 311 | void EngineFactoryVkImpl::CreateSwapChainVk(IRenderDevice* pDevice, |
333 | 312 | IDeviceContext* pImmediateContext, |
334 | 313 | const SwapChainDesc& SCDesc, |
335 | void* pNativeWndHandle, | |
314 | const NativeWindow& Window, | |
336 | 315 | ISwapChain** ppSwapChain) |
337 | 316 | { |
338 | 317 | VERIFY(ppSwapChain, "Null pointer provided"); |
347 | 326 | auto* pDeviceContextVk = ValidatedCast<DeviceContextVkImpl>(pImmediateContext); |
348 | 327 | auto& RawMemAllocator = GetRawAllocator(); |
349 | 328 | |
350 | auto* pSwapChainVk = NEW_RC_OBJ(RawMemAllocator, "SwapChainVkImpl instance", SwapChainVkImpl)(SCDesc, pDeviceVk, pDeviceContextVk, pNativeWndHandle); | |
329 | auto* pSwapChainVk = NEW_RC_OBJ(RawMemAllocator, "SwapChainVkImpl instance", SwapChainVkImpl)(SCDesc, pDeviceVk, pDeviceContextVk, Window); | |
351 | 330 | pSwapChainVk->QueryInterface(IID_SwapChain, reinterpret_cast<IObject**>(ppSwapChain)); |
352 | 331 | } |
353 | 332 | catch (const std::runtime_error&) |
39 | 39 | const SwapChainDesc& SCDesc, |
40 | 40 | RenderDeviceVkImpl* pRenderDeviceVk, |
41 | 41 | DeviceContextVkImpl* pDeviceContextVk, |
42 | void* pNativeWndHandle) : | |
42 | const NativeWindow& Window) : | |
43 | 43 | // clang-format off |
44 | 44 | TSwapChainBase {pRefCounters, pRenderDeviceVk, pDeviceContextVk, SCDesc}, |
45 | 45 | m_VulkanInstance {pRenderDeviceVk->GetVulkanInstance()}, |
54 | 54 | |
55 | 55 | surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; |
56 | 56 | surfaceCreateInfo.hinstance = GetModuleHandle(NULL); |
57 | surfaceCreateInfo.hwnd = (HWND)pNativeWndHandle; | |
57 | surfaceCreateInfo.hwnd = (HWND)Window.hWnd; | |
58 | 58 | |
59 | 59 | auto err = vkCreateWin32SurfaceKHR(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); |
60 | 60 | #elif defined(VK_USE_PLATFORM_ANDROID_KHR) |
61 | 61 | VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo = {}; |
62 | 62 | |
63 | 63 | surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; |
64 | surfaceCreateInfo.window = (ANativeWindow*)pNativeWndHandle; | |
64 | surfaceCreateInfo.window = (ANativeWindow*)Window.pAWindow; | |
65 | 65 | |
66 | 66 | auto err = vkCreateAndroidSurfaceKHR(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, NULL, &m_VkSurface); |
67 | 67 | #elif defined(VK_USE_PLATFORM_IOS_MVK) |
68 | 68 | VkIOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; |
69 | 69 | |
70 | 70 | surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; |
71 | surfaceCreateInfo.pView = pNativeWndHandle; | |
71 | surfaceCreateInfo.pView = Window.pNSWindow; | |
72 | 72 | |
73 | 73 | auto err = vkCreateIOSSurfaceMVK(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); |
74 | 74 | #elif defined(VK_USE_PLATFORM_MACOS_MVK) |
75 | 75 | VkMacOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; |
76 | 76 | |
77 | 77 | surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; |
78 | surfaceCreateInfo.pView = pNativeWndHandle; | |
78 | surfaceCreateInfo.pView = Window.pNSView; | |
79 | 79 | |
80 | 80 | auto err = vkCreateMacOSSurfaceMVK(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, NULL, &m_VkSurface); |
81 | 81 | #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) |
82 | 82 | VkWaylandSurfaceCreateInfoKHR surfaceCreateInfo = {}; |
83 | 83 | |
84 | 84 | surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; |
85 | surfaceCreateInfo.display = display; | |
86 | surfaceCreatem_VkSurface = window; | |
85 | surfaceCreateInfo.display = Window.pDisplay; | |
86 | surfaceCreatem_VkSurface = Window.pWindow; | |
87 | 87 | |
88 | 88 | err = vkCreateWaylandSurfaceKHR(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); |
89 | 89 | #elif defined(VK_USE_PLATFORM_XCB_KHR) |
90 | 90 | VkXcbSurfaceCreateInfoKHR surfaceCreateInfo = {}; |
91 | 91 | |
92 | surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; | |
93 | struct XCBInfo | |
94 | { | |
95 | xcb_connection_t* connection = nullptr; | |
96 | uint32_t window = 0; | |
97 | }; | |
98 | XCBInfo& info = *reinterpret_cast<XCBInfo*>(pNativeWndHandle); | |
99 | surfaceCreateInfo.connection = info.connection; | |
100 | surfaceCreateInfo.window = info.window; | |
92 | surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; | |
93 | surfaceCreateInfo.connection = Window.pXCBConnection; | |
94 | surfaceCreateInfo.window = Window.pWindow; | |
101 | 95 | |
102 | 96 | auto err = vkCreateXcbSurfaceKHR(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); |
103 | 97 | #endif |
32 | 32 | |
33 | 33 | struct LinuxNativeWindow |
34 | 34 | { |
35 | void* pDisplay DEFAULT_INITIALIZER(nullptr); | |
36 | void* pWindow DEFAULT_INITIALIZER(nullptr); | |
35 | void* pDisplay DEFAULT_INITIALIZER(nullptr); | |
36 | void* pWindow DEFAULT_INITIALIZER(nullptr); | |
37 | void* pXCBConnection DEFAULT_INITIALIZER(nullptr); | |
37 | 38 | }; |
38 | 39 | |
39 | 40 | DILIGENT_END_NAMESPACE // namespace Diligent |