logo
pub struct PhysicalDevice<'a> { /* private fields */ }
Expand description

Represents one of the available devices on this machine.

This struct simply contains a pointer to an instance and a number representing the physical device. You are therefore encouraged to pass this around by value instead of by reference.

Example

use vulkano::device::physical::PhysicalDevice;

for physical_device in PhysicalDevice::enumerate(&instance) {
    print_infos(physical_device);
}

fn print_infos(dev: PhysicalDevice) {
    println!("Name: {}", dev.properties().device_name);
}

Implementations

Returns an iterator that enumerates the physical devices available.

Example
use vulkano::device::physical::PhysicalDevice;

for physical_device in PhysicalDevice::enumerate(&instance) {
    println!("Available device: {}", physical_device.properties().device_name);
}

Returns a physical device from its index. Returns None if out of range.

Indices range from 0 to the number of devices.

Example
use vulkano::instance::Instance;
use vulkano::instance::InstanceExtensions;
use vulkano::device::physical::PhysicalDevice;
use vulkano::Version;

let instance = Instance::new(Default::default()).unwrap();
let first_physical_device = PhysicalDevice::from_index(&instance, 0).unwrap();

Returns the instance corresponding to this physical device.

Example
use vulkano::device::physical::PhysicalDevice;

fn do_something(physical_device: PhysicalDevice) {
    let _loaded_extensions = physical_device.instance().enabled_extensions();
    // ...
}

Returns the index of the physical device in the physical devices list.

This index never changes and can be used later to retrieve a PhysicalDevice from an instance and an index.

Returns the version of Vulkan supported by this device.

Unlike the api_version property, which is the version reported by the device directly, this function returns the version the device can actually support, based on the instance’s, max_api_version.

Returns the extensions that are supported by this physical device.

Returns the extensions that must be enabled as a minimum when creating a Device from this physical device.

Returns the properties reported by the device.

Returns the features that are supported by this physical device.

Retrieves the external memory properties supported for buffers with a given configuration.

Returns None if the instance API version is less than 1.1 and the khr_external_memory_capabilities extension is not enabled on the instance.

Retrieves the properties of a format when used by this physical device.

Retrieves the external handle properties supported for semaphores with a given configuration.

Returns None if the instance API version is less than 1.1 and the khr_external_semaphore_capabilities extension is not enabled on the instance.

Returns the properties supported for images with a given image configuration.

Some is returned if the configuration is supported, None if it is not.

Panics
  • Panics if image_format_info.format is None.

Builds an iterator that enumerates all the memory types on this physical device.

Returns the memory type with the given index, or None if out of range.

Builds an iterator that enumerates all the memory heaps on this physical device.

Returns the memory heap with the given index, or None if out of range.

Builds an iterator that enumerates all the queue families on this physical device.

Returns the queue family with the given index, or None if out of range.

Returns the capabilities that are supported by the physical device for the given surface.

Panic
  • Panics if the physical device and the surface don’t belong to the same instance.

Returns the combinations of format and color space that are supported by the physical device for the given surface.

Panic
  • Panics if the physical device and the surface don’t belong to the same instance.

Returns the present modes that are supported by the physical device for the given surface.

Panic
  • Panics if the physical device and the surface don’t belong to the same instance.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The type of the object.

Returns a reference to the object.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.