[][src]Struct nobs_vk::device::Builder

pub struct Builder { /* fields omitted */ }

Implements the builder pattern for Device

Configures validation layers, used extensions, used queues and surface

Example

  • Create an instance (see here)
  • Enumerates all physical devices and picks the first one.
  • Creates a builder from the physical device and cofigures it
  • Finally create will create the device and set up the queues
#[macro_use]
extern crate nobs_vk as vk;
// create instance ...
let (pdevice, device) = vk::device::PhysicalDevice::enumerate_all(inst.handle)
  .remove(0)
  .into_device()
  .add_queue(vk::device::QueueProperties {
    present: false,
    graphics: true,
    compute: true,
    transfer: true,
  }).create()
  .expect("device creation failed");

Methods

impl Builder[src]

pub fn from_physical_device(physical_device: PhysicalDevice) -> Builder[src]

Creates a device builder from the physical device.

The physical device is returned as the first item of the tuple in create again.

pub fn add_layer(&mut self, name: &str) -> &mut Self[src]

Adds a layer, if it is supported

pub fn add_layers(&mut self, names: &[&str]) -> &mut Self[src]

Adds layers, if they are supported

pub fn add_extension(&mut self, name: &str) -> &mut Self[src]

Adds an extension, if it is supported

pub fn add_extensions(&mut self, names: &[&str]) -> &mut Self[src]

Adds extensions, if they are supported

pub fn add_queue(&mut self, properties: QueueProperties) -> &mut Self[src]

Adds a queue with the requested properties

pub fn surface(&mut self, surface: SurfaceKHR) -> &mut Self[src]

Specify a surface for devices that can present to a window

pub fn create(&mut self) -> Result<(PhysicalDevice, Device), Error>[src]

Creates the device

Returns

A tuple with the PhysicalDevice from which the builder was created and the new Device.

This function fails if

  • A queue that was specified with add_queue is not supported
  • The vk::CreateDevice command fails

Auto Trait Implementations

impl Send for Builder

impl Sync for Builder

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.