From 1821aff04ee01d4515df2b2d584982fb9d46634e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=2E=C4=B0?= Date: Sat, 10 Sep 2016 18:47:05 +0300 Subject: [PATCH] Update vulkan.c I know it is overkill but in first OpenGL releases, there is have only two or three Extensions. I think it is same for Vulkan. More futuristic... --- src/vulkan.c | 72 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 13 deletions(-) diff --git a/src/vulkan.c b/src/vulkan.c index 49ca4446a..ac452e849 100644 --- a/src/vulkan.c +++ b/src/vulkan.c @@ -104,20 +104,66 @@ GLFWbool _glfwInitVulkan(void) return GLFW_FALSE; } - for (i = 0; i < count; i++) + for (i = 0; i < count; i++) { - if (strcmp(ep[i].extensionName, "VK_KHR_surface") == 0) - _glfw.vk.KHR_surface = GLFW_TRUE; - if (strcmp(ep[i].extensionName, "VK_KHR_win32_surface") == 0) - _glfw.vk.KHR_win32_surface = GLFW_TRUE; - if (strcmp(ep[i].extensionName, "VK_KHR_xlib_surface") == 0) - _glfw.vk.KHR_xlib_surface = GLFW_TRUE; - if (strcmp(ep[i].extensionName, "VK_KHR_xcb_surface") == 0) - _glfw.vk.KHR_xcb_surface = GLFW_TRUE; - if (strcmp(ep[i].extensionName, "VK_KHR_wayland_surface") == 0) - _glfw.vk.KHR_wayland_surface = GLFW_TRUE; - if (strcmp(ep[i].extensionName, "VK_KHR_mir_surface") == 0) - _glfw.vk.KHR_mir_surface = GLFW_TRUE; +#if defined(_WIN32) || defined(WIN32) + if(_glfw.vk.KHR_surface && _glfw.vk.KHR_win32_surface) + break; +#else + if(_glfw.vk.KHR_surface && (_glfw.vk.KHR_xlib_surface || _glfw.vk.KHR_xcb_surface || _glfw.vk.KHR_wayland_surface || _glfw.vk.KHR_mir_surface)) + break; +#endif + if(!_glfw.vk.KHR_surface) + { + if (strcmp(ep[i].extensionName, "VK_KHR_surface") == 0) + { + _glfw.vk.KHR_surface = GLFW_TRUE; + continue; + } + } +#if defined(_WIN32) || defined(WIN32) + if(!_glfw.vk.KHR_win32_surface) + { + if (strcmp(ep[i].extensionName, "VK_KHR_win32_surface") == 0) + { + _glfw.vk.KHR_win32_surface = GLFW_TRUE; + continue; + } + } +#else + if(!_glfw.vk.KHR_xlib_surface) + { + if (strcmp(ep[i].extensionName, "VK_KHR_xlib_surface") == 0) + { + _glfw.vk.KHR_xlib_surface = GLFW_TRUE; + continue; + } + } + if(!_glfw.vk.KHR_xcb_surface) + { + if (strcmp(ep[i].extensionName, "VK_KHR_xcb_surface") == 0) + { + _glfw.vk.KHR_xcb_surface = GLFW_TRUE; + continue; + } + } + if(!_glfw.vk.KHR_wayland_surface) + { + if (strcmp(ep[i].extensionName, "VK_KHR_wayland_surface") == 0) + { + _glfw.vk.KHR_wayland_surface = GLFW_TRUE; + continue; + } + } + if(!_glfw.vk.KHR_mir_surface) + { + if (strcmp(ep[i].extensionName, "VK_KHR_mir_surface") == 0) + { + _glfw.vk.KHR_mir_surface = GLFW_TRUE; + continue; + } + } +#endif } free(ep);