sdl3_sys/generated/
vulkan.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
//! Functions for creating Vulkan surfaces on SDL windows.
//!
//! For the most part, Vulkan operates independent of SDL, but it benefits from
//! a little support during setup.
//!
//! Use [`SDL_Vulkan_GetInstanceExtensions()`] to get platform-specific bits for
//! creating a VkInstance, then [`SDL_Vulkan_GetVkGetInstanceProcAddr()`] to get
//! the appropriate function for querying Vulkan entry points. Then
//! [`SDL_Vulkan_CreateSurface()`] will get you the final pieces you need to
//! prepare for rendering into an [`SDL_Window`] with Vulkan.
//!
//! Unlike OpenGL, most of the details of "context" creation and window buffer
//! swapping are handled by the Vulkan API directly, so SDL doesn't provide
//! Vulkan equivalents of [`SDL_GL_SwapWindow()`], etc; they aren't necessary.

use super::stdinc::*;

use super::error::*;

use super::video::*;

apply_cfg!(#[cfg(any(any(/* always disabled: _M_IA64 */), target_arch = "x86_64", all(windows, target_pointer_width = "64"), all(not(windows), target_pointer_width = "64"), target_arch = "aarch64", any(/* always disabled: __ia64 */), target_arch = "powerpc64", target_arch = "x86_64"))] => {
});

apply_cfg!(#[cfg(not(any(any(/* always disabled: _M_IA64 */), target_arch = "x86_64", all(windows, target_pointer_width = "64"), all(not(windows), target_pointer_width = "64"), target_arch = "aarch64", any(/* always disabled: __ia64 */), target_arch = "powerpc64", target_arch = "x86_64")))] => {
});

apply_cfg!(#[cfg(feature = "use-ash-v0-38")] => {
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::Instance` from the `ash` crate. Otherwise it's a pointer to an opaque struct.
    pub type VkInstance = ::ash_v0_38::vk::Instance;
});

apply_cfg!(#[cfg(not(feature = "use-ash-v0-38"))] => {
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::Instance` from the `ash` crate. Otherwise it's a pointer to an opaque struct.
    pub type VkInstance = *mut __VkInstance;

    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    #[doc(hidden)]
    #[repr(C)]
    pub struct __VkInstance { _opaque: [::core::primitive::u8; 0] }
});

apply_cfg!(#[cfg(feature = "use-ash-v0-38")] => {
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::PhysicalDevice` from the `ash` crate. Otherwise it's a pointer to an opaque struct.
    pub type VkPhysicalDevice = ::ash_v0_38::vk::PhysicalDevice;
});

apply_cfg!(#[cfg(not(feature = "use-ash-v0-38"))] => {
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::PhysicalDevice` from the `ash` crate. Otherwise it's a pointer to an opaque struct.
    pub type VkPhysicalDevice = *mut __VkPhysicalDevice;

    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    #[doc(hidden)]
    #[repr(C)]
    pub struct __VkPhysicalDevice { _opaque: [::core::primitive::u8; 0] }
});

apply_cfg!(#[cfg(feature = "use-ash-v0-38")] => {
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::SurfaceKHR` from the `ash` crate. Otherwise it's a target dependent opaque type.
    pub type VkSurfaceKHR = ::ash_v0_38::vk::SurfaceKHR;
});

apply_cfg!(#[cfg(not(feature = "use-ash-v0-38"))] => {
    #[cfg(target_pointer_width = "64")]
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    pub type VkSurfaceKHR = *mut __VkSurfaceKHR;

    #[cfg(target_pointer_width = "64")]
    #[doc(hidden)]
    #[repr(C)]
    pub struct __VkSurfaceKHR { _opaque: [::core::primitive::u8; 0] }

    #[cfg(not(target_pointer_width = "64"))]
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::SurfaceKHR` from the `ash` crate. Otherwise it's a target dependent opaque type.
    pub type VkSurfaceKHR = ::core::primitive::u64;
});

extern "C" {
    /// Dynamically load the Vulkan loader library.
    ///
    /// This should be called after initializing the video driver, but before
    /// creating any Vulkan windows. If no Vulkan loader library is loaded, the
    /// default library will be loaded upon creation of the first Vulkan window.
    ///
    /// SDL keeps a counter of how many times this function has been successfully
    /// called, so it is safe to call this function multiple times, so long as it
    /// is eventually paired with an equivalent number of calls to
    /// [`SDL_Vulkan_UnloadLibrary`]. The `path` argument is ignored unless there is no
    /// library currently loaded, and and the library isn't actually unloaded until
    /// there have been an equivalent number of calls to [`SDL_Vulkan_UnloadLibrary`].
    ///
    /// It is fairly common for Vulkan applications to link with libvulkan instead
    /// of explicitly loading it at run time. This will work with SDL provided the
    /// application links to a dynamic library and both it and SDL use the same
    /// search path.
    ///
    /// If you specify a non-NULL `path`, an application should retrieve all of the
    /// Vulkan functions it uses from the dynamic library using
    /// [`SDL_Vulkan_GetVkGetInstanceProcAddr`] unless you can guarantee `path` points
    /// to the same vulkan loader library the application linked to.
    ///
    /// On Apple devices, if `path` is NULL, SDL will attempt to find the
    /// `vkGetInstanceProcAddr` address within all the Mach-O images of the current
    /// process. This is because it is fairly common for Vulkan applications to
    /// link with libvulkan (and historically MoltenVK was provided as a static
    /// library). If it is not found, on macOS, SDL will attempt to load
    /// `vulkan.framework/vulkan`, `libvulkan.1.dylib`,
    /// `MoltenVK.framework/MoltenVK`, and `libMoltenVK.dylib`, in that order. On
    /// iOS, SDL will attempt to load `libMoltenVK.dylib`. Applications using a
    /// dynamic framework or .dylib must ensure it is included in its application
    /// bundle.
    ///
    /// On non-Apple devices, application linking with a static libvulkan is not
    /// supported. Either do not link to the Vulkan loader or link to a dynamic
    /// library version.
    ///
    /// ### Parameters
    /// - `path`: the platform dependent Vulkan loader library name or NULL.
    ///
    /// ### Return value
    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
    ///   information.
    ///
    /// ### Thread safety
    /// This function is not thread safe.
    ///
    /// ### Availability
    /// This function is available since SDL 3.2.0.
    ///
    /// ### See also
    /// - [`SDL_Vulkan_GetVkGetInstanceProcAddr`]
    /// - [`SDL_Vulkan_UnloadLibrary`]
    pub fn SDL_Vulkan_LoadLibrary(path: *const ::core::ffi::c_char) -> ::core::primitive::bool;
}

extern "C" {
    /// Get the address of the `vkGetInstanceProcAddr` function.
    ///
    /// This should be called after either calling [`SDL_Vulkan_LoadLibrary()`] or
    /// creating an [`SDL_Window`] with the [`SDL_WINDOW_VULKAN`] flag.
    ///
    /// The actual type of the returned function pointer is
    /// PFN_vkGetInstanceProcAddr, but that isn't available because the Vulkan
    /// headers are not included here. You should cast the return value of this
    /// function to that type, e.g.
    ///
    /// `vkGetInstanceProcAddr =
    /// (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr();`
    ///
    /// ### Return value
    /// Returns the function pointer for `vkGetInstanceProcAddr` or NULL on
    ///   failure; call [`SDL_GetError()`] for more information.
    ///
    /// ### Availability
    /// This function is available since SDL 3.2.0.
    pub fn SDL_Vulkan_GetVkGetInstanceProcAddr() -> SDL_FunctionPointer;
}

extern "C" {
    /// Unload the Vulkan library previously loaded by [`SDL_Vulkan_LoadLibrary()`].
    ///
    /// SDL keeps a counter of how many times this function has been called, so it
    /// is safe to call this function multiple times, so long as it is paired with
    /// an equivalent number of calls to [`SDL_Vulkan_LoadLibrary`]. The library isn't
    /// actually unloaded until there have been an equivalent number of calls to
    /// [`SDL_Vulkan_UnloadLibrary`].
    ///
    /// Once the library has actually been unloaded, if any Vulkan instances
    /// remain, they will likely crash the program. Clean up any existing Vulkan
    /// resources, and destroy appropriate windows, renderers and GPU devices
    /// before calling this function.
    ///
    /// ### Thread safety
    /// This function is not thread safe.
    ///
    /// ### Availability
    /// This function is available since SDL 3.2.0.
    ///
    /// ### See also
    /// - [`SDL_Vulkan_LoadLibrary`]
    pub fn SDL_Vulkan_UnloadLibrary();
}

extern "C" {
    /// Get the Vulkan instance extensions needed for vkCreateInstance.
    ///
    /// This should be called after either calling [`SDL_Vulkan_LoadLibrary()`] or
    /// creating an [`SDL_Window`] with the [`SDL_WINDOW_VULKAN`] flag.
    ///
    /// On return, the variable pointed to by `count` will be set to the number of
    /// elements returned, suitable for using with
    /// VkInstanceCreateInfo::enabledExtensionCount, and the returned array can be
    /// used with VkInstanceCreateInfo::ppEnabledExtensionNames, for calling
    /// Vulkan's vkCreateInstance API.
    ///
    /// You should not free the returned array; it is owned by SDL.
    ///
    /// ### Parameters
    /// - `count`: a pointer filled in with the number of extensions returned.
    ///
    /// ### Return value
    /// Returns an array of extension name strings on success, NULL on failure;
    ///   call [`SDL_GetError()`] for more information.
    ///
    /// ### Availability
    /// This function is available since SDL 3.2.0.
    ///
    /// ### See also
    /// - [`SDL_Vulkan_CreateSurface`]
    pub fn SDL_Vulkan_GetInstanceExtensions(
        count: *mut Uint32,
    ) -> *const *const ::core::ffi::c_char;
}

extern "C" {
    /// Create a Vulkan rendering surface for a window.
    ///
    /// The `window` must have been created with the [`SDL_WINDOW_VULKAN`] flag and
    /// `instance` must have been created with extensions returned by
    /// [`SDL_Vulkan_GetInstanceExtensions()`] enabled.
    ///
    /// If `allocator` is NULL, Vulkan will use the system default allocator. This
    /// argument is passed directly to Vulkan and isn't used by SDL itself.
    ///
    /// ### Parameters
    /// - `window`: the window to which to attach the Vulkan surface.
    /// - `instance`: the Vulkan instance handle.
    /// - `allocator`: a VkAllocationCallbacks struct, which lets the app set the
    ///   allocator that creates the surface. Can be NULL.
    /// - `surface`: a pointer to a VkSurfaceKHR handle to output the newly
    ///   created surface.
    ///
    /// ### Return value
    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
    ///   information.
    ///
    /// ### Availability
    /// This function is available since SDL 3.2.0.
    ///
    /// ### See also
    /// - [`SDL_Vulkan_GetInstanceExtensions`]
    /// - [`SDL_Vulkan_DestroySurface`]
    pub fn SDL_Vulkan_CreateSurface(
        window: *mut SDL_Window,
        instance: VkInstance,
        allocator: *const VkAllocationCallbacks,
        surface: *mut VkSurfaceKHR,
    ) -> ::core::primitive::bool;
}

extern "C" {
    /// Destroy the Vulkan rendering surface of a window.
    ///
    /// This should be called before [`SDL_DestroyWindow`], if [`SDL_Vulkan_CreateSurface`]
    /// was called after [`SDL_CreateWindow`].
    ///
    /// The `instance` must have been created with extensions returned by
    /// [`SDL_Vulkan_GetInstanceExtensions()`] enabled and `surface` must have been
    /// created successfully by an [`SDL_Vulkan_CreateSurface()`] call.
    ///
    /// If `allocator` is NULL, Vulkan will use the system default allocator. This
    /// argument is passed directly to Vulkan and isn't used by SDL itself.
    ///
    /// ### Parameters
    /// - `instance`: the Vulkan instance handle.
    /// - `surface`: vkSurfaceKHR handle to destroy.
    /// - `allocator`: a VkAllocationCallbacks struct, which lets the app set the
    ///   allocator that destroys the surface. Can be NULL.
    ///
    /// ### Availability
    /// This function is available since SDL 3.2.0.
    ///
    /// ### See also
    /// - [`SDL_Vulkan_GetInstanceExtensions`]
    /// - [`SDL_Vulkan_CreateSurface`]
    pub fn SDL_Vulkan_DestroySurface(
        instance: VkInstance,
        surface: VkSurfaceKHR,
        allocator: *const VkAllocationCallbacks,
    );
}

extern "C" {
    /// Query support for presentation via a given physical device and queue
    /// family.
    ///
    /// The `instance` must have been created with extensions returned by
    /// [`SDL_Vulkan_GetInstanceExtensions()`] enabled.
    ///
    /// ### Parameters
    /// - `instance`: the Vulkan instance handle.
    /// - `physicalDevice`: a valid Vulkan physical device handle.
    /// - `queueFamilyIndex`: a valid queue family index for the given physical
    ///   device.
    ///
    /// ### Return value
    /// Returns true if supported, false if unsupported or an error occurred.
    ///
    /// ### Availability
    /// This function is available since SDL 3.2.0.
    ///
    /// ### See also
    /// - [`SDL_Vulkan_GetInstanceExtensions`]
    pub fn SDL_Vulkan_GetPresentationSupport(
        instance: VkInstance,
        physicalDevice: VkPhysicalDevice,
        queueFamilyIndex: Uint32,
    ) -> ::core::primitive::bool;
}

apply_cfg!(#[cfg(feature = "use-ash-v0-38")] => {
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::AllocationCallbacks::<'static>` from the `ash` crate. Otherwise it's an opaque type. <div class="warning">The `'static` lifetime is too long. `ash` requires a lifetime for this, but as it's a C ffi type there's no way for `sdl3-sys` to set the correct lifetime.</div>
    pub type VkAllocationCallbacks = ::ash_v0_38::vk::AllocationCallbacks::<'static>;
});

apply_cfg!(#[cfg(not(feature = "use-ash-v0-38"))] => {
    #[cfg_attr(all(feature = "nightly", doc), doc(cfg(all())))]
    /// (`sdl3-sys`) Enable a `use-ash-*` feature to alias this to `vk::AllocationCallbacks::<'static>` from the `ash` crate. Otherwise it's an opaque type. <div class="warning">The `'static` lifetime is too long. `ash` requires a lifetime for this, but as it's a C ffi type there's no way for `sdl3-sys` to set the correct lifetime.</div>
    #[repr(C)]
    pub struct VkAllocationCallbacks { _opaque: [::core::primitive::u8; 0] }
});

#[cfg(doc)]
use crate::everything::*;