psl1ght
A free SDK for Sony's PS3 console
Functions
commands.h File Reference

RSX commands. More...

#include <rsx/gcm_sys.h>
#include <rsx/rsx_program.h>

Go to the source code of this file.

Functions

void rsxSetFrontFace (gcmContextData *context, u32 dir)
 Set drawing direction of front face. More...
 
void rsxSetCullFace (gcmContextData *context, u32 cull)
 Set culling mode. More...
 
void rsxSetCullFaceEnable (gcmContextData *context, u32 enable)
 Enable/Disable face culling. More...
 
void rsxSetDepthWriteEnable (gcmContextData *context, u32 enable)
 Enable/Disable write to depth buffer. More...
 
void rsxDrawVertexEnd (gcmContextData *context)
 Stop the render sequence. More...
 
void rsxSetShadeModel (gcmContextData *context, u32 shadeModel)
 Set the shading model for the render sequence. More...
 
void rsxDrawVertexBegin (gcmContextData *context, u32 type)
 Start the render sequence. More...
 
void rsxDrawVertex2f (gcmContextData *context, u8 idx, f32 x, f32 y)
 
void rsxDrawVertex3f (gcmContextData *context, u8 idx, f32 x, f32 y, f32 z)
 
void rsxDrawVertex4f (gcmContextData *context, u8 idx, f32 x, f32 y, f32 z, f32 w)
 
void rsxSetScissor (gcmContextData *context, u16 x, u16 y, u16 w, u16 h)
 
void rsxSetDepthFunc (gcmContextData *context, u32 func)
 Specify the value used for depth buffer comparisons. More...
 
void rsxSetDepthTestEnable (gcmContextData *context, u32 enable)
 Enable or disable the depth test. More...
 
void rsxClearSurface (gcmContextData *context, u32 clear_mask)
 Clear the render surface. More...
 
void rsxSetClearDepthValue (gcmContextData *context, u32 value)
 Set the clear depth value. More...
 
void rsxSetReturnCommand (gcmContextData *context)
 
void rsxSetCallCommand (gcmContextData *context, u32 offset)
 
void rsxSetJumpCommand (gcmContextData *context, u32 offset)
 
void rsxSetNopCommand (gcmContextData *context, u32 count)
 
void rsxSetClearColor (gcmContextData *context, u32 color)
 Set the clear color. More...
 
void rsxSetColorMask (gcmContextData *context, u32 mask)
 Enable or disable write access to the framebuffer color components. More...
 
void rsxSetColorMaskMRT (gcmContextData *context, u32 mask)
 Enable or disable write access to the framebuffer color components (Multiple Render Target output). More...
 
void rsxSetSurface (gcmContextData *context, gcmSurface *surface)
 Setup the render surface. More...
 
void rsxSetReferenceCommand (gcmContextData *context, u32 ref_value)
 
void rsxSetWaitLabel (gcmContextData *context, u8 index, u32 value)
 Enqueues a Wait for label command. More...
 
void rsxSetWriteCommandLabel (gcmContextData *context, u8 index, u32 value)
 Enqueues a Write Command label command. More...
 
void rsxSetWriteBackendLabel (gcmContextData *context, u8 index, u32 value)
 Enqueues a Write Backend label command. More...
 
void rsxSetViewportClip (gcmContextData *context, u8 sel, u16 width, u16 height)
 
void rsxSetViewport (gcmContextData *context, u16 x, u16 y, u16 width, u16 height, f32 min, f32 max, const f32 scale[4], const f32 offset[4])
 Set viewport. More...
 
void rsxInvalidateTextureCache (gcmContextData *context, u32 type)
 Invalidates a texture cache. More...
 
void rsxLoadTexture (gcmContextData *context, u8 index, const gcmTexture *texture)
 Loads a texture. More...
 
void rsxTextureControl (gcmContextData *context, u8 index, u32 enable, u16 minlod, u16 maxlod, u8 maxaniso)
 Set texture control parameters. More...
 
void rsxTextureFilter (gcmContextData *context, u8 index, u8 min, u8 mag, u8 conv)
 
void rsxTextureWrapMode (gcmContextData *context, u8 index, u8 wraps, u8 wrapt, u8 wrapr, u8 unsignedRemap, u8 zfunc, u8 gamma)
 
void rsxLoadVertexProgram (gcmContextData *context, rsxVertexProgram *program, const void *ucode)
 Load a compiled vertex shader program. More...
 
void rsxLoadFragmentProgramLocation (gcmContextData *context, rsxFragmentProgram *program, u32 offset, u32 location)
 Load a compiled fragment shader program. More...
 
void rsxZControl (gcmContextData *context, u8 cullNearFar, u8 zClampEnable, u8 cullIgnoreW)
 
void rsxLoadVertexProgramBlock (gcmContextData *context, rsxVertexProgram *program, const void *ucode)
 
void rsxLoadVertexProgramParameterBlock (gcmContextData *context, u32 base_const, u32 const_cnt, const f32 *value)
 
void rsxSetVertexProgramParameter (gcmContextData *context, rsxVertexProgram *program, s32 index, const f32 *value)
 
void rsxSetFragmentProgramParameter (gcmContextData *context, rsxFragmentProgram *program, s32 index, const f32 *value, u32 offset)
 
void rsxDrawVertexArray (gcmContextData *context, u32 type, u32 start, u32 count)
 
void rsxBindVertexArrayAttrib (gcmContextData *context, u8 attr, u32 offset, u8 stride, u8 elems, u8 dtype, u8 location)
 
void rsxDrawIndexArray (gcmContextData *context, u32 type, u32 offset, u32 count, u32 data_type, u32 location)
 
void rsxInlineTransfer (gcmContextData *context, const u32 dstOffset, const void *srcAddress, const u32 sizeInWords, const u8 location)
 
void rsxSetUserClipPlaneControl (gcmContextData *context, u32 plane0, u32 plane1, u32 plane2, u32 plane3, u32 plane4, u32 plane5)
 
void rsxSetBlendFunc (gcmContextData *context, u16 sfcolor, u16 dfcolor, u16 sfalpha, u16 dfalpha)
 Specify pixel arithmetic. More...
 
void rsxSetBlendEquation (gcmContextData *context, u16 color, u16 alpha)
 Set the blend equation. More...
 
void rsxSetBlendColor (gcmContextData *context, u32 color0, u32 color1)
 Set the blending constant color. More...
 
void rsxSetBlendEnable (gcmContextData *context, u32 enable)
 Enable or disable blending. More...
 
void rsxSetTransformBranchBits (gcmContextData *context, u32 branchBits)
 
void rsxSetTransferDataMode (gcmContextData *context, u8 mode)
 Configuration the mode for an upcoming asynchronous RSX DMA transfer. More...
 
void rsxSetTransferDataOffset (gcmContextData *context, u32 dst, u32 src)
 Specify the memory locations for an RSX DMA transfer. This function should be called after rsxSetTransferDataMode() and rsxSetTransferDataFormat(). More...
 
void rsxSetTransferDataFormat (gcmContextData *context, s32 inpitch, s32 outpitch, u32 linelength, u32 linecount, u8 inbytes, u8 outbytes)
 Format an upcoming asynchronous RSX DMA transfer. More...
 
void rsxSetTransferData (gcmContextData *context, u8 mode, u32 dst, u32 outpitch, u32 src, u32 inpitch, u32 linelength, u32 linecount)
 Initiate an asynchronous RSX DMA transfer. More...
 
void rsxSetTransferScaleMode (gcmContextData *context, const u8 mode, const u8 surface)
 Configure an upcoming asynchronous RSX blit. More...
 
void rsxSetTransferScaleSurface (gcmContextData *context, const gcmTransferScale *scale, const gcmTransferSurface *surface)
 Initiate an asynchronous RSX blit. More...
 
void rsxSetTransferImage (gcmContextData *context, const u8 mode, const u32 dstOffset, const u32 dstPitch, const u32 dstX, const u32 dstY, const u32 srcOffset, const u32 srcPitch, const u32 srcX, const u32 srcY, const u32 width, const u32 height, const u32 bytesPerPixel)
 Initialiate an asynchronous transfer of a rectangular image from one area of memory to another. More...
 
void rsxSetTimeStamp (gcmContextData *context, u32 index)
 

Detailed Description

RSX commands.

These are functions to enqueue commands into the RSX's command buffer.

Function Documentation

◆ rsxClearSurface()

void rsxClearSurface ( gcmContextData context,
u32  clear_mask 
)

Clear the render surface.

This function clears the chosen selection of color components, depth and stencil values for all pixels in the destination surface. The clear color can be chosen using rsxSetClearColor, and the clear value for the depth buffer is set using rsxSetClearDepthValue.

Parameters
contextPointer to the context object.
clear_maskA selection of components to be cleared. Must be an OR combination of the following values:

◆ rsxDrawVertexBegin()

void rsxDrawVertexBegin ( gcmContextData context,
u32  type 
)

Start the render sequence.

Starts the rendering for a primitive.

Parameters
contextPointer to the context object.
typeType of primitive to render. Possible values are:

◆ rsxDrawVertexEnd()

void rsxDrawVertexEnd ( gcmContextData context)

Stop the render sequence.

Stops the rendering for a primitive, started by rsxDrawVertexBegin.

Parameters
contextPointer to the context object.

◆ rsxInvalidateTextureCache()

void rsxInvalidateTextureCache ( gcmContextData context,
u32  type 
)

Invalidates a texture cache.

Parameters
contextPointer to the context object.
typeType of texture cache to be invalidated. Possible values are:

◆ rsxLoadFragmentProgramLocation()

void rsxLoadFragmentProgramLocation ( gcmContextData context,
rsxFragmentProgram program,
u32  offset,
u32  location 
)

Load a compiled fragment shader program.

Parameters
contextPointer to the context object
programPointer to the fragment program configuration
offsetMemory offset of fragment program
locationMemory location type where the program relies. Possible values are:

◆ rsxLoadTexture()

void rsxLoadTexture ( gcmContextData context,
u8  index,
const gcmTexture texture 
)

Loads a texture.

Parameters
contextPointer to the context object.
indexTexture index.
texturePointer to the texture data.

◆ rsxLoadVertexProgram()

void rsxLoadVertexProgram ( gcmContextData context,
rsxVertexProgram program,
const void *  ucode 
)

Load a compiled vertex shader program.

Parameters
contextPointer to the context object
programPointer to the vertex program configuration
ucodePointer to the shader micro code

◆ rsxSetBlendColor()

void rsxSetBlendColor ( gcmContextData context,
u32  color0,
u32  color1 
)

Set the blending constant color.

Parameters
contextPointer to the context object
color0all A, R, G, B components in 8-bit component mode
color1reserved for 16-bit components

◆ rsxSetBlendEnable()

void rsxSetBlendEnable ( gcmContextData context,
u32  enable 
)

Enable or disable blending.

Parameters
contextPointer to the context object
enable
  • GCM_TRUE : enable blending
  • GCM_FALSE : disable blending

◆ rsxSetBlendEquation()

void rsxSetBlendEquation ( gcmContextData context,
u16  color,
u16  alpha 
)

Set the blend equation.

The blend equations determine how a new pixel (the “source” color) is combined with a pixel already in the framebuffer (the “destination” color). This function specifies one blend equation for the RGB-color components and one blend equation for the alpha component.

These equations use the source and destination blend factors specified by rsxSetBlendFunc. See rsxSetBlendFunc for a description of the various blend factors.

In the equations that follow, source and destination color components are referred to as Rs, Gs, Bs, As and Rd, Gd, Bd, Ad, respectively. The result color is referred to as Rr, Gr, Br, Ar. The source and destination blend factors are denoted sR, sG, sB, sA and dR, dG, dB, dA, respectively. For these equations all color components are understood to have values in the range [0,1].

Mode Rr Gr Br Ar
GCM_FUNC_ADD RssR+RddRGssG+GddGBssB+BddBAssA+AddA
GCM_MIN min(Rs,Rd) min(Gs,Gd) min(Bs,Bd) min(As,Ad)
GCM_MAX max(Rs,Rd) max(Gs,Gd) max(Bs,Bd) max(As,Ad)
GCM_FUNC_SUBTRACT RssR-RddRGssG-GddGBssB-BddBAssA-AddA
GCM_FUNC_REVERSE_SUBTRACTRddR-RssRGddG-GssGBddB-BssBAddA-AssA

The results of these equations are clamped to the range [0,1].

The GCM_MIN and GCM_MAX equations are useful for applications that analyze image data (image thresholding against a constant color, for example). The GCM_FUNC_ADD equation is useful for antialiasing and transparency, among other things.

Initially, both the RGB blend equation and the alpha blend equation are set to GCM_FUNC_ADD.

Notes

The GCM_MIN, and GCM_MAX equations do not use the source or destination factors, only the source and destination colors.

Parameters
contextPointer to the context object
colorSpecifies the RGB blend equation, how the red, green, and blue components of the source and destination colors are combined.
alphaSpecifies the alpha blend equation, how the alpha component of the source and destination colors are combined.

◆ rsxSetBlendFunc()

void rsxSetBlendFunc ( gcmContextData context,
u16  sfcolor,
u16  dfcolor,
u16  sfalpha,
u16  dfalpha 
)

Specify pixel arithmetic.

In RGBA mode, pixels can be drawn using a function that blends the incoming (source) RGBA values with the RGBA values that are already in the frame buffer (the destination values). Blending is initially disabled. Use rsxSetBlendEnable to enable and disable blending.

rsxSetBlendFunc defines the operation of blending when it is enabled. sfcolor and and sfalpha specify which method is used to scale the source color and alpha components. dfcolor and and dfalpha specify which method is used to scale the destination color and alpha components. The possible methods are described in the following table. Each method defines four scale factors, one each for red, green, blue, and alpha. In the table and in subsequent equations, source and destination color components are referred to as Rs, Gs, Bs, As and Rd, Gd, Bd, Ad, respectively. The color specified by rsxSetBlendColor is referred to as Rc, Gc, Bc, Ac. They are understood to have integer values between 0 and kR, kG, kB, kA, where

kc = 2mc - 1

and mR, mG, mB, mA is the number of red, green, blue, and alpha bitplanes.

Source and destination scale factors are referred to as sR, sG, sB, sA and dR, dG, dB, dA. The scale factors described in the table, denoted fR, fG, fB, fA, represent either source or destination factors. All scale factors have range [0,1].

Parameter fR fG fB fA
GCM_ZERO 0 0 0 0
GCM_ONE 1 1 1 1
GCM_SRC_COLOR Rs/kR Gs/kG Bs/kB As/kA
GCM_ONE_MINUS_SRC_COLOR 1-Rs/kR1-Gs/kG1-Bs/kB1-As/kA
GCM_DST_COLOR Rd/kR Gd/kG Bd/kB Ad/kA
GCM_ONE_MINUS_DST_COLOR 1-Rd/kR1-Gd/kG1-Bd/kB1-Ad/kA
GCM_SRC_ALPHA As/kA As/kA As/kA As/kA
GCM_ONE_MINUS_SRC_ALPHA 1-As/kA1-As/kA1-As/kA1-As/kA
GCM_DST_ALPHA Ad/kA Ad/kA Ad/kA Ad/kA
GCM_ONE_MINUS_DST_ALPHA 1-Ad/kA1-Ad/kA1-Ad/kA1-Ad/kA
GCM_CONSTANT_COLOR Rc Gc Bc Ac
GCM_ONE_MINUS_CONSTANT_COLOR1-Rc 1-Gc 1-Bc 1-Ac
GCM_CONSTANT_ALPHA Ac Ac Ac Ac
GCM_ONE_MINUS_CONSTANT_ALPHA1-Ac 1-Ac 1-Ac 1-Ac
GCM_SRC_ALPHA_SATURATE i i i 1

In the table,

i = min(As/kA, 1 - Ad/kA)

To determine the blended RGBA values of a pixel when drawing in RGBA mode, the equation defined by rsxSetBlendEquation us used. In the default mode (GCM_FUNC_ADD for RGB and alpha equations), the equations are the following:

  • Rd = min(kR, RssR + RddR)
  • Gd = min(kG, GssG + GddG)
  • Bd = min(kB, BssB + BddB)
  • Ad = min(kA, AssA + AddA)

Despite the apparent precision of the above equations, blending arithmetic is not exactly specified, because blending operates with imprecise integer color values. However, a blend factor that should be equal to 1 is guaranteed not to modify its multiplicand, and a blend factor equal to 0 reduces its multiplicand to 0. For example, when sfcolor is GCM_SRC_ALPHA, fdcolor is GCM_ONE_MINUS_SRC_ALPHA, and As is equal to kA, the equations reduce to simple replacement:

Rd = Rs ; Gd = Gs ; Bd = Bs

Examples

Transparency is best implemented using blend function (sfcolor = sfalpha = GCM_SRC_ALPHA, dfcolor = dfalpha = GCM_ONE_MINUS_SRC_ALPHA) with primitives sorted from farthest to nearest. Note that this transparency calculation does not require the presence of alpha bitplanes in the frame buffer.

Blend function (GCM_SRC_ALPHA, GCM_ONE_MINUS_SRC_ALPHA) is also useful for rendering antialiased points and lines in arbitrary order.

Polygon antialiasing is optimized using blend function (GCM_SRC_ALPHA_SATURATE, GCM_ONE) with polygons sorted from nearest to farthest. Destination alpha bitplanes, which must be present for this blend function to operate correctly, store the accumulated coverage.

Notes

Incoming (source) alpha is correctly thought of as a material opacity, ranging from 1.0 ( kA ), representing complete opacity, to 0.0 (0), representing complete transparency.

Parameters
contextPointer to the context object
sfcolorSpecifies how the red, green, and blue source blending factors are computed.
dfcolorSpecifies how the red, green, and blue source blending factors are computed.
sfalphaSpecifies how the alpha source blending factor is computed.
dfalphaSpecifies how the alpha destination blending factor is computed.

◆ rsxSetClearColor()

void rsxSetClearColor ( gcmContextData context,
u32  color 
)

Set the clear color.

The clear color value is used by the rsxClearSurface function.

Parameters
contextPointer to the context object.
colorThe clear color value.

◆ rsxSetClearDepthValue()

void rsxSetClearDepthValue ( gcmContextData context,
u32  value 
)

Set the clear depth value.

This value is used by the rsxClearSurface function.

Parameters
contextPointer to the context object.
valueColor value

◆ rsxSetColorMask()

void rsxSetColorMask ( gcmContextData context,
u32  mask 
)

Enable or disable write access to the framebuffer color components.

Parameters
contextPointer to the context object.
maskA selection of the components to enable write access. It is an OR combination of the following values:

◆ rsxSetColorMaskMRT()

void rsxSetColorMaskMRT ( gcmContextData context,
u32  mask 
)

Enable or disable write access to the framebuffer color components (Multiple Render Target output).

Parameters
contextPointer to the context object.
maskA selection of the components to enable write access. It is an OR combination of the following values:

◆ rsxSetCullFace()

void rsxSetCullFace ( gcmContextData context,
u32  cull 
)

Set culling mode.

Parameters
contextPointer to context object.
cullType of cull mode. Possible values are:

◆ rsxSetCullFaceEnable()

void rsxSetCullFaceEnable ( gcmContextData context,
u32  enable 
)

Enable/Disable face culling.

Parameters
contextPointer to the context object.
enableEnable flag. Possible values are:

◆ rsxSetDepthFunc()

void rsxSetDepthFunc ( gcmContextData context,
u32  func 
)

Specify the value used for depth buffer comparisons.

Parameters
contextPointer to the context object.
funcSpecifies the depth comparison function. Possible values are:

◆ rsxSetDepthTestEnable()

void rsxSetDepthTestEnable ( gcmContextData context,
u32  enable 
)

Enable or disable the depth test.

If depth test is enabled, the GPU performs depth comparisons and updates the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled.

Parameters
contextPointer to the context object.
enableEnable flag. Possible values are:

◆ rsxSetDepthWriteEnable()

void rsxSetDepthWriteEnable ( gcmContextData context,
u32  enable 
)

Enable/Disable write to depth buffer.

Parameters
contextPointer to the context object.
enableEnable flag. Possible values are:

◆ rsxSetFrontFace()

void rsxSetFrontFace ( gcmContextData context,
u32  dir 
)

Set drawing direction of front face.

Parameters
contextPointer to the context object.
dirDrawing direction of front face. Possible values are:

◆ rsxSetShadeModel()

void rsxSetShadeModel ( gcmContextData context,
u32  shadeModel 
)

Set the shading model for the render sequence.

Parameters
contextPointer to the context object.
shadeModelType of shading model. Possible values are:

◆ rsxSetSurface()

void rsxSetSurface ( gcmContextData context,
gcmSurface surface 
)

Setup the render surface.

This function is used to setup the render target where RSX should render the frame into.

Parameters
contextPointer to the context object.
surfacePointer to the surface object.

◆ rsxSetTransferData()

void rsxSetTransferData ( gcmContextData context,
u8  mode,
u32  dst,
u32  outpitch,
u32  src,
u32  inpitch,
u32  linelength,
u32  linecount 
)

Initiate an asynchronous RSX DMA transfer.

Parameters
contextPointer to the context object
modeSpecify source and destination memory areas. Possible values are:
  • GCM_TRANSFER_LOCAL_TO_LOCAL
  • GCM_TRANSFER_MAIN_TO_LOCAL
  • GCM_TRANSFER_LOCAL_TO_MAIN
  • GCM_TRANSFER_MAIN_TO_MAIN
dstDestination memory offset, e.g., a value returned by gcmAddressToOffset() or gcmMapMainMemory().
outpitchPitch size, in bytes, of the destination buffer (e.g., for a buffer that represents a rectangular image, this would be the width multiplied by the number of bytes in each pixel).
srcSource memory offset, e.g., a value returned by gcmAddressToOffset() or gcmMapMainMemory().
inpitchPitch size, in bytes, of the source buffer (e.g., for a buffer that represents a rectangular image, this would be the width multiplied by the number of bytes in each pixel).
linelengthSize, in bytes, of each line of data that will be transfered.
linecountNumber of lines of data to transfer.

◆ rsxSetTransferDataFormat()

void rsxSetTransferDataFormat ( gcmContextData context,
s32  inpitch,
s32  outpitch,
u32  linelength,
u32  linecount,
u8  inbytes,
u8  outbytes 
)

Format an upcoming asynchronous RSX DMA transfer.

Parameters
contextPointer to the context object
inpitchPitch size, in bytes, of the source buffer (e.g., for a buffer that represents a rectangular image, this would be the width multiplied by the number of bytes in each pixel).
outpitchPitch size, in bytes, of the destination buffer (e.g., for a buffer that represents a rectangular image, this would be the width multiplied by the number of bytes in each pixel).
linelengthSize, in bytes, of each line of data that will be transfered.
linecountNumber of lines of data to transfer.
inbytesNumber of bytes for each block (e.g., pixel) of data to be transfered: 1, 2, or 4. Will perform scatter-gather transfer if different from outbytes.
outbytesNumber of bytes for each block (e.g., pixel) of data to be transfered: 1, 2, or 4. Will perform scatter-gather transfer if different from inbytes.

◆ rsxSetTransferDataMode()

void rsxSetTransferDataMode ( gcmContextData context,
u8  mode 
)

Configuration the mode for an upcoming asynchronous RSX DMA transfer.

Parameters
contextPointer to the context object
modeSpecify source and destination memory areas. Possible values are:
  • GCM_TRANSFER_LOCAL_TO_LOCAL
  • GCM_TRANSFER_MAIN_TO_LOCAL
  • GCM_TRANSFER_LOCAL_TO_MAIN
  • GCM_TRANSFER_MAIN_TO_MAIN

◆ rsxSetTransferDataOffset()

void rsxSetTransferDataOffset ( gcmContextData context,
u32  dst,
u32  src 
)

Specify the memory locations for an RSX DMA transfer. This function should be called after rsxSetTransferDataMode() and rsxSetTransferDataFormat().

Parameters
contextPointer to the context object
dstDestination memory offset, e.g., a value returned by gcmAddressToOffset() or gcmMapMainMemory().
srcSource memory offset, e.g., a value returned by gcmAddressToOffset() or gcmMapMainMemory().

◆ rsxSetTransferImage()

void rsxSetTransferImage ( gcmContextData context,
const u8  mode,
const u32  dstOffset,
const u32  dstPitch,
const u32  dstX,
const u32  dstY,
const u32  srcOffset,
const u32  srcPitch,
const u32  srcX,
const u32  srcY,
const u32  width,
const u32  height,
const u32  bytesPerPixel 
)

Initialiate an asynchronous transfer of a rectangular image from one area of memory to another.

Parameters
contextPointer to the context object
modeSpecify source and destination memory areas. Possible values are:
  • GCM_TRANSFER_LOCAL_TO_LOCAL
  • GCM_TRANSFER_MAIN_TO_LOCAL
  • GCM_TRANSFER_LOCAL_TO_MAIN
  • GCM_TRANSFER_MAIN_TO_MAIN
dstOffsetDestination memory offset, e.g., a value returned by gcmAddressToOffset() or gcmMapMainMemory().
dstPitchPitch size, in bytes, of the destination image data (width multiplied by the number of bytes in each pixel).
dstXOrigin of the destination data, relative to the beginning of the destination buffer.
dstYOrigin of the destination data, relative to the beginning of the destination buffer.
srcOffsetSource memory offset, e.g., a value returned by gcmAddressToOffset() or gcmMapMainMemory().
srcPitchPitch size, in bytes, of the source image data (width multiplied by the number of bytes in each pixel).
srcXOrigin of the source rectangle, relative to the beginning of the source buffer.
srcYOrigin of the source rectangle, relative to the beginning of the source buffer.
widthWidth of the transfer rectangle.
heightHeight of the transfer rectangle.
bytesPerPixelNumber of bytes per pixel to transfer: 2 or 4.

◆ rsxSetTransferScaleMode()

void rsxSetTransferScaleMode ( gcmContextData context,
const u8  mode,
const u8  surface 
)

Configure an upcoming asynchronous RSX blit.

Parameters
contextPointer to the context object
modeSpecify source and destination memory areas. Possible values are:
  • GCM_TRANSFER_LOCAL_TO_LOCAL
  • GCM_TRANSFER_MAIN_TO_LOCAL
  • GCM_TRANSFER_LOCAL_TO_MAIN
  • GCM_TRANSFER_MAIN_TO_MAIN
surfaceTransfer surface mode. Possible values are:
  • GCM_TRANSFER_SURFACE
  • GCM_TRANSFER_SWIZZLE

◆ rsxSetTransferScaleSurface()

void rsxSetTransferScaleSurface ( gcmContextData context,
const gcmTransferScale scale,
const gcmTransferSurface surface 
)

Initiate an asynchronous RSX blit.

Parameters
contextPointer to the context object
scaleSpecify the transfer geometry & parameters.
surfaceSpecify the surface to blit to.

◆ rsxSetViewport()

void rsxSetViewport ( gcmContextData context,
u16  x,
u16  y,
u16  width,
u16  height,
f32  min,
f32  max,
const f32  scale[4],
const f32  offset[4] 
)

Set viewport.

This function sets the viewport.
The origin (0,0) of the normalized device coordinate points to the center of the screen.
Performing viewport conversion, where the upper left corner is the origin is as follows:

x = X;
y = Y;
width = WIDTH;
height = HEIGHT;
min = 0.0f;
max = 1.0f;
scale[0] = width * 0.5f;
scale[1] = height * 0.5f;
scale[2] = (max - min) * 0.5f;
offset[0] = x + width * 0.5f;
offset[1] = y + height * 0.5f;
offset[2] = (max + min) * 0.5f;



Performing viewport conversion, where the lower left corner is the origin is as follows (this is equivalent to glViewport):

x = X;
y = WINDOW_HEIGHT - Y - HEIGHT;
width = WIDTH;
height = HEIGHT;
min = 0.0f;
max = 1.0f;
scale[0] = width * 0.5f;
scale[1] = height * -0.5f;
scale[2] = (max - min) * 0.5f;
offset[0] = x + width * 0.5f;
offset[1] = y + height * 0.5f;
offset[2] = (max + min) * 0.5f;
Parameters
contextPointer to the context object.
xOrigin of the viewport rectangle in pixels (0 - 4095). Initial value is (0,0).
yOrigin of the viewport rectangle in pixels (0 - 4095). Initial value is (0,0).
widthWidth of the viewport (0 - 4096). Initial value is 4096.
heightHeight of the viewport (0 - 4096). Initial value is 4096.
minMinimum Z clip value. Initial value is 0.0.
maxMaximum Z clip value. Initial value is 1.0.
scaleScale values to be used for viewport conversion. Initial values are (2048.0,2048.0,0.5,0.0).
offsetOffset values to be used for viewport conversion. Initial values are (2048.0,2048.0,0.5,0.0).

◆ rsxSetWaitLabel()

void rsxSetWaitLabel ( gcmContextData context,
u8  index,
u32  value 
)

Enqueues a Wait for label command.

Parameters
contextPointer to the context object.
indexLabel index
valuieLabel value

◆ rsxSetWriteBackendLabel()

void rsxSetWriteBackendLabel ( gcmContextData context,
u8  index,
u32  value 
)

Enqueues a Write Backend label command.

Parameters
contextPointer to the context object.
indexLabel index
valueLabel value

◆ rsxSetWriteCommandLabel()

void rsxSetWriteCommandLabel ( gcmContextData context,
u8  index,
u32  value 
)

Enqueues a Write Command label command.

Parameters
contextPointer to the context object.
indexLabel index
valueLabel value

◆ rsxTextureControl()

void rsxTextureControl ( gcmContextData context,
u8  index,
u32  enable,
u16  minlod,
u16  maxlod,
u8  maxaniso 
)

Set texture control parameters.

Parameters
contextPointer to the context object.
indexTexture index.
enableEnable flag. Possible values are:
minlodminimum level of detail.
maxlodmaximum level of detail.
maxanisosample level of the anisotropic filter. Possible values are:
Todo:
finish args documentation.