Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

OrderedCommandStream

Struct OrderedCommandStream 

Source
pub struct OrderedCommandStream<D: CommandStreamDma = GpuDma> { /* private fields */ }
Expand description

Forward, incremental GPU command list over caller-owned static storage.

Append complete packets with Self::push_packet, then Self::submit to overlap CPU work with GPU drawing. Call Self::flush before immediate GP0 drawing, VRAM uploads, or framebuffer presentation. Capacity exhaustion performs that same synchronization before reusing storage. Dropping the stream waits for in-flight DMA and discards unsent commands.

To present through psx-rt’s queued flip, arm the draw-done flag (crate::Gpu::arm_draw_done on the transport Self::flush returns) before the frame’s first packet (nodes can start walking as soon as they close) and end the frame with push_packet([gp0::REQUEST_IRQ]) and Self::submit; see crate::is_draw_done.

Implementations§

Source§

impl<D: CommandStreamDma> OrderedCommandStream<D>

Source

pub fn with_dma(words: &'static mut [u32], dma: D) -> Self

A stream over words, at least 17 word-aligned RAM words, driven by dma: the GpuDma token on the console, a test double on the host.

Source

pub fn push_packet<const N: usize>(&mut self, words: [u32; N])

Append one complete GP0 packet in painter order.

N must be 1..=15. Packets are never split across DMA nodes.

Source

pub fn push_upload( &mut self, x: u16, y: u16, width: u16, height: u16, pixels: &[u16], )

Append a small A0 upload between surrounding draw commands.

Coordinates and dimensions use VRAM halfwords. The rectangle must match pixels and fit one node (at most 24 pixels). Odd pixel counts have a zero-padded final halfword. Large asset uploads should use the VRAM upload helpers after Self::flush.

Source

pub fn submit(&mut self)

Submit all pending commands, retaining storage until completion.

Source

pub fn flush(&mut self) -> &mut D

Submit, wait for DMA and GPU, and reset the buffer for reuse.

Returns the transport, idle, for work that must not overlap the stream: Gpu::from_dma_mut(stream.flush()) draws immediately or arms the draw-done flag before the next frame’s first packet.

Source

pub fn release(self) -> (&'static mut [u32], D)

Flush, then hand back the buffer and the transport.

Trait Implementations§

Source§

impl<D: CommandStreamDma> Debug for OrderedCommandStream<D>

Shows the buffer’s fill state, not its words.

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<D: CommandStreamDma> Drop for OrderedCommandStream<D>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<D: CommandStreamDma + Send> Send for OrderedCommandStream<D>

Source§

impl<D: CommandStreamDma + Sync> Sync for OrderedCommandStream<D>

Auto Trait Implementations§

§

impl<D> Freeze for OrderedCommandStream<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for OrderedCommandStream<D>
where D: RefUnwindSafe,

§

impl<D> Unpin for OrderedCommandStream<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for OrderedCommandStream<D>
where D: UnsafeUnpin,

§

impl<D = GpuDma> !UnwindSafe for OrderedCommandStream<D>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.