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

Represents one of the available physical devices on this machine.

Examples

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

for physical_device in instance.enumerate_physical_devices().unwrap() {
    print_infos(&physical_device);
}

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

Implementations§

source§

impl PhysicalDevice

source

pub unsafe fn from_handle( instance: Arc<Instance>, handle: PhysicalDevice ) -> Result<Arc<Self>, VulkanError>

Creates a new PhysicalDevice from a raw object handle.

Safety
  • handle must be a valid Vulkan object handle created from instance.
source

pub fn instance(&self) -> &Arc<Instance>

Returns the instance that owns the physical device.

source

pub fn api_version(&self) -> Version

Returns the version of Vulkan supported by the physical 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.

source

pub fn properties(&self) -> &Properties

Returns the properties reported by the physical device.

source

pub fn extension_properties(&self) -> &[ExtensionProperties]

Returns the extension properties reported by the physical device.

source

pub fn supported_extensions(&self) -> &DeviceExtensions

Returns the extensions that are supported by the physical device.

source

pub fn supported_features(&self) -> &Features

Returns the features that are supported by the physical device.

source

pub fn memory_properties(&self) -> &MemoryProperties

Returns the memory properties reported by the physical device.

source

pub fn queue_family_properties(&self) -> &[QueueFamilyProperties]

Returns the queue family properties reported by the physical device.

source

pub unsafe fn directfb_presentation_support<D>( &self, queue_family_index: u32, dfb: *const D ) -> Result<bool, Box<ValidationError>>

Queries whether the physical device supports presenting to DirectFB surfaces from queues of the given queue family.

Safety
  • dfb must be a valid DirectFB IDirectFB handle.
source

pub fn display_properties<'a>( self: &'a Arc<Self> ) -> Result<Vec<Arc<Display>>, Validated<VulkanError>>

Returns the properties of displays attached to the physical device.

source

pub fn display_plane_properties( self: &Arc<Self> ) -> Result<Vec<DisplayPlaneProperties>, Validated<VulkanError>>

Returns the properties of the display planes of the physical device.

source

pub fn display_plane_supported_displays( self: &Arc<Self>, plane_index: u32 ) -> Result<Vec<Arc<Display>>, Validated<VulkanError>>

Returns the displays that are supported for the given plane index.

The index must be less than the number of elements returned by display_plane_properties.

source

pub fn external_buffer_properties( &self, info: ExternalBufferInfo ) -> Result<ExternalBufferProperties, Box<ValidationError>>

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

Instance API version must be at least 1.1, or the khr_external_memory_capabilities extension must be enabled on the instance.

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

source

pub fn external_fence_properties( &self, info: ExternalFenceInfo ) -> Result<ExternalFenceProperties, Box<ValidationError>>

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

The instance API version must be at least 1.1, or the khr_external_fence_capabilities extension must be enabled on the instance.

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

source

pub fn external_semaphore_properties( &self, info: ExternalSemaphoreInfo ) -> Result<ExternalSemaphoreProperties, Box<ValidationError>>

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

The instance API version must be at least 1.1, or the khr_external_semaphore_capabilities extension must be enabled on the instance.

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

source

pub fn format_properties( &self, format: Format ) -> Result<FormatProperties, Box<ValidationError>>

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

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

source

pub fn image_format_properties( &self, image_format_info: ImageFormatInfo ) -> Result<Option<ImageFormatProperties>, Validated<VulkanError>>

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

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

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

Panics
  • Panics if image_format_info.format is None.
source

pub unsafe fn qnx_screen_presentation_support<W>( &self, queue_family_index: u32, window: *const W ) -> Result<bool, Box<ValidationError>>

Queries whether the physical device supports presenting to QNX Screen surfaces from queues of the given queue family.

Safety
  • window must be a valid QNX Screen _screen_window handle.
source

pub fn sparse_image_format_properties( &self, format_info: SparseImageFormatInfo ) -> Result<Vec<SparseImageFormatProperties>, Box<ValidationError>>

Returns the properties of sparse images with a given image configuration.

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

Panics
  • Panics if format_info.format is None.
source

pub fn surface_capabilities( &self, surface: &Surface, surface_info: SurfaceInfo ) -> Result<SurfaceCapabilities, Validated<VulkanError>>

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

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

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

pub fn surface_formats( &self, surface: &Surface, surface_info: SurfaceInfo ) -> Result<Vec<(Format, ColorSpace)>, Validated<VulkanError>>

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

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

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

pub fn surface_present_modes( &self, surface: &Surface, surface_info: SurfaceInfo ) -> Result<impl Iterator<Item = PresentMode>, Validated<VulkanError>>

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

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

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

pub fn surface_support( &self, queue_family_index: u32, surface: &Surface ) -> Result<bool, Validated<VulkanError>>

Returns whether queues of the given queue family can draw on the given surface.

The results of this function are cached, so that future calls with the same arguments do not need to make a call to the Vulkan API again.

source

pub fn tool_properties( &self ) -> Result<Vec<ToolProperties>, Validated<VulkanError>>

Retrieves the properties of tools that are currently active on the physical device.

These properties may change during runtime, so the result only reflects the current situation and is not cached.

The physical device API version must be at least 1.3, or the ext_tooling_info extension must be supported by the physical device.

source

pub unsafe fn wayland_presentation_support<D>( &self, queue_family_index: u32, display: *const D ) -> Result<bool, Box<ValidationError>>

Queries whether the physical device supports presenting to Wayland surfaces from queues of the given queue family.

Safety
  • display must be a valid Wayland wl_display handle.
source

pub fn win32_presentation_support( &self, queue_family_index: u32 ) -> Result<bool, Box<ValidationError>>

Queries whether the physical device supports presenting to Win32 surfaces from queues of the given queue family.

source

pub unsafe fn xcb_presentation_support<C>( &self, queue_family_index: u32, connection: *const C, visual_id: xcb_visualid_t ) -> Result<bool, Box<ValidationError>>

Queries whether the physical device supports presenting to XCB surfaces from queues of the given queue family.

Safety
  • connection must be a valid X11 xcb_connection_t handle.
source

pub unsafe fn xlib_presentation_support<D>( &self, queue_family_index: u32, display: *const D, visual_id: VisualID ) -> Result<bool, Box<ValidationError>>

Queries whether the physical device supports presenting to Xlib surfaces from queues of the given queue family.

Safety
  • display must be a valid Xlib Display handle.

Trait Implementations§

source§

impl Debug for PhysicalDevice

source§

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

Formats the value using the given formatter. Read more
source§

impl Hash for PhysicalDevice

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl InstanceOwned for PhysicalDevice

source§

fn instance(&self) -> &Arc<Instance>

Returns the instance that owns self.
source§

impl PartialEq for PhysicalDevice

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl VulkanObject for PhysicalDevice

§

type Handle = PhysicalDevice

The type of the object.
source§

fn handle(&self) -> Self::Handle

Returns the raw Vulkan handle of the object.
source§

impl Eq for PhysicalDevice

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

§

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

§

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.