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>
impl<const N: usize> OrderingTable<N>
Sourcepub fn frame(&mut self) -> OtFrame<'_, N>
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.
Sourcepub unsafe fn resume_frame(&mut self) -> OtFrame<'_, N>
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>
impl<const N: usize> OrderingTable<N>
Sourcepub const fn new() -> Self
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.
Sourcepub fn clear(&mut self)
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.
Sourcepub fn clear_with_dma(&mut self, dma: &mut OrderingTableClearDma)
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.
Sourcepub unsafe fn insert(&mut self, z: usize, packet_ptr: *mut u32, words: u8)
👎Deprecated: use OtFrame::add_raw, through frame() or resume_frame()
pub unsafe fn insert(&mut self, z: usize, packet_ptr: *mut u32, words: u8)
use OtFrame::add_raw, through frame() or resume_frame()
Sourcepub 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()
pub unsafe fn insert_unchecked( &mut self, z: usize, packet_ptr: *mut u32, words: u8, )
use OtFrame::add_raw_unchecked, through frame() or resume_frame()
Prepend a raw packet to slot z without the clamp or length check.
§Safety
Sourcepub 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()
pub unsafe fn insert_packed_commands_reverse_unchecked( &mut self, commands: *const usize, command_count: usize, )
use OtFrame::add_packed_commands_reverse_unchecked, through frame() or resume_frame()
Add packed two-word commands, last to first.
§Safety
Sourcepub 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()
pub unsafe fn insert_tagged_packet_stream_unchecked( &mut self, first: *mut u32, end: *mut u32, )
use OtFrame::add_tagged_packet_stream_unchecked, through frame() or resume_frame()
Add a contiguous stream of packets whose tags carry their slot.
§Safety
Sourcepub fn end_with_draw_done(&mut self)
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.
Sourcepub unsafe fn end_with_chain(&mut self, head: *const u32)
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.
Sourcepub fn submit_head(&self) -> *const u32
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.
Sourcepub unsafe fn submit(&self)
👎Deprecated: nothing proves the linked packets are alive; use OrderingTable::frame and OtFrame::submit
pub unsafe fn submit(&self)
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.
Sourcepub unsafe fn submit_async(&self)
👎Deprecated: returns mid-walk with the table still mutable; use OtFrame::submit_with, FrameStorage::draw_async or FramePair
pub unsafe fn submit_async(&self)
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.
Sourcepub unsafe fn packets(&self) -> Packets<'_> ⓘ
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.
impl<const N: usize> Debug for OrderingTable<N>
Shows the slot count, not the N link words.