1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<TITLE>GXInitTexCacheRegion</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">GXInitTexCacheRegion</H1> 12<H2>C Specification</H2> 13<DL> 14 <DD> 15<PRE><CODE>#include <revolution/gx.h></CODE></PRE> 16 <DD> 17<PRE><CODE>void GXInitTexCacheRegion( 18<A href="../Structures/GXTexRegion.html">GXTexRegion</A><EM>* </EM>region, 19<a href="../Enumerated_Types/GXBool.html">GXBool</a> is_32b_mipmap, 20u32 tmem_even, 21<a href="../Enumerated_Types/GXTexCacheSize.html">GXTexCacheSize</a> size_even, 22u32 tmem_odd, 23<a href="../Enumerated_Types/GXTexCacheSize.html">GXTexCacheSize</a> size_odd );</CODE></PRE> 24</DL> 25<H2>Arguments</H2> 26<TABLE border="1" cellpadding="3" cellspacing="0.1"> 27 <TBODY> 28 <TR> 29<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>region</CODE></STRONG></EM></TD> 30<TD width="520">pointer to a <a href="../Structures/GXTexRegion.html"><code>GXTexRegion</code></a> structure</TD> 31 </TR> 32 <TR> 33<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>is_32b_mipmap</CODE></STRONG></EM></TD> 34<TD width="520">when this flag is true, the argument is interpreted according to the 32-bit mipmap format</TD> 35 </TR> 36 <TR> 37<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>tmem_even</CODE></STRONG></EM></TD> 38<TD width="520">the base pointer in texture memory for even-numbered LODs (see table below) <BR>Must be in 2KB multiples.</TD> 39 </TR> 40 <TR> 41<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>size_even</CODE></STRONG></EM></TD> 42<TD width="520">the size of the even-numbered cache <BR>Applicable settings are <CODE>GX_TEXCACHE_32K</CODE>, <CODE>GX_TEXCACHE_128K</CODE> or <CODE>GX_TEXCACHE_512K</CODE>.</TD> 43 </TR> 44 <TR> 45<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>tmem_odd</CODE></STRONG></EM></TD> 46<TD width="520">the base pointer in texture memory for odd-numbered LODs (see table below) <BR>Must be in 2KB multiples.</TD> 47 </TR> 48 <TR> 49<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>size_odd</CODE></STRONG></EM></TD> 50<TD width="520">the size of the odd-numbered cache <BR>Applicable settings are <CODE>GX_TEXCACHE_32K</CODE>, <CODE>GX_TEXCACHE_128K</CODE> or <CODE>GX_TEXCACHE_512K</CODE>.</TD> 51 </TR> 52 </TBODY> 53</TABLE> 54<H2>Return Values</H2> 55<P>None.</P> 56<H2>Description</H2> 57<P>This function initializes a texture memory (TMEM) region object for use as a cache. The region is allocated by the application and can be used as a cache. For pre-loaded textures, the region must be defined by using <a href="GXInitTexPreLoadRegion.html"><code>GXInitTexPreLoadRegion</code></a>. An application can create many region objects and some of them can overlap; no two overlapping regions, however, can be active simultaneously.</P> 58<P>The possible sizes of a TMEM cache region are 32, 128 or 512 KB.</P> 59<P><A href="../Management/GXInit.html"><CODE>GXInit</CODE></A> generates the default texture regions so it is not necessary for the application to use this function unless a different texture memory configuration is desired. In that case, the application should also define a region using <a href="GXSetTexRegionCallback.html"><code>GXSetTexRegionCallBack</code></a>.</P> 60<P>When changing the use of a region of TMEM from preloaded to cached, you must first call <a href="../Management/GXTexModeSync.html"><code>GXTexModeSync</code></a> to ensure that all preloaded texels are rendered.</P> 61<P>The function <a href="GXInvalidateTexRegion.html"><code>GXInvalidateTexRegion</code></a> can be used to force the texture in main memory associated with this region to be reloaded. This will be necessary whenever the texture data in main memory changes. All cached regions can be invalidated at once using <a href="GXInvalidateTexAll.html"><code>GXInvalidateTexAll</code></a>.</P> 62<H4><A name="TMEM_rules"><B>Texture Memory Region Allocation Rules</B></A></H4> 63<P>Texture memory is divided into high and low banks. The first 512 KB is the low bank, the next 512 KB is the high bank. Textures will have their components stored in the banks according to the rules below. Be aware that no component may span the boundary between the two banks. The notation <em>m:n</em> refers to the address (m) and size (n) for a given range of texture memory. CI is an abbreviation for color index.</P> 64<TABLE border="1" cellpadding="3" cellspacing="0" width="847"> 65 <TBODY> 66 <TR> 67<TD width="233"><B>Texture Types</B></TD> 68<TD width="602"><B>Allocation Rules</B></TD> 69 </TR> 70 <TR> 71<TD width="233">planar, non-32 bit RGB, non-CI </TD> 72<TD width="602">Uses only <code>tmem_even:size_even</code>.<BR>Can use both banks.<BR>The arguments <code>tmem_odd:size_odd</code> must be set to <code>0:GX_TEXCACHE_NONE</code>.</TD> 73 </TR> 74 <TR> 75<TD width="233">planar, 32 bit RGB, non-CI</TD> 76<TD width="602">The AR color components use <code>tmem_even:size_even</code>. Must be in the low bank.<br>Color element GB uses <code>tmem_odd:size_odd</code>. Must be in the high bank.</TD> 77 </TR> 78 <TR> 79<TD width="233">planar, color index </TD> 80<TD width="602">Uses only <code>tmem_even:size_even</code>. Must be in the low bank.<br>(The corresponding TLUT will be accessed from the high bank.)<br>)The <code>tmem_odd:size_odd</code> arguments should be set to <code>0:GX_TEXCACHE_NONE</code></TD> 81 </TR> 82 <TR> 83<TD width="233">mipmapped, non-32 bit RGB, non-CI </TD> 84<TD width="602">Even LODs use <code>tmem_even:size_even</code>. Odd LODs use <code>tmem_odd:size_odd</code>.<br>Even LODs may be in the high or low bank. Odd LODs must be in the opposite bank.</TD> 85 </TR> 86 <TR> 87<TD width="233">mipmapped, 32 bit RGB, non-CI </TD> 88<TD width="602">Even (AR) and odd (GB) LODs use <code>tmem_even:</code>(<code>size_even</code> + <code>size_odd</code>).<br>Even (GB) and odd (AR) LODs use <code>tmem_odd:</code>(<code>size_even</code> + <code>size_odd</code>).<br>Total texture cache memory usage = 2 * (<code>size_even</code> + <code>size_odd</code>).</TD> 89 </TR> 90 <TR> 91<TD width="233">mipmapped, color index</TD> 92<TD width="602">Even-numbered LODs use <code>tmem_even:size_even</code>. Must be in the low bank.<br>Odd LODs use <code>tmem_odd:size_odd</code>. Must be in the low bank.<br>Be aware that trilinear filtering will not work for this texture type.</TD> 93 </TR> 94 </TBODY> 95</TABLE> 96<P>Be aware that mipmapped, 32 bit RGB textures use twice as much texture-cache memory compared to other types. The <code>is_32b_mipmap</code> argument must be set when the texture region will be used in this manner. This argument is used by <a href="GXInvalidateTexRegion.html"><code>GXInvalidateTexRegion</code></a> function to compute how much of the texture cache to invalidate.</P> 97<H2>See Also</H2> 98<P><A href="GXInitTexPreLoadRegion.html"><CODE>GXInitTexPreLoadRegion</CODE></A><BR> <A href="GXSetTexRegionCallback.html"><CODE>GXSetTexRegionCallBack</CODE></A><BR> <A href="GXInitTlutRegion.html"><CODE>GXInitTlutRegion</CODE></A><BR> <A href="GXSetTlutRegionCallback.html"><CODE>GXSetTlutRegionCallBack</CODE></A><BR> <A href="GXGetTexRegionAll.html"><CODE>GXGetTexRegionAll</CODE></A></P> 99<P><A href="GXTMEMDefault.html">GX Default TMEM Configuration<br></A></P> 100<H2>Revision History</H2> 101<P>03/01/2006 Initial version.</P></BODY> 102</HTML>