gspTurbo3D

Currently not supported. Please use F3DEX microcode

Function

gspTurbo3D, gspTurbo3D.dram, gspTurbo3D.fifo

Reduced-feature, reduced-precision, and simplified 3D polygon geometry RSP microcode

Description

This is a reduced-feature simplified 3D polygon geometry RSP microcode that work effectively for "characters" and objects that are always displayed near the center of the view area.

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.

All processing is done with low accuracy to increase speed. However, this low degree of accuracy is reflected in the objects.

The features not supported by gspTurbo3D are:

Clipping
Game programs must not send any geometric objects that will not be displayed on the 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 coordinates 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.)

Turbo Display List

Turbo microcode uses a simpler format for the display list, which is not compatible with other microcode.

The turbo display list is a linear list of object structures that ends with a NULL object (the object state is a NULL object).

#include "gt.h"

/*
 * The following structure is a turbo object,
 * and the turbo display list is a simple list like this.
 *(4 pointers = 16 bytes)
 */

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).

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.

#include "gt.h"
/*
 * This is a global state structure.
 * Because this is paired with the microcode,
 * you must change the microcode when you change the structure. 
 */

typedef struct {
        u16 perspNorm;    /* normalization of perspective */
        u16 pad0;
        u32 flag;
        Gfx rdpOthermode;
        u32 segBases[16]; /* segment base address(see the note) */
        Vp viewport;      /* view-port */
        Gfx *rdpCmds;     /* RDP data block, when not 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. Some DP macros (given later on this page) cannot use the DP command block. The list of DP macros in the DP command block must end with the gDPEndDispley macro.

Turbo Object State

The turbo object state structure is shown below.

#include "gt.h"
/*
 * 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. 
 */
 
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;

/* gtStateLite : same as gtState, but not matrix (see flags below) */
/* 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 to 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. Refer to GT_FLAG_NOMTX described later.

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. GT_FLAG_NOMTX flag needs to be set when you use gtStateL structure. In that case, the matrix will not be loaded, but the previous matrix will be used for vertex transformation.

The rdpCmds field points to the DP command block. When this pointer is a NULL character, these commands are transferred to the RDP. For the DP commands that cannot be used in this command block, see the list described later. This list must end with gDPEndDisplay command.

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.

#include "gt.h"
/*
 * The following structure represents a single triangle,
 * which is one of a list of triangle objects to be rendered.
 * Note: The triangle list must be 8-byte-aligned.
 * 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 aligned
 * in 8-byte units in MIPS C compiler.
 */
typedef struct {
        u8 v0, v1, v2, flag; /* flag for flat shading */
} gtTriN;

This array must be aligned to an 8-byte boundary.

GBI

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.

The turbo microcodes do not support the following DP GBI commands:

Most of these can be set by using the gtStateSetOthermode interface (as some of the functionalities have been reduced).

Performance

This microcode generates the following triangle types in order of speed, beginning with the fastest:

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.

Known Issue

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