Struct vulkano::instance::PhysicalDevice
source · 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::instance::PhysicalDevice;
for physical_device in PhysicalDevice::enumerate(&instance) {
print_infos(physical_device);
}
fn print_infos(dev: PhysicalDevice) {
println!("Name: {}", dev.name());
}
Implementations
sourceimpl<'a> PhysicalDevice<'a>
impl<'a> PhysicalDevice<'a>
sourcepub fn enumerate(instance: &'a Arc<Instance>) -> PhysicalDevicesIter<'a> ⓘ
pub fn enumerate(instance: &'a Arc<Instance>) -> PhysicalDevicesIter<'a> ⓘ
Returns an iterator that enumerates the physical devices available.
Example
use vulkano::instance::PhysicalDevice;
for physical_device in PhysicalDevice::enumerate(&instance) {
println!("Available device: {}", physical_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::instance::PhysicalDevice;
let instance = Instance::new(None, &InstanceExtensions::none(), None).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::instance::PhysicalDevice;
fn do_something(physical_device: PhysicalDevice) {
let _loaded_extensions = physical_device.instance().loaded_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 ty(&self) -> PhysicalDeviceType
pub fn ty(&self) -> PhysicalDeviceType
Returns the type of the device.
Example
use vulkano::instance::PhysicalDevice;
for physical_device in PhysicalDevice::enumerate(&instance) {
println!("Available device: {} (type: {:?})",
physical_device.name(), physical_device.ty());
}
sourcepub fn api_version(&self) -> Version
pub fn api_version(&self) -> Version
Returns the version of Vulkan supported by this device.
sourcepub fn supported_features(&self) -> &'a Features
pub fn supported_features(&self) -> &'a Features
Returns the Vulkan features that are supported by this physical device.
sourcepub fn queue_families(&self) -> QueueFamiliesIter<'a> ⓘ
pub fn queue_families(&self) -> QueueFamiliesIter<'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 memory_types(&self) -> MemoryTypesIter<'a> ⓘ
pub fn memory_types(&self) -> MemoryTypesIter<'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) -> MemoryHeapsIter<'a> ⓘ
pub fn memory_heaps(&self) -> MemoryHeapsIter<'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 limits(&self) -> Limits<'a>
pub fn limits(&self) -> Limits<'a>
Gives access to the limits of the physical device.
This function should be zero-cost in release mode. It only exists to not pollute the
namespace of PhysicalDevice
with all the limits-related getters.
sourcepub fn driver_version(&self) -> u32
pub fn driver_version(&self) -> u32
Returns an opaque number representing the version of the driver of this device.
The meaning of this number is implementation-specific. It can be used in bug reports, for example.
sourcepub fn pci_device_id(&self) -> u32
pub fn pci_device_id(&self) -> u32
Returns the PCI ID of the device.
sourcepub fn pci_vendor_id(&self) -> u32
pub fn pci_vendor_id(&self) -> u32
Returns the PCI ID of the vendor.
Trait Implementations
sourceimpl<'a> Clone for PhysicalDevice<'a>
impl<'a> Clone for PhysicalDevice<'a>
sourcefn clone(&self) -> PhysicalDevice<'a>
fn clone(&self) -> PhysicalDevice<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<'a> Debug for PhysicalDevice<'a>
impl<'a> Debug for PhysicalDevice<'a>
sourceimpl<'a> VulkanObject for PhysicalDevice<'a>
impl<'a> VulkanObject for PhysicalDevice<'a>
sourceconst TYPE: DebugReportObjectTypeEXT = 2u32
const TYPE: DebugReportObjectTypeEXT = 2u32
DebugReportObjectTypeEXT
of the internal Vulkan handle.