Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba1be25

Browse files
committed
Mention that WSI extension functions are included in the standard loader
1 parent db1725c commit ba1be25

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

03_Drawing_a_triangle/01_Presentation/00_Window_surface.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,10 @@ The `glfwGetWin32Window` function is used to get the raw `HWND` from the GLFW
5858
window object. The `GetModuleHandle` call returns the `HINSTANCE` handle of the
5959
current process.
6060

61-
After that the surface can be created with `vkCreateWin32SurfaceKHR`, which
62-
needs to be explicitly loaded again. Other than that the call is trivial and
63-
includes a parameter for the instance, surface creation details, custom
64-
allocators and the variable for the surface handle to be stored in.
61+
After that the surface can be created with `vkCreateWin32SurfaceKHR`, which includes a parameter for the instance, surface creation details, custom allocators and the variable for the surface handle to be stored in. Technically this is a WSI extension function, but it is so commonly used that the standard Vulkan loader includes it, so unlike other extensions you don't need to explicitly load it.
6562

6663
```c++
67-
auto CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR) vkGetInstanceProcAddr(instance, "vkCreateWin32SurfaceKHR");
68-
69-
if (!CreateWin32SurfaceKHR || CreateWin32SurfaceKHR(instance, &createInfo, nullptr, &surface) != VK_SUCCESS) {
64+
if (vkCreateWin32SurfaceKHR(instance, &createInfo, nullptr, &surface) != VK_SUCCESS) {
7065
throw std::runtime_error("failed to create window surface!");
7166
}
7267
```

0 commit comments

Comments
 (0)