pub enum RenderCommand<W> {
SurfaceCreated {
window: W,
size: SurfaceSize,
},
SurfaceChanged {
size: SurfaceSize,
},
SurfaceDestroyed {
ack: Ack,
},
Pause {
ack: Ack,
},
Resume,
}Expand description
A lifecycle command the UI thread sends to the render thread across
render_channel, as an owned value — not a shared
mutable flag. Generic over the surface-handle type W a
Self::SurfaceCreated carries (frust-render’s raw-window wrapper in a
real shell; a stand-in in host tests), keeping this crate render-free.
Self::Pause and Self::SurfaceDestroyed carry an Ack: the UI
thread blocks on the paired AckWaiter until the render thread honors
them (the window-release / backgrounding barrier). The others are
fire-and-forget. The command’s effect on the render thread’s RenderPhase
is given by Self::event → next_render_phase.
Variants§
SurfaceCreated
A surface became available: the render thread takes ownership of window
and (re)configures its swapchain to size. Fire-and-forget.
Fields
window: WThe raw surface handle the render thread takes ownership of.
size: SurfaceSizeThe initial physical surface size.
SurfaceChanged
The existing surface was resized/reconfigured (rotation, inset change). Fire-and-forget.
Fields
size: SurfaceSizeThe new physical surface size.
SurfaceDestroyed
The surface is being torn down: the render thread must drop every
surface-derived wgpu resource before acknowledging, so the UI
thread can safely release the underlying window (the Android
ANativeWindow-release hazard). Blocks the UI thread via Ack.
Pause
The app is backgrounding: the render thread must stop submitting frames
before acknowledging, so the app never submits Metal/Vulkan work
after it backgrounds (the iOS process-kill hazard). Blocks the UI thread
via Ack.
Resume
The app returned to the foreground with its surface intact: resume submitting. Fire-and-forget.
Implementations§
Source§impl<W> RenderCommand<W>
impl<W> RenderCommand<W>
Sourcepub fn event(&self) -> RenderEvent
pub fn event(&self) -> RenderEvent
The pure RenderEvent this command drives on the render thread’s
RenderPhase — the Copy projection that feeds next_render_phase
(borrowing self, leaving the owned Ack/window in place).
Sourcepub fn requires_ack(&self) -> bool
pub fn requires_ack(&self) -> bool
Whether this command carries an Ack the UI thread blocks on — true
for Self::Pause/Self::SurfaceDestroyed, false for the
fire-and-forget variants.