DeviceBuilder

Struct DeviceBuilder 

Source
pub struct DeviceBuilder<'a> { /* private fields */ }
Expand description

Allows to easily create an erupt::DeviceLoader and queues.

Implementations§

Source§

impl<'a> DeviceBuilder<'a>

Source

pub fn new() -> Self

Create a new device builder.

Source

pub fn with_loader_builder(loader_builder: DeviceLoaderBuilder<'a>) -> Self

Create a new device builder with a custom DeviceLoaderBuilder.

Source

pub fn custom_queue_setup( self, custom_queue_setup: Box<CustomQueueSetupFn>, ) -> Self

Specify a custom queue setup.

§Default setup
|physical_device, queue_family_criteria, queue_family_properties| {
    let mut queue_setup = HashSet::with_capacity(queue_family_criteria.len());
    for queue_family_criteria in queue_family_criteria {
        match queue_family_criteria.choose_queue_family(
            instance,
            physical_device,
            queue_family_properties,
            surface,
        )? {
            Some((idx, _properties)) => {
                queue_setup.insert(QueueSetup::simple(idx, 1));
            }
            None => return Ok(None),
        }
    }

    Ok(Some(queue_setup))
}
Source

pub fn additional_suitability( self, additional_suitability: Box<AdditionalSuitabilityFn>, ) -> Self

Allows to specify custom criteria for a physical device. This can for example be used to check for limits.

Source

pub fn for_surface(self, surface: SurfaceKHR) -> Self

Surface to use to check for presentation support in queue families.

Source

pub fn prioritise_device_types(self, types: &[PhysicalDeviceType]) -> Self

Prioritise devices of these types when choosing a device. The further ahead, the higher the priority.

Source

pub fn queue_family(self, criteria: QueueFamilyCriteria) -> Self

The queue family chosen by the criteria will be enabled on the device.

Source

pub fn prefer_device_memory_size(self, size: DeviceSize) -> Self

Prefer a device which has at least one DEVICE_LOCAL memory heap with a minimum of size bytes of memory.

Source

pub fn require_device_memory_size(self, size: DeviceSize) -> Self

Require a device which has at least one DEVICE_LOCAL memory heap with a minimum of size bytes of memory.

Source

pub fn prefer_extension(self, extension: *const c_char) -> Self

Prefer a device which supports extension. The extension will only be enabled if it’s supported.

Source

pub fn require_extension(self, extension: *const c_char) -> Self

Require a device which supports extension. The extension will be enabled.

Source

pub fn prefer_version(self, major: u32, minor: u32) -> Self

Prefer a device which supports this version.

Source

pub fn prefer_version_raw(self, version: u32) -> Self

Prefer a device which supports this version.

Source

pub fn require_version(self, major: u32, minor: u32) -> Self

Require the device to support this version.

Source

pub fn require_version_raw(self, version: u32) -> Self

Require the device to support this version.

Source

pub fn require_features(self, features: &'a PhysicalDeviceFeatures2) -> Self

Require these features to be present for the device. The elements of the pointer chain will only be considered if possible. The features will be enabled.

Source

pub fn select_nth_unconditionally(self, n: usize) -> Self

Skip the selection logic and always select the physical device at the specified index.

Source

pub fn allocation_callbacks(self, allocator: AllocationCallbacks) -> Self

Allocation callback to use for internal Vulkan calls in the builder.

Source

pub unsafe fn build( self, instance: &'a InstanceLoader, instance_metadata: &InstanceMetadata, ) -> Result<(DeviceLoader, DeviceMetadata), DeviceCreationError>

Returns the erupt::DeviceLoader and DeviceMetadata, containing the handle of the used physical device handle and its properties, as wells as the enabled device extensions and used queue setups.

Trait Implementations§

Source§

impl<'a> Default for DeviceBuilder<'a>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a> Freeze for DeviceBuilder<'a>

§

impl<'a> !RefUnwindSafe for DeviceBuilder<'a>

§

impl<'a> !Send for DeviceBuilder<'a>

§

impl<'a> !Sync for DeviceBuilder<'a>

§

impl<'a> Unpin for DeviceBuilder<'a>

§

impl<'a> !UnwindSafe for DeviceBuilder<'a>

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