In the last chapter, the routines that control texel selection and texture combining on the TMU were presented. The discussion assumed that appropriate textures had already been loaded into the texture memory. This chapter describes the multitude of texture formats that Glide supports and the routines that download texture maps and manage texture memory.
You will learn about:
the texture formats supported by Glide, including special formats for compressed textures and a color palette
Texture memory is a valuable and limited resource. Glide supports a multitude of texture formats in order to help the application programmer use texture memory wisely. Each format encodes the color information for each texel in a different way; most compress it in some manner. Texels have either 8 or 16 bits, depending on the texture format, and are expanded to 32 bits before being sent to the texture combine unit.
Glide uses symbolic names for the texture formats; the name describes the form of encoding for the color information and the precision. For example,
Texture formats GR_TEXFMT_RGB_332 and GR_TEXFMT_ARGB_8332 use three bits each for red and green and two bits for blue. An 8-bit alpha is included in the latter.
Texture formats GR_TEXFMT_RGB_565, GR_TEXFMT_ARGB_1555, and GR_TEXFMT_ARGB_4444 provide three different ways to compress three or four 8-bit color component values into 16 bits. The first format discards alphaand uses five bits for red and blue, and six bits for green. The second one uses five bits each for red, green, and blue, and saves the extra bit for alpha. The third format treats all four components equally, using four bits for each.
Texture formats GR_TEXFMT_INTENSITY_8, GR_TEXFMT_ALPHA_INTENSITY_44 and GR_TEXFMT_ALPHA_INTENSITY_88 contain an intensity value rather than color components and can model monochrome lighting effects. Example Texture Mapping.2 in the previous chapter uses an intensity texture in combination with another to produce a modulated texture.
Texture format GR_TEXFMT_ALPHA_8 contains only an 8-bit alpha value. When the texel is expanded to a 32-bit ARGB form, the alpha value is used for red, green, and blue as well.
Texture formats GR_TEXFMT_YIQ_422 and GR_TEXFMT_AYIQ_8422 use a narrow channel compression technique to encode the color information. Each TMU has storage for two distinct decompression tables that translate the encoded information into 32-bit colors. Narrow channel compression is described in detail below.
Texture formats GR_TEXFMT_P_8 and GR_TEXFMT_AP_88 implement a color palette, described below. Each TMU has room for one 256-entry color palette.
Table Managing Texture Memory.1 shows all thirteen texture formats, detailing the format of a texel and the expansion to 32 bits for each texture format.