warn = -pedantic -Wall -Wno-unused-variable
CFLAGS = $(warn) -g -MMD
-LDFLAGS = -lvulkan -lX11
+LDFLAGS = -lvulkan -lX11 -lX11-xcb
$(bin): $(obj) $(spirv)
$(CC) -o $@ $(obj) $(LDFLAGS)
.PHONY: clean
clean:
- rm -f $(src) $(obj) $(spirv)
+ rm -f $(bin) $(obj) $(spirv)
#ifdef __WIN32__
#include <vulkan/vulkan_win32.h>
#else
-#include <vulkan/vulkan_xlib.h>
+/*#include <vulkan/vulkan_xlib.h>*/
+#include <X11/Xlib-xcb.h>
+#include <vulkan/vulkan_xcb.h>
#endif
static int create_instance(void);
#ifdef __WIN32__
{"VK_KHR_win32_surface", 1},
#else
- {"VK_KHR_xlib_surface", 1},
+ /*{"VK_KHR_xlib_surface", 1},*/
+ {"VK_KHR_xcb_surface", 1},
#endif
{"VK_KHR_debug_report", 0}
};
static int create_surface(void)
{
+ int res;
+
+ /*
VkXlibSurfaceCreateInfoKHR xinf = {0};
xinf.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
xinf.dpy = dpy;
fprintf(stderr, "failed to create Xlib window surface\n");
return -1;
}
+ */
+ VkXcbSurfaceCreateInfoKHR xinf = {0};
+ xinf.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
+ xinf.connection = XGetXCBConnection(dpy);
+ xinf.window = (xcb_window_t)win;
+
+ if((res = vkCreateXcbSurfaceKHR(vk, &xinf, 0, &vksurf)) != 0) {
+ fprintf(stderr, "failed to create XCB window surface (%d)\n", res);
+ return -1;
+ }
return 0;
}