Skip to main content

Crate rustyn64_rdp

Crate rustyn64_rdp 

Source
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 0x000x3F 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§

BlendCycle
One cycle of the blender: the P/M color selects and the A/B alpha selects for P * A + M * (B + 1) (Set Other Modes, 0x2F). Each is 2-bit.
BlendInputs
The resolved per-pixel blender input colors (each RGBA8888).
CombineCycle
One cycle of the color combiner.
CombineMode
The two-cycle color-combiner configuration (Set Combine Mode, 0x3C).
DepthInputs
The Z-buffer read and render-mode flags Rdp::depth_test needs beyond the incoming pixel’s own z/dz (grouped so the signature stays legible).
DepthResult
The outcome of a per-pixel depth test: whether the pixel is written, and the blend/coverage state the blender consumes.
NeedsBus
Proof that a step needs the bus, produced only by Rdp::tick_without_bus and consumed only by Rdp::tick_with_bus.
OtherModes
The Set Other Modes (0x2F) render-mode state the blender and cycle control need.
Rdp
RDP state (skeleton).
TileDescriptor
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.h SUBPIXELS).
CYCLE_TYPE_1CYCLE
Set Other Modes.cycle_type value for 1-cycle mode — the default pipeline: one combiner pass per pixel.
CYCLE_TYPE_2CYCLE
Set Other Modes.cycle_type value 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_type value for copy mode — a raw texel blit that bypasses the combiner and blender entirely.
CYCLE_TYPE_FILL
Set Other Modes.cycle_type value for fill mode — the Set Fill Color register is repeated verbatim to memory, bypassing the combiner and blender.
DPC_ADDR_MASK
The DPC_START/DPC_END register mask: a 24-bit, 8-byte-aligned RDRAM address (n64-systemtest’s RDP START & END REG (masking)).
DP_STATUS_END_VALID
DPC_STATUS.END_VALID (the wiki’s END_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 to DPC_START are ignored until it is consumed by a DPC_END write.
DP_STATUS_XBUS
DPC_STATUS.XBUS — the DP reads commands from DMEM rather than RDRAM.
LOAD_BLOCK_MAX_TEXELS
Maximum texels a single Load Block may 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§

RdramBus
The shared RDRAM memory bus, as seen by chips that DMA into/out of main RAM.
VideoBus
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 (each s.3, from quantize_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.