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
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gx.h&gt;
16
17void GXInitTexCacheRegion(
18    <A href="../Structures/GXTexRegion.html">GXTexRegion</A>*      region,
19    <A href="../Enumerated_Types/GXBool.html">GXBool</A>            is_32b_mipmap,
20    u32               tmem_even,
21    <A href="../Enumerated_Types/GXTexCacheSize.html">GXTexCacheSize</A>    size_even,
22    u32               tmem_odd,
23    <A href="../Enumerated_Types/GXTexCacheSize.html">GXTexCacheSize</A>    size_odd );
24</pre></dd></dl>
25
26<H2>Arguments</H2>
27<TABLE class="arguments" border="1" >
28  <TBODY>
29    <TR>
30<TH>region</TH>
31<TD>Pointer to a <A href="../Structures/GXTexRegion.html"><CODE>GXTexRegion</CODE></A> structure</TD>
32    </TR>
33    <TR>
34<TH>is_32b_mipmap</TH>
35<TD>If the flag is <CODE>TRUE</CODE>, the argument is interpreted according to 32-bit mipmap format.</TD>
36    </TR>
37    <TR>
38<TH>tmem_even</TH>
39<TD>Base pointer in texture memory for even-numbered LODs (see table below). Must be in multiples of 2KB.</TD>
40    </TR>
41    <TR>
42<TH>size_even</TH>
43<TD>Size of even-numbered cache. Possible settings are <CODE>GX_TEXCACHE_32K</CODE>, <CODE>GX_TEXCACHE_128K</CODE> and <CODE>GX_TEXCACHE_512K</CODE>.</TD>
44    </TR>
45    <TR>
46<TH>tmem_odd</TH>
47<TD>Base pointer in texture memory for odd-numbered LODs (see table below). Must be in multiples of 2KB.</TD>
48    </TR>
49    <TR>
50<TH>size_odd</TH>
51<TD>Size of odd-numbered cache. Possible settings are <CODE>GX_TEXCACHE_32K</CODE>, <CODE>GX_TEXCACHE_128K</CODE> and <CODE>GX_TEXCACHE_512K</CODE>.</TD>
52    </TR>
53  </TBODY>
54</TABLE>
55
56<H2>Return Values</H2>
57<P>None.</P>
58
59<H2>Description</H2>
60<P>This function initializes a texture memory (TMEM) region object for the cache.&nbsp;The region is allocated by the application and can be used as a cache.&nbsp;To use pre-loaded textures, the region must be configured using the <A href="GXInitTexPreLoadRegion.html"><CODE>GXInitTexPreLoadRegion</CODE></A> function. An application can create many region objects and some of them can overlap; however, no two overlapping regions can be active at the same time.</P>
61<P>The possible sizes of a TMEM cache region are 32, 128 or 512 KB.</P>
62<P>The <A href="../Management/GXInit.html"><CODE>GXInit</CODE></A> function creates the default texture regions, so it is not necessary for the application to use this function unless a different Texture Memory configuration is desired.&nbsp;In that case, the application should also define a region allocator using the <A href="GXSetTexRegionCallback.html"><CODE>GXSetTexRegionCallBack</CODE></A> function.</P>
63<P>When changing the use of a region of TMEM from preloaded to cached, you must first call the <A href="../Management/GXTexModeSync.html"><CODE>GXTexModeSync</CODE></A> function to ensure that all preloaded textures are rendered.</P>
64<P>The <A href="GXInvalidateTexRegion.html"><CODE>GXInvalidateTexRegion</CODE></A> function can be used to force the textures in main memory associated with this region to be reloaded. This will be necessary whenever the texture data in main memory changes. You may invalidate all cached regions at once using the <a href="GXInvalidateTexAll.html"><code>GXInvalidateTexAll</code></a> function.</P>
65
66<H4><A name="TMEM_rules"><B>Texture Memory Region Allocation Rules</B></A></H4>
67<P>Texture memory is divided into high and low banks.&nbsp;The first 512 Kbytes is the low bank, the next 512 Kbytes is the high bank.&nbsp;Textures will have their components stored in the banks according to the rules below.&nbsp; Note that no component may span the boundary between two banks. The notation <SPAN class="argument">m:n</SPAN> refers to the address (<SPAN class="argument">m</SPAN>) and size (<SPAN class="argument">n</SPAN>) for a given range of the texture memory. CI is an abbreviation for color-index.</P>
68
69<TABLE class="arguments" border="1" >
70  <TBODY>
71    <TR>
72<TD width="25%" bgcolor="#C0C0C0"><B>Texture Types</B></TD>
73<TD bgcolor="#C0C0C0"><B>Allocation Rules</B></TD>
74    </TR>
75    <TR>
76<TD>planar, non-32 bit RGB, non-CI&nbsp;</TD>
77<TD>Uses only <SPAN class="argument">tmem_even:size_even</SPAN>.<BR>Can use both banks.<BR>The argument <SPAN class="argument">tmem_odd</SPAN> must be set to 0, and <SPAN class="argument">size_odd</SPAN> must be set to <CODE>GX_TEXCACHE_NONE</CODE>.</TD>
78    </TR>
79    <TR>
80<TD>planar, 32 bit RGB, non-CI</TD>
81<TD>Color element AR uses <SPAN class="argument">tmem_even:size_even</SPAN>. Must be in the low bank.<BR>Color element GB uses <SPAN class="argument">tmem_odd:size_odd</SPAN>. Must be in the high bank.</TD>
82    </TR>
83    <TR>
84<TD>planar, color index&nbsp;</TD>
85<TD>Uses only <SPAN class="argument">tmem_even:size_even</SPAN>. Must be in the low bank.<BR> (The corresponding TLUT will be accessed from the high bank.)<br>)<BR>The argument <SPAN class="argument">tmem_odd</SPAN> must be set to 0, and <SPAN class="argument">size_odd</SPAN> must be set to <CODE>GX_TEXCACHE_NONE</CODE>.</TD>
86    </TR>
87    <TR>
88<TD>mipmapped, non-32 bit RGB, non-CI</TD>
89<TD>Even-numbered LODs use <SPAN class="argument">tmem_even:size_even</SPAN>. Odd LODs use <SPAN class="argument">tmem_odd:size_odd</SPAN>.<BR>Even LODs may be in the high or low bank. Odd LODs must be in the opposite bank.</TD>
90    </TR>
91    <TR>
92<TD>mipmapped, 32 bit RGB, non-CI&nbsp;</TD>
93<TD>Even (AR) + odd (GB) LODs use <SPAN class="argument">tmem_even:(size_even + size_odd)</SPAN>.<BR>Even (GB) + odd (AR) LODs use <SPAN class="argument">tmem_even:(size_even + size_odd)</SPAN>.<BR>Total texture cache memory usage = 2 * (<SPAN class="argument">size_even</SPAN> + <SPAN class="argument">size_odd</SPAN>).</TD>
94    </TR>
95    <TR>
96<TD>mipmapped, color index</TD>
97<TD>Even-numbered LODs use <SPAN class="argument">tmem_even:size_even</SPAN>. Must be in the low bank.<BR>Odd LODs use <SPAN class="argument">tmem_odd:size_odd</SPAN>. Must be in the low bank.<BR>Be aware that trilinear filtering will not work for this texture type.</TD>
98    </TR>
99  </TBODY>
100</TABLE>
101<P>Be aware that mipmapped, 32 bit RGB textures use twice as much texture-cache memory compared to other types.&nbsp;The <SPAN class="argument">is_32b_mipmap</SPAN> argument must be set when the texture region will be used in this manner. This argument is used by the <A href="GXInvalidateTexRegion.html"><CODE>GXInvalidateTexRegion</CODE></A> function to compute how much of the texture cache to invalidate.</P>
102
103<H2>See Also</H2>
104<P class="reference">
105<A href="GXInitTexPreLoadRegion.html">GXInitTexPreLoadRegion</A>,
106<A href="GXSetTexRegionCallback.html">GXSetTexRegionCallBack</A>,
107<A href="GXInitTlutRegion.html">GXInitTlutRegion</A>,
108<A href="GXSetTlutRegionCallback.html">GXSetTlutRegionCallBack</A>,
109<A href="GXGetTexRegionAll.html">GXGetTexRegionAll</A>,
110<A href="GXTMEMDefault.html">GX Default TMEM Configuration</A>
111</P>
112
113<H2>Revision History</H2>
114<P>
1152006/03/01 Initial version.<BR>
116</P>
117
118<hr><p>CONFIDENTIAL</p></body>
119</HTML>