1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>GXLoadTlut</title> 10</head> 11 12<body> 13 14<h1 align="left">GXLoadTlut</h1> 15 16<h2>Syntax</h2> 17<dl><dd><pre class="construction"> 18#include <revolution/gx.h> 19 20void GXLoadTlut( 21 const <a href="../Structures/GXTlutObj.html">GXTlutObj</a>* tlut_obj, 22 u32 <a href="../Enumerated_Types/GXTlut.html">tlut_name</a> ); 23</pre></dd></dl> 24 25<h2>Arguments</h2> 26<TABLE class="arguments" border="1" > 27 <tr> 28<TH>tlut_obj</TH> 29<TD>Pointer to a <a href="../Structures/GXTlutObj.html"><CODE>GXTlutObj</CODE></a> structure. <BR>The application must allocate the memory for this object.</TD> 30 </tr> 31 <tr> 32<TH>tlut_name</TH> 33<TD>Name of the texture memory lookup table.</TD> 34 </tr> 35</TABLE> 36 37<h2>Return Values</h2> 38<p>None.</p> 39 40<H2>Description</H2> 41<P>This function copies a texture lookup table (TLUT) from main memory to texture memory (TMEM). The <SPAN class="argument">tlut_name</SPAN> argument is the name of a pre-allocated region of TMEM. The callback function set by the <A href="GXSetTlutRegionCallback.html"><CODE>GXSetTlutRegionCallBack</CODE></A> function converts <SPAN class="argument">tlut_name</SPAN> into a pointer to a <A href="../Structures/GXTlutRegion.html"><CODE>GXTlutRegion</CODE></A> structure. The TLUT is loaded in the TMEM region described by this pointer. <SPAN class="argument">tlut_obj</SPAN> describes the location of the TLUT in main memory, the TLUT format and the TLUT size. Initialize <SPAN class="argument">tlut_obj</SPAN> in advance with the <A href="GXInitTlutObj.html"><CODE>GXInitTlutObj</CODE></A> function.</P> 42<P>The <CODE>GXLoadTlut</CODE> function will make an assertion check to make sure the TLUT size described by <SPAN class="argument">tlut_obj</SPAN> is less than or equal to the TLUT region size described by <SPAN class="argument">tlut_name</SPAN>.</P> 43<P>The <A href="../Management/GXInit.html"><CODE>GXInit</CODE></A> function sets a default callback to convert <SPAN class="argument">tlut_names</SPAN> from <A href="../Enumerated_Types/GXTlut.html"><CODE>GXTlut</CODE></A> to a pointer to a<A href="../Structures/GXTlutRegion.html"><CODE>GXTlutRegion</CODE></A> structure. The default configuration of TMEM has 20 TLUTs, sixteen of which are 16-bit 256 entries, and four of which are 16-bit 1K entries. This configuration can be overwritten by calling the <A href="GXInitTlutRegion.html"><CODE>GXInitTlutRegion</CODE></A> and <A href="GXInitTexCacheRegion.html"><CODE>GXInitTexCacheRegion</CODE></A> functions to allocate TMEM. You can then define your own region allocation scheme using the <A href="GXSetTlutRegionCallback.html"><CODE>GXSetTlutRegionCallBack</CODE></A> and <A href="GXSetTexRegionCallback.html"><CODE>GXSetTexRegionCallBack</CODE></A> functions.</P> 44 45<H4>Note:</H4> 46<P>Due to a restriction in the GX library, <code>GXLoadTlut</code> must be called before the <A href="GXLoadTexObj.html"><code>GXLoadTexObj</code></A> function that references it.</P> 47<P>For this reason, the following two restrictions apply.</P> 48<P>1. The <A href="../Structures/GXTexObj.html"><CODE>GXTexObj</CODE></A> structure (texel data) for CI textures must be loaded after the TLUT it uses, as shown in the following code sample.</P> 49<DL><DD><CODE>// Example 1.<BR>GXInitTexObjCI(texObj, ..., GX_TLUT0);<BR>GXInitTlutObj(tlut, ...);<BR> :<BR>GXLoadTlut(tlut, GX_TLUT0);<BR> GXLoadTexObj(texObj, ...); </CODE></DD></DL> 50 51<DL><DD><CODE>// Example 2.<BR>GXInitTexObjCI(texObj, ..., GX_TLUT0);<BR>GXLoadTlut(tlut, GX_TLUT0);<BR> :<BR>GXInitTlutObj(tlut, ...);<BR> GXLoadTexObj(texObj, ...); </CODE></DD></DL> 52 53<P>2. If the TLUT portion of the CI texture is updated with the <CODE>GXLoadTlut</CODE> function, the texel data portion must be reloaded with the <A href="GXLoadTexObj.html"><code>GXLoadTexObj</code></A> structure.</P> 54<DL><DD><CODE>GXInitTexObjCI(texObj, ..., GX_TLUT0);<BR>GXInitTlutObj(tlutA, ...);<BR>GXInitTlutObj(tlutB, ...);<BR> :<BR>GXLoadTlut(tlutA, GX_TLUT0);<BR>GXLoadTexObj(texObj, ...);<BR> :<BR>GXLoadTlut(tlutB, GX_TLUT0); // Only TLUT is going to be updated.<BR> GXLoadTexObj(texObj, ...); // Must reload texobj.<BR></CODE></DD></DL> 55 56<P>There is an insignificant performance penalty for the extra <A href="GXLoadTexObj.html"><code>GXLoadTexObj</code></A> call because the <A href="GXLoadTexObj.html"><code>GXLoadTexObj</code></A> function won't actually load the entire texture into TMEM, but will only load the settings.</P> 57 58<h2>See Also</h2> 59<P class="reference"> 60<a href="GXInitTlutObj.html">GXInitTlutObj</a>, 61<a href="GXInitTlutRegion.html">GXInitTlutRegion</a>, 62<a href="GXSetTlutRegionCallback.html">GXSetTlutRegionCallBack</a> 63</p> 64 65<H2>Revision History</H2> 66<P> 672006/09/08 Revised the wording of the Note.<BR>2006/03/01 Initial version.<BR> 68</P> 69 70<hr><p>CONFIDENTIAL</p></body> 71</HTML>