pub struct PhysicalDevice { /* private fields */ }
Expand description
A physical device abstracts away an actual device, like a graphics card or integrated graphics card. This struct stores its Vulkan handle, properties and requested queues.
Implementations§
Source§impl PhysicalDevice
impl PhysicalDevice
Sourcepub fn select<Window: WindowInterface>(
instance: &Instance,
surface: Option<&Surface>,
settings: &AppSettings<'_, Window>,
) -> Result<Self>
pub fn select<Window: WindowInterface>( instance: &Instance, surface: Option<&Surface>, settings: &AppSettings<'_, Window>, ) -> Result<Self>
Selects the best available physical device from the given requirements and parameters.
Sourcepub fn select_with_surface<Window: WindowInterface>(
instance: &Instance,
settings: &AppSettings<'_, Window>,
) -> Result<(Surface, Self)>
pub fn select_with_surface<Window: WindowInterface>( instance: &Instance, settings: &AppSettings<'_, Window>, ) -> Result<(Surface, Self)>
Selects the best available physical device and creates a surface on it.
Sourcepub fn queue_families(&self) -> &[QueueFamilyProperties]
pub fn queue_families(&self) -> &[QueueFamilyProperties]
Get all queue families available on this device. This is different from
Device::queue_families()
since this knows about properties of each family, while the
device function only knows about family indices.
Sourcepub fn queues(&self) -> &[QueueInfo]
pub fn queues(&self) -> &[QueueInfo]
Get information on all requested queues.
§Example
fn list_queues(device: PhysicalDevice) {
device.queues()
.iter()
.for_each(|info| {
println!("Queue #{} supports {:#?} (dedicated = {}, can_present = {})", info.family_index, info.flags, info.dedicated, info.can_present);
})
}
Sourcepub unsafe fn handle(&self) -> PhysicalDevice
pub unsafe fn handle(&self) -> PhysicalDevice
Get unsafe access to the physical device handle
§Safety
Any vulkan calls that mutate this physical device may leave the system in an undefined state.
Sourcepub fn properties(&self) -> &PhysicalDeviceProperties
pub fn properties(&self) -> &PhysicalDeviceProperties
This is the same function as Device::properties()
Sourcepub fn memory_properties(&self) -> &PhysicalDeviceMemoryProperties
pub fn memory_properties(&self) -> &PhysicalDeviceMemoryProperties
Get the memory properties of this physical device, such as the different memory heaps available.
§Example
fn list_memory_heaps(device: PhysicalDevice) {
let properties = device.memory_properties();
for i in 0..properties.memory_heap_count {
let heap = properties.memory_heaps[i as usize];
println!("Heap #{i} has flags {:#?} and a size of {} bytes", heap.flags, heap.size);
}
}