2.2 Graphics


2.2.1 There is no picture on the screen, but the drawing loop is running

You are probably sending a bad segment address to the RSP graphics pipeline. This problem is easy to overlook, as there are no warnings. Make sure you thoroughly understand how a MIPS family processor performs addressing and how KSEG0 works (most games run in KSEG0). It allows cached access with no TLB translation. All CPU registers are accessible. KSEG addresses use the most significant bits of the address to indicate the addressing modes.

Figure 2-1 CPU KSEG0-3 Addresses
[Figure 2-1]

The RSP uses a segment addressing scheme with base pointers. It is very easy to hand a CPU KSEG0 address to the RSP by mistake and spend hours locating a simple error. Note that KSEG0 CPU address would reference an invalid segment if decoded as an RSP address.

Figure 2-2 RSP Address
[Figure 2-2]

For example, if you have the following code, the RSP/RDP pipeline will receive garbage:

Mtx matrix;
gSPMatrix(gdl++, &matrix, G_MTX_.....);

matrix is a KSEG0 CPU address 0x8xxxxxxx. When this is handed to RSP, it fetches garbage. Below is a list of common commands with pointers:

  1. gDPSetColorImage
  2. gDPSetTextureImage
  3. gDPSetMaskImage
  4. gSPMatrix
  5. gSPViewport
  6. gSPVertex
  7. gSPDisplayList

Keep in mind that CPU addresses and RSP/RDP addresses use different addressing schemes and are not interchangeable.

One useful way to debug possible display list problems is to link with the GBI dumping routines in libgu, and print out the display list. This will immediately show bad pointers and garbage matrix. See the main page for guParseGbiDL() and guParseRdpDL().


2.2.2 Ending a Display List

Make sure that your recent gbi display edit has gSPEndDisplayList in each display list. Without this, the RSP will probably hang. The RDP requires a gDPFullSync at the end of the entire display list sequence to make the DP interrupt the CPU for notification.


2.2.3 Flicker on the Screen

The beginning of the framebuffer and z-buffer addresses must be 64 byte boundary aligned.