thecodingidiot.com

c05-the-pipeline

The Pipeline

THREE TOOLS

Every texture on every surface in every N64 game went through a pipeline before a player could see it.

SGI Onyx — the class of workstation used for early Nintendo 64 development
SGI Indy development kit with Nintendo 64 simulation board and controller connectors

Nintendo 64 development happened on Silicon Graphics workstations — Onyx systems in larger studios, Indy machines on desks. Artists created textures in SGI's native image format.

The N64 hardware could not load those images directly: it expected pixel data packed as a static C array at a fixed memory address, embedded in the ROM at compile time.

The SGI connection goes deeper than the toolchain. In 1993, Nintendo and SGI announced Project Reality — a joint development partnership that produced the N64's Reality Co-Processor: the chip inside every console responsible for all polygon transformation and texture mapping. The same company built both the dev workstations and the chip.

Those same workstations were at Industrial Light & Magic during production of Terminator 2 and Jurassic Park. The professional 3D software — SoftImage for Jurassic Park's dinosaurs, proprietary tools for the T-1000 morphing sequences in T2 — ran on IRIX only.

T. rex skeletal data in Alias software on an SGI monitor, Jurassic Park (1993)
T. rex geometry and wireframe in Alias on SGI, Jurassic Park (1993)
Terminator 2 saucehead morphing test, January 1991 — SGI wireframe and final composited shot

An SGI Indigo2 started at around $25,000; a fully configured system reached $55,000 or more, and professional 3D software added tens of thousands on top. Until Windows NT ports arrived at the end of the decade, the tools did not exist on any other platform.

In 1994, when the PlayStation launched, no consumer PC had a dedicated 3D graphics chip. The 3Dfx Voodoo — the first — shipped in late 1996, the same year as the N64.

The SDK shipped a tool called rgb2c that consumed an SGI RGB image and produced a .c source file — a static const uint8_t array of raw pixel data. That file was compiled alongside the game code by the IDO compiler on IRIX. The object files were then linked and packed by makerom into the final cartridge ROM.

Three tools. Each one consumed the output of the previous. The image never touched memory on its own — it passed through.

Super Mario 64 — N64 box art
GoldenEye 007 — N64 box art
The Legend of Zelda: Ocarina of Time — N64 box art

Super Mario 64,[1] GoldenEye 007,[2] The Legend of Zelda: Ocarina of Time[3] — every texture on every surface went through that pipeline before a player could see it.

The shell's | does the same thing without the intermediate files. Instead of writing a .c file between rgb2c and makerom, the kernel maintains a pipe — a buffer in memory — and connects one program's standard output directly to the next program's standard input. The programs do not know they are connected. They read from stdin and write to stdout, as always.

You will build a program that does what the shell does: open a file, fork N child processes, connect them with pipes, redirect input and output, execute each command, and wait. By the time you finish, the pipe is not a feature — it is a mechanism you have assembled from parts you understand.

The implementation pages start with processes — fork, execve, waitpid — then build up the pipe mechanism, file redirects, and a full two-command pipeline before generalising to chains of arbitrary length using the linked-list API. The list functions are introduced in pages 01 and 02 up front, before the systems work begins. Start at Setup.

Implementation

Setup

Begin Implementation
  1. 0Setup
  2. 1Lists
  3. 2List Operations
  4. 3Processes
  5. 4The Pipe
  6. 5Redirects
  7. 6The Pipeline
  8. 7Chains
  9. 8Ship It

Footnotes

  1. Super Mario 64 - Wikipedia

  2. GoldenEye 007 (1997 video game) - Wikipedia

  3. The Legend of Zelda: Ocarina of Time - Wikipedia