# G3*_SwapBuffers

## C Specification

      #include <nitro/gx/g3imm.h>
      #include <nitro/gx/g3b.h>
      #include <nitro/gx/g3c.h>

      void G3_SwapBuffers(GXSortMode am, GXBufferMode zw);

      // Below are APIs for creating the display list (command list)
      void G3B_SwapBuffers(GXDLInfo* info, GXSortMode am, GXBufferMode zw);
      void G3C_SwapBuffers(GXDLInfo* info, GXSortMode am, GXBufferMode zw);
      void G3BS_SwapBuffers(GXDLInfo* info, GXSortMode am, GXBufferMode zw);
      void G3CS_SwapBuffers(GXDLInfo* info, GXSortMode am, GXBufferMode zw);

## Arguments

info | Command List Information
am | Translucent polygon y-sorting selection
zw | Depth buffering selection

## Return Values

None.

## Description

This function swaps the data group referenced by the rendering engine. `zw` is the depth buffering selection flag that selects the value to use in the depth test. Buffering using w-values will not function normally for orthogonal projections. `am` is the translucent polygon sorting selection flag that should be set to the manual sort mode when you want to specify the drawing order when using shadow volumes. When the V-Blank period starts immediately after the `SwapBuffers` command is issued, the data that is referenced by the rendering engine is swapped. This data includes the polygon list RAM, vertex RAM, and rendering-related registers. Therefore, the written graphics data will be rendered in the frame after the V-Blank that is started after the `SwapBuffers` command was issued.
Note: When this instruction is issued after the V-Blank begins, the data will be swapped when the next V-Blank begins. Note: The Geometry engine will maintain a busy status until the data swap is performed. In addition, subsequent processing of geometry commands is not performed.

`GX_SORTMODE_AUTO` | Auto sort mode
`GX_SORTMODE_MANUAL` | Manual sort mode

`GX_BUFFERMODE_Z` | Buffering using z-values
`GX_BUFFERMODE_W` | Buffering using w-values (does not function normally if `G3_Ortho` is used)

The following indicates the type definitions for `GXSortMode` and `GXBufferMode` types.

    typedef enum
    {
    GX_SORTMODE_AUTO = 0,
    GX_SORTMODE_MANUAL = 1
    }
    GXSortMode;

    typedef enum
    {
    GX_BUFFERMODE_Z = 0,
    GX_BUFFERMODE_W = 1
    }
    GXBufferMode;

## See Also

## Revision History

02/09/2004

- Added a note

01/19/2004 Initial version