Skip to main content

NativeFrame

Trait NativeFrame 

Source
pub unsafe trait NativeFrame:
    Debug
    + Send
    + Sync {
    // Required method
    fn copy_d3d11(
        &self,
        copy: &mut dyn FnMut(*mut c_void) -> bool,
    ) -> Result<bool, String>;

    // Provided method
    fn copy_d3d12(
        &self,
        _copy: &mut dyn FnMut(*mut c_void, *mut c_void, u64) -> bool,
    ) -> Result<bool, String> { ... }
}
Expand description

Native texture format is straight-alpha BGRA8 on the renderer’s own device. The pointer is borrowed only for the synchronous copy callback.

§Safety

Implementors must keep a valid ID3D11Texture2D alive and acquired throughout the callback, then release/flush it before subsequent wgpu queue work. The callback may panic; cleanup must still run. No JSC callback is allowed.

Required Methods§

Source

fn copy_d3d11( &self, copy: &mut dyn FnMut(*mut c_void) -> bool, ) -> Result<bool, String>

Provided Methods§

Source

fn copy_d3d12( &self, _copy: &mut dyn FnMut(*mut c_void, *mut c_void, u64) -> bool, ) -> Result<bool, String>

Exposes a BGRA8 D3D12 resource in RENDER_TARGET state and a readiness fence signalled on the producer queue. The consumer waits on its GPU queue, restores the state after copying, and retains this frame until its own copy fence completes. No JS callback is allowed here.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§