Table of Contents Glide Programming Guide


Chapter 10. Managing Texture Memory



Download 6.22 Mb.
Page69/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   65   66   67   68   69   70   71   72   ...   106
GLIDEPGM

Chapter 10. Managing Texture Memory

1In This Chapter


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:

2Texture Map Formats


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 alpha and 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.

Download 6.22 Mb.

Share with your friends:
1   ...   65   66   67   68   69   70   71   72   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page