gfx_hal::adapter

Trait PhysicalDevice

Source
pub trait PhysicalDevice<B: Backend>:
    Debug
    + Any
    + Send
    + Sync {
Show 13 methods // Required methods unsafe fn open( &self, families: &[(&B::QueueFamily, &[QueuePriority])], requested_features: Features, ) -> Result<Gpu<B>, CreationError>; fn format_properties(&self, format: Option<Format>) -> Properties; fn image_format_properties( &self, format: Format, dimensions: u8, tiling: Tiling, usage: Usage, view_caps: ViewCapabilities, ) -> Option<FormatProperties>; fn memory_properties(&self) -> MemoryProperties; fn external_buffer_properties( &self, usage: Usage, sparse: SparseFlags, memory_type: ExternalMemoryType, ) -> ExternalMemoryProperties; fn external_image_properties( &self, format: Format, dimensions: u8, tiling: Tiling, usage: Usage, view_caps: ViewCapabilities, external_memory_type: ExternalMemoryType, ) -> Result<ExternalMemoryProperties, ExternalImagePropertiesError>; fn features(&self) -> Features; fn properties(&self) -> PhysicalDeviceProperties; unsafe fn enumerate_displays(&self) -> Vec<Display<B>>; unsafe fn enumerate_compatible_planes( &self, display: &Display<B>, ) -> Vec<Plane>; unsafe fn create_display_mode( &self, display: &Display<B>, resolution: (u32, u32), refresh_rate: u32, ) -> Result<DisplayMode<B>, DisplayModeError>; unsafe fn create_display_plane<'a>( &self, display: &'a DisplayMode<B>, plane: &'a Plane, ) -> Result<DisplayPlane<'a, B>, OutOfMemory>; // Provided method fn is_valid_cache(&self, _cache: &[u8]) -> bool { ... }
}
Expand description

Represents a physical device (such as a GPU) capable of supporting the given backend.

Required Methods§

Source

unsafe fn open( &self, families: &[(&B::QueueFamily, &[QueuePriority])], requested_features: Features, ) -> Result<Gpu<B>, CreationError>

Create a new logical device with the requested features. If requested_features is empty, then only the core features are supported.

§Arguments
  • families - which queue families to create queues from. The implementation may allocate more processing time to the queues with higher priority.
  • requested_features - device features to enable. Must be a subset of the features supported by this device.
§Errors
  • Returns TooManyObjects if the implementation can’t create a new logical device.
  • Returns MissingFeature if the implementation does not support a requested feature.
§Examples
use gfx_hal::{adapter::PhysicalDevice, Features};

let gpu = physical_device.open(&[(&family, &[1.0; 1])], Features::empty());
Source

fn format_properties(&self, format: Option<Format>) -> Properties

Fetch details for a particular format.

Source

fn image_format_properties( &self, format: Format, dimensions: u8, tiling: Tiling, usage: Usage, view_caps: ViewCapabilities, ) -> Option<FormatProperties>

Fetch details for a particular image format.

Source

fn memory_properties(&self) -> MemoryProperties

Fetch details for the memory regions provided by the device.

Source

fn external_buffer_properties( &self, usage: Usage, sparse: SparseFlags, memory_type: ExternalMemoryType, ) -> ExternalMemoryProperties

Get external buffer properties. The parameters specify how the buffer is going to used.

§Arguments
  • usage - the usage of the buffer.
  • sparse - the sparse flags of the buffer.
  • memory_type - the external memory type for the buffer.
Source

fn external_image_properties( &self, format: Format, dimensions: u8, tiling: Tiling, usage: Usage, view_caps: ViewCapabilities, external_memory_type: ExternalMemoryType, ) -> Result<ExternalMemoryProperties, ExternalImagePropertiesError>

Get external image properties. The parameters specify how the image is going to used.

§Arguments
  • format - the format of the image.
  • dimensions - the dimensions of the image.
  • tiling - the tiling mode of the image.
  • usage - the usage of the image.
  • view_caps - the view capabilities of the image.
  • external_memory_type - the external memory type for the image.
§Errors
  • Returns OutOfMemory if the implementation goes out of memory during the operation.
  • Returns FormatNotSupported if the implementation does not support the requested image format.
Source

fn features(&self) -> Features

Returns the features of this PhysicalDevice. This usually depends on the graphics API being used, as well as the actual platform underneath.

Source

fn properties(&self) -> PhysicalDeviceProperties

Returns the properties of this PhysicalDevice. Similarly to Features, they

Source

unsafe fn enumerate_displays(&self) -> Vec<Display<B>>

Enumerate active displays surface from display. Please notice that, even if a system has displays attached, they could be not returned because they are managed by some other components. This function only return the display that are available to be managed by the current application. Since, generally, while compositor are running they take the control of every display connected, it could be better to run the application directly from the tty to avoid the return of an empty list.

§Arguments
  • adapter - the adapter from which the displays will be enumerated.
Source

unsafe fn enumerate_compatible_planes(&self, display: &Display<B>) -> Vec<Plane>

Enumerate compatibles planes with the provided display.

§Arguments
  • display - display on which the the compatible planes will be listed.
Source

unsafe fn create_display_mode( &self, display: &Display<B>, resolution: (u32, u32), refresh_rate: u32, ) -> Result<DisplayMode<B>, DisplayModeError>

Create a new display mode from a display, a resolution, a refresh_rate and the plane index. If the builtin display modes does not satisfy the requirements, this function will try to create a new one.

§Arguments
  • display - display on which the display mode will be created.
  • resolution - the desired resolution.
  • refresh_rate - the desired refresh_rate.
Source

unsafe fn create_display_plane<'a>( &self, display: &'a DisplayMode<B>, plane: &'a Plane, ) -> Result<DisplayPlane<'a, B>, OutOfMemory>

Create a display plane from a display, a resolution, a refresh_rate and a plane. If the builtin display modes does not satisfy the requirements, this function will try to create a new one.

§Arguments
  • display - display on which the display plane will be created.
  • plane - the plane on which the surface will be rendered on.
  • resolution - the desired resolution.
  • refresh_rate - the desired refresh_rate.

Provided Methods§

Source

fn is_valid_cache(&self, _cache: &[u8]) -> bool

Check cache compatibility with the PhysicalDevice.

Implementors§