N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

gspTurbo3D Microcode
gspTurbo3D.dram Microcode
gspTurbo3D.fifo Microcode

The gspTurbo3D microcode is a reduced-feature, reduced-precision microcode that delivers significantly faster performance.

All three subtypes (.o, .dram.o, and .fifo.o) are low accuracy, simplified 3D polygon geometry RSP microcodes that work effectively for characters and objects that are always displayed near the center of the view area. All processing is done with low accuracy to increase speed. However, this low degree of accuracy is reflected in the objects.

The DRAM version writes its output (RDP display list) into a memory buffer instead of transferring it to the RDP. The FIFO version transfers data to the RDP by using DRAM FIFO.

The features not supported by gspTurbo3D are:
  • Clipping
    Game programs must not send any geometric objects that require clipping to appear on screen. Scissoring is supported by using the DP command.

  • Lighting
    Calculation of dynamic lighting is not executed in this microcode.

  • Perspective Correction in Textures
    Perspective correction in textures is not done.

  • Matrix Stack
    There is no matrix stack. A single matrix is a part of the object state. It is used for vertex transformation.

  • Anti-aliasing
    Game programs cannot use anti-aliasing with this microcode because low accuracy calculations are used. Anti-aliasing is applied to all edges, but it does not work well because of low accuracy vertex positioning. The quality of the anti-aliasing suffers due to the lack of precision used by gspTurbo3D. This loss of precision can also manifest itself as various visual artifacts, depending on the content.

  • Display List
    The gspTurbo3D microcode uses a different, simpler format for the display list. The simpler display list is not compatible with other microcodes.
Turbo Display List
The turbo display list is a linear list of object structures that ends with a NULL object (the object state is a NULL object). For example, the following structure is a turbo object, and the turbo display list is a simple list like this.
#include "gt.h"

typedef struct {
  gtGlobState *gstatep; // global state, usually NULL

  gtState *statep;      // when NULL, object
                        // processing is finished

  Vtx *vtxp;            // when NULL, point in
                        // buffer is used

  gtTriN *trip;         // when NULL,
                        // nothing is drawn
} gtGfx_t;

typedef union {
  gtGfx_t obj;
  long long int force_structure_alignment;
} gtGfx;
Each object structure includes 4 pointers (global state, object state, vertex list, and triangle list) for a total of 16 bytes.

When a global state pointer or vertex list pointer is NULL, the one in current DMEM is used. When the triangle list pointer is NULL, the triangle is not generated. When the object state pointer is NULL, the end of display list is assumed.

Turbo Global State
Following is the turbo global state structure. Because it is specific to this microcode, you must change the microcode when you change the structure.
#include "gt.h" 

typedef struct {
     u16 perspNorm; // normalization of perspective
     u16 pad0;
     u32 flag;
     Gfx rdpOthermode;
     u32 segBases[16]; // segment base address
     Vp viewport;  // view-port
     Gfx *rdpCmds; // RDP data block when NULL block
                   // ended by gDPEndDisplayList
} gtGlobState_t;

/* Note: Although there are 16 segment 
 * table entries, the first segment (segment 0) 
 * is reserved for physical memory mapping. 
 * Therefore, segment 0 cannot be used. */

typedef union {
     gtGlobState_t sp
     long long int force_structure_alignment;
} gtGlobState;
The global state includes data that is unlikely to change and that is also the prime of each object. A format of the global state structure is exactly the same as DMEM and this structure is simply copied to DMEM.

The perspNorm field is used while transforming a vertex (see gSPPerspNormalize).

The rdpOthermode field includes the DP command SetOtherMode which is sent before sending any other DP commands.

The segBases array includes a 16-segment base address. Its entry 0 is reserved for physical memory mapping, so it cannot be used.

The viewport is used while transforming a vertex (see gSPViewport).

The rdpCmds points to a DP command block. When this pointer is not NULL, the macros in the DP command block are transferred to the RDP. The list of DP macros in the DP command block must end with the gDPEndDispley macro. Some DP macros (given later on this page) cannot use the DP command block.

Turbo Object State
The turbo object state structure is shown below. This is 'state' structure, which is linked to each object to be rendered. This is limited to microcode. When you change its structure, you must also change the gtoff.c tool and microcode.
#include "gt.h"

typedef struct {
     u32 renderState;  // render state
     u32 textureState; // texture state
     u8 vtxCount; // number of vertex
     u8 vtxV0; // vertex load address
     u8 triCount; // number of triangles
     u8 flag;
     Gfx *rdpCmds;
     Gfx rdpOthermode;
     Mtx transform; // transformation matrix
} gtState_t;

typedef union {
     gtState_t sp;
     long long int force_structure_alignment;
} gtState;	// same as gtStateLite : gtState, 
	      // but not matrix. (see flag)
            // This structure must go
            // through gtState.

typedef struct {
   u32 renderState; // render state
   u32 textureState; // texture state
   u8 vtxCount; // number of vertex
   u8 vtxV0; // vertex load address
   u8 triCount; // number of triangles
   u8 flag;
   Gfx *rdpCmds; // pointer for RDP DL
                   // (segment address)
   Gfx rdpOthermode;
} gtStateL_t;

typedef union {
   gtStateL_t sp;
   long long int force_structure_alignment;
} gtStateL;
The gtStateL version of the state structure can be used when a new matrix is not necessary. This is good for large objects that need to be placed among some turbo objects. The same transformation matrix can be used for all of its parts. You must set the GT_FLAG_NOMTX flag when using the gtStateL version of the state structure. In this case, the matrix is never loaded and the previous matrix is used for vertex transformation.

The renderState field is similar to geometry mode in gbi.h. It uses the following flags which are bit OR'd together:
  • GT_ZBUFFER to set Z buffering
  • GT_TEXTURE to set texture mapping
  • GT_CULL_BACK to perform back-face culling
  • GT_SHADING_SMOOTH to perform smooth shading
The textureState field has a texture tile number in the lower three bits of its field. All primitives in an object are drawn by using the same tile.

The vtxCount field is the vertex list size.

The vtxV0 field loads a vertex that begins with index v0(0-63) in the vertex buffer.

The triCount field is the triangle list size.

The flag field holds a group of bits to control execution.

The rdpCmds field points to the DP command block. When this pointer is a non-NULL character, these commands are transferred to the RDP. The command list must be ended by the gDPEndDisplay macro.

The rdpOthermode field includes the DP command SetOtherMode which is sent prior to other DP commands.

The transform matrix is used for vertex transformation.

Turbo Vertex
The vertex list is an aggregation of vertex structures. It uses the same format as the vertex format in gbi.h. Please see gSPVertex for details.

The vertex cache in the turbo microcode can read 64 vertices. The vertex is transformed when it is loaded.

Turbo Triangle List
The triangle list is an aggregation of the following structure. The following structure represents a single triangle, which is one of a list of triangle objects to be rendered. The triangle list has an 8-byte limit. This structure is only 4-bytes, so it is assumed that this triangle is an element in an array. It is also assumed that the array is arranged in 8-byte units.
#include "gt.h"

typedef struct {
   u8 v0, v1, v2, flag; // flag for flat shading
   } gtTriN;
This array must be aligned to an 8-byte boundary.

GBI DL Command
The turbo microcode uses a completely different display list format, so the GBI DL command is not supported.

However, the global and object states of the DP command block are supported. These commands are the same format (and same microcode) as the one in gbi.h. Some DP commands are not supported because the DP state operation is not appropriate for the interface between turbo geometry and turbo display list processes.

Unsupported DP GBI Macros
The turbo microcodes do not support the following DP GBI commands:
  • gDPPipelineMode
  • gDPSetCycleType
  • gDPSetTexturePersp
  • gDPSetTextureDetail
  • gDPSetTextureLOD
  • gDPSetTextureLUT
  • gDPSetTextureFilter
  • gDPSetTextureConvert
  • gDPSetCombineKey
  • gDPSetColorDither
  • gDPSetAlphaDither
  • gDPSetAlphaCompare
  • gDPSetDepthSource
  • gDPSetRenderMode
Most of these can be set by using the gtStateSetOthermode interface.

Performance
This microcode generates the following triangle types in order of speed, beginning with the fastest:
  • Fill flat shading (it is necessary to store primitive color to the DP)
  • Gouraud shading
  • Texturing and gouraud shading
  • Z buffering and gouraud shading
  • Texturing, Z buffering, and gouraud shading
Because vectors are used efficiently for a calculation of the triangle attributes, you can calculate the gouraud shading attributes without limitations when other attributes are also generated.

Z buffering the triangle needs a few additional processes.

Because vectors are used for efficient vertex transformation, it is the best to operate as many vertices as possible. Loading vertices in a multiple of four is the most effective method.

The RCP is designed to be able to draw high-quality texture primitives. Texture mapping should be used where possible (instead of additional geometry) in order to achieve more complicated graphics.

Caution
This is first release of this microcode. Its functions and display list format will be changed in the future. Cracks and tears sometimes appear because the calculation of the edge slope is simplified.

See Also
gtStateSetOthermode
gDPClearOtherMode
gDPEndDisplayList
gspFast3D
gspLine3D



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.

Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998