Skip to main content

create_wgpu_surface

Function create_wgpu_surface 

Source
pub unsafe fn create_wgpu_surface(
    instance: &Instance,
    window: &Window<'_>,
) -> Option<Surface<'static>>
Expand description

Bridge a baseview raw-window-handle 0.5 to a wgpu-compatible SurfaceTargetUnsafe using rwh 0.6 types.

Both truce-gui’s blit pipeline (cpu mode) and truce_gpu::WgpuBackend::from_window (gpu mode, used by GpuEditor) need this bridge; the two crates can’t share a canonical copy without forming a dep cycle, so each carries its own ~100 LOC version. The two are kept in sync by inspection.

§Safety

The window handle must be valid for the lifetime of the returned surface.