Skip to main content

NativeImporter

Trait NativeImporter 

Source
pub trait NativeImporter: Send + Sync {
    // Required method
    fn import(
        &self,
        handle: &NativeHandle,
        device: &Device,
        queue: &Queue,
    ) -> Result<ImportedTexture, ImportError>;
}
Expand description

Turns a platform GPU buffer into a texture on the frame’s device, without a CPU copy.

Installed per NativeHandleKind with set_native_importer, and called on the render thread inside the frame’s external-pass drain — so it records nothing of its own and never submits; it creates (or looks up) a texture over the buffer and returns a view of it. Send + Sync because the table it is installed in is process-wide.

Required Methods§

Source

fn import( &self, handle: &NativeHandle, device: &Device, queue: &Queue, ) -> Result<ImportedTexture, ImportError>

Imports handle on device. The bus holds the frame’s release callback until the imported texture is retired and the GPU finished with it, but the platform buffer is still the importer’s to keep alive: an importer whose texture aliases it keeps its own reference for the texture’s lifetime.

§Errors

ImportError when the handle cannot be imported on this device.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§