Expand description
rustyn64-rdp — RDP (Reality Display Processor), the RCP rasterizer.
The RDP consumes a command stream (from the RSP or the CPU via the DP FIFO) and rasterizes triangles/rectangles into a framebuffer in RDRAM, running the color-combiner + blender + Z/coverage pipeline. The Video Interface (VI) then scans that framebuffer out. The accuracy bar is LLE — a faithful per-pixel pipeline (the ParaLLEl-RDP / angrylion reference), not a triangle-list HLE.
Rdp::tick decodes the DP FIFO — recognizing every command 0x00–0x3F
and consuming each one’s full length (via command) so the stream stays
aligned — and dispatches the sync commands and the FILL pipeline (Set
Color Image, Set Fill Color, Set Scissor, Fill Rectangle), which writes solid
rectangles into the framebuffer. The rest of the rasterizer (edge-walked
triangles, the texture engine with TMEM, the combiner/blender, dithering,
coverage AA) is the remainder of this roadmap phase.
Part of the one-directional chip-crate graph (see docs/architecture.md):
this crate depends on exactly one chip crate, rustyn64-cart, purely for
its RdramBus memory-bus trait — the RDP reads texture and framebuffer
reaches its tile storage through rustynes-mappers. #![no_std] + alloc.
Modules§
- command
- RDP command-stream decoding.
Structs§
- Blend
Cycle - One cycle of the blender: the
P/Mcolor selects and theA/Balpha selects forP * A + M * (B + 1)(Set Other Modes, 0x2F). Each is 2-bit. - Blend
Inputs - The resolved per-pixel blender input colors (each RGBA8888).
- Combine
Cycle - One cycle of the color combiner.
- Combine
Mode - The two-cycle color-combiner configuration (
Set Combine Mode, 0x3C). - Depth
Inputs - The Z-buffer read and render-mode flags
Rdp::depth_testneeds beyond the incoming pixel’s ownz/dz(grouped so the signature stays legible). - Depth
Result - The outcome of a per-pixel depth test: whether the pixel is written, and the blend/coverage state the blender consumes.
- Needs
Bus - Proof that a step needs the bus, produced only by
Rdp::tick_without_busand consumed only byRdp::tick_with_bus. - Other
Modes - The
Set Other Modes(0x2F) render-mode state the blender and cycle control need. - Rdp
- RDP state (skeleton).
- Tile
Descriptor - One of the RDP’s eight tile descriptors.
Constants§
- COVERAGE_
SUBPIXELS - The number of Y-subpixels the RDP samples per scanline for coverage
(parallel-rdp
coverage.hSUBPIXELS). - CYCLE_
TYPE_ 1CYCLE Set Other Modes.cycle_typevalue for 1-cycle mode — the default pipeline: one combiner pass per pixel.- CYCLE_
TYPE_ 2CYCLE Set Other Modes.cycle_typevalue for 2-cycle mode — two combiner passes per pixel, so a second texel and the LOD fraction become available.- CYCLE_
TYPE_ COPY Set Other Modes.cycle_typevalue for copy mode — a raw texel blit that bypasses the combiner and blender entirely.- CYCLE_
TYPE_ FILL Set Other Modes.cycle_typevalue for fill mode — theSet Fill Colorregister is repeated verbatim to memory, bypassing the combiner and blender.- DPC_
ADDR_ MASK - The
DPC_START/DPC_ENDregister mask: a 24-bit, 8-byte-aligned RDRAM address (n64-systemtest’sRDP START & END REG (masking)). - DP_
STATUS_ END_ VALID DPC_STATUS.END_VALID(the wiki’sEND_PENDING, read bit 9) — an end address is latched behind an in-flight transfer.- DP_
STATUS_ FREEZE DPC_STATUS.FREEZE— the DP is halted; registers can be read/written freely without the command FIFO advancing.- DP_
STATUS_ START_ VALID DPC_STATUS.START_VALID— a start address is latched and pending; further writes toDPC_STARTare ignored until it is consumed by aDPC_ENDwrite.- DP_
STATUS_ XBUS DPC_STATUS.XBUS— the DP reads commands from DMEM rather than RDRAM.- LOAD_
BLOCK_ MAX_ TEXELS - Maximum texels a single
Load Blockmay transfer (N64brew …/Commands §Load Block); a load over this writes nothing into TMEM. - SYNC_
LOAD_ GCLK Sync Load(0x26) pipeline stall, in GCLK cycles.- SYNC_
PIPE_ GCLK Sync Pipe(0x27) pipeline stall, in GCLK cycles.- SYNC_
TILE_ GCLK Sync Tile(0x28) pipeline stall, in GCLK cycles.- TMEM_
SIZE - TMEM size in bytes — 4 KiB of on-chip texture memory.
Traits§
- Rdram
Bus - The shared RDRAM memory bus, as seen by chips that DMA into/out of main RAM.
- Video
Bus - The narrow bus the RDP sees.
Functions§
- compute_
coverage - The 8-bit sub-pixel coverage mask for integer pixel column
x, given the per-Y-subpixel left/right span edges (eachs.3, fromquantize_x). - quantize_
x - Quantize a signed edge X to the 3-fraction-bit sub-pixel domain used by
compute_coverage, with the RDP sticky bit. - version
- Returns the crate version string.
Type Aliases§
- Pixel
- One RGBA8888 output pixel (post-VI-filter); the framebuffer the frontend presents is a slice of these.