diff --git a/ash-window/src/lib.rs b/ash-window/src/lib.rs index 70b14bf..83fc84f 100644 --- a/ash-window/src/lib.rs +++ b/ash-window/src/lib.rs @@ -11,9 +11,9 @@ use ash::extensions::ext; // portability extensions /// /// # Safety /// -/// In order for the created `SurfaceKHR` to be valid for the duration of its -/// usage, the `Instance` this was called on must be dropped later than the -/// resulting `SurfaceKHR`. +/// In order for the created [`vk::SurfaceKHR`] to be valid for the duration of its +/// usage, the [`Instance`] this was called on must be dropped later than the +/// resulting [`vk::SurfaceKHR`]. pub unsafe fn create_surface( entry: &EntryCustom, instance: &Instance, diff --git a/ash/src/device.rs b/ash/src/device.rs index 0b397c3..e49004e 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -489,7 +489,7 @@ impl Device { .result_with_success(event) } - /// Returns true if the event was set, and false if the event was reset, otherwise it will + /// Returns [`true`] if the event was set, and [`false`] if the event was reset, otherwise it will /// return the error code. #[doc = ""] pub unsafe fn get_event_status(&self, event: vk::Event) -> VkResult { diff --git a/ash/src/entry.rs b/ash/src/entry.rs index 644ecee..c7009d5 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -10,7 +10,12 @@ use std::os::raw::c_char; use std::os::raw::c_void; use std::ptr; -/// Function loader +/// Holds a custom type `L` to load symbols from (usually a handle to a `dlopen`ed library), +/// the [`vkGetInstanceProcAddr`][vk::StaticFn::get_instance_proc_addr()] loader function from +/// this library (in [`vk::StaticFn`]), and Vulkan's "entry point" functions (resolved with `NULL` +/// `instance`) as listed in [`vkGetInstanceProcAddr`'s description]. +/// +/// [`vkGetInstanceProcAddr`'s description]: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetInstanceProcAddr.html#_description #[derive(Clone)] pub struct EntryCustom { static_fn: vk::StaticFn, @@ -95,9 +100,9 @@ impl EntryCustom { #[doc = ""] /// /// # Safety - /// In order for the created `Instance` to be valid for the duration of its - /// usage, the `Entry` this was called on must be dropped later than the - /// resulting `Instance`. + /// In order for the created [`Instance`] to be valid for the duration of its + /// usage, the [`Entry`](Self) this was called on must be dropped later than the + /// resulting [`Instance`]. pub unsafe fn create_instance( &self, create_info: &vk::InstanceCreateInfo, @@ -170,6 +175,8 @@ impl EntryCustom { #[deprecated = "This function is unavailable and therefore panics on Vulkan 1.0, please use `try_enumerate_instance_version` instead"] #[doc = ""] + /// + /// Please use [`Self::try_enumerate_instance_version`] instead. pub fn enumerate_instance_version(&self) -> VkResult { unsafe { let mut api_version = 0; diff --git a/ash/src/entry_libloading.rs b/ash/src/entry_libloading.rs index 1ea476e..3e9386a 100644 --- a/ash/src/entry_libloading.rs +++ b/ash/src/entry_libloading.rs @@ -22,9 +22,6 @@ const LIB_PATH: &str = "libvulkan.so"; #[cfg(any(target_os = "macos", target_os = "ios"))] const LIB_PATH: &str = "libvulkan.dylib"; -/// Function loader -pub type Entry = EntryCustom>; - #[derive(Debug)] pub enum LoadingError { LibraryLoadFailure(libloading::Error), @@ -55,7 +52,10 @@ impl From for LoadingError { } } -impl EntryCustom> { +/// Default function loader +pub type Entry = EntryCustom>; + +impl Entry { /// Load default Vulkan library for the current platform /// /// # Safety diff --git a/ash/src/instance.rs b/ash/src/instance.rs index 04d3018..9a3c78f 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -246,9 +246,9 @@ impl Instance { #[doc = ""] /// /// # Safety - /// In order for the created `Device` to be valid for the duration of its - /// usage, the `Instance` this was called on must be dropped later than the - /// resulting `Device`. + /// In order for the created [`Device`] to be valid for the duration of its + /// usage, the [`Instance`] this was called on must be dropped later than the + /// resulting [`Device`]. pub unsafe fn create_device( &self, physical_device: vk::PhysicalDevice, diff --git a/ash/src/lib.rs b/ash/src/lib.rs index 074fa86..c6ca4eb 100644 --- a/ash/src/lib.rs +++ b/ash/src/lib.rs @@ -25,6 +25,12 @@ //! # Ok(()) } //! ``` //! +//! ## Getting started +//! Load the Vulkan library at the default location using [`Entry::new()`][EntryCustom<_>::new()], +//! or at a custom location using [`Entry::with_library("path/to/vulkan")`][EntryCustom<_>::with_library()]. +//! These loaders use [`libloading`]. If you wish to perform function loading yourself +//! call [`EntryCustom::new_custom()`] with a closure turning function names +//! into function pointers. pub use crate::device::Device; pub use crate::entry::{EntryCustom, InstanceError}; @@ -39,10 +45,12 @@ mod entry_libloading; mod instance; pub mod prelude; pub mod util; +/// Raw Vulkan bindings and types, generated from `vk.xml` #[macro_use] pub mod vk; // macros of vk need to be defined beforehand +/// Wrappers for Vulkan extensions pub mod extensions; pub trait RawPtr { diff --git a/ash/src/util.rs b/ash/src/util.rs index 48591d8..8a7465f 100644 --- a/ash/src/util.rs +++ b/ash/src/util.rs @@ -5,12 +5,12 @@ use std::mem::size_of; use std::os::raw::c_void; use std::{io, slice}; -/// `Align` handles dynamic alignment. The is useful for dynamic uniform buffers where +/// [`Align`] handles dynamic alignment. The is useful for dynamic uniform buffers where /// the alignment might be different. For example a 4x4 f32 matrix has a size of 64 bytes /// but the min alignment for a dynamic uniform buffer might be 256 bytes. A slice of `&[Mat4x4]` /// has a memory layout of `[[64 bytes], [64 bytes], [64 bytes]]`, but it might need to have a memory /// layout of `[[256 bytes], [256 bytes], [256 bytes]]`. -/// `Align::copy_from_slice` will copy a slice of `&[T]` directly into the host memory without +/// [`Align::copy_from_slice`] will copy a slice of `&[T]` directly into the host memory without /// an additional allocation and with the correct alignment. #[derive(Debug, Clone)] pub struct Align {