Context Initialization
gcmInitBody
Initialize the RSX/GCM context.Pointer to receive the effective address of the allocated context structure
Command buffer size in bytes
IO buffer size in bytes
Pointer to allocated IO buffer
Returns 0 on success, nonzero on error
gcmGetConfiguration
Retrieve the current RSX configuration.Pointer to configuration structure to be filled
Returns 0 on success, nonzero on error
gcmConfiguration Structure
gcmConfiguration Structure
Example
Memory Management
gcmAddressToOffset
Convert an effective address in RSX memory to an offset.Effective address to convert
Pointer to receive the offset value
Returns 0 on success, nonzero on error
gcmIoOffsetToAddress
Convert an offset to an effective address in RSX memory.Offset to convert
Pointer to receive the effective address
Returns 0 on success, nonzero on error
gcmMapMainMemory
Map a memory block in main memory for RSX access.Pointer to the block to be mapped
Size of the block in bytes
Pointer to receive the mapped offset value
Returns 0 on success, nonzero on error
Example
gcmMapEaIoAddress
Map an effective address to an IO address.Effective address to map
IO address
Size in bytes
Returns 0 on success, nonzero on error
gcmUnmapIoAddress
Unmap a previously mapped IO address.IO address to unmap
Returns 0 on success, nonzero on error
gcmMapLocalMemory
Map local RSX memory.Pointer to receive the mapped address
Pointer to receive the size of mapped memory
Returns 0 on success, nonzero on error
gcmGetMaxIoMapSize
Get the maximum IO map size available.Maximum IO map size in bytes
Display Management
gcmSetDisplayBuffer
Configure a display framebuffer.Buffer ID (0-7)
Offset of the buffer in video memory (from rsxAddressToOffset)
Size of a buffer line in bytes (width * bytes_per_pixel)
Buffer width in pixels
Buffer height in pixels
Returns 0 on success, nonzero on error
Example
gcmSetFlip
Enqueue a flip command into the command buffer.Pointer to the context object
Framebuffer ID to flip to (as configured with gcmSetDisplayBuffer)
Returns 0 on success, nonzero on error
gcmSetFlipMode
Set the flip synchronization mode.Flip mode: GCM_FLIP_HSYNC, GCM_FLIP_VSYNC, or GCM_FLIP_HSYNC_AND_BREAK_EVERYTHING
GCM_FLIP_VSYNC to synchronize with vertical refresh and prevent tearing.
gcmSetWaitFlip
Wait for a flip to complete.Pointer to the context object
gcmGetFlipStatus
Get the flip status.Returns nonzero if a flip occurred, 0 otherwise
gcmResetFlipStatus() before querying again.
gcmResetFlipStatus
Reset the flip status.gcmSetPrepareFlip
Perform preprocessing for display output.Pointer to context object
Buffer ID
Returns status value
gcmGetLastFlipTime
Get the timestamp of the last flip.Timestamp of last flip
gcmSetFlipImmediate
Perform an immediate flip without waiting for VSync.Buffer ID to flip to
Returns 0 on success, nonzero on error
gcmGetCurrentDisplayBufferId
Get the currently displayed buffer ID.Pointer to receive the current buffer ID
Returns 0 on success, nonzero on error
gcmGetVBlankCount
Get the VBlank count.Current VBlank count
Event Handlers
gcmSetVBlankHandler
Register a callback function to be called on VBlank.Callback function (NULL to cancel)
Example
gcmSetFlipHandler
Register a callback function to be called when a flip is executed.Callback function (NULL to cancel)
gcmSetGraphicsHandler
Register a callback function for graphics pipeline exceptions.Callback function (NULL to cancel)
gcmSetUserHandler
Register a user-defined handler.Callback function
Command Buffer Control
gcmGetControlRegister
Obtain registers for controlling the command buffer.Pointer to control register structure
gcmControlRegister Structure
gcmControlRegister Structure
gcmSetDefaultCommandBuffer
Set the default command buffer.Render Operations
gcmSetTile
Configure a tile region.Tile index (0-14)
Memory location (GCM_LOCATION_RSX or GCM_LOCATION_CELL)
Memory offset
Tile size
Tile pitch
Compression mode
Base value
Bank value
gcmSetInvalidateTile
Invalidate a tile region.Tile index to invalidate
gcmBindTile
Bind a tile region.Tile index to bind
Returns 0 on success, nonzero on error
gcmUnbindTile
Unbind a tile region.Tile index to unbind
Returns 0 on success, nonzero on error
gcmSetZcull
Configure Z-culling.Zcull region index
Memory offset
Width in pixels
Height in pixels
Cull start offset
Depth format (GCM_ZCULL_Z16 or GCM_ZCULL_Z24S8)
Anti-aliasing format
Z-cull direction (GCM_ZCULL_LESS or GCM_ZCULL_GREATER)
Z-cull format
Stencil function
Stencil reference value
Stencil mask
gcmGetLabelAddress
Get the address of a specified label.Label index
Pointer to the label address
gcmGetReport
Get a report value.Report type
Report index
Report value
gcmGetTimeStamp
Get a timestamp value.Timestamp index
Timestamp value
Hardware Cursor
gcmInitCursor
Initialize hardware cursor support.Returns 0 on success, nonzero on error
gcmSetCursorEnable
Enable the hardware cursor.Returns 0 on success, nonzero on error
gcmSetCursorDisable
Disable the hardware cursor.Returns 0 on success, nonzero on error
gcmSetCursorPosition
Set the cursor position.X coordinate
Y coordinate
Returns 0 on success, nonzero on error
gcmSetCursorImageOffset
Set the cursor image offset.Image offset in video memory
Returns 0 on success, nonzero on error
gcmUpdateCursor
Update the cursor display.Returns 0 on success, nonzero on error
Constants
Memory Locations
GCM_LOCATION_RSX(0) - Buffer in RSX video memoryGCM_LOCATION_CELL(1) - Buffer in main memoryGCM_LOCATION_REPORT(2) - Buffer in report memory
Flip Modes
GCM_FLIP_HSYNC(1) - Flip on horizontal sync (accurate)GCM_FLIP_VSYNC(2) - Flip on vertical syncGCM_FLIP_HSYNC_AND_BREAK_EVERYTHING(3) - Flip on horizontal sync (inaccurate)
Surface Formats
GCM_SURFACE_X8R8G8B8(5) - 32-bit color without alphaGCM_SURFACE_A8R8G8B8(8) - 32-bit color with alphaGCM_SURFACE_R5G6B5(3) - 16-bit color
Depth Formats
GCM_SURFACE_ZETA_Z16(1) - 16-bit depth bufferGCM_SURFACE_ZETA_Z24S8(2) - 24-bit depth + 8-bit stencil