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<H2>C Specification</H2> 13<DL> 14 <DD> 15 <PRE><CODE>#include <revolution/gx.h></CODE></PRE> 16 <DD> 17 <PRE><CODE>void GXSetPixelFmt( 18 <A href="../Enumerated_Types/GXPixelFmt.html">GXPixelFmt</A> pix_fmt, 19 <A href="../Enumerated_Types/GXZFmt16.html">GXZFmt16</A> z_fmt );</CODE></PRE> 20</DL> 21<H2>Arguments</H2> 22<TABLE border="1" cellpadding="3" cellspacing="0.1"> 23 <TBODY> 24 <TR> 25<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>pix_fmt</FONT></STRONG></EM></TD> 26<TD width="520">pixel format Accepted values are:<BR> 27 <TABLE border="1" width="500" cellpadding="3" cellspacing="0.1"> 28 29 <tr> 30<TD width="150" bgcolor="#C0C0C0">Name</TD> 31<TD width="350" bgcolor="#C0C0C0">Pixel Format</TD> 32 </tr> 33 <tr> 34<TD width="150"><code>GX_PF_RGB8_Z24</code></TD> 35<TD width="350">No anti-aliasing; 8-bit for each RGB value, 24-bit Z value.</TD> 36 </tr> 37 <tr> 38<TD width="150"><code><CODE>GX_PF_RGBA6_Z24</CODE></code></TD> 39<TD width="350">No anti-aliasing; 6-bit for each RGBA value, 24-bit Z value.</TD> 40 </tr> 41 <tr> 42<TD width="150"><code>GX_PF_RGB565_Z16</code></TD> 43<TD width="350">Anti-aliasing; RGB565, 16-bit Z value.</TD> 44 </tr> 45 46 </TABLE> 47When <CODE>GX_PF_RGB565_Z16</CODE> is selected, anti-aliasing mode is turned on. It is off otherwise.</TD> 48 </TR> 49 <TR> 50<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>z_fmt</FONT></STRONG></EM></TD> 51<TD width="520">The compression type for the 16-bit Z <A href="../Enumerated_Types/GXZFmt16.html">format</A>. Accepted values are:<BR> 52 <TABLE border="1" width="500" cellpadding="3" cellspacing="0.1"> 53 54 <tr> 55<TD width="150" bgcolor="#C0C0C0">Name</TD> 56<TD width="350" bgcolor="#C0C0C0">Z format</TD> 57 </tr> 58 <tr> 59<TD width="150"><code>GX_ZC_LINEAR.</code></TD> 60<TD width="350">Linear 16bit.</TD> 61 </tr> 62 <tr> 63<TD width="150"><code>GX_ZC_NEAR.</code></TD> 64<TD width="350">Compressed format for smaller far/near ratio.</TD> 65 </tr> 66 <tr> 67<TD width="150"><code>GX_ZC_MID</code></TD> 68<TD width="350">Compressed format for medium far/near ratio.</TD> 69 </tr> 70 <tr> 71<TD width="150"><code>GX_ZC_FAR</code></TD> 72<TD width="350">Compressed format for large far/near ratio.</TD> 73 </tr> 74 75 </TABLE> 76This argument is ignored if a 24-bit Z format is selected.</TD> 77 </TR> 78 </TBODY> 79</TABLE> 80<H2>Return Values</H2> 81<P>None.</P> 82<H2>Description</H2> 83<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> 84<P>There are two non-antialiased <code>pix_fmt</code> pixel formats, <code>GX_PF_RGB8_Z24</code> and <code>GX_PF_RGBA6_Z24</code>. The EFB stride is 640 pixels. The non-antialiased EFB has 528 lines available.</P> 85<P>When <code>pix_fmt</code> is <code>GX_PF_RGB565_Z16</code>, multi-sample anti-aliasing is enabled. In order to get the correct results, <a href="../Framebuffer/GXSetCopyFilter.html"><code>GXSetCopyFilter</code></a> must also be called. The position of the subsamples and the anti-aliasing filter coefficients are set using <a href="../Framebuffer/GXSetCopyFilter.html"><code>GXSetCopyFilter</code></a>. 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> 86<P><a href="GXSetPixelFmt.html"><code>GXSetPixelFmt</code></a> also sets the compression type for 16-bit Z formats, which allows Z precision trade-offs within the range. The following guidelines apply:</P> 87<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> 88<P>It is always best to use as little compression as possible (choice <I>a</I> is least compressed, choice <I>d</I> is most compressed). Higher compression results in less precision. The <B>far</B> in the above list does not necessarily reference the far clipping plane. You should think of it as the farthest object that you want to have accurate occlusion.</P> 89 90<P> 91<STRONG>Note: </STRONG>If the pixel format is changed, the format of data in the EFB will change too. Therefore, even if the pixel format is changed in the middle of rendering, the desired rendering results cannot be obtained. 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. 92<P> 93 94<P>Furthermore, 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> 95 96<H2>See Also</H2> 97<P><A href="../Framebuffer/GXSetCopyFilter.html"><CODE>GXSetCopyFilter</CODE></A><br> <A href="../Framebuffer/GXCopyDisp.html"><CODE>GXCopyDisp</CODE></A></P> 98<H2>Revision History</H2> 99<P> 1002007/06/13 Added a note and included the description about stalling.<BR>2006/03/01 Initial version. 101</P> 102<hr> 103<P>CONFIDENTIAL</p> 104</BODY> 105</HTML>