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
sourceimpl<'a> PhysicalDevice<'a>
impl<'a> PhysicalDevice<'a>
sourcepub fn enumerate(
instance: &'a Arc<Instance>
) -> impl ExactSizeIterator<Item = PhysicalDevice<'a>>
pub fn enumerate(
instance: &'a Arc<Instance>
) -> impl ExactSizeIterator<Item = PhysicalDevice<'a>>
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);
}
sourcepub fn from_index(
instance: &'a Arc<Instance>,
index: usize
) -> Option<PhysicalDevice<'a>>
pub fn from_index(
instance: &'a Arc<Instance>,
index: usize
) -> Option<PhysicalDevice<'a>>
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();
sourcepub fn instance(&self) -> &'a Arc<Instance>
pub fn instance(&self) -> &'a Arc<Instance>
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();
// ...
}
sourcepub fn index(&self) -> usize
pub fn index(&self) -> usize
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.
sourcepub fn api_version(&self) -> Version
pub fn api_version(&self) -> Version
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
.
sourcepub fn supported_extensions(&self) -> &'a DeviceExtensions
pub fn supported_extensions(&self) -> &'a DeviceExtensions
Returns the extensions that are supported by this physical device.
sourcepub fn properties(&self) -> &'a Properties
pub fn properties(&self) -> &'a Properties
Returns the properties reported by the device.
sourcepub fn supported_features(&self) -> &'a Features
pub fn supported_features(&self) -> &'a Features
Returns the features that are supported by this physical device.
sourcepub fn external_buffer_properties(
&self,
info: ExternalBufferInfo
) -> Option<ExternalBufferProperties>
pub fn external_buffer_properties(
&self,
info: ExternalBufferInfo
) -> Option<ExternalBufferProperties>
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.
sourcepub fn format_properties(&self, format: Format) -> FormatProperties
pub fn format_properties(&self, format: Format) -> FormatProperties
Retrieves the properties of a format when used by this physical device.
sourcepub fn external_semaphore_properties(
&self,
info: ExternalSemaphoreInfo
) -> Option<ExternalSemaphoreProperties>
pub fn external_semaphore_properties(
&self,
info: ExternalSemaphoreInfo
) -> Option<ExternalSemaphoreProperties>
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.
sourcepub fn image_format_properties(
&self,
image_format_info: ImageFormatInfo
) -> Result<Option<ImageFormatProperties>, OomError>
pub fn image_format_properties(
&self,
image_format_info: ImageFormatInfo
) -> Result<Option<ImageFormatProperties>, OomError>
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
isNone
.
sourcepub fn memory_types(&self) -> impl ExactSizeIterator<Item = MemoryType<'a>>
pub fn memory_types(&self) -> impl ExactSizeIterator<Item = MemoryType<'a>>
Builds an iterator that enumerates all the memory types on this physical device.
sourcepub fn memory_type_by_id(&self, id: u32) -> Option<MemoryType<'a>>
pub fn memory_type_by_id(&self, id: u32) -> Option<MemoryType<'a>>
Returns the memory type with the given index, or None
if out of range.
sourcepub fn memory_heaps(&self) -> impl ExactSizeIterator<Item = MemoryHeap<'a>>
pub fn memory_heaps(&self) -> impl ExactSizeIterator<Item = MemoryHeap<'a>>
Builds an iterator that enumerates all the memory heaps on this physical device.
sourcepub fn memory_heap_by_id(&self, id: u32) -> Option<MemoryHeap<'a>>
pub fn memory_heap_by_id(&self, id: u32) -> Option<MemoryHeap<'a>>
Returns the memory heap with the given index, or None
if out of range.
sourcepub fn queue_families(&self) -> impl ExactSizeIterator<Item = QueueFamily<'a>>
pub fn queue_families(&self) -> impl ExactSizeIterator<Item = QueueFamily<'a>>
Builds an iterator that enumerates all the queue families on this physical device.
sourcepub fn queue_family_by_id(&self, id: u32) -> Option<QueueFamily<'a>>
pub fn queue_family_by_id(&self, id: u32) -> Option<QueueFamily<'a>>
Returns the queue family with the given index, or None
if out of range.
sourcepub fn surface_capabilities<W>(
&self,
surface: &Surface<W>,
surface_info: SurfaceInfo
) -> Result<SurfaceCapabilities, SurfacePropertiesError>
pub fn surface_capabilities<W>(
&self,
surface: &Surface<W>,
surface_info: SurfaceInfo
) -> Result<SurfaceCapabilities, SurfacePropertiesError>
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.
sourcepub fn surface_formats<W>(
&self,
surface: &Surface<W>,
surface_info: SurfaceInfo
) -> Result<Vec<(Format, ColorSpace)>, SurfacePropertiesError>
pub fn surface_formats<W>(
&self,
surface: &Surface<W>,
surface_info: SurfaceInfo
) -> Result<Vec<(Format, ColorSpace)>, SurfacePropertiesError>
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.
sourcepub fn surface_present_modes<W>(
&self,
surface: &Surface<W>
) -> Result<impl Iterator<Item = PresentMode>, SurfacePropertiesError>
pub fn surface_present_modes<W>(
&self,
surface: &Surface<W>
) -> Result<impl Iterator<Item = PresentMode>, SurfacePropertiesError>
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
sourceimpl<'a> Clone for PhysicalDevice<'a>
impl<'a> Clone for PhysicalDevice<'a>
sourcefn clone(&self) -> PhysicalDevice<'a>
fn clone(&self) -> PhysicalDevice<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for PhysicalDevice<'a>
impl<'a> Debug for PhysicalDevice<'a>
sourceimpl<'a> VulkanObject for PhysicalDevice<'a>
impl<'a> VulkanObject for PhysicalDevice<'a>
type Object = PhysicalDevice
type Object = PhysicalDevice
The type of the object.
sourcefn internal_object(&self) -> PhysicalDevice
fn internal_object(&self) -> PhysicalDevice
Returns a reference to the object.
impl<'a> Copy for PhysicalDevice<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for PhysicalDevice<'a>
impl<'a> Send for PhysicalDevice<'a>
impl<'a> Sync for PhysicalDevice<'a>
impl<'a> Unpin for PhysicalDevice<'a>
impl<'a> UnwindSafe for PhysicalDevice<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more