• Home
  • Raw
  • Download

Lines Matching +full:vulkan +full:- +full:loader

3 // <LICENSE-APACHE or
4 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT
5 // license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
10 //! Vulkan library loading system.
13 //! of Vulkan. A Vulkan implementation is defined as a single `vkGetInstanceProcAddr` function,
14 //! which can be accessed through the `Loader` trait.
16 //! This module provides various implementations of the `Loader` trait.
18 //! Once you have a type that implements `Loader`, you can create a `VulkanLibrary`
38 /// A loaded library containing a valid Vulkan implementation.
41 loader: Box<dyn Loader>, field
50 /// Loads the default Vulkan library for this system.
51 pub fn new() -> Result<Arc<Self>, LoadingError> { in new()
54 fn def_loader_impl() -> Result<Box<dyn Loader>, LoadingError> { in new()
55 let loader = crate::statically_linked_vulkan_loader!(); in new() localVariable
57 Ok(Box::new(loader)) in new()
61 fn def_loader_impl() -> Result<Box<dyn Loader>, LoadingError> { in new()
63 fn get_path() -> &'static Path { in new()
64 Path::new("vulkan-1.dll") in new()
67 fn get_path() -> &'static Path { in new()
71 fn get_path() -> &'static Path { in new()
75 fn get_path() -> &'static Path { in new()
79 let loader = unsafe { DynamicLibraryLoader::new(get_path())? }; in new() localVariable
81 Ok(Box::new(loader)) in new()
87 /// Loads a custom Vulkan library.
88 pub fn with_loader(loader: impl Loader + 'static) -> Result<Arc<Self>, LoadingError> { in with_loader()
90 loader in with_loader()
95 let api_version = unsafe { Self::get_api_version(&loader)? }; in with_loader()
103 loader: Box::new(loader), in with_loader()
111 unsafe fn get_api_version(loader: &impl Loader) -> Result<Version, VulkanError> { in get_api_version()
112 // Per the Vulkan spec: in get_api_version()
114 // Vulkan 1.0 implementation. Otherwise, the application can call vkEnumerateInstanceVersion in get_api_version()
115 // to determine the version of Vulkan. in get_api_version()
118 let func = loader.get_instance_proc_addr(ash::vk::Instance::null(), name.as_ptr()); in get_api_version()
139 ) -> Result<Vec<ExtensionProperties>, VulkanError> { in get_extension_properties()
174 /// Returns pointers to the raw global Vulkan functions of the library.
176 pub fn fns(&self) -> &EntryFunctions { in fns()
180 /// Returns the highest Vulkan version that is supported for instances.
182 pub fn api_version(&self) -> Version { in api_version()
188 pub fn extension_properties(&self) -> &[ExtensionProperties] { in extension_properties()
194 pub fn supported_extensions(&self) -> &InstanceExtensions { in supported_extensions()
223 ) -> Result<impl ExactSizeIterator<Item = LayerProperties>, OomError> { in layer_properties()
260 ) -> Result<Vec<ExtensionProperties>, VulkanError> { in layer_extension_properties()
269 ) -> Result<InstanceExtensions, VulkanError> { in supported_layer_extensions()
283 ) -> Result<InstanceExtensions, VulkanError> { in supported_extensions_with_layers()
292 /// Calls `get_instance_proc_addr` on the underlying loader.
298 ) -> ash::vk::PFN_vkVoidFunction { in get_instance_proc_addr()
299 self.loader.get_instance_proc_addr(instance, name) in get_instance_proc_addr()
303 /// Implemented on objects that grant access to a Vulkan implementation.
304 pub unsafe trait Loader: Send + Sync { interface
312 ) -> ash::vk::PFN_vkVoidFunction; in get_instance_proc_addr()
315 unsafe impl<T> Loader for T
318 T::Target: Loader,
324 ) -> ash::vk::PFN_vkVoidFunction { in get_instance_proc_addr()
329 impl Debug for dyn Loader { implementation
330 fn fmt(&self, _f: &mut Formatter<'_>) -> Result<(), FmtError> { in fmt()
335 /// Implementation of `Loader` that loads Vulkan from a dynamic library.
347 /// - The dynamic library must be a valid Vulkan implementation.
349 pub unsafe fn new(path: impl AsRef<Path>) -> Result<DynamicLibraryLoader, LoadingError> { in new()
363 unsafe impl Loader for DynamicLibraryLoader {
369 ) -> ash::vk::PFN_vkVoidFunction { in get_instance_proc_addr()
374 /// Expression that returns a loader that assumes that Vulkan is linked to the executable you're
390 ) -> ash::vk::PFN_vkVoidFunction;
394 unsafe impl Loader for StaticallyLinkedVulkanLoader {
399 ) -> ash::vk::PFN_vkVoidFunction {
408 /// Error that can happen when loading a Vulkan library.
411 /// Failed to load the Vulkan shared library.
419 fn source(&self) -> Option<&(dyn Error + 'static)> { in source()
429 fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { in fmt()
434 Self::LibraryLoadFailure(_) => "failed to load the Vulkan shared library", in fmt()
442 fn from(err: VulkanError) -> Self { in from()