///////////////////////////////////////////////////////
| 183 | |
| 184 | //////////////////////////////////////////////////////////// |
| 185 | bool VulkanImpl::createVulkanSurface(const VkInstance& instance, |
| 186 | WindowHandle windowHandle, |
| 187 | VkSurfaceKHR& surface, |
| 188 | const VkAllocationCallbacks* allocator) |
| 189 | { |
| 190 | if (!isAvailable()) |
| 191 | return false; |
| 192 | |
| 193 | // Make a copy of the instance handle since we get it passed as a reference |
| 194 | VkInstance inst = instance; |
| 195 | |
| 196 | auto vkCreateXlibSurfaceKHR = reinterpret_cast<PFN_vkCreateXlibSurfaceKHR>( |
| 197 | wrapper.vkGetInstanceProcAddr(inst, "vkCreateXlibSurfaceKHR")); |
| 198 | |
| 199 | if (!vkCreateXlibSurfaceKHR) |
| 200 | return false; |
| 201 | |
| 202 | // Since the surface is basically attached to the window, the connection |
| 203 | // to the X display will stay open even after we open and close it here |
| 204 | const auto display = openDisplay(); |
| 205 | VkXlibSurfaceCreateInfoKHR surfaceCreateInfo = VkXlibSurfaceCreateInfoKHR(); |
| 206 | surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; |
| 207 | surfaceCreateInfo.dpy = display.get(); |
| 208 | surfaceCreateInfo.window = windowHandle; |
| 209 | |
| 210 | const bool result = (vkCreateXlibSurfaceKHR(instance, &surfaceCreateInfo, allocator, &surface) == VK_SUCCESS); |
| 211 | |
| 212 | return result; |
| 213 | } |
| 214 | |
| 215 | } // namespace sf::priv |
nothing calls this directly
no test coverage detected