Debian Codegraph @

src/entry.rs

raw symbols SCIP
1 use craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::instancerust-analyzer cargo ash 0.38.0+1.3.281 instance/::Instancerust-analyzer cargo ash 0.38.0+1.3.281 instance/Instance#;
2 #[cfg(doc)]
3 use craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::khrrust-analyzer cargo ash 0.38.0+1.3.281 extensions_generated/khr/;
4 use craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::preluderust-analyzer cargo ash 0.38.0+1.3.281 prelude/::*;
5 use craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/;
6 use craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::RawPtrrust-analyzer cargo ash 0.38.0+1.3.281 RawPtr#;
7 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#;
8 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/;
9 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/;
10 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/;
11 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/;
12
13 #[cfg(feature = "loaded")]
14 use libloadingrust-analyzer cargo libloading 0.8.9 crate/::Libraryrust-analyzer cargo libloading 0.8.9 safe/Library#;
15
16 /// Holds the Vulkan functions independent of a particular instance
17 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
18 pub struct Entryrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry# {
19 static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#static_fn.: craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::StaticFnrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#,
20 entry_fn_1_0rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_0.: craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::EntryFnV1_0rust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_0#,
21 entry_fn_1_1rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_1.: craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::EntryFnV1_1rust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_1#,
22 #[cfg(feature = "loaded")]
23 _lib_guardrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#_lib_guard.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::syncrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Libraryrust-analyzer cargo libloading 0.8.9 safe/Library#>>,
24 }
25
26 /// Vulkan core 1.0
27 impl Entryrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry# {
28 /// Load default Vulkan library for the current platform
29 ///
30 /// Prefer this over [`linked()`][Self::linked()] when your application can gracefully handle
31 /// environments that lack Vulkan support, and when the build environment might not have Vulkan
32 /// development packages installed (e.g. the Vulkan SDK, or Ubuntu's `libvulkan-dev`).
33 ///
34 /// # Safety
35 ///
36 /// `dlopen`ing native libraries is inherently unsafe. The safety guidelines
37 /// for [`Library::new()`] and [`Library::get()`] apply here.
38 ///
39 /// No Vulkan functions loaded directly or indirectly from this [`Entry`]
40 /// may be called after it is [dropped][drop()].
41 ///
42 /// # Example
43 ///
44 /// ```no_run
45 /// use ash::{vk, Entry};
46 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
47 /// let entry = unsafe { Entry::load()? };
48 /// let app_info = vk::ApplicationInfo {
49 /// api_version: vk::make_api_version(0, 1, 0, 0),
50 /// ..Default::default()
51 /// };
52 /// let create_info = vk::InstanceCreateInfo {
53 /// p_application_info: &app_info,
54 /// ..Default::default()
55 /// };
56 /// let instance = unsafe { entry.create_instance(&create_info, None)? };
57 /// # Ok(()) }
58 /// ```
59 #[cfg(feature = "loaded")]
60 #[cfg_attr(docsrs, doc(cfg(feature = "loaded")))]
61 pub unsafe fn loadrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]load().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry], LoadingErrorrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#> {
62 #[cfg(windows)]
63 const LIB_PATH: &str = "vulkan-1.dll";
64
65 #[cfg(all(
66 unix,
67 not(any(
68 target_os = "macos",
69 target_os = "ios",
70 target_os = "android",
71 target_os = "fuchsia"
72 ))
73 ))]
74 const LIB_PATHrust-analyzer cargo ash 0.38.0+1.3.281 entry/LIB_PATH.: &str = "libvulkan.so.1";
75
76 #[cfg(any(target_os = "android", target_os = "fuchsia"))]
77 const LIB_PATH: &str = "libvulkan.so";
78
79 #[cfg(any(target_os = "macos", target_os = "ios"))]
80 const LIB_PATH: &str = "libvulkan.dylib";
81
82 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]::load_fromrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]load_from().(LIB_PATHrust-analyzer cargo ash 0.38.0+1.3.281 entry/LIB_PATH.)
83 }
84
85 /// Load entry points from a Vulkan loader linked at compile time
86 ///
87 /// Compared to [`load()`][Self::load()], this is infallible, but requires that the build
88 /// environment have Vulkan development packages installed (e.g. the Vulkan SDK, or Ubuntu's
89 /// `libvulkan-dev`), and prevents the resulting binary from starting in environments that do not
90 /// support Vulkan.
91 ///
92 /// Note that instance/device functions are still fetched via `vkGetInstanceProcAddr` and
93 /// `vkGetDeviceProcAddr` for maximum performance.
94 ///
95 /// Any Vulkan function acquired directly or indirectly from this [`Entry`] may be called after it
96 /// is [dropped][drop()].
97 ///
98 /// # Example
99 ///
100 /// ```no_run
101 /// use ash::{vk, Entry};
102 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
103 /// let entry = Entry::linked();
104 /// let app_info = vk::ApplicationInfo {
105 /// api_version: vk::make_api_version(0, 1, 0, 0),
106 /// ..Default::default()
107 /// };
108 /// let create_info = vk::InstanceCreateInfo {
109 /// p_application_info: &app_info,
110 /// ..Default::default()
111 /// };
112 /// let instance = unsafe { entry.create_instance(&create_info, None)? };
113 /// # Ok(()) }
114 /// ```
115 #[cfg(feature = "linked")]
116 #[cfg_attr(docsrs, doc(cfg(feature = "linked")))]
117 pub fn linkedrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]linked().() -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry] {
118 // Sound because we're linking to Vulkan, which provides a vkGetInstanceProcAddr that has
119 // defined behavior in this use.
120 unsafe {
121 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]::from_static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]from_static_fn().(craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::StaticFnrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn# {
122 get_instance_proc_addrrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#get_instance_proc_addr.: vkGetInstanceProcAddrrust-analyzer cargo ash 0.38.0+1.3.281 vkGetInstanceProcAddr().,
123 })
124 }
125 }
126
127 /// Load Vulkan library at `path`
128 ///
129 /// # Safety
130 ///
131 /// `dlopen`ing native libraries is inherently unsafe. The safety guidelines
132 /// for [`Library::new()`] and [`Library::get()`] apply here.
133 ///
134 /// No Vulkan functions loaded directly or indirectly from this [`Entry`]
135 /// may be called after it is [dropped][drop()].
136 #[cfg(feature = "loaded")]
137 #[cfg_attr(docsrs, doc(cfg(feature = "loaded")))]
138 pub unsafe fn load_fromrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]load_from().(path: impl AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry], LoadingErrorrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#> {
139 let lib = Libraryrust-analyzer cargo libloading 0.8.9 safe/Library#::newrust-analyzer cargo libloading 0.8.9 safe/impl#[Library]new().(path)
140 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(LoadingErrorrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#::LibraryLoadFailurerust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#LibraryLoadFailure#)
141 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::syncrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
142
143 let static_fn = craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::StaticFnrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#::load_checkedrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[`crate::StaticFn`]load_checked().(|name| {
144 lib.getrust-analyzer cargo libloading 0.8.9 safe/impl#[Library]get().(name.to_bytes_with_nulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]to_bytes_with_nul().())
145 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|symbol| *rust-analyzer cargo libloading 0.8.9 safe/impl#[`Symbol<'_, T>`][Deref]deref().symbol)
146 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().())
147 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
148
149 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry] {
150 _lib_guardrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#_lib_guard.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(lib),
151 ..Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]::from_static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]from_static_fn().(static_fn)
152 })
153 }
154
155 /// Load entry points based on an already-loaded [`crate::StaticFn`]
156 ///
157 /// # Safety
158 ///
159 /// `static_fn` must contain valid function pointers that comply with the semantics specified
160 /// by Vulkan 1.0, which must remain valid for at least the lifetime of the returned [`Entry`].
161 pub unsafe fn from_static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]from_static_fn().(static_fn: craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::StaticFnrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#) -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry] {
162 let load_fn = move |name: &ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#| {
163 memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::transmuterust-analyzer cargo core https://github.com/rust-lang/rust/library/core intrinsics/transmute().((static_fn.get_instance_proc_addrrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#get_instance_proc_addr.)(
164 vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Instancerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Instance#::nullrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/impl#[Instance]null().(),
165 name.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(),
166 ))
167 };
168
169 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]::from_parts_1_1rust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]from_parts_1_1().(
170 static_fn,
171 craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::EntryFnV1_0rust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_0#::loadrust-analyzer cargo ash 0.38.0+1.3.281 tables/impl#[EntryFnV1_0]load().(load_fn),
172 craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::EntryFnV1_1rust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_1#::loadrust-analyzer cargo ash 0.38.0+1.3.281 tables/impl#[EntryFnV1_1]load().(load_fn),
173 )
174 }
175
176 #[inline]
177 pub fn from_parts_1_1rust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]from_parts_1_1().(
178 static_fn: craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::StaticFnrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#,
179 entry_fn_1_0: craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::EntryFnV1_0rust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_0#,
180 entry_fn_1_1: craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::EntryFnV1_1rust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_1#,
181 ) -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry] {
182 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry] {
183 static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#static_fn.,
184 entry_fn_1_0rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_0.,
185 entry_fn_1_1rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_1.,
186 #[cfg(feature = "loaded")]
187 _lib_guardrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#_lib_guard.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
188 }
189 }
190
191 #[inline]
192 pub fn fp_v1_0rust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]fp_v1_0().(&self) -> &craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::EntryFnV1_0rust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_0# {
193 &self.entry_fn_1_0rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_0.
194 }
195
196 #[inline]
197 pub fn static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]static_fn().(&self) -> &craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::StaticFnrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn# {
198 &self.static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#static_fn.
199 }
200
201 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceVersion.html>
202 ///
203 /// # Example
204 ///
205 /// ```no_run
206 /// # use ash::{Entry, vk};
207 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
208 /// let entry = Entry::linked();
209 /// match unsafe { entry.try_enumerate_instance_version() }? {
210 /// // Vulkan 1.1+
211 /// Some(version) => {
212 /// let major = vk::version_major(version);
213 /// let minor = vk::version_minor(version);
214 /// let patch = vk::version_patch(version);
215 /// },
216 /// // Vulkan 1.0
217 /// None => {},
218 /// }
219 /// # Ok(()) }
220 /// ```
221 #[inline]
222 pub unsafe fn try_enumerate_instance_versionrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]try_enumerate_instance_version().(&self) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>> {
223 let enumerate_instance_version: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::PFN_vkEnumerateInstanceVersionrust-analyzer cargo ash 0.38.0+1.3.281 vk/features/PFN_vkEnumerateInstanceVersion#> = {
224 let name = ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_bytes_with_nul_uncheckedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_bytes_with_nul_unchecked().(b"vkEnumerateInstanceVersion\0");
225 memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::transmuterust-analyzer cargo core https://github.com/rust-lang/rust/library/core intrinsics/transmute().((self.static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#static_fn..get_instance_proc_addrrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#get_instance_proc_addr.)(
226 vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Instancerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Instance#::nullrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/impl#[Instance]null().(),
227 name.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(),
228 ))
229 };
230 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(enumerate_instance_version) = enumerate_instance_version {
231 let mut api_version = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::MaybeUninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/MaybeUninit#::uninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]uninit().();
232 (enumerate_instance_version)(api_version.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]as_mut_ptr().())
233 .assume_init_on_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]assume_init_on_success().(api_version)
234 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#)
235 } else {
236 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
237 }
238 }
239
240 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateInstance.html>
241 ///
242 /// # Safety
243 ///
244 /// The resulting [`Instance`] and any function-pointer objects (e.g. [`Device`][crate::Device]
245 /// and extensions like [`khr::swapchain::Device`]) loaded from it may not be used after
246 /// this [`Entry`] object is dropped, unless it was crated using [`Entry::linked()`] or
247 /// [`Entry::from_parts_1_1()`].
248 ///
249 /// [`Instance`] does _not_ implement [drop][drop()] semantics and can only be destroyed via
250 /// [`destroy_instance()`][Instance::destroy_instance()].
251 #[inline]
252 pub unsafe fn create_instancerust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]create_instance().(
253 &self,
254 create_info: &vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::InstanceCreateInforust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/InstanceCreateInfo#<'_>,
255 allocation_callbacks: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::AllocationCallbacksrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/AllocationCallbacks#<'_>>,
256 ) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<Instancerust-analyzer cargo ash 0.38.0+1.3.281 instance/Instance#> {
257 let mut instance = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::MaybeUninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/MaybeUninit#::uninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]uninit().();
258 let instance = (self.entry_fn_1_0rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_0..create_instancerust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_0#create_instance.)(
259 create_info,
260 allocation_callbacks.as_raw_ptrrust-analyzer cargo ash 0.38.0+1.3.281 impl#[`Option<&'r T>`][`RawPtr<T>`]as_raw_ptr().(),
261 instance.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]as_mut_ptr().(),
262 )
263 .assume_init_on_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]assume_init_on_success().(instance)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
264 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Instancerust-analyzer cargo ash 0.38.0+1.3.281 instance/Instance#::loadrust-analyzer cargo ash 0.38.0+1.3.281 instance/impl#[Instance]load().(&self.static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#static_fn., instance))
265 }
266
267 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceLayerProperties.html>
268 #[inline]
269 pub unsafe fn enumerate_instance_layer_propertiesrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]enumerate_instance_layer_properties().(&self) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::LayerPropertiesrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/LayerProperties#>> {
270 read_into_uninitialized_vectorrust-analyzer cargo ash 0.38.0+1.3.281 prelude/read_into_uninitialized_vector().(|count, data| {
271 (self.entry_fn_1_0rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_0..enumerate_instance_layer_propertiesrust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_0#enumerate_instance_layer_properties.)(count, data)
272 })
273 }
274
275 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html>
276 #[inline]
277 pub unsafe fn enumerate_instance_extension_propertiesrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]enumerate_instance_extension_properties().(
278 &self,
279 layer_name: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#>,
280 ) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::ExtensionPropertiesrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/ExtensionProperties#>> {
281 read_into_uninitialized_vectorrust-analyzer cargo ash 0.38.0+1.3.281 prelude/read_into_uninitialized_vector().(|count, data| {
282 (self.entry_fn_1_0rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_0..enumerate_instance_extension_propertiesrust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_0#enumerate_instance_extension_properties.)(
283 layer_name.map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().(), |str| str.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().()),
284 count,
285 data,
286 )
287 })
288 }
289
290 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetInstanceProcAddr.html>
291 #[inline]
292 pub unsafe fn get_instance_proc_addrrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]get_instance_proc_addr().(
293 &self,
294 instance: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Instancerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Instance#,
295 p_name: *const ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#,
296 ) -> vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::PFN_vkVoidFunctionrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/PFN_vkVoidFunction# {
297 (self.static_fnrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#static_fn..get_instance_proc_addrrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#get_instance_proc_addr.)(instance, p_name)
298 }
299 }
300
301 /// Vulkan core 1.1
302 impl Entryrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry# {
303 #[inline]
304 pub fn fp_v1_1rust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]fp_v1_1().(&self) -> &craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::EntryFnV1_1rust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_1# {
305 &self.entry_fn_1_1rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_1.
306 }
307
308 #[deprecated = "This function is unavailable and therefore panics on Vulkan 1.0, please use `try_enumerate_instance_version()` instead"]
309 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceVersion.html>
310 ///
311 /// Please use [`try_enumerate_instance_version()`][Self::try_enumerate_instance_version()] instead.
312 #[inline]
313 pub unsafe fn enumerate_instance_versionrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]enumerate_instance_version().(&self) -> VkResultrust-analyzer cargo ash 0.38.0+1.3.281 prelude/VkResult#<u32> {
314 let mut api_version = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::MaybeUninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/MaybeUninit#::uninitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]uninit().();
315 (self.entry_fn_1_1rust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry#entry_fn_1_1..enumerate_instance_versionrust-analyzer cargo ash 0.38.0+1.3.281 tables/EntryFnV1_1#enumerate_instance_version.)(api_version.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/maybe_uninit/impl#[`MaybeUninit<T>`]as_mut_ptr().())
316 .assume_init_on_successrust-analyzer cargo ash 0.38.0+1.3.281 prelude/impl#[`vk::Result`]assume_init_on_success().(api_version)
317 }
318 }
319
320 #[cfg(feature = "linked")]
321 #[cfg_attr(docsrs, doc(cfg(feature = "linked")))]
322 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Entryrust-analyzer cargo ash 0.38.0+1.3.281 entry/Entry# {
323 #[inline]
324 fn defaultrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry][Default]default().() -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry][Default] {
325 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry][Default]::linkedrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[Entry]linked().()
326 }
327 }
328
329 impl craterust-analyzer cargo ash 0.38.0+1.3.281 crate/::StaticFnrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn# {
330 pub fn load_checkedrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[`crate::StaticFn`]load_checked().<F>(mut _f: F) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[`crate::StaticFn`], MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/MissingEntryPoint#>
331 where
332 F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(&ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#) -> *const ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::c_voidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_void#,
333 {
334 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[`crate::StaticFn`] {
335 get_instance_proc_addrrust-analyzer cargo ash 0.38.0+1.3.281 tables/StaticFn#get_instance_proc_addr.: unsafe {
336 let cname = ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_bytes_with_nul_uncheckedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_bytes_with_nul_unchecked().(b"vkGetInstanceProcAddr\0");
337 let val = _f(cname);
338 if val.is_nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]is_null().() {
339 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/MissingEntryPoint#);
340 } else {
341 memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::transmuterust-analyzer cargo core https://github.com/rust-lang/rust/library/core intrinsics/transmute().(val)
342 }
343 },
344 })
345 }
346 }
347
348 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
349 pub struct MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/MissingEntryPoint#;
350 impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/MissingEntryPoint# {
351 fn fmtrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[MissingEntryPoint][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
352 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Cannot load `vkGetInstanceProcAddr` symbol from library")
353 }
354 }
355 #[cfg(feature = "std")] // TODO: implement when error_in_core is stabilized
356 impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/MissingEntryPoint# {}
357
358 #[cfg(feature = "linked")]
359 extern "system" {
360 fn vkGetInstanceProcAddrrust-analyzer cargo ash 0.38.0+1.3.281 vkGetInstanceProcAddr().(
361 instance: vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::Instancerust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/Instance#,
362 name: *const ffirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/::c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#,
363 ) -> vkrust-analyzer cargo ash 0.38.0+1.3.281 vk/::PFN_vkVoidFunctionrust-analyzer cargo ash 0.38.0+1.3.281 vk/definitions/PFN_vkVoidFunction#;
364 }
365
366 #[cfg(feature = "loaded")]
367 mod loadedrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/ {
368
369 use superrust-analyzer cargo ash 0.38.0+1.3.281 entry/::*;
370
371 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
372 #[cfg_attr(docsrs, doc(cfg(feature = "loaded")))]
373 pub enum LoadingErrorrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError# {
374 LibraryLoadFailurerust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#LibraryLoadFailure#(libloadingrust-analyzer cargo libloading 0.8.9 crate/::Errorrust-analyzer cargo libloading 0.8.9 error/Error#),
375 MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#MissingEntryPoint#(MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/MissingEntryPoint#),
376 }
377
378 impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for LoadingErrorrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError# {
379 fn fmtrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
380 match self {
381 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][Display]::LibraryLoadFailurerust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#LibraryLoadFailure#(err) => fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo libloading 0.8.9 error/impl#[Error][Display]fmt().(err, f),
382 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][Display]::MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#MissingEntryPoint#(err) => fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo ash 0.38.0+1.3.281 entry/impl#[MissingEntryPoint][Display]fmt().(err, f),
383 }
384 }
385 }
386
387 #[cfg(feature = "std")]
388 impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for LoadingErrorrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError# {
389 fn sourcerust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> {
390 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(match self {
391 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][Error]::LibraryLoadFailurerust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#LibraryLoadFailure#(err) => err,
392 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][Error]::MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#MissingEntryPoint#(err) => err,
393 })
394 }
395 }
396
397 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/MissingEntryPoint#> for LoadingErrorrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError# {
398 fn fromrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][`From<MissingEntryPoint>`]from().(err: MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/MissingEntryPoint#) -> Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][`From<MissingEntryPoint>`] {
399 Selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/impl#[LoadingError][`From<MissingEntryPoint>`]::MissingEntryPointrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/LoadingError#MissingEntryPoint#(err)
400 }
401 }
402 }
403 #[cfg(feature = "loaded")]
404 pub use selfrust-analyzer cargo ash 0.38.0+1.3.281 entry/::loadedrust-analyzer cargo ash 0.38.0+1.3.281 entry/loaded/::*;