Branimir Karadžić 7 years ago
parent
commit
2bbc67e922
3 changed files with 18 additions and 15 deletions
  1. 0 5
      examples/common/entry/entry_x11.cpp
  2. 0 1
      scripts/genie.lua
  3. 18 9
      src/renderer_vk.cpp

+ 0 - 5
examples/common/entry/entry_x11.cpp

@@ -12,7 +12,6 @@
 #include <X11/keysymdef.h>
 #include <X11/Xlib.h> // will include X11 which #defines None... Don't mess with order of includes.
 #include <X11/Xutil.h>
-//#include <X11/Xlib-xcb.h>
 #include <bgfx/platform.h>
 
 #include <unistd.h> // 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;

+ 0 - 1
scripts/genie.lua

@@ -283,7 +283,6 @@ function exampleProjectDefaults()
 			"X11",
 			"GL",
 			"pthread",
---			"X11-xcb",
 		}
 
 	configuration { "linux-steamlink" }

+ 18 - 9
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);