pub struct PreparedWgpuContext { /* private fields */ }Expand description
后台线程无头预初始化的 wgpu 设备与预编译 2D SDF 渲染管线上下文(可跨线程 Send 移交主线程)。
用于实现「秒开首屏 + 异步后台 GPU 无缝热升舱」:
后台线程并发执行最耗时的图形驱动加载、request_adapter、request_device 与着色器管线编译,
就绪后主线程仅需 ~10ms 绑定窗口 Surface 即可零闪烁接管至硬件加速渲染。
Implementations§
Source§impl PreparedWgpuContext
impl PreparedWgpuContext
Sourcepub fn init_headless() -> Option<Self>
pub fn init_headless() -> Option<Self>
在无窗口句柄的独立后台线程中完成 wgpu 驱动加载、设备创建与着色器管线预编译。
Trait Implementations§
impl Send for PreparedWgpuContext
Auto Trait Implementations§
impl !RefUnwindSafe for PreparedWgpuContext
impl !UnwindSafe for PreparedWgpuContext
impl Forget for PreparedWgpuContext
impl Freeze for PreparedWgpuContext
impl Move for PreparedWgpuContext
impl Sync for PreparedWgpuContext
impl Unpin for PreparedWgpuContext
impl UnsafeUnpin for PreparedWgpuContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。