Normally, mipmap levels are stored sequentially in texture memory. Multi-base addressing allows mipmap levels to be loaded into different texture memory locations. A mipmap can be split into four chunks (along pre-defined boundaries), each of which can be loaded in a different location in texture memory. Four different base addresses are specified for a multi-based texture, one each for GR_LOD_256, GR_LOD_128, and GR_LOD_64, and one for textures GR_LOD_32 through GR_LOD_1.
To use multi-base addressing, you must enable it with a call to grTexMultibase(), download the mipmap as four smaller mipmaps, and then set up the multi-base addressing by calling grTexMultibaseAddress() four times with the four starting addresses. See Example Managing Texture Memory.6.
void grTexMultibase(GrChipID_t tmu, FxBool enable)
grTexMultibase() enables or disables multi-base addressing. Multi-base addressing must be enabled before downloading a multi-based texture, and before rendering using a multi-based texture. Multi-base addressing must be disabled before downloading or rendering from a texture with a single base address.
You must call grTexMultibaseAddress() once for each part of a fragmented texture with multiple base addresses. In each case, startAddress should point to the texture memory location for the corresponding mipmap level. All of the base addresses for a multi-based texture should be specified before downloading the texture or rendering from the texture.
void grTexMultibaseAddress(GrChipID_t tmu,
GrTexBaseRange_t range,
FxU32 startAddress,
FxU32 evenOdd,
GrTexInfo *info ) The first argument names the TMU on which the fragmented texture will be loaded. The second argument, range, tells which fragment this call is about, and is one of four Glide constants: GR_TEXBASE_256, GR_TEXBASE_128, GR_TEXBASE_64, or GR_TEXBASE_32_TO_1. The third argument, startAddress, is the starting address for this fragment. Note that grTexMultibaseAddress() should be called with a valid starting address before the fragment is downloaded.
The fourth argument, evenOdd, specifies whether the even, the odd, or all textures in the mipmap will be downloaded on this tmu. If a fragment is missing from the mipmap, or if a fragment will not be downloaded on this tmu, then grTexMultibaseAddress() need not be called for that fragment.
Calls to grTexSource()are equivalent to calls to grTexMultibaseAddress() with the range argument set to GR_LOD_256.
Example Managing Texture Memory.6 Using multiple texture base registers. Suppose that start is an array of starting addresses that have been obtained from a memory management routine. (The memory management details are left as an exercise for the reader.) Further suppose that the block of texture memory pointed to by start[0] is large enough for GR_LOD_256, that the block pointed to by start[1] is large enough for GR_LOD_128, and so on. The array mipmap points to the four fragments. The lod array stores the four constants that identify the fragments for convenience in the for loop that sets up the multiple base registers and downloads the fragments. int i;
GrTexInfo info;
FxU32 start[4];
FxU16 mipmap[4][];
GrTexBaseRange_t lod[4]=( GR_TEXBASE_256, GR_TEXBASE_128, GR_TEXBASE_64, GR_TEXBASE_32_TO_1);
grTexMultibase(GR_TMU0, FX_TRUE);