ash

Struct Entry

Source
pub struct Entry { /* private fields */ }
Expand description

Holds the Vulkan functions independent of a particular instance

Implementations§

Source§

impl Entry

Vulkan core 1.0

Source

pub fn linked() -> Self

Load entry points from a Vulkan loader linked at compile time

Compared to load, this is infallible, but requires that the build environment have Vulkan development packages installed (e.g. the Vulkan SDK, or Ubuntu’s libvulkan-dev), and prevents the resulting binary from starting in environments that do not support Vulkan.

Note that instance/device functions are still fetched via vkGetInstanceProcAddr and vkGetDeviceProcAddr for maximum performance.

use ash::{vk, Entry};
let entry = Entry::linked();
let app_info = vk::ApplicationInfo {
    api_version: vk::make_api_version(0, 1, 0, 0),
    ..Default::default()
};
let create_info = vk::InstanceCreateInfo {
    p_application_info: &app_info,
    ..Default::default()
};
let instance = unsafe { entry.create_instance(&create_info, None)? };
Source

pub unsafe fn from_static_fn(static_fn: StaticFn) -> Self

Load entry points based on an already-loaded vk::StaticFn

§Safety

static_fn must contain valid function pointers that comply with the semantics specified by Vulkan 1.0, which must remain valid for at least the lifetime of the returned Entry.

Source

pub fn fp_v1_0(&self) -> &EntryFnV1_0

Source

pub fn static_fn(&self) -> &StaticFn

Source

pub fn try_enumerate_instance_version(&self) -> VkResult<Option<u32>>

https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceVersion.html

let entry = Entry::linked();
match entry.try_enumerate_instance_version()? {
    // Vulkan 1.1+
    Some(version) => {
        let major = vk::version_major(version);
        let minor = vk::version_minor(version);
        let patch = vk::version_patch(version);
    },
    // Vulkan 1.0
    None => {},
}
Source

pub unsafe fn create_instance( &self, create_info: &InstanceCreateInfo, allocation_callbacks: Option<&AllocationCallbacks>, ) -> VkResult<Instance>

https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateInstance.html

§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.

Source

pub fn enumerate_instance_layer_properties( &self, ) -> VkResult<Vec<LayerProperties>>

Source

pub fn enumerate_instance_extension_properties( &self, layer_name: Option<&CStr>, ) -> VkResult<Vec<ExtensionProperties>>

Source

pub unsafe fn get_instance_proc_addr( &self, instance: Instance, p_name: *const c_char, ) -> PFN_vkVoidFunction

Source§

impl Entry

Vulkan core 1.1

Source

pub fn fp_v1_1(&self) -> &EntryFnV1_1

Source

pub fn enumerate_instance_version(&self) -> VkResult<u32>

👎Deprecated: This function is unavailable and therefore panics on Vulkan 1.0, please use try_enumerate_instance_version() instead
Source§

impl Entry

Vulkan core 1.2

Source

pub fn fp_v1_2(&self) -> &EntryFnV1_2

Source§

impl Entry

Vulkan core 1.3

Source

pub fn fp_v1_3(&self) -> &EntryFnV1_3

Trait Implementations§

Source§

impl Clone for Entry

Source§

fn clone(&self) -> Entry

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Entry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Entry

§

impl RefUnwindSafe for Entry

§

impl Send for Entry

§

impl Sync for Entry

§

impl Unpin for Entry

§

impl UnwindSafe for Entry

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.