SDK crate

psx-gpu

Drawing, command submission and framebuffers

On this page

Use psx-gpu to initialize the display, send drawing commands and manage framebuffers. A minimal frame clears the back buffer, emits primitives, waits for drawing and VBlank, then swaps buffers.

How the crate is organized

Gpu is the handle for the GPU: it takes the GPU's DMA token from psx_rt::Peripherals, so one owner at a time drives GP0, and the drawing, draw-area and synchronization methods hang off it. display holds DisplayConfig, the video mode and resolution, and DoubleBuffer, whose methods take the Gpu to clear and swap the two framebuffers. prim describes primitive packets, ot builds depth-ordered DMA lists and frame wraps one frame of them (OtFrame, PrimitiveArena, FrameStorage) so the borrow checker tracks packet lifetimes. ordered preserves the caller's command order in a bounded command stream, and chain builds static DMA chains. material groups texture page, CLUT, tint and blend state. The older free functions and framebuf::FrameBuffer remain only as deprecated forwarders.

Integration notes

Choose how to submit commands. An ordering table is useful when geometry needs depth ordering; an ordered stream suits commands already in painter order. DMA reads the command storage asynchronously, so keep it alive until completion. OrderedCommandStream uses caller-provided static storage and an explicit fence before reuse or separate VRAM work. Drawing completion and VBlank are different events: queued presentation waits for the frame's closing draw-done command.

Complete examples: triangle, ordering table, queued presentation and the VBlank-kicked present queue.

API, dependencies and source structure

SDK revision f2fec1c301f1. Structure, dependencies and features below come from this revision.

The PS1 reference includes all Cargo features. The manifest below shows which features are enabled by default.

Dependencies

  • bitflags (shared repository crate): all targets
  • psx-hw (shared repository crate): all targets
  • psx-io: all targets

Cargo features

This crate declares no Cargo features.

Read the complete manifest and feature comments.

Source layout

The list includes internal implementation and test files. Public modules, types, functions and their signatures are indexed in the API reference above.

14 source and manifest files