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>GXSetPixelFmt</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">GXSetPixelFmt</H1> 12 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/gx.h> 16 17void GXSetPixelFmt( 18 <A href="../Enumerated_Types/GXPixelFmt.html">GXPixelFmt</A> pix_fmt, 19 <A href="../Enumerated_Types/GXZFmt16.html">GXZFmt16</A> z_fmt ); 20</pre></dd></dl> 21 22<H2>Arguments</H2> 23<TABLE class="arguments" border="1" > 24 <TBODY> 25 <TR> 26<TH>pix_fmt</TH> 27<TD>Pixel format. Accepted values are:<BR> 28 <TABLE class="arguments" border="1" > 29 <tr> 30<TD bgcolor="#C0C0C0">Name</TD> 31<TD bgcolor="#C0C0C0">Pixel Format</TD> 32 </tr> 33 <tr> 34<TH>GX_PF_RGB8_Z24</TH> 35<TD>No anti-aliasing. 8-bit for each RGB value, 24-bit Z value.</TD> 36 </tr> 37 <tr> 38<TH>GX_PF_RGBA6_Z24</TH> 39<TD>No anti-aliasing. 6-bit for each RGBA value, 24-bit Z value.</TD> 40 </tr> 41 <tr> 42<TH>GX_PF_RGB565_Z16</TH> 43<TD>Anti-aliasing. RGB565, 16-bit Z value.</TD> 44 </tr> 45 </TABLE> 46When <CODE>GX_PF_RGB565_Z16</CODE> is selected, anti-aliasing mode is turned on. It is off otherwise.</TD> 47 </TR> 48 <TR> 49<TH>z_fmt</TH> 50<TD>The compression type for the 16-bit Z <A href="../Enumerated_Types/GXZFmt16.html">format</A>. Accepted values are:<BR> 51 <TABLE class="arguments" border="1" > 52 <tr> 53<TD bgcolor="#C0C0C0">Name</TD> 54<TD bgcolor="#C0C0C0">Z format</TD> 55 </tr> 56 <tr> 57<TH>GX_ZC_LINEAR</TH> 58<TD>16-bit linear.</TD> 59 </tr> 60 <tr> 61<TH>GX_ZC_NEAR</TH> 62<TD>Compressed format for smaller far/near ratio.</TD> 63 </tr> 64 <tr> 65<TH>GX_ZC_MID</TH> 66<TD>Compressed format for medium far/near ratio.</TD> 67 </tr> 68 <tr> 69<TH>GX_ZC_FAR</TH> 70<TD>Compressed format for large far/near ratio.</TD> 71 </tr> 72 </TABLE> 73This argument is ignored if a 24-bit Z format is selected.</TD> 74 </TR> 75 </TBODY> 76</TABLE> 77 78<H2>Return Values</H2> 79<P>None.</P> 80 81<H2>Description</H2> 82<P>This function sets the format of pixels in the embedded frame buffer (EFB) internal to the graphics processor. It also controls the anti-aliasing (AA) mode.</P> 83<P>There are two <SPAN class="argument">pix_fmt</SPAN> pixel formats that are not anti-aliased: <CODE>GX_PF_RGB8_Z24</CODE> and <CODE>GX_PF_RGBA6_Z24</CODE>. The EFB stride is 640 pixels. The non-anti-aliased EFB has 528 lines available.</P> 84<P>When <SPAN class="argument">pix_fmt</SPAN> is <CODE>GX_PF_RGB565_Z16</CODE>, multi-sample anti-aliasing is enabled. In order to get the correct results, the <A href="../Framebuffer/GXSetCopyFilter.html"><CODE>GXSetCopyFilter</CODE></A> function must also be called. The position of the subsamples and the anti-aliasing filter coefficients are set using the <A href="../Framebuffer/GXSetCopyFilter.html"><CODE>GXSetCopyFilter</CODE></A> function. When anti-aliasing, three 16-bit color/Z samples are calculated for each pixel, and the total available number of pixels in the EFB is reduced by half (640 pixels x 264 lines). </P> 85<P>The <A href="GXSetPixelFmt.html"><CODE>GXSetPixelFmt</CODE></A> function also sets the compression type for 16-bit Z formats, which allows Z precision trade-offs related to the range. The following guidelines apply:</P> 86<P>a) far/near ratio <= 2^16, use <code>GX_ZC_LINEAR</code><BR> b) far/near ratio <= 2^18, use <code>GX_ZC_NEAR</code><BR> c) far/near ratio <= 2^20, use <code>GX_ZC_MID</code><BR> d) far/near ratio <= 2^24, use <code>GX_ZC_FAR</code></P> 87<P>It is always best to use as little compression as possible (choice (a) is least compressed, choice (d) is most compressed). Higher compression results in less precision. The "far" in the above list does not necessarily reference the far clipping plane. You should think of it as the farthest object for which you want to have accurate occlusion.</P> 88 89<P> 90<STRONG>Note: </STRONG> When the pixel format is changed, the data format inside EFB also changes. Therefore, when you switch pixel formats during rendering, the result of rendering will not be as intended. For example, it is not possible to render up to a certain point in RGB8, and then render only a particular object in the anti-aliasing mode. 91<P> 92 93<P>Since changing the pixel format requires the pixel pipeline to be synchronized, the use of this function causes the graphics processor to stall as a result. Therefore, redundant calls of this function should be avoided.</P> 94 95<H2>See Also</H2> 96<P class="reference"> 97<A href="../Framebuffer/GXSetCopyFilter.html">GXSetCopyFilter</A>, 98<A href="../Framebuffer/GXCopyDisp.html">GXCopyDisp</A> 99</P> 100 101<H2>Revision History</H2> 102<P> 1032007/06/13 Added a note and included the description about stalling.<BR>2006/03/01 Initial version.<br> 104</P> 105 106<hr><p>CONFIDENTIAL</p></body> 107</HTML>