Skip to main content

Adapter

Trait Adapter 

Source
pub trait Adapter: WasmNotSendSync {
    type A: Api;

    // Required methods
    unsafe fn open(
        &self,
        features: Features,
        limits: &Limits,
        memory_hints: &MemoryHints,
    ) -> Result<OpenDevice<Self::A>, DeviceError>;
    unsafe fn texture_format_capabilities(
        &self,
        format: TextureFormat,
    ) -> TextureFormatCapabilities;
    unsafe fn surface_capabilities(
        &self,
        surface: &<Self::A as Api>::Surface,
    ) -> Option<SurfaceCapabilities>;
    unsafe fn get_presentation_timestamp(&self) -> PresentationTimestamp;
    fn get_ordered_buffer_usages(&self) -> BufferUses;
    fn get_ordered_texture_usages(&self) -> TextureUses;

    // Provided method
    unsafe fn surface_display_hdr_info(
        &self,
        surface: &<Self::A as Api>::Surface,
    ) -> Option<DisplayHdrInfo> { ... }
}

Required Associated Types§

Source

type A: Api

Required Methods§

Source

unsafe fn open( &self, features: Features, limits: &Limits, memory_hints: &MemoryHints, ) -> Result<OpenDevice<Self::A>, DeviceError>

Source

unsafe fn texture_format_capabilities( &self, format: TextureFormat, ) -> TextureFormatCapabilities

Return the set of supported capabilities for a texture format.

Source

unsafe fn surface_capabilities( &self, surface: &<Self::A as Api>::Surface, ) -> Option<SurfaceCapabilities>

Returns the capabilities of working with a specified surface.

None means presentation is not supported for it.

Source

unsafe fn get_presentation_timestamp(&self) -> PresentationTimestamp

Creates a PresentationTimestamp using the adapter’s WSI.

Source

fn get_ordered_buffer_usages(&self) -> BufferUses

The combination of all usages that the are guaranteed to be be ordered by the hardware. If a usage is ordered, then if the buffer state doesn’t change between draw calls, there are no barriers needed for synchronization.

Source

fn get_ordered_texture_usages(&self) -> TextureUses

The combination of all usages that the are guaranteed to be be ordered by the hardware. If a usage is ordered, then if the buffer state doesn’t change between draw calls, there are no barriers needed for synchronization.

Provided Methods§

Source

unsafe fn surface_display_hdr_info( &self, surface: &<Self::A as Api>::Surface, ) -> Option<DisplayHdrInfo>

Returns the HDR / luminance characteristics of the display backing surface, queried from the OS on each call.

None means no information is available; wgpu-core maps it to wgt::DisplayHdrInfo::default. Implementors must not panic; degrade any OS-query failure to None. The default implementation returns None.

Implemented by Metal (macOS only, and only from the main thread), DX12, and Vulkan (Win32 HWND surfaces only); GLES and noop keep the default None.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Adapter for Adapter

Available on gles only.
Source§

type A = Api

Source§

impl Adapter for Context

Source§

type A = Api