User Tools

Site Tools


RCP Structures

Every rendition of Fast3D shares a few common structures by the RCP, such as some bit-mapping used within certain opcodes. These are explained within this page.

RSP Geometry Mode

This 32-bit value configures how the RSP will process geometry. They are all 1-bit flags. All of these flags are disabled by default except for G_CLIPPING.
1 is the affected bit, and 1 is the affected bit for F3D and F3DEX (if different from EX2).

Affects Bit Name Description
0000 0000 0000 0000 0000 0000 0000 0001 G_ZBUFFER Enables depth (Z buffer) calculations in the RSP
0000 0000 0000 0000 0000 0000 0000 0100 G_SHADE Enables calculating vertex color for triangle. Uses flat shading without G_SHADING_SMOOTH.
0000 0000 0000 0000 0001 0010 0000 0000 G_CULL_FRONT Front-face culling
0000 0000 0000 0000 0010 0100 0000 0000 G_CULL_BACK Back-face culling
0000 0000 0000 0001 0000 0000 0000 0000 G_FOG Calculates alpha value of primitives for fog effects
0000 0000 0000 0010 0000 0000 0000 0000 G_LIGHTING Enables lighting calculations to determine vertex color (determines how the color/normal part of loaded vertices are interpreted)
0000 0000 0000 0100 0000 0000 0000 0000 G_TEXTURE_GEN Generates spherical texture coordinates, based on X and Y components of the projected version of the normal
0000 0000 0000 1000 0000 0000 0000 0000 G_TEXTURE_GEN_LINEAR Generates linear texture coordinates, based on acos() of X and Y components of the normal, after projection transformation
0000 0000 0010 0000 0000 0010 0000 0000 G_SHADING_SMOOTH Enables smooth (Gouraud) shading of primitives. Needs G_SHADE enabled to work.
0000 0000 1000 0000 0000 0000 0000 0000 G_CLIPPING In F3DLX2, can disable clipping calculations, and is on by default. Ignored by other F3D microcodes, clipping is always on.
Affects Bits Other Meanings
0000 0000 0000 0000 0000 0000 1111 1111 The lowest byte of the geometry mode can be OR'd with G_TRI_FILL (0xC8) to generate an appropriate internal triangle opcode, apparently.
1111 1111 0000 0000 0000 0000 0000 0000 The highest byte of the geometry mode is OR'd with 0x703 to generate a “clip code mask”. All that's known about this value is that when set to 0x04 (after ORing, 0x707), “near clipping will occur”.


Here you'll find the bit-mapping used for G_SetOtherMode, SetOtherMode_H, and SetOtherMode_L.

Higher-Half Bits

The higher half of the RDP Other Modes bits controls various aspects of the RDP (whereas the lower half deals more with just the blender). Some of these options differ between two hardware versions.

Bits Affected Option Name
0000 0000 0000 0000 0000 0000 0011 0000 G_MDSFT_ALPHADITHER
0000 0000 0000 0000 0000 0000 1100 0000 G_MDSFT_RGBDITHER
0000 0000 0000 0000 0000 0001 0000 0000 G_MDSFT_COMBKEY
0000 0000 0000 0000 0000 1110 0000 0000 G_MDSFT_TEXTCONV
0000 0000 0000 0000 0011 0000 0000 0000 G_MDSFT_TEXTFILT
0000 0000 0000 0000 1100 0000 0000 0000 G_MDSFT_TEXTLUT
0000 0000 0000 0001 0000 0000 0000 0000 G_MDSFT_TEXTLOD
0000 0000 0000 0110 0000 0000 0000 0000 G_MDSFT_TEXTDETAIL
0000 0000 0000 1000 0000 0000 0000 0000 G_MDSFT_TEXTPERSP
0000 0000 0011 0000 0000 0000 0000 0000 G_MDSFT_CYCLETYPE
0000 0000 0100 0000 0000 0000 0000 0000 G_MDSFT_COLORDITHER
0000 0000 1000 0000 0000 0000 0000 0000 G_MDSFT_PIPELINE
Option Name Description

Only a hardware v2.0 option. Sets up the dithering of the alpha value for when the blender drops from 8-bit to 5-bit precision (this always happens, even for a 32-bit color buffer). Some of the settings are dependent on the color dither setting (see G_MDSFT_RGBDITHER and/or G_MDSFT_COLORDITHER below).
Possible values are:

00: G_AD_PATTERN: Alpha dithering uses the same pattern as that for the color components. If the color dither is disabled, alpha dithering uses the “standard” Bayer pattern (so G_CD_BAYER). If the color dither is set to G_CD_NOISE, alpha dither is instead like G_CD_MAGICSQ.

01: G_AD_NOTPATTERN: the inverse of whatever G_AD_PATTERN would be using.

10: G_AD_NOISE: Random dithering pattern.

11: G_AD_DISABLE: No dithering for alpha values.

Only a hardware v2.0 option. Sets up the dithering for the color components.
Possible options are:

00: G_CD_MAGICSQ: Uses magic square ordered dithering (presumably a matrix of values which is a magic square, though it's not further specified)

01: G_CD_BAYER: Uses standard Bayer matrix (of unknown size) for ordered dithering

10: G_CD_NOISE: Random dithering pattern

These names for the G_MDSFT_COLORDITHER option are defined as aliases for this option in hardware version 2.0:

11: G_CD_DISABLE: Disable dithering for color.

10: G_CD_ENABLE: Backwards-compatible name, for code previously expecting hardware version 1.0. Equivalent to G_CD_NOISE.

The above two options are defined differently for hardware version 1.0, see G_MDSFT_COLORDITHER below.
G_MDSFT_COMBKEY This option enables/disables chroma key, with the bit enabled specifying chroma key is enabled.

Specifies what the Texture Filter unit of the RDP should do with the texels it receives.
Valid options are:

000: G_TC_CONV: Does the first step of converting texels from YUV to RGB (second step done in color combiner)

101: G_TC_FILTCONV: Does both G_TC_CONV and G_TC_FILT.

110: G_TC_FILT: Does linear filtering between the four texels it received into one texel. (Typically referred to as “bilinear” filtering in this context.)

Note that even though G_TC_CONV is the default state, most programs will make sure to set this value differently. If you're making a new display list, for example, and the textures happen to be messed up, making sure you set this option is one place to look (assuming a real N64 or perfect emulator).

Chooses how the Texture Filter unit filters the texels it received (if doing filtering, see G_MDSFT_TEXTCONV). Available choices are:

00: G_TF_POINT: Just takes the texel closest to the destination pixel as-is.

10: G_TF_BILERP: Does linear filtering between the four texels (“bilinear filtering”)

11: G_TF_AVERAGE: Averages values of the four texels

Sets the storage type of the pixels in the TLUT, for color-indexed textures. Possible values are:

00: G_TT_NONE: No TLUT is being used

10: G_TT_RGBA16: Colors are stored in RGBA16 format

11: G_TT_IA16: Colors are stored in IA16 format

Sets whether to use LOD calculations in selecting texture tiles. Possible values are:

0: G_TL_TILE: No LOD performed. Display list specifies the tile to use directly. In 2-cycle mode the second tile selected is the next one after the specified tile, that is selected_tile + 1.

1: G_TL_LOD: LOD is performed. Calculations are done to select the closer (i.e. larger) tile for a given LOD. In 2-cycle mode the second-closest mipmap level is chosen as the second tile.

Decides how to handle texturing when the LOD is less than 1.0, if LOD is enabled (see G_MDSFT_TEXTLOD above). Available choices are:

00: G_TD_CLAMP: Just uses the tile for the highest LOD.

01: G_TD_SHARPEN: Generates a sharper texture from the highest two mipmap levels.

10: G_TD_DETAIL: Uses a special detail texture to add detail to the highest mipmap level.

It's not known what would happen if you set both bits, that is specify both sharpening and detail texture.
G_MDSFT_TEXTPERSP Enables perspective correction on texture coordinates when set.

Sets the cycle type of RDP, and thus what it does in rendering.

00: G_CYC_1CYCLE: 1-cycle mode. Renders a pixel per clock cycle.

01: G_CYC_2CYCLE: 2-cycle mode. Renders a pixel per two clock cycles. Used when more advanced operations are needed, e.g. fog effects or mipmapping.

10: G_CYC_COPY: Texture copy mode. Copies a texture direct to the framebuffer at 64 bits per clock cycle. Can apparently still do alpha comparison, but otherwise is just direct copying.

11: G_CYC_FILL: Buffer fill mode. Fills the chosen color buffer (which may really be the depth buffer) with the color in the fill color register at a rate of 64 bits per clock cycle.

Note that only 1-cycle and 2-cycle mode make use of the whole RDP pipeline; fill and copy mode skip past most (if not all) of it for greater speeds.

Only for hardware version 1.0. Enables dithering in the color components of pixels, with the set bit enabling it. Note that the names G_CD_ENABLE and G_CD_DISABLE are defined for G_MDSFT_RGBDITHER instead in hardware version 2.0.

This option controls whether span buffer coherency will be used in the RDP. Options are:

0: G_PM_NPRIMITIVE: No coherency is guaranteed. Several span buffers may load the same area of the framebuffer into memory, causing problems in rendering.

1: G_PM_1PRIMITIVE: Coherency is acheived via adding around 30 to 40 null cycles after the last span of a primitive is rendered. This ensures that each span buffer will always have the latest-computed version of pixels. This reduces speed (due to the empty cycles) at the cost of correctness. The SDK notes that this shouldn't be used unless necessary.

Lower-Half Bits

The lower half of the RDP Other Modes control various aspects of the RDP blender, which mixes new primitives with the framebuffer. The majority of this 32-bit value sets up the render mode for the blender.

Affects Bits Name of Option
0000 0000 0000 0000 0000 0000 0000 0011 G_MDSFT_ALPHACOMPARE
0000 0000 0000 0000 0000 0000 0000 0100 G_MDSFT_ZSRCSEL
0000 0000 0000 0000 1111 1111 1111 1000 G_MDSFT_RENDERMODE (cycle-independent)
1111 1111 1111 1111 0000 0000 0000 0000 G_MDSFT_RENDERMODE (cycle-dependent)
Name of Option Description

Decides how to compare the input (new) pixel's alpha value, valid choices are:

00: No comparisons are made, so doesn't affect the process

01: Compare to the alpha value of the blend color register. Draw only if input alpha is larger than the blend color alpha.

11: Compare to a random dither value in the range 0.0 < x < 1.0. Creates stippling transparency effects, among other uses.

Selects the source of depth information for pixels. If enabled, it uses the depth value from the primitive depth value for the entire primitive. If disabled, the depth value is calculated per-pixel and used instead.
G_MDSFT_RENDERMODE Sets the cycle-independent render mode options for the RDP blender. See below for details.
G_MDSFT_RENDERMODE Sets the cycle-dependent render mode options for the RDP blender. See below for details.

Cycle-Independent Blender Settings

The thirteen bits described here are settings for the blender that apply across both cycles in 2-cycle mode. The table in the section above shows where these cycle-independent settings fit into the lower Other Mode settings. The bit values are as follows:

Affects Bits Name of Option Description
0000 0000 0000 1 AA_EN Judging by the name, enables antialiasing. The only description in the SDK is a cryptic “if no FORCE_BL set, allow blend enable - use cvgbit.”
0000 0000 0001 0 Z_CMP Enables use of the Z buffer to check if an input pixel should be written to the framebuffer.
0000 0000 0010 0 Z_UPD Updates the depth buffer when writing a new pixel. If disabled, the depth buffer value for a pixel will stay the same even after writing a closer pixel to the framebuffer.

0000 0000 0100 0

According to description, enables read/write memory access for color and coverage values. The true meaning of this flag is unclear, though, since it's apparently not needed by all of the pre-assembled rendering modes. It seems to be the deciding factor between the two different kinds of antialiasing provided (with this option disabled leading to the faster but uglier version), but that's not the sole pattern in pre-assembled modes.

0000 0000 1000 0

Prevents updating the color of a pixel unless its coverage value overflows, at which point the color is set and the coverage value is set to the lower four bits of the overflowing summed coverage value. Note that coverage value is always updated, this mode doesn't prevent it.

0000 0011 0000 0

Configures out to handle the coverage value in the framebuffer (CVG_DST presumably means “coverage [value] destination”). The options available are:

00: CVG_DST_CLAMP: clamps the value if FORCE_BL, otherwise “new” (perhaps “new coverage value”?)

01: CVG_DST_WRAP: Always wraps the coverage value on overflow

10: CVG_DST_FULL: Force coverage value to fully-on (hence “full”)

11: CVG_DST_SAVE: Don't overwrite buffer coverage value

0000 1100 0000 0

This mode is unfortunately completely unexplained. Judging by the name, it controls the usage of the depth buffer, depending on the type of surface being rendered. Values are:

00: ZMODE_OPA: Opaque surfaces

01: ZMODE_INTER: Interpenetrating surfaces

10: ZMODE_XLU: Translucent surfaces

11: ZMODE_DEC: Decal surfaces
0001 0000 0000 0 CVG_X_ALPHA Multiplies coverage and alpha values and uses the result as both the coverage and the alpha.
0010 0000 0000 0 ALPHA_CVG_SEL Use the coverage value for alpha instead (does nothing different if CVG_X_ALPHA is enabled)
0100 0000 0000 0 FORCE_BL “Forces blending” if enabled. What this means is not explained.

Note that the highest bit of this group no longer means anything.

Cycle-Dependent Blender Settings

The 16 bits that make up the cycle-dependent settings for the RDP blender specify what and how to actually blend things together. The blender runs on the formula

(P * A + M - B) / (A + B)

to blend primitives into the framebuffer. The 16 bits specify the values of these variables for both cycles in the following layout:

Bit Layout
Cycle No. 1122 1122 1122 1122

Or in other words, each nybble specifies one of the formula parameters, with each nybble half specifying that parameter for one of the two cycles. In 1-cycle mode, both halves must be equal.

The P and M values can be any of the following values:

  • 00: G_BL_CLR_IN: In the first cycle, parameter is color from input pixel. In the second cycle, parameter is the numerator of the formula as computed for the first cycle.
  • 01: G_BL_CLR_MEM: Takes color from the framebuffer
  • 10: G_BL_CLR_BL: Takes color from the blend color register
  • 11: G_BL_CLR_FOG: Takes color from the fog color register

The A parameter can be set to any of these things:

  • 00: G_BL_A_IN: Parameter is alpha value of input pixel
  • 01: G_BL_A_FOG: Alpha value from the fog color register
  • 10: G_BL_A_SHADE: Calculated alpha value for the pixel, presumably
  • 11: G_BL_0: Constant 0.0 value

And the B parameter can be set to any of these:

  • 00: G_BL_1MA: 1.0 - source alpha
  • 01: G_BL_A_MEM: Framebuffer alpha value
  • 10: G_BL_1: Constant 1.0 value
  • 11: G_BL_0: Constant 0.0 value

Vertex Structure

Vertices are points in 3D space that are used in drawing triangles. This structure is the same no matter which graphics microcode you use. Each vertex takes up 16 bytes.

[XX XX] [YY YY] [ZZ ZZ] [FF FF] [UU UU] [VV VV] [XR] [YG] [ZB] [AA]

XXXX short Position on X axis
YYYY short Position on Y axis
ZZZZ short Position on Z axis
FFFF ushort Flag. Unknown usage, usually just 0000
UUUU short Texture coordinate on the U axis
VVVV short Texture coordinate on the V axis
XR byte or ubyte X unit vector of normal or red color*
YG byte or ubyte Y unit vector of normal or green color*
ZB byte or ubyte Z unit vector of normal or blue color*
AA ubyte Alpha (Transparency)**

* You cannot use vertex colors and vertex lighting at the same time. Normals are used if the geometry mode G_LIGHTING bit is enabled, otherwise the RGB colors will be used instead. (see: RSP Geometry Mode)

** Vertex alpha cannot be used when fog is enabled. The vertex will use the fog alpha value instead.

rcpstructs.txt · Last modified: 2018/10/01 05:58 by David