#include <revolution/gx.h>
void GXInitTexPreLoadRegion(
GXTexRegion* region,
u32 tmem_even,
u32 size_even,
u32 tmem_odd,
u32 size_odd );
| region | Pointer to a GXTexRegion structure |
|---|---|
| tmem_even | Base pointer to texture memory used for even-numbered LODs of the mipmap (see table below). Must be 32-byte aligned. |
| size_even | Size of the even-numbered cache (in bytes). Must be in multiples of 32 bytes. |
| tmem_odd | Base pointer to texture memory used for odd-numbered LODs of the mipmap (see table below). Must be 32-byte aligned. |
| size_odd | Size of the odd-numbered cache (in bytes). Must be in multiples of 32 bytes. |
None.
This function initializes a texture memory (TMEM) region object for preloading. The region is allocated in TMEM by the application and can be used only as a pre-loaded buffer. Cache regions must be allocated by using the GXInitTexCacheRegion function. For pre-loaded textures, the size of the region must match the size of the texture. An application can create many region objects and some of them can overlap. No two overlapping regions can be active at the same time, however.
The maximum size of a region is 512 KB.
The GXInit function creates no preloading regions. The application should allocate appropriate regions if preloading is necessary. In addition, a cache region and allocator must be created using the GXInitTexCacheRegion and GXSetTexRegionCallBack functions. This is because the new cache region may overwrite the preload region. (Alternatively, if you do not use any color index textures, you may preload textures into the portion of texture memory normally allocated to color index usage by the default allocator.))
Texture memory is divided into high and low banks. The first 512 Kbytes is the low bank, the next 512 Kbytes is the high bank. Textures will have their components stored in the banks according to the rules below. Note that no component may span the boundary between two banks. The notation m:n refers to the address (m) and size (n) for a given range of the texture memory. CI is an abbreviation for color-index.
| Texture Types | Allocation Rules |
| Non-mipmap, non-32 bit RGB, non-CI | Uses only tmem_even:size_even. Can use both banks. The arguments tmem_odd and size_odd must both be set to 0. |
| Non-mipmap, 32 bit RGB, non-CI | Color element AR uses tmem_even:size_even. Must be in the low bank. Color element GB uses tmem_odd:size_odd. Must be in the high bank. |
| Non-mipmap, color index | Uses only tmem_even:size_even. Must be in the low bank. (The corresponding TLUT will be accessed from the high bank.) ) The arguments tmem_odd and size_odd must both be set to 0. |
| Mipmapped, non-32 bit RGB, non-CI | Even-numbered LODs use tmem_even:size_even. Odd LODs use tmem_odd:size_odd. Even LODs may be in the high or low bank. Odd LODs must be in the opposite bank. |
| mipmapped, 32 bit RGB, non-CI | Even (AR) + odd (GB) LODs use tmem_even:size_even. Even (GB) + odd (AR) LODs use tmem_odd:size_odd. |
| mipmapped, color index | Even-numbered LODs use tmem_even:size_even. Must be in the low bank. Odd LODs use tmem_odd:size_odd. Must be in the low bank. Be aware that trilinear filtering will not work for this texture type. |
GXInitTexCacheRegion, GXSetTexRegionCallBack, GXInitTlutRegion, GXSetTlutRegionCallBack, GXGetTexRegionAll, GX Default TMEM Configuration
2006/03/01 Initial version.
CONFIDENTIAL