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

screen_area

Function screen_area 

Source
pub fn screen_area(vertices: [(i16, i16); 3]) -> i32
Expand description

Signed screen-space area of a triangle – the same value GTE NCLIP writes to MAC0: SX0*(SY1-SY2) + SX1*(SY2-SY0) + SX2*(SY0-SY1). Positive = front-facing, <= 0 = back-facing/degenerate.

Computed in software rather than via NCLIP on purpose: reading MAC0 immediately after NCLIP returns a STALE value on real PS1 hardware (the GTE result-read hazard – MAC0 settles a few cycles later than the CPU reads it), which mis-culls and drops wall faces on silicon while looking fine on every emulator. The i32 cross product is exact for screen coordinates (|coord| <= 0x400 after clamping) and has no read latency. Confirmed against real hardware (cortex GTE disc 2026-06-09: NCLIP MAC0 back-to-back read is stale, +8 nops reads correct).