Skip to main content

RenderCommand

Enum RenderCommand 

Source
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: W

The raw surface handle the render thread takes ownership of.

§size: SurfaceSize

The initial physical surface size.

§

SurfaceChanged

The existing surface was resized/reconfigured (rotation, inset change). Fire-and-forget.

Fields

§size: SurfaceSize

The 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.

Fields

§ack: Ack

Acknowledged once surface resources are dropped.

§

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.

Fields

§ack: Ack

Acknowledged once the render thread has quiesced.

§

Resume

The app returned to the foreground with its surface intact: resume submitting. Fire-and-forget.

Implementations§

Source§

impl<W> RenderCommand<W>

Source

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).

Source

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.

Trait Implementations§

Source§

impl<W: Debug> Debug for RenderCommand<W>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<W> Freeze for RenderCommand<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for RenderCommand<W>
where W: RefUnwindSafe,

§

impl<W> Send for RenderCommand<W>
where W: Send,

§

impl<W> Sync for RenderCommand<W>
where W: Sync,

§

impl<W> Unpin for RenderCommand<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for RenderCommand<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for RenderCommand<W>
where W: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.