[][src]Struct nobs_vk::instance::Builder

pub struct Builder { /* fields omitted */ }

Builder for an Instance

Configures validation layers, application, engine name and used extensions for the new instance.

Creating an Instance will take ownership of the specified VkLib object. However it is still necessary to create it before the Builder, so that we can look up supported layers and extensions, while configuring.

Example

#[macro_use]
extern crate nobs_vk as vk;

let vk_lib = vk::VkLib::new();
let inst = vk::instance::new()
  .validate(vk::DEBUG_REPORT_ERROR_BIT_EXT | vk::DEBUG_REPORT_WARNING_BIT_EXT)
  .application("awesome app", make_version!(1, 0, 0))
  .engine("very fast with lots of PS", make_version!(1, 33, 7))
  // add extensions like this
  //.add_extension(vk::KHR_SURFACE_EXTENSION_NAME)
  //.add_extension(vk::KHR_XLIB_SURFACE_EXTENSION_NAME)
  .create(vk_lib)
  .expect("instance creation failed");

Methods

impl Builder[src]

pub fn validate(&mut self, flags: DebugReportFlagsEXT) -> &mut Self[src]

Enables or disables validation layers.

Arguments

  • flags - chooses between
    • 0 - validation disabled
    • other - automatically adds the VK_LAYER_LUNARG_standard_validation layer and configure the debug callback

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

Set the application name and version

Arguments

  • name - application name
  • version - application version, as created with make_version

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

Set the engine name and version

Arguments

  • name - engine name
  • version - engine version, as created with make_version

pub fn get_supported_layers() -> Vec<String>[src]

Retrieve a list of all supported layers on this system

Returns

The names of all supported layers in this vulkan instance.

The vk::EnumerateInstanceLayerProperties command can fail, in this case an empty list is returned

pub fn is_layer_supported(name: &str) -> bool[src]

Check if the specified name is a supported layer

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 get_supported_extensions(layer: Option<&str>) -> Vec<String>[src]

Retrieve a list of all supported extensions on this system

Returns

The names of all supported extensions in this vulkan instance.

The vk::EnumerateInstanceExtensionProperties command can fail, in this case an empty list is returned

pub fn is_extension_supported(layer: Option<&str>, name: &str) -> bool[src]

Check if the specified name is a supported extension

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 create(&mut self, vklib: Box<VkLib>) -> Result<Instance, Error>[src]

Create the instance from the current configuration

Returns

Instance creation can only fail, if the vk::CreateInstance call is unsuccessfull. In this case the vk::Error is returned.

Trait Implementations

impl Default for Builder[src]

fn default() -> Builder[src]

Initializes builder with no layers, no extensions and no validation

Auto Trait Implementations

impl Send for Builder

impl Sync for Builder

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<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.