GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* handle, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface) { _GLFWwindow* window = (_GLFWwindow*) handle; assert(window != NULL); assert(surface != NULL); *surface = VK_NULL_HANDLE; _GLFW_REQUIRE_INIT_OR_RETURN(VK_ERROR_INITIALIZATION_FAILED); if (!_glfwInitVulkan()) return VK_ERROR_INITIALIZATION_FAILED; if (!_glfw.vk.extensions) { _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Window surface creation extensions not found"); return VK_ERROR_EXTENSION_NOT_PRESENT; } return _glfwPlatformCreateWindowSurface(instance, window, allocator, surface); }
GLFWAPI int glfwInit(void) { if (_glfwInitialized) return GLFW_TRUE; memset(&_glfw, 0, sizeof(_glfw)); if (!_glfwPlatformInit()) { _glfwPlatformTerminate(); return GLFW_FALSE; } _glfwInitVulkan(); _glfw.monitors = _glfwPlatformGetMonitors(&_glfw.monitorCount); _glfwInitialized = GLFW_TRUE; _glfw.timerOffset = _glfwPlatformGetTimerValue(); // Not all window hints have zero as their default value glfwDefaultWindowHints(); return GLFW_TRUE; }
GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname) { GLFWvkproc proc; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); if (!_glfwInitVulkan()) return NULL; proc = (GLFWvkproc) vkGetInstanceProcAddr(instance, procname); if (!proc) proc = (GLFWvkproc) _glfw_dlsym(_glfw.vk.handle, procname); return proc; }
GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily) { _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); if (!_glfwInitVulkan()) return GLFW_FALSE; if (!_glfw.vk.extensions) { _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Window surface creation extensions not found"); return GLFW_FALSE; } return _glfwPlatformGetPhysicalDevicePresentationSupport(instance, device, queuefamily); }
GLFWAPI int glfwVulkanSupported(void) { _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); return _glfwInitVulkan(); }