GXReadPixMetric

Syntax

#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 The number of pixels input for Z comparison before the texture lookup.
top_pixels_out The number of pixels passed for Z comparison before the texture lookup.
bot_pixels_in The number of pixels input for Z comparison after the texture lookup.
bot_pixels_out The number of pixels passed for Z comparison after the texture lookup.
clr_pixels_in The number of pixels input for the blender.
copy_clks The 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 clock cycles spent copying the embedded frame buffer (EFB) to textures or external frame buffer (XFB).

Call the GXClearPixMetric function to reset these counters to zero.

Example

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

GXClearPixMetric();

// Render Object(s)
// wait until object(s) rendered
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

In the GP, the Z buffer can be constructed either before or after texture lookups (see theGXSetZCompLoc function). The top_pixels_in argument returns the number of pixels input to Z comparison before texture lookup. The top_pixels_out argument indicates how many pixels passed the Z comparison test. 

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

The clr_pixels_in argument 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 copy_clks argument counts the number of GP clock cycles spent on copy operations, either from the EFB to a texture (see theGXCopyTex function), or from the EFB to a display buffer (see the GXCopyDisp function).

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

See Also

GXReadMemMetric, GXClearMemMetric, GXSetVCacheMetric, GXReadVCacheMetric, GXClearVCacheMetric, GXReadGPMetric, GXSetGPMetric, GXClearGPMetric

Revision History

2006/03/01 Initial version.


CONFIDENTIAL