diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | main.c | 12 |
2 files changed, 12 insertions, 2 deletions
@@ -4,11 +4,13 @@ FEATURE=-DHAVE_MSAA GLSLC=glslc CFLAGS=-I$(VULKAN_SDK)/include $(FEATURE) $(DEBUG) $(WARN) +CXXFLAGS=$(CFLAGS) -std=c++14 LDFLAGS=-L$(VULKAN_SDK)/lib -lvulkan # XXX: Pugl branch location CFLAGS+=-I../pugl LDFLAGS+=-L../pugl/build -lpugl_x11 +#LDFLAGS+=-L../pugl/build -lpugl_win all: main shaders @@ -277,6 +277,14 @@ static VkDeviceSize getNearestAlignment(const VkDeviceSize offset, const VkDevic return offset; } +#if defined(__linux__) +#define PLATFORM_SURFACE VK_KHR_XLIB_SURFACE_EXTENSION_NAME +#elif defined(__WIN32) +#define PLATFORM_SURFACE VK_KHR_WIN32_SURFACE_EXTENSION_NAME +#else +#error "Unknown Vulkan surface extension for this platform" +#endif + static void createInstance() { const VkApplicationInfo appInfo = { @@ -301,7 +309,7 @@ static void createInstance() // This could be negotiated at a later time. static const char *const additional[] = { VK_KHR_SURFACE_EXTENSION_NAME, - VK_KHR_XLIB_SURFACE_EXTENSION_NAME, + PLATFORM_SURFACE, VK_EXT_DEBUG_REPORT_EXTENSION_NAME }; const unsigned nAdditional = sizeof(additional)/sizeof(additional[0]); @@ -987,7 +995,7 @@ static void createSurface() const VkWin32SurfaceCreateInfoKHR createInfo = { .sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR, .hinstance = GetModuleHandle(NULL), // FIXME: whole process scope - .hwnd = puglGetNativeWindow(view) + .hwnd = (HWND)puglGetNativeWindow(view) }; VkResult result; if ((result = vkCreateWin32SurfaceKHR(instance, &createInfo, NULL, &surface))) { |