From 2bbc67e92298e3dff1f3bfb5850e14a8528fe969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 10 Apr 2018 08:55:56 -0700 Subject: [PATCH] Cleanup. --- examples/common/entry/entry_x11.cpp | 5 ----- scripts/genie.lua | 1 - src/renderer_vk.cpp | 27 ++++++++++++++++++--------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/examples/common/entry/entry_x11.cpp b/examples/common/entry/entry_x11.cpp index 49149f2e8..6bfd3192c 100644 --- a/examples/common/entry/entry_x11.cpp +++ b/examples/common/entry/entry_x11.cpp @@ -12,7 +12,6 @@ #include #include // will include X11 which #defines None... Don't mess with order of includes. #include -//#include #include #include // syscall @@ -36,11 +35,7 @@ namespace entry inline void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL) { bgfx::PlatformData pd; -#if 0 - pd.ndt = XGetXCBConnection( (Display*)_display); -#else pd.ndt = _display; -#endif // 0 pd.nwh = (void*)(uintptr_t)_window; pd.context = _glx; pd.backBuffer = NULL; diff --git a/scripts/genie.lua b/scripts/genie.lua index 92d55c4b8..fd6f21f53 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -283,7 +283,6 @@ function exampleProjectDefaults() "X11", "GL", "pthread", --- "X11-xcb", } configuration { "linux-steamlink" } diff --git a/src/renderer_vk.cpp b/src/renderer_vk.cpp index e008ccb80..369c18e58 100644 --- a/src/renderer_vk.cpp +++ b/src/renderer_vk.cpp @@ -1284,14 +1284,23 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - VkXcbSurfaceCreateInfoKHR sci; - sci.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; - sci.pNext = NULL; - sci.flags = 0; - sci.connection = (xcb_connection_t*)g_platformData.ndt; - union { void* ptr; xcb_window_t window; } cast = { g_platformData.nwh }; - sci.window = cast.window; - result = vkCreateXcbSurfaceKHR(m_instance, &sci, m_allocatorCb, &m_surface); + void* xcbdll = bx::dlopen("libX11-xcb.so.1"); + if (NULL != xcbdll) + { + typedef xcb_connection_t* (*PFN_XGETXCBCONNECTION)(Display*); + PFN_XGETXCBCONNECTION XGetXCBConnection = (PFN_XGETXCBCONNECTION)bx::dlsym(xcbdll, "XGetXCBConnection"); + + VkXcbSurfaceCreateInfoKHR sci; + sci.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; + sci.pNext = NULL; + sci.flags = 0; + sci.connection = XGetXCBConnection( (Display*)g_platformData.ndt); + union { void* ptr; xcb_window_t window; } cast = { g_platformData.nwh }; + sci.window = cast.window; + result = vkCreateXcbSurfaceKHR(m_instance, &sci, m_allocatorCb, &m_surface); + + bx::dlclose(xcbdll); + } } } #else @@ -3516,7 +3525,7 @@ VK_DESTROY uint32_t shaderSize; bx::read(&reader, shaderSize); -#if 1 +#if 0 const void* code = reader.getDataPtr(); bx::skip(&reader, shaderSize+1);