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

OtFrame

Struct OtFrame 

Source
pub struct OtFrame<'f, const N: usize> { /* private fields */ }
Expand description

One frame’s view of an OrderingTable: insert packets, then submit.

Made by OrderingTable::frame. Every packet added must live for 'f, the frame’s borrow of the table, and is exclusively borrowed for that long; submitting consumes the frame and waits for the walk.

Implementations§

Source§

impl<'f, const N: usize> OtFrame<'f, N>

Source

pub fn add<P: GpuPacket>(&mut self, z: usize, packet: &'f mut P)

Prepend packet to depth slot z (clamped to N - 1). Slot N - 1 is walked first, slot 0 last, so lower slots draw on top.

Source

pub unsafe fn add_raw(&mut self, z: usize, packet: *mut u32, words: u8)

Prepend a raw packet to depth slot z (clamped to N - 1).

§Safety

packet must point at a 4-byte-aligned tag word followed by words payload words, all in RAM that stays live and unmodified, except for the tag this call writes, until this frame’s walk has finished (or for good, if the frame is never submitted).

§Panics

If words exceeds crate::chain::MAX_NODE_WORDS.

Source

pub unsafe fn add_raw_unchecked( &mut self, z: usize, packet: *mut u32, words: u8, )

add_raw without the depth clamp or the node-length check.

§Safety

The contract of add_raw, and also: z is less than N, and words is at most crate::chain::MAX_NODE_WORDS.

Source

pub unsafe fn add_raw_tag_high_unchecked( &mut self, z: usize, packet: *mut u32, tag_high: u32, )

add_raw_unchecked with the word count already in tag form, in bits 24..31 of tag_high.

§Safety

The contract of add_raw_unchecked, with tag_high >> 24 as the word count, and also: the low 24 bits of tag_high are zero.

Source

pub unsafe fn add_packed_commands_unchecked( &mut self, commands: *const usize, command_count: usize, )

Add packed two-word commands, first to last, the way repeated classic addPrim calls do: packets that share a slot come out in reverse.

Each command is two machine words: the packet’s address (ptr as usize, which exposes it), then a word with the slot in bits 0..=15 and the packet’s payload word count in bits 24..=31. On the console this is one hand-scheduled loop; host builds run a scalar twin.

§Safety

commands points at command_count * 2 readable words in that layout; every slot is less than N and every word count at most crate::chain::MAX_NODE_WORDS; and every packet meets the contract of add_raw.

Source

pub unsafe fn add_packed_commands_reverse_unchecked( &mut self, commands: *const usize, command_count: usize, )

add_packed_commands_unchecked last to first, so packets that share a slot keep their array order.

§Safety

As add_packed_commands_unchecked.

Source

pub unsafe fn add_tagged_packet_stream_unchecked( &mut self, first: *mut u32, end: *mut u32, )

Add a contiguous stream of packets whose tags carry their own slot.

Before this call each tag holds the packet’s payload word count in bits 24..=31 and its slot in bits 0..=15. Packets are prepended from first to end, as repeated addPrim calls would; slot 0xFFFF skips a packet, so separately ordered HUD packets can share the arena. Renderers stage depth keys in the tags as they build packets and leave the link pass to this one loop.

§Safety

first..end is a writable, contiguous sequence of complete packets in that layout; every word count describes the next packet exactly and is at most crate::chain::MAX_NODE_WORDS; every slot other than 0xFFFF is less than N; and the whole range meets the contract of add_raw.

Source

pub unsafe fn add_tagged_packet_stream_shifted_unchecked<const SLOT_SHIFT: u32>( &mut self, first: *mut u32, end: *mut u32, )

add_tagged_packet_stream_unchecked with every staged slot other than 0xFFFF shifted right by SLOT_SHIFT, so a smaller table can back a fine depth range (SLOT_SHIFT = 3 maps depths 0..2047 onto 256 slots).

§Safety

As add_tagged_packet_stream_unchecked, with every shifted slot less than N, and SLOT_SHIFT less than 16.

Source

pub fn end_with_draw_done(&mut self)

End the walk with GP0(1Fh) so crate::is_draw_done rises once the frame is drawn; see OrderingTable::end_with_draw_done.

§Panics

If anything was already added at slot 0, or the frame already ends in a link.

Source

pub fn submit_head(&self) -> *const u32

The node the frame’s walk starts at, for a chain that continues into this frame (a recorded preamble handed to psx_rt::present). Only an address: kicking a walk from it is up to an unsafe call that takes on the frame’s lifetime itself.

Source

pub unsafe fn end_with_chain(&mut self, head: *const u32)

Continue this frame’s walk into head, a chain that ends the list itself; see OrderingTable::end_with_chain.

§Safety

Every node reachable from head must stay live and unmodified for 'f, and for any walk of this frame that outlives it, under crate::chain::submit_async_raw’s node rules.

§Panics

If anything was already added at slot 0, or the frame already ends in a link.

Continue this frame’s walk into next once its own slot 0 is done, so both tables go out in one kick.

next is consumed: its table stays borrowed for 'f and is walked as part of this frame. Its own packets keep their order; anything added to this frame’s slot 0 afterwards still draws before next.

Host builds link for real, but OrderingTable::packets only follows links within one table’s address window.

§Panics

If anything was already added at slot 0, or the frame already ends in a link or GP0(1Fh): call it before slot 0 is used, and close only the last frame of a chain with end_with_draw_done.

Source

pub fn submit(self, dma: &mut GpuDma)

Kick the walk and wait for it.

Source

pub fn submit_with<R>(self, _dma: &mut GpuDma, overlap: impl FnOnce() -> R) -> R

Kick the walk, run overlap while the GPU walks, then wait.

overlap cannot reach the table or the packets: they are still borrowed by this frame.

Trait Implementations§

Source§

impl<'f, const N: usize> Debug for OtFrame<'f, N>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'f, const N: usize> Freeze for OtFrame<'f, N>

§

impl<'f, const N: usize> RefUnwindSafe for OtFrame<'f, N>

§

impl<'f, const N: usize> Send for OtFrame<'f, N>

§

impl<'f, const N: usize> Sync for OtFrame<'f, N>

§

impl<'f, const N: usize> Unpin for OtFrame<'f, N>

§

impl<'f, const N: usize> UnsafeUnpin for OtFrame<'f, N>

§

impl<'f, const N: usize> !UnwindSafe for OtFrame<'f, N>

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.