Table of Contents Glide Programming Guide



Download 6.22 Mb.
Page95/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   91   92   93   94   95   96   97   98   ...   106
GLIDEPGM
guTexCombineFunction() also keeps track of which TMUs require texture coordinates for the rendering routines. Many combining functions that simultaneously use both clocal and cother can be computed with two passes on a single TMU system by using the frame buffer to store intermediate results and the alpha blender to combine the two partial results.

5Allocating Texture Memory


WARNING: You cannot mix and match grTex and guTex commands. Do not use the functions described here in conjunction with grTexMinAddress(), grTexMaxAddress(), grTexNCCTable(), grTexSource(), grTexDownloadTable(), grTexDownloadMipMapLevel(), grTexDownloadMipMap(), grTexMultiBase(), and grTexMultibaseAddress().
Before downloading a mipmap, an application must first allocate some memory for it. This is done using guTexAllocateMemory(), which returns a handle to an allocated mipmap storage area within a specific TMU.
GrMipMapId_t guTexAllocateMemory( GrChipID_t tmu,
FxU8 oddEvenMask,
int width,
int height,
GrTextureFormat_t format,
GrMipMapMode_t mipmapMode,
GrLOD_t smallLOD,
GrLOD_t largeLOD,
GrAspectRatio_t aspectRatio,
GrTextureClampMode_t sClampMode,
GrTextureClampMode_t tClampMode,
GrTextureFilterMode_t minFilterMode,
GrTextureFilterMode_t magFilterMode,
float LODbias,
FxBool LODblend
)
The arguments are similar to those for routines in Chapter 10; refer to Table Managing Texture Memory.2 for a summary of the possible values. The memory will be allocated on tmu. The height and width of the largest mipmap level are specified, and, in combination with oddEvenMask, format, smallLOD, largeLOD, and aspect ratio, are used to compute the amount of memory required.
oddEvenMask is used to selectively download LOD levels when LOD blending is to be used. Correct usage is to allocate and download the even levels onto one TMU, and the odd levels onto another, both with the LODblend parameter set to FXTRUE. Then the texture combine mode for the lower numbered TMU is set to GR_TEXTURECOMBINE_TRILINEAR_ODD or GR_TEXTURECOMBINE_TRILINEAR_EVEN depending on whether the odd levels or the even levels were downloaded to it.
All the parameters that define the texel selection process when this mipmap is downloaded are also included in the call: mipmapMode, sClampMode, tClampMode, minFilterMode, magFilterMode, LODbias, and LODblend. See Chapter 9 for more details.
If memory could not be allocated, a value of GR_NULL_MIPMAP_HANDLE is returned. Mipmap handles cannot be shared across multiple Voodoo Graphics subsystems, i.e. a texture must be allocated and downloaded multiple times if an application wishes to use it across multiple Voodoo Graphics subsystems.
The amount of unallocated texture memory can be determined with the Glide function guTexMemQueryAvail(), which returns the amount of unallocated memory in bytes for the specified TMU in the currently active Voodoo Graphics subsystem. Only memory that was allocated with guTexAllocateMemory() is taken into account.
FxU32 guTexMemQueryAvail( GrChipID_t tmu )


Download 6.22 Mb.

Share with your friends:
1   ...   91   92   93   94   95   96   97   98   ...   106




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

    Main page