pub struct QueueFamilyInfo { /* private fields */ }
Expand description

The logical device constructor uses an array of these structs to build the Vulkan DeviceQueueCreateInfo structs.

It’s convenient to use this wrapper instead of the raw DeviceQueueCreateInfo structs because the raw structs include a pointer to an array of priorities. It can be unwieldy to handle the raw pointer without introducing memory safety problems, so this struct owns a vector of priority values.

Examples

use ccthw_ash_instance::QueueFamilyInfo;

let mut queue_family_info = QueueFamilyInfo::new(2);
queue_family_info.add_queue_priority(1.0);

// NOTE - create_info is only valid while QueueFamilyInfo exists and no
//        additional calls to add_queue_priority are made.
let create_info = unsafe { queue_family_info.as_queue_create_info() };
println!("{:#?}", create_info);

Implementations§

source§

impl QueueFamilyInfo

source

pub fn new(queue_family_index: u32) -> Self

Create a new instance with no queue priorities.

Params
  • queue_family_index - index for the underlying queue family. This comes from enumerating the physical devices queue family properties.
source

pub fn add_queue_priority(&mut self, priority: f32)

Add a queue with the given priority.

Params
  • priority - should be between 0.0 and 1.0. Implementations are allowed to give more resources to higher-priority queues, but it isn’t required. If you don’t have a good reason to do otherwise, 1.0 is a reasonable choice.
source

pub unsafe fn as_queue_create_info(&self) -> DeviceQueueCreateInfo

Get a DeviceQueueCreateInfo struct based on the number of queue priorities specified for this queue family.

Safety

Unsafe because the device queue create info struct contains a pointer to the queue_priorities vector. This means that if any queue priorities are added AFTER calling this function, then using the struct will cause undefined behavior.

Trait Implementations§

source§

impl Clone for QueueFamilyInfo

source§

fn clone(&self) -> QueueFamilyInfo

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 Debug for QueueFamilyInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.