MCPcopy Create free account
hub / github.com/SFML/SFML / createVulkanSurface

Method createVulkanSurface

src/SFML/Window/Win32/VulkanImplWin32.cpp:184–207  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

182
183////////////////////////////////////////////////////////////
184bool VulkanImpl::createVulkanSurface(const VkInstance& instance,
185 WindowHandle windowHandle,
186 VkSurfaceKHR& surface,
187 const VkAllocationCallbacks* allocator)
188{
189 if (!isAvailable())
190 return false;
191
192 // Make a copy of the instance handle since we get it passed as a reference
193 VkInstance inst = instance;
194
195 auto vkCreateWin32SurfaceKHR = reinterpret_cast<PFN_vkCreateWin32SurfaceKHR>(
196 wrapper.vkGetInstanceProcAddr(inst, "vkCreateWin32SurfaceKHR"));
197
198 if (!vkCreateWin32SurfaceKHR)
199 return false;
200
201 VkWin32SurfaceCreateInfoKHR surfaceCreateInfo = VkWin32SurfaceCreateInfoKHR();
202 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
203 surfaceCreateInfo.hinstance = GetModuleHandleA(nullptr);
204 surfaceCreateInfo.hwnd = windowHandle;
205
206 return vkCreateWin32SurfaceKHR(instance, &surfaceCreateInfo, allocator, &surface) == VK_SUCCESS;
207}
208
209} // namespace sf::priv

Callers

nothing calls this directly

Calls 2

isAvailableFunction · 0.50

Tested by

no test coverage detected