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
impl PhysicalDevice
Sourcepub unsafe fn from_handle(
instance: Arc<Instance>,
handle: PhysicalDevice,
) -> Result<Arc<Self>, VulkanError>
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 frominstance
.
Sourcepub fn api_version(&self) -> Version
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
.
Sourcepub fn properties(&self) -> &DeviceProperties
pub fn properties(&self) -> &DeviceProperties
Returns the properties reported by the physical device.
Sourcepub fn extension_properties(&self) -> &[ExtensionProperties]
pub fn extension_properties(&self) -> &[ExtensionProperties]
Returns the extension properties reported by the physical device.
Sourcepub fn supported_extensions(&self) -> &DeviceExtensions
pub fn supported_extensions(&self) -> &DeviceExtensions
Returns the extensions that are supported by the physical device.
Sourcepub fn supported_features(&self) -> &DeviceFeatures
pub fn supported_features(&self) -> &DeviceFeatures
Returns the features that are supported by the physical device.
Sourcepub fn memory_properties(&self) -> &MemoryProperties
pub fn memory_properties(&self) -> &MemoryProperties
Returns the memory properties reported by the physical device.
Sourcepub fn queue_family_properties(&self) -> &[QueueFamilyProperties]
pub fn queue_family_properties(&self) -> &[QueueFamilyProperties]
Returns the queue family properties reported by the physical device.
Sourcepub fn display_properties(
self: &Arc<Self>,
) -> Result<Vec<Arc<Display>>, Validated<VulkanError>>
pub fn display_properties( self: &Arc<Self>, ) -> Result<Vec<Arc<Display>>, Validated<VulkanError>>
Returns the properties of displays attached to the physical device.
Sourcepub fn display_plane_properties(
self: &Arc<Self>,
) -> Result<Vec<DisplayPlaneProperties>, Validated<VulkanError>>
pub fn display_plane_properties( self: &Arc<Self>, ) -> Result<Vec<DisplayPlaneProperties>, Validated<VulkanError>>
Returns the properties of the display planes of the physical device.
Sourcepub fn display_plane_supported_displays(
self: &Arc<Self>,
plane_index: u32,
) -> Result<Vec<Arc<Display>>, Validated<VulkanError>>
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
.
Sourcepub fn external_buffer_properties(
&self,
info: ExternalBufferInfo,
) -> Result<ExternalBufferProperties, Box<ValidationError>>
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.
Sourcepub fn external_fence_properties(
&self,
info: ExternalFenceInfo,
) -> Result<ExternalFenceProperties, Box<ValidationError>>
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.
Sourcepub fn external_semaphore_properties(
&self,
info: ExternalSemaphoreInfo,
) -> Result<ExternalSemaphoreProperties, Box<ValidationError>>
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.
Sourcepub fn format_properties(
&self,
format: Format,
) -> Result<FormatProperties, Box<ValidationError>>
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.
Sourcepub fn image_format_properties(
&self,
image_format_info: ImageFormatInfo,
) -> Result<Option<ImageFormatProperties>, Validated<VulkanError>>
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
isNone
.
Sourcepub fn sparse_image_format_properties(
&self,
format_info: SparseImageFormatInfo,
) -> Result<Vec<SparseImageFormatProperties>, Box<ValidationError>>
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
isNone
.
Sourcepub fn surface_capabilities(
&self,
surface: &Surface,
surface_info: SurfaceInfo,
) -> Result<SurfaceCapabilities, Validated<VulkanError>>
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.
Sourcepub fn surface_formats(
&self,
surface: &Surface,
surface_info: SurfaceInfo,
) -> Result<Vec<(Format, ColorSpace)>, Validated<VulkanError>>
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.
Sourcepub fn surface_present_modes(
&self,
surface: &Surface,
surface_info: SurfaceInfo,
) -> Result<Vec<PresentMode>, Validated<VulkanError>>
pub fn surface_present_modes( &self, surface: &Surface, surface_info: SurfaceInfo, ) -> Result<Vec<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.
Sourcepub fn surface_support(
&self,
queue_family_index: u32,
surface: &Surface,
) -> Result<bool, Validated<VulkanError>>
pub fn surface_support( &self, queue_family_index: u32, surface: &Surface, ) -> Result<bool, Validated<VulkanError>>
Returns whether queues of the given queue family support presentation to 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.
See also presentation_support
for determining if a queue family supports presentation
to the surface of any window of a given event loop, for instance in cases where you have no
window and hence no surface at hand to test with or when you could have multiple windows.
Sourcepub fn tool_properties(
&self,
) -> Result<Vec<ToolProperties>, Validated<VulkanError>>
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.
Sourcepub fn presentation_support(
&self,
queue_family_index: u32,
event_loop: &impl HasDisplayHandle,
) -> Result<bool, Validated<HandleError>>
pub fn presentation_support( &self, queue_family_index: u32, event_loop: &impl HasDisplayHandle, ) -> Result<bool, Validated<HandleError>>
Returns whether queues of the given queue family support presentation to surfaces of windows of the given event loop.
On the X11 platform, this checks if the given queue family supports presentation to
surfaces of windows created with the root visual. This means that if you create your
window(s) with a different visual, the result of this function doesn’t guarantee support
for that window’s surface, and you should use xcb_presentation_support
or
xlib_presentation_support
directly to determine support for presentation to such
surfaces.
See also surface_support
for determining if a queue family supports presentation to a
specific surface.
Sourcepub unsafe fn wayland_presentation_support(
&self,
queue_family_index: u32,
display: *mut wl_display,
) -> Result<bool, Box<ValidationError>>
pub unsafe fn wayland_presentation_support( &self, queue_family_index: u32, display: *mut wl_display, ) -> 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 Waylandwl_display
handle.
Sourcepub fn win32_presentation_support(
&self,
queue_family_index: u32,
) -> Result<bool, Box<ValidationError>>
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.
Sourcepub unsafe fn xcb_presentation_support(
&self,
queue_family_index: u32,
connection: *mut xcb_connection_t,
visual_id: xcb_visualid_t,
) -> Result<bool, Box<ValidationError>>
pub unsafe fn xcb_presentation_support( &self, queue_family_index: u32, connection: *mut xcb_connection_t, 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 X11xcb_connection_t
handle.
Sourcepub unsafe fn xlib_presentation_support(
&self,
queue_family_index: u32,
display: *mut Display,
visual_id: VisualID,
) -> Result<bool, Box<ValidationError>>
pub unsafe fn xlib_presentation_support( &self, queue_family_index: u32, display: *mut Display, 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 XlibDisplay
handle.
Sourcepub unsafe fn directfb_presentation_support(
&self,
queue_family_index: u32,
dfb: *mut IDirectFB,
) -> Result<bool, Box<ValidationError>>
pub unsafe fn directfb_presentation_support( &self, queue_family_index: u32, dfb: *mut IDirectFB, ) -> 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 DirectFBIDirectFB
handle.
Sourcepub unsafe fn qnx_screen_presentation_support(
&self,
queue_family_index: u32,
window: *mut _screen_window,
) -> Result<bool, Box<ValidationError>>
pub unsafe fn qnx_screen_presentation_support( &self, queue_family_index: u32, window: *mut _screen_window, ) -> 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.