Table of Contents Glide Programming Guide



Download 6.22 Mb.
Page74/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   70   71   72   73   74   75   76   77   ...   106
GLIDEPGM

8Downloading Mipmaps


Download a mipmap into texture memory with the function grTexDownloadMipMap(). Replace an individual mipmap level with grTexDownloadMipMapLevel(). Replace part of an LOD with grTexDownloadMipMapLevelPartial().
The first argument to all three routines is tmu, which designates the target TMU for the load. Each of the three routines also provides a startAddress argument that specifies an offset into texture memory where the texture will be loaded, and an evenOdd argument that indicates which levels to load (specified as one of GR_MIPMAPLEVELMASK_EVEN, GR_MIPMAPLEVELMASK_ODD, or GR_MIPMAPLEVELMASK_BOTH). startAddress must lie be between the values returned by grTexMinAddress() and grTexMaxAddress() and must be 8-byte aligned.
grTexDownloadMipMap() expects the mipmap parameters (aspect ratio, texture format, LOD range, and the texture data) in a GrTexInfo structure; the other two routines have arguments for each parameter.

1Downloading All or Part of a Mipmap


Use grTexDownloadMipMap() to load a mipmap.
typedef struct {
GrLOD_t smallLod;
GrLOD_t largeLod;
GrAspectRatio_t aspectRatio;
GrTextureFormat_t format;
void *data;
} GrTexInfo;

void grTexDownloadMipMap( GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info )


Figure Managing Texture Memory.3 Downloading a mipmap.
Suppose we have a GrTexInfo structure with data as shown below.

The three drawings below show startAddress and its relationship to where and what textures are loaded, based on the evenOdd value. The first grTexDownloadMipMap() call loads all LODs between GR_LOD_128 and GR_LOD_8.



The second scenario loads only the odd LODs. Recall that the largest dimension of odd LODs is an odd power of two. In this case, GR_LOD_128, GR_LOD_32, and GR_LOD_8 are odd LODs.

The final scenario loads only the even LODs. Note that no modification is necessary to the values in the GrTexInfo structure pointed to by info. Glide will skip over the texture data for the odd LODs, only loading the even ones.


Download 6.22 Mb.

Share with your friends:
1   ...   70   71   72   73   74   75   76   77   ...   106




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

    Main page