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

Crate psx_gpu

Crate psx_gpu 

Source
Expand description

The PS1 GPU: a driver that owns it, the packets it draws, and safe frame building over its linked-list DMA.

§Layers

  • Gpu owns GP0, GP1 and DMA channel 2 through the GpuDma token. Every port write is a method, so the borrow checker keeps immediate drawing out of a running walk.
  • prim holds the packets: repr(C) structs whose words are the GP0 wire format. Gpu::draw sends one now; an ot::OrderingTable frame links many for one DMA walk.
  • frame builds frames with lifetimes instead of unsafe: a packet added to an frame::OtFrame stays borrowed until the walk that reads it has finished.
  • ordered streams packets in painter order over static storage.
  • display describes what the GPU shows; material describes how textured packets sample and blend.
  • The raw layer, chain::submit_async_raw and the *_unchecked adds on frame::OtFrame, is unsafe: it hands the DMA controller addresses the type system cannot follow.

Register addresses and command-word encoders live in psx-hw, shared with the emulator’s GPU, so the two cannot disagree on a layout.

Re-exports§

pub use chain::DrawDoneNode;
pub use chain::StaticChain;
pub use chain::StaticPacket;
pub use chain::DRAW_DONE_NODE;
pub use chain::MAX_NODE_WORDS;

Modules§

chain
The raw linked-list layer: DMA channel 2 walking a chain of GP0 nodes.
display
What the GPU shows: video standard, resolution, and where the picture sits in the TV signal.
frame
Borrow-checked frame building over an ordering table.
framebuf
The pre-Gpu double buffer, kept for one stage: use crate::display::DoubleBuffer, whose methods take the crate::Gpu they write to.
material
PS1 texture material state.
ordered
Painter-order command streaming with bounded GPU DMA nodes.
ot
Ordering Table: depth-sorted linked-list of GPU primitives.
prim
Primitive packet types for DMA-based GPU submission.

Structs§

Gpu
The PS1 GPU: its command port (GP0), its control port (GP1) and DMA channel 2, which feeds GP0.
MaskMode
GP0(E6h) mask-bit state.
RecoveryStats
How often the SDK recovered a hung GPU since boot, for a debug overlay or a test log. Every GPU wait is bounded and recovers by resetting the GPU; these counts make the recoveries visible.

Functions§

arm_draw_doneDeprecated
Clear GPUSTAT bit 24 with GP1(02h).
draw_line_monoDeprecated
Draw a monochrome line.
draw_quad_flatDeprecated
Draw a flat-shaded quad.
draw_quad_texturedDeprecated
Draw a textured quad with a single tint.
draw_quad_textured_gouraud_materialDeprecated
Draw a Gouraud-shaded textured quad using a TextureMaterial.
draw_quad_textured_materialDeprecated
Draw a textured quad using a TextureMaterial.
draw_rect_flatDeprecated
Fill an axis-aligned rectangle with a flat color, as a polygon.
draw_sprite_materialDeprecated
Draw a variable-size textured sprite using a TextureMaterial.
draw_syncDeprecated
Renamed to Gpu::wait_idle.
draw_tri_flatDeprecated
Draw a flat-shaded triangle.
draw_tri_flat_blendedDeprecated
Draw a semi-transparent flat-shaded triangle.
draw_tri_gouraudDeprecated
Draw a Gouraud-shaded triangle.
fill_rectDeprecated
Fill a VRAM rectangle with a solid color.
initDeprecated
Initialise the GPU: reset, display mode, display window, DMA direction, display on.
is_draw_done
True once the GPU has executed the GP0(1Fh) that closes the work kicked after the last Gpu::arm_draw_done, so everything before it is drawn.
recovery_stats
The recovery counts since boot. Reads only, so it needs no Gpu.
set_draw_areaDeprecated
Set the drawing-area rectangle.
set_draw_offsetDeprecated
Set the drawing offset.
signal_draw_doneDeprecated
Send GP0(1Fh) through the command port.
submit_linked_list_async⚠Deprecated
Old name of submit_linked_list_async_raw.
submit_linked_list_async_raw⚠Deprecated
Kick a linked-list chain without waiting for the walk.
submit_linked_list_raw⚠Deprecated
Kick a linked-list chain and wait for the walk.
submit_linked_list_raw_async⚠Deprecated
Renamed to submit_linked_list_async_raw.
submit_linked_list_waitDeprecated
Wait until the linked-list walk kicked last has finished.
vsyncDeprecated
Wait 242 HBlank periods (~15.4ms) from the moment of the call.
wait_idleDeprecated
Block until the GPU has finished drawing everything sent to it.

Type Aliases§

ResolutionDeprecated
Moved to display::Resolution.
VideoModeDeprecated
Moved to display::VideoMode.