GXReadPixMetric

C Specification

#include <revolution/gx.h>
void GXReadPixMetric( u32* top_pixels_in,
u32* top_pixels_out,
u32* bot_pixels_in,
u32* bot_pixels_out,
u32* clr_pixels_in,
u32* copy_clks );

Arguments

top_pixels_in number of pixels input for Z comparison before texture lookup
top_pixels_out number of pixels passed to Z comparison before texture lookup
bot_pixels_in number of pixels input for Z comparison after texture lookup
bot_pixels_out number of pixels passed to Z comparison after texture lookup
clr_pixels_in number of pixels input for the blender
copy_clks number of GP clock cycles consumed in copying to the texture or display buffer

Return Values

None.

Description

The graphics processor (GP) can count many internal events that give detailed information on performance. This function returns the number of pixels processed in the GP pipeline and the number of clocks spent copying the embedded frame buffer (EFB) to textures or external frame buffer (XFB).

Call GXClearPixMetric to reset the counters to zero.

Example

u32 tpi, tpo, bpi, bpo, cpi, cc;

GXClearPixMetric();

// Draw Object(s)

// wait until object drawn
GXSetDrawSync(0xbeef);
while (0xbeef != GXReadDrawSync())
    ;

GXReadPixMetric(&tpi, &tpo, &bpi, &bpo, &cpi, &cc);   // returns request counter

OSReport("Number of copy clocks:  %d\n",cc);

This function reads CPU-accessible registers in the GP and so should not be called in a display list.

Pixel Counter Details

The GP can be configured for Z buffering before or after texture lookup (see GXSetZCompLoc).  The argument top_pixels_in returns the number of pixels entering the Z compare before texture lookup. The argument top_pixels_out indicates how many pixels passed the Z comparison test. 

The argument bot_pixels_in counts the number of pixels input to Z comparison after texture lookup. The argument bot_pixels_out indicates how many pixels passed Z comparison.

The argument clr_pixels_in counts the number of pixels processed by the blend unit in the last stage of the pipeline. This is normally the sum of top_pixels_out and bot_pixels_out.

The argument copy_clks counts the number of GP clock cycles spent on copy operations, either from the EFB to a texture (see GXCopyTex), or from the EFB to a display buffer (see GXCopyDisp).

Note that the hardware can only count the number of quads (2x2 pixel blocks) instead of pixels. Since each counter value is calculated as 4x of the number of quads that passed specified event, it is not accurate in pixels and usually over-counted.

See Also

GXReadMemMetric
GXClearMemMetric
GXSetVCacheMetric
GXReadVCacheMetric
GXClearVCacheMetric
GXReadGPMetric
GXSetGPMetric
GXClearGPMetric

Revision History

03/01/2006 Initial version.