diff options
author | Jordan Halase <jordan@halase.me> | 2019-10-27 15:02:42 -0500 |
---|---|---|
committer | Jordan Halase <jordan@halase.me> | 2019-10-27 15:02:42 -0500 |
commit | 25168e79f33cb51625c150e0819268f0da16b67f (patch) | |
tree | 4de0d6c4d767e7dbc9a362412a349d86a9f8c1a8 | |
parent | b9b804e59c983f9f21f695f51577da93b92ebb0f (diff) |
Begin adding Windows support
-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))) { |