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

OrderingTable

Struct OrderingTable 

Source
pub struct OrderingTable<const N: usize> { /* private fields */ }
Expand description

Fixed-size OT. N depth slots. Typical values: 256, 1024, 4096.

Implementations§

Source§

impl<const N: usize> OrderingTable<N>

Source

pub fn frame(&mut self) -> OtFrame<'_, N>

Clear the table and start building a frame in it.

The table stays borrowed until the frame is submitted and its walk has finished, so it can neither be cleared nor moved under the DMA.

Source

pub unsafe fn resume_frame(&mut self) -> OtFrame<'_, N>

Continue a frame in this table without clearing it, for a frame built in several phases (a scene pass, then an overlay pass).

§Safety

Every packet the table links already, through an earlier OtFrame or a raw add, must stay live and unmodified, except for tags later adds write, until the returned frame’s walk has finished (or for good, if it is never submitted). Packets an earlier frame added with OtFrame::add were borrowed only for that frame, so the caller now owns their lifetime. The table must not be walking.

Source§

impl<const N: usize> OrderingTable<N>

Source

pub const fn new() -> Self

Create a table with every slot being a chain terminator. Call clear before submitting – that wires up the inter-slot chain so DMA walks across all N slots.

Source

pub fn clear(&mut self)

Reset every slot for a fresh frame. Entry [0] is the terminator (farthest from camera); each higher slot points to the slot below. Submission starts at [N-1] so the DMA walker visits [N-1] → [N-2] → … → [0] → end.

Source

pub fn clear_with_dma(&mut self, dma: &mut OrderingTableClearDma)

clear through the ordering-table-clear DMA channel (channel 6) instead of the CPU.

The wait is bounded: if the channel wedges, which the CL2 silicon probes saw it do, or the table is longer than a 16-bit word count, the CPU clear runs instead, so the table is always valid. Host builds always clear with the CPU.

Source

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

👎Deprecated:

use OtFrame::add_raw, through frame() or resume_frame()

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

§Safety

As OtFrame::add_raw.

Source

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

👎Deprecated:

use OtFrame::add_raw_unchecked, through frame() or resume_frame()

Prepend a raw packet to slot z without the clamp or length check.

§Safety

As OtFrame::add_raw_unchecked.

Source

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

👎Deprecated:

use OtFrame::add_packed_commands_reverse_unchecked, through frame() or resume_frame()

Add packed two-word commands, last to first.

§Safety

As OtFrame::add_packed_commands_reverse_unchecked.

Source

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

👎Deprecated:

use OtFrame::add_tagged_packet_stream_unchecked, through frame() or resume_frame()

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

§Safety

As OtFrame::add_tagged_packet_stream_unchecked.

Source

pub fn end_with_draw_done(&mut self)

End this table’s DMA walk with GP0(1Fh), so the GPU raises crate::is_draw_done once everything in the table is drawn.

Links slot 0, the last one walked, to crate::chain::DRAW_DONE_NODE; packets inserted at slot 0 afterwards still draw before it. Call it after every clear and before anything is inserted at slot 0. Pair the submission with crate::arm_draw_done.

Host builds leave the table as it is: the shared node lives outside the table’s address window, which packets relies on.

§Panics

If slot 0 is not empty.

Source

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

Continue this table’s walk into head, the first node of a chain that ends the list itself: a command recording (psx_io::gpu::begin_recording_raw) closed on crate::chain::DRAW_DONE_NODE, say, for a frame published to psx_rt::present.

§Safety

head must point at a 4-byte-aligned node tag in RAM, and every node reachable from it must meet crate::chain::submit_async_raw’s contract (at most crate::chain::MAX_NODE_WORDS payload words each, live and unmodified) until every walk of this table has finished.

§Panics

If slot 0 is not empty: call it right after clear, before anything is inserted at slot 0.

Source

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

Pointer to the slot where DMA starts ([N-1]). Passed to crate::chain::submit_raw as the linked-list entry point.

Source

pub unsafe fn submit(&self)

👎Deprecated:

nothing proves the linked packets are alive; use OrderingTable::frame and OtFrame::submit

Submit the whole table to GPU via DMA channel 2 linked-list mode and wait for completion.

§Safety

As crate::chain::submit_raw for the chain this table heads: every packet linked into it must be live and unmodified, and the table must not have moved since it was cleared.

Source

pub unsafe fn submit_async(&self)

👎Deprecated:

returns mid-walk with the table still mutable; use OtFrame::submit_with, FrameStorage::draw_async or FramePair

Kick the table’s DMA walk without waiting for it to finish; pair it with crate::chain::wait.

§Safety

As crate::chain::submit_async_raw: the table and every packet it chains must stay live, unmoved and unmodified until that wait returns.

Source

pub unsafe fn packets(&self) -> Packets<'_> ⓘ

Walk the linked chain in DMA submission order, producing one (packet_ptr, words) pair per primitive packet.

Used by the editor’s host-side preview to convert an OT into a psx-gpu-render command log without DMAing through real hardware. The hardware DMA walker follows the same links in the same order, so the iterator yields what the GPU would consume.

A link holds only the low 24 bits of an address, as on the console. A link into this table is read through the table; any other link is read as an exposed address with the table’s upper address bits, which every packet in console RAM shares.

§Safety

Every chained packet must be live for the lifetime of the returned iterator, exactly the invariant a submission requires, and its address must have been exposed, as every insert does.

Trait Implementations§

Source§

impl<const N: usize> Debug for OrderingTable<N>

Shows the slot count, not the N link words.

Source§

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

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

impl<const N: usize> Default for OrderingTable<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<const N: usize> Freeze for OrderingTable<N>

§

impl<const N: usize> RefUnwindSafe for OrderingTable<N>

§

impl<const N: usize> Send for OrderingTable<N>

§

impl<const N: usize> Sync for OrderingTable<N>

§

impl<const N: usize> Unpin for OrderingTable<N>

§

impl<const N: usize> UnsafeUnpin for OrderingTable<N>

§

impl<const N: usize> UnwindSafe for OrderingTable<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.