glfw_sys/sys/manual.rs
1#![allow(
2 unused,
3 clippy::upper_case_acronyms,
4 reason = "for type aliases. type aliases inside extern blocks are not allowed yet."
5)]
6
7use super::*;
8
9type HWND = *mut std::ffi::c_void;
10#[cfg(all(target_os = "windows", feature = "native-handles"))]
11extern "C" {
12 /** @brief Returns the adapter device name of the specified monitor.
13 *
14 * @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
15 * of the specified monitor, or `NULL` if an error
16 * occurred.
17 *
18 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
19 * GLFW_PLATFORM_UNAVAILABLE.
20 *
21 * @thread_safety This function may be called from any thread. Access is not
22 * synchronized.
23 *
24 * @since Added in version 3.1.
25 *
26 * @ingroup native
27 */
28 pub fn glfwGetWin32Adapter(monitor: *mut GLFWmonitor) -> *const std::ffi::c_char;
29 /** @brief Returns the display device name of the specified monitor.
30 *
31 * @return The UTF-8 encoded display device name (for example
32 * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
33 * error occurred.
34 *
35 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
36 * GLFW_PLATFORM_UNAVAILABLE.
37 *
38 * @thread_safety This function may be called from any thread. Access is not
39 * synchronized.
40 *
41 * @since Added in version 3.1.
42 *
43 * @ingroup native
44 */
45 pub fn glfwGetWin32Monitor(monitor: *mut GLFWmonitor) -> *const std::ffi::c_char;
46
47 /** @brief Returns the `HWND` of the specified window.
48 *
49 * @return The `HWND` of the specified window, or `NULL` if an
50 * error occurred.
51 *
52 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
53 * GLFW_PLATFORM_UNAVAILABLE.
54 *
55 * @remark The `HDC` associated with the window can be queried with the
56 * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
57 * function.
58 * @code
59 * HDC dc = GetDC(glfwGetWin32Window(window));
60 * @endcode
61 * This DC is private and does not need to be released.
62 *
63 * @thread_safety This function may be called from any thread. Access is not
64 * synchronized.
65 *
66 * @since Added in version 3.0.
67 *
68 * @ingroup native
69 */
70 pub fn glfwGetWin32Window(window: *mut GLFWwindow) -> HWND;
71}
72type HGLRC = *mut std::ffi::c_void;
73#[cfg(all(target_os = "windows", feature = "native-gl"))]
74extern "C" {
75 /** @brief Returns the `HGLRC` of the specified window.
76 *
77 * @return The `HGLRC` of the specified window, or `NULL` if an
78 * error occurred.
79 *
80 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
81 * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
82 *
83 * @remark The `HDC` associated with the window can be queried with the
84 * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
85 * function.
86 * @code
87 * HDC dc = GetDC(glfwGetWin32Window(window));
88 * @endcode
89 * This DC is private and does not need to be released.
90 *
91 * @thread_safety This function may be called from any thread. Access is not
92 * synchronized.
93 *
94 * @since Added in version 3.0.
95 *
96 * @ingroup native
97 */
98 pub fn glfwGetWGLContext(window: *mut GLFWwindow) -> HGLRC;
99}
100type CGDirectDisplayID = u32;
101type NSWindow = *mut std::ffi::c_void;
102type NSView = *mut std::ffi::c_void;
103#[cfg(all(target_os = "macos", feature = "native-handles"))]
104extern "C" {
105 /** @brief Returns the `CGDirectDisplayID` of the specified monitor.
106 *
107 * @return The `CGDirectDisplayID` of the specified monitor, or
108 * `kCGNullDirectDisplay` if an error occurred.
109 *
110 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
111 * GLFW_PLATFORM_UNAVAILABLE.
112 *
113 * @thread_safety This function may be called from any thread. Access is not
114 * synchronized.
115 *
116 * @since Added in version 3.1.
117 *
118 * @ingroup native
119 */
120 pub fn glfwGetCocoaMonitor(monitor: *mut GLFWmonitor) -> CGDirectDisplayID;
121
122 /** @brief Returns the `NSWindow` of the specified window.
123 *
124 * @return The `NSWindow` of the specified window, or `nil` if an
125 * error occurred.
126 *
127 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
128 * GLFW_PLATFORM_UNAVAILABLE.
129 *
130 * @thread_safety This function may be called from any thread. Access is not
131 * synchronized.
132 *
133 * @since Added in version 3.0.
134 *
135 * @ingroup native
136 */
137 pub fn glfwGetCocoaWindow(window: *mut GLFWwindow) -> NSWindow;
138
139 /** @brief Returns the `NSView` of the specified window.
140 *
141 * @return The `NSView` of the specified window, or `nil` if an
142 * error occurred.
143 *
144 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
145 * GLFW_PLATFORM_UNAVAILABLE.
146 *
147 * @thread_safety This function may be called from any thread. Access is not
148 * synchronized.
149 *
150 * @since Added in version 3.4.
151 *
152 * @ingroup native
153 */
154 pub fn glfwGetCocoaView(window: *mut GLFWwindow) -> NSView;
155}
156type NSOpenGLContext = *mut std::ffi::c_void;
157#[cfg(all(target_os = "macos", feature = "native-gl"))]
158extern "C" {
159 /** @brief Returns the `NSOpenGLContext` of the specified window.
160 *
161 * @return The `NSOpenGLContext` of the specified window, or `nil` if an
162 * error occurred.
163 *
164 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
165 * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
166 *
167 * @thread_safety This function may be called from any thread. Access is not
168 * synchronized.
169 *
170 * @since Added in version 3.0.
171 *
172 * @ingroup native
173 */
174 pub fn glfwGetNSGLContext(window: *mut GLFWwindow) -> NSOpenGLContext;
175}
176type XID = usize;
177type Display = std::ffi::c_void;
178type Window = XID;
179type RRCrtc = XID;
180type RROutput = XID;
181#[cfg(all(
182 not(target_os = "macos"),
183 not(target_os = "windows"),
184 not(target_os = "emscripten"),
185 feature = "x11",
186 feature = "native-handles"
187))]
188extern "C" {
189 /** @brief Returns the `Display` used by GLFW.
190 *
191 * @return The `Display` used by GLFW, or `NULL` if an
192 * error occurred.
193 *
194 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
195 * GLFW_PLATFORM_UNAVAILABLE.
196 *
197 * @thread_safety This function may be called from any thread. Access is not
198 * synchronized.
199 *
200 * @since Added in version 3.0.
201 *
202 * @ingroup native
203 */
204 pub fn glfwGetX11Display() -> *mut Display;
205
206 /** @brief Returns the `RRCrtc` of the specified monitor.
207 *
208 * @return The `RRCrtc` of the specified monitor, or `None` if an
209 * error occurred.
210 *
211 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
212 * GLFW_PLATFORM_UNAVAILABLE.
213 *
214 * @thread_safety This function may be called from any thread. Access is not
215 * synchronized.
216 *
217 * @since Added in version 3.1.
218 *
219 * @ingroup native
220 */
221 pub fn glfwGetX11Adapter(monitor: *mut GLFWmonitor) -> RRCrtc;
222
223 /* @brief Returns the `RROutput` of the specified monitor.
224 *
225 * @return The `RROutput` of the specified monitor, or `None` if an
226 * error occurred.
227 *
228 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
229 * GLFW_PLATFORM_UNAVAILABLE.
230 *
231 * @thread_safety This function may be called from any thread. Access is not
232 * synchronized.
233 *
234 * @since Added in version 3.1.
235 *
236 * @ingroup native
237 */
238 pub fn glfwGetX11Monitor(monitor: *mut GLFWmonitor) -> RROutput;
239
240 /** @brief Returns the `Window` of the specified window.
241 *
242 * @return The `Window` of the specified window, or `None` if an
243 * error occurred.
244 *
245 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
246 * GLFW_PLATFORM_UNAVAILABLE.
247 *
248 * @thread_safety This function may be called from any thread. Access is not
249 * synchronized.
250 *
251 * @since Added in version 3.0.
252 *
253 * @ingroup native
254 */
255 pub fn glfwGetX11Window(window: *mut GLFWwindow) -> Window;
256
257 /** @brief Sets the current primary selection to the specified string.
258 *
259 * @param string A UTF-8 encoded string.
260 *
261 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
262 * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
263 *
264 * @pointer_lifetime The specified string is copied before this function
265 * returns.
266 *
267 * @thread_safety This function must only be called from the main thread.
268 *
269 * @sa @ref clipboard
270 * @sa glfwGetX11SelectionString
271 * @sa glfwSetClipboardString
272 *
273 * @since Added in version 3.3.
274 *
275 * @ingroup native
276 */
277 pub fn glfwSetX11SelectionString(string: *const std::ffi::c_char);
278
279 /** @brief Returns the contents of the current primary selection as a string.
280 *
281 * If the selection is empty or if its contents cannot be converted, `NULL`
282 * is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated.
283 *
284 * @return The contents of the selection as a UTF-8 encoded string, or `NULL`
285 * if an error occurred.
286 *
287 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
288 * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
289 *
290 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
291 * should not free it yourself. It is valid until the next call to @ref
292 * glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the
293 * library is terminated.
294 *
295 * @thread_safety This function must only be called from the main thread.
296 *
297 * @sa @ref clipboard
298 * @sa glfwSetX11SelectionString
299 * @sa glfwGetClipboardString
300 *
301 * @since Added in version 3.3.
302 *
303 * @ingroup native
304 */
305 pub fn glfwGetX11SelectionString() -> *const std::ffi::c_char;
306}
307type GLXContext = XID;
308type GLXWindow = XID;
309#[cfg(all(
310 not(target_os = "macos"),
311 not(target_os = "windows"),
312 not(target_os = "emscripten"),
313 feature = "x11",
314 feature = "native-gl"
315))]
316extern "C" {
317 /** @brief Returns the `GLXContext` of the specified window.
318 *
319 * @return The `GLXContext` of the specified window, or `NULL` if an
320 * error occurred.
321 *
322 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
323 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
324 *
325 * @thread_safety This function may be called from any thread. Access is not
326 * synchronized.
327 *
328 * @since Added in version 3.0.
329 *
330 * @ingroup native
331 */
332 pub fn glfwGetGLXContext(window: *mut GLFWwindow) -> GLXContext;
333
334 /** @brief Returns the `GLXWindow` of the specified window.
335 *
336 * @return The `GLXWindow` of the specified window, or `None` if an
337 * error occurred.
338 *
339 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
340 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
341 *
342 * @thread_safety This function may be called from any thread. Access is not
343 * synchronized.
344 *
345 * @since Added in version 3.2.
346 *
347 * @ingroup native
348 */
349 pub fn glfwGetGLXWindow(window: *mut GLFWwindow) -> GLXWindow;
350}
351
352#[cfg(all(
353 not(target_os = "macos"),
354 not(target_os = "windows"),
355 not(target_os = "emscripten"),
356 feature = "wayland",
357 feature = "native-handles"
358))]
359extern "C" {
360 /** @brief Returns the `struct wl_display*` used by GLFW.
361 *
362 * @return The `struct wl_display*` used by GLFW, or `NULL` if an
363 * error occurred.
364 *
365 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
366 * GLFW_PLATFORM_UNAVAILABLE.
367 *
368 * @thread_safety This function may be called from any thread. Access is not
369 * synchronized.
370 *
371 * @since Added in version 3.2.
372 *
373 * @ingroup native
374 */
375 pub fn glfwGetWaylandDisplay() -> *const std::ffi::c_void;
376
377 /** @brief Returns the `struct wl_output*` of the specified monitor.
378 *
379 * @return The `struct wl_output*` of the specified monitor, or `NULL` if an
380 * error occurred.
381 *
382 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
383 * GLFW_PLATFORM_UNAVAILABLE.
384 *
385 * @thread_safety This function may be called from any thread. Access is not
386 * synchronized.
387 *
388 * @since Added in version 3.2.
389 *
390 * @ingroup native
391 */
392 pub fn glfwGetWaylandMonitor(monitor: *mut GLFWmonitor) -> *const std::ffi::c_void;
393
394 /** @brief Returns the main `struct wl_surface*` of the specified window.
395 *
396 * @return The main `struct wl_surface*` of the specified window, or `NULL` if
397 * an error occurred.
398 *
399 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
400 * GLFW_PLATFORM_UNAVAILABLE.
401 *
402 * @thread_safety This function may be called from any thread. Access is not
403 * synchronized.
404 *
405 * @since Added in version 3.2.
406 *
407 * @ingroup native
408 */
409 pub fn glfwGetWaylandWindow(window: *mut GLFWwindow) -> *mut std::ffi::c_void;
410}
411type EGLDisplay = *mut std::ffi::c_void;
412type EGLSurface = *mut std::ffi::c_void;
413type EGLContext = *mut std::ffi::c_void;
414#[cfg(all(
415 not(target_os = "macos"),
416 not(target_os = "windows"),
417 not(target_os = "emscripten"),
418 any(
419 all(feature = "wayland", feature = "native-gl"),
420 feature = "native-egl"
421 )
422))]
423extern "C" {
424 /** @brief Returns the `EGLDisplay` used by GLFW.
425 *
426 * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
427 * error occurred.
428 *
429 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
430 *
431 * @remark Because EGL is initialized on demand, this function will return
432 * `EGL_NO_DISPLAY` until the first context has been created via EGL.
433 *
434 * @thread_safety This function may be called from any thread. Access is not
435 * synchronized.
436 *
437 * @since Added in version 3.0.
438 *
439 * @ingroup native
440 */
441 pub fn glfwGetEGLDisplay() -> EGLDisplay;
442
443 /** @brief Returns the `EGLContext` of the specified window.
444 *
445 * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
446 * error occurred.
447 *
448 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
449 * GLFW_NO_WINDOW_CONTEXT.
450 *
451 * @thread_safety This function may be called from any thread. Access is not
452 * synchronized.
453 *
454 * @since Added in version 3.0.
455 *
456 * @ingroup native
457 */
458 pub fn glfwGetEGLContext(window: *mut GLFWwindow) -> EGLContext;
459
460 /** @brief Returns the `EGLSurface` of the specified window.
461 *
462 * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
463 * error occurred.
464 *
465 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
466 * GLFW_NO_WINDOW_CONTEXT.
467 *
468 * @thread_safety This function may be called from any thread. Access is not
469 * synchronized.
470 *
471 * @since Added in version 3.0.
472 *
473 * @ingroup native
474 */
475 pub fn glfwGetEGLSurface(window: *mut GLFWwindow) -> EGLSurface;
476}
477type OSMesaContext = *mut std::ffi::c_void;
478#[cfg(feature = "osmesa")]
479extern "C" {
480 /** @brief Retrieves the color buffer associated with the specified window.
481 *
482 * @param[in] window The window whose color buffer to retrieve.
483 * @param[out] width Where to store the width of the color buffer, or `NULL`.
484 * @param[out] height Where to store the height of the color buffer, or `NULL`.
485 * @param[out] format Where to store the OSMesa pixel format of the color
486 * buffer, or `NULL`.
487 * @param[out] buffer Where to store the address of the color buffer, or
488 * `NULL`.
489 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
490 * error occurred.
491 *
492 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
493 * GLFW_NO_WINDOW_CONTEXT.
494 *
495 * @thread_safety This function may be called from any thread. Access is not
496 * synchronized.
497 *
498 * @since Added in version 3.3.
499 *
500 * @ingroup native
501 */
502 pub fn glfwGetOSMesaColorBuffer(
503 window: *mut GLFWwindow,
504 width: *mut std::ffi::c_int,
505 height: *mut std::ffi::c_int,
506 format: *mut std::ffi::c_int,
507 buffer: *mut *mut std::ffi::c_void,
508 ) -> std::ffi::c_int;
509
510 /** @brief Retrieves the depth buffer associated with the specified window.
511 *
512 * @param[in] window The window whose depth buffer to retrieve.
513 * @param[out] width Where to store the width of the depth buffer, or `NULL`.
514 * @param[out] height Where to store the height of the depth buffer, or `NULL`.
515 * @param[out] bytesPerValue Where to store the number of bytes per depth
516 * buffer element, or `NULL`.
517 * @param[out] buffer Where to store the address of the depth buffer, or
518 * `NULL`.
519 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
520 * error occurred.
521 *
522 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
523 * GLFW_NO_WINDOW_CONTEXT.
524 *
525 * @thread_safety This function may be called from any thread. Access is not
526 * synchronized.
527 *
528 * @since Added in version 3.3.
529 *
530 * @ingroup native
531 */
532 pub fn glfwGetOSMesaDepthBuffer(
533 window: *mut GLFWwindow,
534 width: *mut std::ffi::c_int,
535 height: *mut std::ffi::c_int,
536 bytesPerValue: *mut std::ffi::c_int,
537 buffer: *mut *mut std::ffi::c_void,
538 ) -> std::ffi::c_int;
539
540 /** @brief Returns the `OSMesaContext` of the specified window.
541 *
542 * @return The `OSMesaContext` of the specified window, or `NULL` if an
543 * error occurred.
544 *
545 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
546 * GLFW_NO_WINDOW_CONTEXT.
547 *
548 * @thread_safety This function may be called from any thread. Access is not
549 * synchronized.
550 *
551 * @since Added in version 3.3.
552 *
553 * @ingroup native
554 */
555 pub fn glfwGetOSMesaContext(window: *mut GLFWwindow) -> OSMesaContext;
556
557}
558
559/*
560manually maintained vulkan bindings.
561I didn't know about allowlist-file feature and thought enabling vulkan means
562generating bindings for the entire vulkan header (too expensive).
563So, I made these bindings, which are now useless. Just keeping them here *in-case* we
564ever need them again.
565
566#[cfg(all(not(feature = "bindings"), feature = "vulkan"))]
567mod vulkan {
568 type VkInstance = *mut std::ffi::c_void;
569 type VkPhysicalDevice = *mut std::ffi::c_void;
570 type VkSurfaceKHR = *mut std::ffi::c_void;
571 type VkAllocationCallbacks = *mut std::ffi::c_void;
572 type VkResult = std::ffi::c_int;
573 /** @brief Returns the address of the specified Vulkan instance function.
574 *
575 * This function returns the address of the specified Vulkan core or extension
576 * function for the specified instance. If instance is set to `NULL` it can
577 * return any function exported from the Vulkan loader, including at least the
578 * following functions:
579 *
580 * - `vkEnumerateInstanceExtensionProperties`
581 * - `vkEnumerateInstanceLayerProperties`
582 * - `vkCreateInstance`
583 * - `vkGetInstanceProcAddr`
584 *
585 * If Vulkan is not available on the machine, this function returns `NULL` and
586 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
587 * to check whether Vulkan is at least minimally available.
588 *
589 * This function is equivalent to calling `vkGetInstanceProcAddr` with
590 * a platform-specific query of the Vulkan loader as a fallback.
591 *
592 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
593 * functions related to instance creation.
594 * @param[in] procname The ASCII encoded name of the function.
595 * @return The address of the function, or `NULL` if an
596 * error occurred.
597 *
598 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
599 * GLFW_API_UNAVAILABLE.
600 *
601 * @pointer_lifetime The returned function pointer is valid until the library
602 * is terminated.
603 *
604 * @thread_safety This function may be called from any thread.
605 *
606 * @sa @ref vulkan_proc
607 *
608 * @since Added in version 3.2.
609 *
610 * @ingroup vulkan
611 */
612 pub fn glfwGetInstanceProcAddress(
613 instance: VkInstance,
614 procname: *const std::ffi::c_char,
615 ) -> GLFWvkproc;
616
617 /** @brief Returns whether the specified queue family can present images.
618 *
619 * This function returns whether the specified queue family of the specified
620 * physical device supports presentation to the platform GLFW was built for.
621 *
622 * If Vulkan or the required window surface creation instance extensions are
623 * not available on the machine, or if the specified instance was not created
624 * with the required extensions, this function returns `GLFW_FALSE` and
625 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
626 * to check whether Vulkan is at least minimally available and @ref
627 * glfwGetRequiredInstanceExtensions to check what instance extensions are
628 * required.
629 *
630 * @param[in] instance The instance that the physical device belongs to.
631 * @param[in] device The physical device that the queue family belongs to.
632 * @param[in] queuefamily The index of the queue family to query.
633 * @return `GLFW_TRUE` if the queue family supports presentation, or
634 * `GLFW_FALSE` otherwise.
635 *
636 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
637 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
638 *
639 * @remark @macos This function currently always returns `GLFW_TRUE`, as the
640 * `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide
641 * a `vkGetPhysicalDevice*PresentationSupport` type function.
642 *
643 * @thread_safety This function may be called from any thread. For
644 * synchronization details of Vulkan objects, see the Vulkan specification.
645 *
646 * @sa @ref vulkan_present
647 *
648 * @since Added in version 3.2.
649 *
650 * @ingroup vulkan
651 */
652 pub fn glfwGetPhysicalDevicePresentationSupport(
653 instance: VkInstance,
654 device: VkPhysicalDevice,
655 queuefamily: u32,
656 ) -> std::ffi::c_int;
657
658 /** @brief Creates a Vulkan surface for the specified window.
659 *
660 * This function creates a Vulkan surface for the specified window.
661 *
662 * If the Vulkan loader or at least one minimally functional ICD were not found,
663 * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref
664 * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether
665 * Vulkan is at least minimally available.
666 *
667 * If the required window surface creation instance extensions are not
668 * available or if the specified instance was not created with these extensions
669 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
670 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
671 * glfwGetRequiredInstanceExtensions to check what instance extensions are
672 * required.
673 *
674 * The window surface cannot be shared with another API so the window must
675 * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib)
676 * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error
677 * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`.
678 *
679 * The window surface must be destroyed before the specified Vulkan instance.
680 * It is the responsibility of the caller to destroy the window surface. GLFW
681 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
682 * surface.
683 *
684 * @param[in] instance The Vulkan instance to create the surface in.
685 * @param[in] window The window to create the surface for.
686 * @param[in] allocator The allocator to use, or `NULL` to use the default
687 * allocator.
688 * @param[out] surface Where to store the handle of the surface. This is set
689 * to `VK_NULL_HANDLE` if an error occurred.
690 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
691 * error occurred.
692 *
693 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
694 * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE
695 *
696 * @remark If an error occurs before the creation call is made, GLFW returns
697 * the Vulkan error code most appropriate for the error. Appropriate use of
698 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
699 * eliminate almost all occurrences of these errors.
700 *
701 * @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the
702 * `VK_MVK_macos_surface` extension as a fallback. The name of the selected
703 * extension, if any, is included in the array returned by @ref
704 * glfwGetRequiredInstanceExtensions.
705 *
706 * @remark @macos This function creates and sets a `CAMetalLayer` instance for
707 * the window content view, which is required for MoltenVK to function.
708 *
709 * @remark @x11 By default GLFW prefers the `VK_KHR_xcb_surface` extension,
710 * with the `VK_KHR_xlib_surface` extension as a fallback. You can make
711 * `VK_KHR_xlib_surface` the preferred extension by setting the
712 * [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init
713 * hint. The name of the selected extension, if any, is included in the array
714 * returned by @ref glfwGetRequiredInstanceExtensions.
715 *
716 * @thread_safety This function may be called from any thread. For
717 * synchronization details of Vulkan objects, see the Vulkan specification.
718 *
719 * @sa @ref vulkan_surface
720 * @sa @ref glfwGetRequiredInstanceExtensions
721 *
722 * @since Added in version 3.2.
723 *
724 * @ingroup vulkan
725 */
726 pub fn glfwCreateWindowSurface(
727 instance: VkInstance,
728 window: *mut GlfwWindow,
729 allocator: *const VkAllocationCallbacks,
730 surface: *mut VkSurfaceKHR,
731 ) -> VkResult;
732}
733
734#[cfg(all(not(feature = "bindings"), feature = "vulkan"))]
735pub use vulkan::*;
736*/