PSPSDK 1.0+beta2
Graphics Utility Library

Functions

void sceGuDepthBuffer (void *zbp, int zbw)
 Set depth buffer parameters. More...
 
void sceGuDispBuffer (int width, int height, void *dispbp, int dispbw)
 Set display buffer parameters. More...
 
void sceGuDrawBuffer (int psm, void *fbp, int fbw)
 Set draw buffer parameters (and store in context for buffer-swap) More...
 
void sceGuDrawBufferList (int psm, void *fbp, int fbw)
 Set draw buffer directly, not storing parameters in the context. More...
 
int sceGuDisplay (int state)
 Turn display on or off. More...
 
void sceGuDepthFunc (int function)
 Select which depth-test function to use. More...
 
void sceGuDepthMask (int mask)
 Mask depth buffer writes. More...
 
void sceGuDepthOffset (unsigned int offset)
 
void sceGuDepthRange (int near, int far)
 Set which range to use for depth calculations. More...
 
void sceGuFog (float near, float far, unsigned int color)
 
void sceGuInit (void)
 Initalize the GU system. More...
 
void sceGuTerm (void)
 Shutdown the GU system. More...
 
void sceGuBreak (int a0)
 
void sceGuContinue (void)
 
void * sceGuSetCallback (int signal, void(*callback)(int))
 Setup signal handler. More...
 
void sceGuSignal (int signal, int behavior)
 Trigger signal to call code from the command stream. More...
 
void sceGuSendCommandf (int cmd, float argument)
 Send raw float-command to the GE. More...
 
void sceGuSendCommandi (int cmd, int argument)
 Send raw command to the GE. More...
 
void * sceGuGetMemory (int size)
 Allocate memory on the current display list for temporary storage. More...
 
void sceGuStart (int cid, void *list)
 Start filling a new display-context. More...
 
int sceGuFinish (void)
 Finish current display list and go back to the parent context. More...
 
int sceGuFinishId (unsigned int id)
 Finish current display list and go back to the parent context, sending argument id for the finish callback. More...
 
void sceGuCallList (const void *list)
 Call previously generated display-list. More...
 
void sceGuCallMode (int mode)
 Set wether to use stack-based calls or signals to handle execution of called lists. More...
 
int sceGuCheckList (void)
 Check how large the current display-list is. More...
 
void sceGuSendList (int mode, const void *list, PspGeContext *context)
 Send a list to the GE directly. More...
 
void * sceGuSwapBuffers (void)
 Swap display and draw buffer. More...
 
int sceGuSync (int mode, int what)
 Wait until display list has finished executing. More...
 
void sceGuDrawArray (int prim, int vtype, int count, const void *indices, const void *vertices)
 Draw array of vertices forming primitives. More...
 
void sceGuBeginObject (int vtype, int count, const void *indices, const void *vertices)
 Begin conditional rendering of object. More...
 
void sceGuEndObject (void)
 End conditional rendering of object. More...
 
void sceGuSetStatus (int state, int status)
 Enable or disable GE state. More...
 
int sceGuGetStatus (int state)
 Get if state is currently enabled or disabled. More...
 
void sceGuSetAllStatus (int status)
 Set the status on all 22 available states. More...
 
int sceGuGetAllStatus (void)
 Query status on all 22 available states. More...
 
void sceGuEnable (int state)
 Enable GE state. More...
 
void sceGuDisable (int state)
 Disable GE state. More...
 
void sceGuLight (int light, int type, int components, const ScePspFVector3 *position)
 Set light parameters. More...
 
void sceGuLightAtt (int light, float atten0, float atten1, float atten2)
 Set light attenuation. More...
 
void sceGuLightColor (int light, int component, unsigned int color)
 Set light color. More...
 
void sceGuLightMode (int mode)
 Set light mode. More...
 
void sceGuLightSpot (int light, const ScePspFVector3 *direction, float exponent, float cutoff)
 Set spotlight parameters. More...
 
void sceGuClear (int flags)
 Clear current drawbuffer. More...
 
void sceGuClearColor (unsigned int color)
 Set the current clear-color. More...
 
void sceGuClearDepth (unsigned int depth)
 Set the current clear-depth. More...
 
void sceGuClearStencil (unsigned int stencil)
 Set the current stencil clear value. More...
 
void sceGuPixelMask (unsigned int mask)
 Set mask for which bits of the pixels to write. More...
 
void sceGuColor (unsigned int color)
 Set current primitive color. More...
 
void sceGuColorFunc (int func, unsigned int color, unsigned int mask)
 Set the color test function. More...
 
void sceGuColorMaterial (int components)
 Set which color components that the material will receive. More...
 
void sceGuAlphaFunc (int func, int value, int mask)
 Set the alpha test parameters. More...
 
void sceGuAmbient (unsigned int color)
 
void sceGuAmbientColor (unsigned int color)
 
void sceGuBlendFunc (int op, int src, int dest, unsigned int srcfix, unsigned int destfix)
 Set the blending-mode. More...
 
void sceGuMaterial (int mode, int color)
 
void sceGuModelColor (unsigned int emissive, unsigned int ambient, unsigned int diffuse, unsigned int specular)
 
void sceGuStencilFunc (int func, int ref, int mask)
 Set stencil function and reference value for stencil testing. More...
 
void sceGuStencilOp (int fail, int zfail, int zpass)
 Set the stencil test actions. More...
 
void sceGuSpecular (float power)
 Set the specular power for the material. More...
 
void sceGuFrontFace (int order)
 Set the current face-order (for culling) More...
 
void sceGuLogicalOp (int op)
 Set color logical operation. More...
 
void sceGuSetDither (const ScePspIMatrix4 *matrix)
 Set ordered pixel dither matrix. More...
 
void sceGuShadeModel (int mode)
 Set how primitives are shaded. More...
 
void sceGuCopyImage (int psm, int sx, int sy, int width, int height, int srcw, void *src, int dx, int dy, int destw, void *dest)
 Image transfer using the GE. More...
 
void sceGuTexEnvColor (unsigned int color)
 Specify the texture environment color. More...
 
void sceGuTexFilter (int min, int mag)
 Set how the texture is filtered. More...
 
void sceGuTexFlush (void)
 Flush texture page-cache. More...
 
void sceGuTexFunc (int tfx, int tcc)
 Set how textures are applied. More...
 
void sceGuTexImage (int mipmap, int width, int height, int tbw, const void *tbp)
 Set current texturemap. More...
 
void sceGuTexLevelMode (unsigned int mode, float bias)
 Set texture-level mode (mipmapping) More...
 
void sceGuTexMapMode (int mode, unsigned int a1, unsigned int a2)
 Set the texture-mapping mode. More...
 
void sceGuTexMode (int tpsm, int maxmips, int a2, int swizzle)
 Set texture-mode parameters. More...
 
void sceGuTexOffset (float u, float v)
 Set texture offset. More...
 
void sceGuTexProjMapMode (int mode)
 Set texture projection-map mode. More...
 
void sceGuTexScale (float u, float v)
 Set texture scale. More...
 
void sceGuTexSlope (float slope)
 
void sceGuTexSync ()
 Synchronize rendering pipeline with image upload. More...
 
void sceGuTexWrap (int u, int v)
 Set if the texture should repeat or clamp. More...
 
void sceGuClutLoad (int num_blocks, const void *cbp)
 Upload CLUT (Color Lookup Table) More...
 
void sceGuClutMode (unsigned int cpsm, unsigned int shift, unsigned int mask, unsigned int a3)
 Set current CLUT mode. More...
 
void sceGuOffset (unsigned int x, unsigned int y)
 Set virtual coordinate offset. More...
 
void sceGuScissor (int x, int y, int w, int h)
 Set what to scissor within the current viewport. More...
 
void sceGuViewport (int cx, int cy, int width, int height)
 Set current viewport. More...
 
void sceGuDrawBezier (int vtype, int ucount, int vcount, const void *indices, const void *vertices)
 Draw bezier surface. More...
 
void sceGuPatchDivide (unsigned int ulevel, unsigned int vlevel)
 Set dividing for patches (beziers and splines) More...
 
void sceGuPatchFrontFace (unsigned int a0)
 
void sceGuPatchPrim (int prim)
 Set primitive for patches (beziers and splines) More...
 
void sceGuDrawSpline (int vtype, int ucount, int vcount, int uedge, int vedge, const void *indices, const void *vertices)
 
void sceGuSetMatrix (int type, const ScePspFMatrix4 *matrix)
 Set transform matrices. More...
 
void sceGuBoneMatrix (unsigned int index, const ScePspFMatrix4 *matrix)
 Specify skinning matrix entry. More...
 
void sceGuMorphWeight (int index, float weight)
 Specify morph weight entry. More...
 
void sceGuDrawArrayN (int primitive_type, int vertex_type, int count, int a3, const void *indices, const void *vertices)
 
void guSwapBuffersBehaviour (int behaviour)
 Set how the display should be set. More...
 
void guSwapBuffersCallback (GuSwapBuffersCallback callback)
 Set a buffer swap callback to allow for more advanced buffer methods without hacking the library. More...
 

Detailed Description

Function Documentation

◆ guSwapBuffersBehaviour()

void guSwapBuffersBehaviour ( int  behaviour)

Set how the display should be set.

Available behaviours are:

  • PSP_DISPLAY_SETBUF_IMMEDIATE - Display is swapped immediately
  • PSP_DISPLAY_SETBUF_NEXTFRAME - Display is swapped on the next frame

Do remember that this swaps the pointers internally, regardless of setting, so be careful to wait until the next vertical blank or use another buffering algorithm (see guSwapBuffersCallback()).

References gu_settings, and GuSettings::swapBuffersBehaviour.

◆ guSwapBuffersCallback()

void guSwapBuffersCallback ( GuSwapBuffersCallback  callback)

Set a buffer swap callback to allow for more advanced buffer methods without hacking the library.

The GuSwapBuffersCallback is defined like this:

void swapBuffersCallback(void** display, void** render);

and on entry they contain the variables that are to be set. To change the pointers that will be used, just write the new pointers. Example of a triple-buffering algorithm:

void* doneBuffer;
void swapBuffersCallback(void** display, void** render)
{
void* active = doneBuffer;
doneBuffer = *display;
*display = active;
}
Parameters
callback- Callback to access when buffers are swapped. Pass 0 to disable.

References gu_settings, and GuSettings::swapBuffersCallback.

◆ sceGuAlphaFunc()

void sceGuAlphaFunc ( int  func,
int  value,
int  mask 
)

Set the alpha test parameters.

Available comparison functions are:

  • GU_NEVER
  • GU_ALWAYS
  • GU_EQUAL
  • GU_NOTEQUAL
  • GU_LESS
  • GU_LEQUAL
  • GU_GREATER
  • GU_GEQUAL
Parameters
func- Specifies the alpha comparison function.
value- Specifies the reference value that incoming alpha values are compared to.
mask- Specifies the mask that both values are ANDed with before comparison.

References a0, a1, a2, and sendCommandi().

◆ sceGuAmbient()

void sceGuAmbient ( unsigned int  color)

References sendCommandi().

◆ sceGuAmbientColor()

void sceGuAmbientColor ( unsigned int  color)

References sendCommandi().

◆ sceGuBeginObject()

void sceGuBeginObject ( int  vtype,
int  count,
const void *  indices,
const void *  vertices 
)

Begin conditional rendering of object.

If no vertices passed into this function are inside the scissor region, it will skip rendering the object. There can be up to 32 levels of conditional testing, and all levels HAVE to be terminated by sceGuEndObject().

Example: test a boundingbox against the frustum, and if visible, render object
void sceGuBeginObject(int vtype, int count, const void *indices, const void *vertices)
Begin conditional rendering of object.
Definition: sceGuBeginObject.c:11
void sceGuDrawArray(int prim, int vtype, int count, const void *indices, const void *vertices)
Draw array of vertices forming primitives.
Definition: sceGuDrawArray.c:11
void sceGuEndObject(void)
End conditional rendering of object.
Definition: sceGuEndObject.c:11
#define GU_TRIANGLES
Definition: pspgu.h:34
#define GU_VERTEX_32BITF
Definition: pspgu.h:92
#define GU_TEXTURE_32BITF
Definition: pspgu.h:73
Parameters
vtype- Vertex type to process
count- Number of vertices to test
indices- Optional list to an index-list
vertices- Pointer to a vertex-list

References a1, GuDisplayList::current, gu_list, gu_object_stack, gu_object_stack_depth, and sendCommandi().

◆ sceGuBlendFunc()

void sceGuBlendFunc ( int  op,
int  src,
int  dest,
unsigned int  srcfix,
unsigned int  destfix 
)

Set the blending-mode.

Keys for the blending operations:

  • Cs - Source color
  • Cd - Destination color
  • Bs - Blend function for source fragment
  • Bd - Blend function for destination fragment

Available blending-operations are:

  • GU_ADD - (Cs*Bs) + (Cd*Bd)
  • GU_SUBTRACT - (Cs*Bs) - (Cd*Bd)
  • GU_REVERSE_SUBTRACT - (Cd*Bd) - (Cs*Bs)
  • GU_MIN - Cs < Cd ? Cs : Cd
  • GU_MAX - Cs < Cd ? Cd : Cs
  • GU_ABS - |Cs-Cd|

Available blending-functions are:

  • GU_SRC_COLOR
  • GU_ONE_MINUS_SRC_COLOR
  • GU_SRC_ALPHA
  • GU_ONE_MINUS_SRC_ALPHA
  • GU_DST_ALPHA
  • GU_ONE_MINUS_DST_ALPHA
  • GU_DST_COLOR
  • GU_ONE_MINUS_DST_COLOR
  • GU_FIX
Parameters
op- Blending Operation
src- Blending function for source operand
dest- Blending function for dest operand
srcfix- Fix value for GU_FIX (source operand)
destfix- Fix value for GU_FIX (dest operand)

References sendCommandi().

◆ sceGuBoneMatrix()

void sceGuBoneMatrix ( unsigned int  index,
const ScePspFMatrix4 matrix 
)

Specify skinning matrix entry.

To enable vertex skinning, pass GU_WEIGHTS(n), where n is between 1-8, and pass available GU_WEIGHT_??? declaration. This will change the amount of weights passed in the vertex araay, and by setting the skinning, matrices, you will multiply each vertex every weight and vertex passed.

Please see sceGuDrawArray() for vertex format information.

Parameters
index- Skinning matrix index (0-7)
matrix- Matrix to set

References i, sendCommandf(), and sendCommandi().

◆ sceGuBreak()

void sceGuBreak ( int  a0)

◆ sceGuCallList()

void sceGuCallList ( const void *  list)

Call previously generated display-list.

Parameters
list- Display list to call

References gu_call_mode, sendCommandi(), and sendCommandiStall().

◆ sceGuCallMode()

void sceGuCallMode ( int  mode)

Set wether to use stack-based calls or signals to handle execution of called lists.

Parameters
mode- GU_TRUE(1) to enable signals, GU_FALSE(0) to disable signals and use normal calls instead.

References gu_call_mode.

◆ sceGuCheckList()

int sceGuCheckList ( void  )

Check how large the current display-list is.

Returns
The size of the current display list

References GuDisplayList::current, gu_list, and GuDisplayList::start.

◆ sceGuClear()

void sceGuClear ( int  flags)

Clear current drawbuffer.

Available clear-flags are (OR them together to get final clear-mode):

  • GU_COLOR_BUFFER_BIT - Clears the color-buffer
  • GU_STENCIL_BUFFER_BIT - Clears the stencil-buffer
  • GU_DEPTH_BUFFER_BIT - Clears the depth-buffer
Parameters
flags- Which part of the buffer to clear

References GuContext::clear_color, GuContext::clear_depth, GuContext::clear_stencil, flags, GU_COLOR_8888, GU_COLOR_BUFFER_BIT, gu_contexts, gu_curr_context, GU_DEPTH_BUFFER_BIT, gu_draw_buffer, GU_FAST_CLEAR_BIT, GU_SPRITES, GU_STENCIL_BUFFER_BIT, GU_TRANSFORM_2D, GU_VERTEX_16BIT, GuDrawBuffer::height, i, GuDrawBuffer::pixel_size, sceGuDrawArray(), sceGuGetMemory(), sendCommandi(), GuDrawBuffer::width, x, y, and z.

◆ sceGuClearColor()

void sceGuClearColor ( unsigned int  color)

Set the current clear-color.

Parameters
color- Color to clear with

References GuContext::clear_color, gu_contexts, and gu_curr_context.

◆ sceGuClearDepth()

void sceGuClearDepth ( unsigned int  depth)

Set the current clear-depth.

Parameters
depth- Set which depth to clear with (0x0000-0xffff)

References GuContext::clear_depth, gu_contexts, and gu_curr_context.

◆ sceGuClearStencil()

void sceGuClearStencil ( unsigned int  stencil)

Set the current stencil clear value.

Parameters
stencil- Set which stencil value to clear with (0-255)

References GuContext::clear_stencil, gu_contexts, and gu_curr_context.

◆ sceGuClutLoad()

void sceGuClutLoad ( int  num_blocks,
const void *  cbp 
)

Upload CLUT (Color Lookup Table)

Note
Data must be aligned to 1 quad word (16 bytes)
Parameters
num_blocks- How many blocks of 8 entries to upload (32*8 is 256 colors)
cbp- Pointer to palette (16 byte aligned)

References sendCommandi().

◆ sceGuClutMode()

void sceGuClutMode ( unsigned int  cpsm,
unsigned int  shift,
unsigned int  mask,
unsigned int  a3 
)

Set current CLUT mode.

Available pixel formats for palettes are:

  • GU_PSM_5650
  • GU_PSM_5551
  • GU_PSM_4444
  • GU_PSM_8888
Parameters
cpsm- Which pixel format to use for the palette
shift- Shifts color index by that many bits to the right
mask- Masks the color index with this bitmask after the shift (0-0xFF)
a3- Unknown, set to 0

References a3, and sendCommandi().

◆ sceGuColor()

void sceGuColor ( unsigned int  color)

Set current primitive color.

Parameters
color- Which color to use (overriden by vertex-colors)

References sceGuMaterial().

◆ sceGuColorFunc()

void sceGuColorFunc ( int  func,
unsigned int  color,
unsigned int  mask 
)

Set the color test function.

The color test is only performed while GU_COLOR_TEST is enabled.

Available functions are:

  • GU_NEVER
  • GU_ALWAYS
  • GU_EQUAL
  • GU_NOTEQUAL
Example: Reject any pixel that does not have 0 as the blue channel
void sceGuColorFunc(int func, unsigned int color, unsigned int mask)
Set the color test function.
Definition: sceGuColorFunc.c:11
#define GU_EQUAL
Definition: pspgu.h:193
Parameters
func- Color test function
color- Color to test against
mask- Mask ANDed against both source and destination when testing

References sendCommandi().

◆ sceGuColorMaterial()

void sceGuColorMaterial ( int  components)

Set which color components that the material will receive.

The components are ORed together from the following values:

  • GU_AMBIENT
  • GU_DIFFUSE
  • GU_SPECULAR
Parameters
components- Which components to receive

References a0, and sendCommandi().

Referenced by sceGuStart().

◆ sceGuContinue()

void sceGuContinue ( void  )

◆ sceGuCopyImage()

void sceGuCopyImage ( int  psm,
int  sx,
int  sy,
int  width,
int  height,
int  srcw,
void *  src,
int  dx,
int  dy,
int  destw,
void *  dest 
)

Image transfer using the GE.

Note
Data must be aligned to 1 quad word (16 bytes)
Example: Copy a fullscreen 32-bit image from RAM to VRAM
sceGuCopyImage(GU_PSM_8888,0,0,480,272,512,pixels,0,0,512,(void*)(((unsigned int)framebuffer)+0x4000000));
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void *src, int dx, int dy, int destw, void *dest)
Image transfer using the GE.
Definition: sceGuCopyImage.c:11
#define GU_PSM_8888
Definition: pspgu.h:121
Parameters
psm- Pixel format for buffer
sx- Source X
sy- Source Y
width- Image width
height- Image height
srcw- Source buffer width (block aligned)
src- Source pointer
dx- Destination X
dy- Destination Y
destw- Destination buffer width (block aligned)
dest- Destination pointer

References sendCommandi().

◆ sceGuDepthBuffer()

void sceGuDepthBuffer ( void *  zbp,
int  zbw 
)

Set depth buffer parameters.

Parameters
zbp- VRAM pointer where the depthbuffer should start
zbw- The width of the depth-buffer (block-aligned)

References GuDrawBuffer::depth_buffer, GuDrawBuffer::depth_width, gu_draw_buffer, and sendCommandi().

◆ sceGuDepthFunc()

void sceGuDepthFunc ( int  function)

Select which depth-test function to use.

Valid choices for the depth-test are:

  • GU_NEVER - No pixels pass the depth-test
  • GU_ALWAYS - All pixels pass the depth-test
  • GU_EQUAL - Pixels that match the depth-test pass
  • GU_NOTEQUAL - Pixels that doesn't match the depth-test pass
  • GU_LESS - Pixels that are less in depth passes
  • GU_LEQUAL - Pixels that are less or equal in depth passes
  • GU_GREATER - Pixels that are greater in depth passes
  • GU_GEQUAL - Pixels that are greater or equal passes
Parameters
function- Depth test function to use

References sendCommandi().

◆ sceGuDepthMask()

void sceGuDepthMask ( int  mask)

Mask depth buffer writes.

Parameters
mask- GU_TRUE(1) to disable Z writes, GU_FALSE(0) to enable

References sendCommandi().

◆ sceGuDepthOffset()

void sceGuDepthOffset ( unsigned int  offset)

◆ sceGuDepthRange()

void sceGuDepthRange ( int  near,
int  far 
)

Set which range to use for depth calculations.

Note
The depth buffer is inversed, and takes values from 65535 to 0.

Example: Use the entire depth-range for calculations:

sceGuDepthRange(65535,0);
void sceGuDepthRange(int near, int far)
Set which range to use for depth calculations.
Definition: sceGuDepthRange.c:11
Parameters
near- Value to use for the near plane
far- Value to use for the far plane

References GuContext::depth_offset, GuContext::far_plane, gu_contexts, gu_curr_context, GuContext::near_plane, sendCommandf(), sendCommandi(), and z.

Referenced by sceGuDepthOffset().

◆ sceGuDisable()

◆ sceGuDispBuffer()

void sceGuDispBuffer ( int  width,
int  height,
void *  dispbp,
int  dispbw 
)

Set display buffer parameters.

Example: Setup a standard 16-bit display buffer
sceGuDispBuffer(480,272,(void*)512*272*2,512); // 480*272, skipping the draw buffer located at address 0
void sceGuDispBuffer(int width, int height, void *dispbp, int dispbw)
Set display buffer parameters.
Definition: sceGuDispBuffer.c:20
Parameters
width- Width of the display buffer in pixels
height- Width of the display buffer in pixels
dispbp- VRAM pointer to where the display-buffer starts
dispbw- Display buffer width (block aligned)

References GuDrawBuffer::disp_buffer, drawRegion(), GuDrawBuffer::frame_width, ge_edram_address, gu_display_on, gu_draw_buffer, GuDrawBuffer::height, GuDrawBuffer::pixel_size, PSP_DISPLAY_SETBUF_NEXTFRAME, sceDisplaySetFrameBuf(), sceDisplaySetMode(), and GuDrawBuffer::width.

◆ sceGuDisplay()

int sceGuDisplay ( int  state)

Turn display on or off.

Available states are:

  • GU_TRUE (1) - Turns display on
  • GU_FALSE (0) - Turns display off
Parameters
state- Turn display on or off
Returns
State of the display prior to this call

References GuDrawBuffer::disp_buffer, GuDrawBuffer::frame_width, ge_edram_address, gu_display_on, gu_draw_buffer, GuDrawBuffer::pixel_size, PSP_DISPLAY_SETBUF_NEXTFRAME, and sceDisplaySetFrameBuf().

◆ sceGuDrawArray()

void sceGuDrawArray ( int  prim,
int  vtype,
int  count,
const void *  indices,
const void *  vertices 
)

Draw array of vertices forming primitives.

Available primitive-types are:

  • GU_POINTS - Single pixel points (1 vertex per primitive)
  • GU_LINES - Single pixel lines (2 vertices per primitive)
  • GU_LINE_STRIP - Single pixel line-strip (2 vertices for the first primitive, 1 for every following)
  • GU_TRIANGLES - Filled triangles (3 vertices per primitive)
  • GU_TRIANGLE_STRIP - Filled triangles-strip (3 vertices for the first primitive, 1 for every following)
  • GU_TRIANGLE_FAN - Filled triangle-fan (3 vertices for the first primitive, 1 for every following)
  • GU_SPRITES - Filled blocks (2 vertices per primitive)

The vertex-type decides how the vertices align and what kind of information they contain. The following flags are ORed together to compose the final vertex format:

  • GU_TEXTURE_8BIT - 8-bit texture coordinates
  • GU_TEXTURE_16BIT - 16-bit texture coordinates
  • GU_TEXTURE_32BITF - 32-bit texture coordinates (float)
  • GU_COLOR_5650 - 16-bit color (R5G6B5A0)
  • GU_COLOR_5551 - 16-bit color (R5G5B5A1)
  • GU_COLOR_4444 - 16-bit color (R4G4B4A4)
  • GU_COLOR_8888 - 32-bit color (R8G8B8A8)
  • GU_NORMAL_8BIT - 8-bit normals
  • GU_NORMAL_16BIT - 16-bit normals
  • GU_NORMAL_32BITF - 32-bit normals (float)
  • GU_VERTEX_8BIT - 8-bit vertex position
  • GU_VERTEX_16BIT - 16-bit vertex position
  • GU_VERTEX_32BITF - 32-bit vertex position (float)
  • GU_WEIGHT_8BIT - 8-bit weights
  • GU_WEIGHT_16BIT - 16-bit weights
  • GU_WEIGHT_32BITF - 32-bit weights (float)
  • GU_INDEX_8BIT - 8-bit vertex index
  • GU_INDEX_16BIT - 16-bit vertex index
  • GU_WEIGHTS(n) - Number of weights (1-8)
  • GU_VERTICES(n) - Number of vertices (1-8)
  • GU_TRANSFORM_2D - Coordinate is passed directly to the rasterizer
  • GU_TRANSFORM_3D - Coordinate is transformed before passed to rasterizer
Note
Every vertex must align to 32 bits, which means that you HAVE to pad if it does not add up!

Vertex order: [for vertices(1-8)] [weights (0-8)] [texture uv] [color] [normal] [vertex] [/for]

Example: Render 400 triangles, with floating-point texture coordinates, and floating-point position, no indices
Parameters
prim- What kind of primitives to render
vtype- Vertex type to process
count- How many vertices to process
indices- Optional pointer to an index-list
vertices- Pointer to a vertex-list

References sendCommandi(), and sendCommandiStall().

Referenced by sceGuClear().

◆ sceGuDrawArrayN()

void sceGuDrawArrayN ( int  primitive_type,
int  vertex_type,
int  count,
int  a3,
const void *  indices,
const void *  vertices 
)

References a3, i, sendCommandi(), and sendCommandiStall().

◆ sceGuDrawBezier()

void sceGuDrawBezier ( int  vtype,
int  ucount,
int  vcount,
const void *  indices,
const void *  vertices 
)

Draw bezier surface.

Parameters
vtype- Vertex type, look at sceGuDrawArray() for vertex definition
ucount- Number of vertices used in the U direction
vcount- Number of vertices used in the V direction
indices- Pointer to index buffer
vertices- Pointer to vertex buffer

References sendCommandi().

◆ sceGuDrawBuffer()

void sceGuDrawBuffer ( int  psm,
void *  fbp,
int  fbw 
)

Set draw buffer parameters (and store in context for buffer-swap)

Available pixel formats are:

  • GU_PSM_5650
  • GU_PSM_5551
  • GU_PSM_4444
  • GU_PSM_8888
Example: Setup a standard 16-bit draw buffer
void sceGuDrawBuffer(int psm, void *fbp, int fbw)
Set draw buffer parameters (and store in context for buffer-swap)
Definition: sceGuDrawBuffer.c:11
#define GU_PSM_5551
Definition: pspgu.h:119
Parameters
psm- Pixel format to use for rendering (and display)
fbp- VRAM pointer to where the draw buffer starts
fbw- Frame buffer width (block aligned)

References GuDrawBuffer::depth_buffer, GuDrawBuffer::depth_width, GuDrawBuffer::frame_buffer, GuDrawBuffer::frame_width, gu_draw_buffer, GuDrawBuffer::height, GuDrawBuffer::pixel_size, and sendCommandi().

◆ sceGuDrawBufferList()

void sceGuDrawBufferList ( int  psm,
void *  fbp,
int  fbw 
)

Set draw buffer directly, not storing parameters in the context.

Parameters
psm- Pixel format to use for rendering
fbp- VRAM pointer to where the draw buffer starts
fbw- Frame buffer width (block aligned)

References sendCommandi().

◆ sceGuDrawSpline()

void sceGuDrawSpline ( int  vtype,
int  ucount,
int  vcount,
int  uedge,
int  vedge,
const void *  indices,
const void *  vertices 
)

References sendCommandi().

◆ sceGuEnable()

void sceGuEnable ( int  state)

Enable GE state.

The currently available states are:

  • GU_ALPHA_TEST
  • GU_DEPTH_TEST
  • GU_SCISSOR_TEST
  • GU_BLEND
  • GU_CULL_FACE
  • GU_DITHER
  • GU_CLIP_PLANES
  • GU_TEXTURE_2D
  • GU_LIGHTING
  • GU_LIGHT0
  • GU_LIGHT1
  • GU_LIGHT2
  • GU_LIGHT3
  • GU_COLOR_LOGIC_OP
Parameters
state- Which state to enable

References GuContext::fragment_2x, GU_ALPHA_TEST, GU_BLEND, GU_CLIP_PLANES, GU_COLOR_LOGIC_OP, GU_COLOR_TEST, gu_contexts, GU_CULL_FACE, gu_curr_context, GU_DEPTH_TEST, GU_DITHER, GU_FACE_NORMAL_REVERSE, GU_FOG, GU_FRAGMENT_2X, GU_LIGHT0, GU_LIGHT1, GU_LIGHT2, GU_LIGHT3, GU_LIGHTING, GU_LINE_SMOOTH, GU_PATCH_CULL_FACE, GU_PATCH_FACE, GU_SCISSOR_TEST, gu_states, GU_STENCIL_TEST, GU_TEXTURE_2D, GuContext::scissor_enable, GuContext::scissor_end, GuContext::scissor_start, sendCommandi(), and GuContext::texture_function.

Referenced by sceGuSetAllStatus(), and sceGuSetStatus().

◆ sceGuEndObject()

void sceGuEndObject ( void  )

End conditional rendering of object.

References GuDisplayList::current, gu_list, gu_object_stack, gu_object_stack_depth, and sendCommandi().

◆ sceGuFinish()

int sceGuFinish ( void  )

Finish current display list and go back to the parent context.

If the context is GU_DIRECT, the stall-address is updated so that the entire list will execute. Otherwise, only the terminating action is written to the list, depending on context-type.

The finish-callback will get a zero as argument when using this function.

This also restores control back to whatever context that was active prior to this call.

Returns
Size of finished display list

References GuDisplayList::current, GU_CALL, gu_call_mode, gu_contexts, gu_curr_context, GU_DIRECT, gu_list, GU_SEND, GuContext::list, GuDisplayList::parent_context, sendCommandi(), sendCommandiStall(), size, and GuDisplayList::start.

◆ sceGuFinishId()

int sceGuFinishId ( unsigned int  id)

Finish current display list and go back to the parent context, sending argument id for the finish callback.

If the context is GU_DIRECT, the stall-address is updated so that the entire list will execute. Otherwise, only the terminating action is written to the list, depending on context-type.

Parameters
id- Finish callback id (16-bit)
Returns
Size of finished display list

References GuDisplayList::current, GU_CALL, gu_call_mode, gu_contexts, gu_curr_context, GU_DIRECT, gu_list, GU_SEND, GuContext::list, GuDisplayList::parent_context, sendCommandi(), sendCommandiStall(), size, and GuDisplayList::start.

◆ sceGuFog()

void sceGuFog ( float  near,
float  far,
unsigned int  color 
)

References sendCommandf(), and sendCommandi().

◆ sceGuFrontFace()

void sceGuFrontFace ( int  order)

Set the current face-order (for culling)

This only has effect when culling is enabled (GU_CULL_FACE)

Culling order can be:

  • GU_CW - Clockwise primitives are not culled
  • GU_CCW - Counter-clockwise are not culled
Parameters
order- Which order to use

References sendCommandi().

◆ sceGuGetAllStatus()

int sceGuGetAllStatus ( void  )

Query status on all 22 available states.

Look at sceGuEnable() for a list of states

Returns
Status of all 22 states as a bitmask (0-21)

References gu_states.

◆ sceGuGetMemory()

void * sceGuGetMemory ( int  size)

Allocate memory on the current display list for temporary storage.

Note
This function is NOT for permanent memory allocation, the memory will be invalid as soon as you start filling the same display list again.
Parameters
size- How much memory to allocate
Returns
Memory-block ready for use

References GuDisplayList::current, ge_list_executed, gu_curr_context, gu_list, sceGeListUpdateStallAddr(), and size.

Referenced by sceGuClear().

◆ sceGuGetStatus()

int sceGuGetStatus ( int  state)

Get if state is currently enabled or disabled.

Look at sceGuEnable() for a list of states

Parameters
state- Which state to query about
Returns
Wether state is enabled or not

References gu_states.

◆ sceGuInit()

◆ sceGuLight()

void sceGuLight ( int  light,
int  type,
int  components,
const ScePspFVector3 position 
)

Set light parameters.

Available light types are:

  • GU_DIRECTIONAL - Directional light
  • GU_POINTLIGHT - Single point of light
  • GU_SPOTLIGHT - Point-light with a cone

Available light components are:

  • GU_AMBIENT_AND_DIFFUSE
  • GU_DIFFUSE_AND_SPECULAR
  • GU_UNKNOWN_LIGHT_COMPONENT
Parameters
light- Light index
type- Light type
components- Light components
position- Light position

References light_settings, sendCommandf(), sendCommandi(), GuLightSettings::type, type, ScePspFVector3::x, GuLightSettings::xpos, ScePspFVector3::y, GuLightSettings::ypos, ScePspFVector3::z, and GuLightSettings::zpos.

◆ sceGuLightAtt()

void sceGuLightAtt ( int  light,
float  atten0,
float  atten1,
float  atten2 
)

Set light attenuation.

Parameters
light- Light index
atten0- Constant attenuation factor
atten1- Linear attenuation factor
atten2- Quadratic attenuation factor

References GuLightSettings::constant, light_settings, GuLightSettings::linear, GuLightSettings::quadratic, and sendCommandf().

◆ sceGuLightColor()

void sceGuLightColor ( int  light,
int  component,
unsigned int  color 
)

Set light color.

Available light components are:

  • GU_AMBIENT
  • GU_DIFFUSE
  • GU_SPECULAR
  • GU_AMBIENT_AND_DIFFUSE
  • GU_DIFFUSE_AND_SPECULAR
Parameters
light- Light index
component- Which component to set
color- Which color to use

References GuLightSettings::ambient, GuLightSettings::diffuse, GU_AMBIENT, GU_AMBIENT_AND_DIFFUSE, GU_DIFFUSE, GU_DIFFUSE_AND_SPECULAR, GU_SPECULAR, light_settings, sendCommandi(), and GuLightSettings::specular.

◆ sceGuLightMode()

void sceGuLightMode ( int  mode)

Set light mode.

Available light modes are:

  • GU_SINGLE_COLOR
  • GU_SEPARATE_SPECULAR_COLOR

Separate specular colors are used to interpolate the specular component independently, so that it can be added to the fragment after the texture color.

Parameters
mode- Light mode to use

References sendCommandi().

◆ sceGuLightSpot()

void sceGuLightSpot ( int  light,
const ScePspFVector3 direction,
float  exponent,
float  cutoff 
)

Set spotlight parameters.

Parameters
light- Light index
direction- Spotlight direction
exponent- Spotlight exponent
cutoff- Spotlight cutoff angle (in radians)

References GuLightSettings::cutoff, GuLightSettings::exponent, light_settings, sendCommandf(), ScePspFVector3::x, GuLightSettings::xdir, ScePspFVector3::y, GuLightSettings::ydir, ScePspFVector3::z, and GuLightSettings::zdir.

◆ sceGuLogicalOp()

void sceGuLogicalOp ( int  op)

Set color logical operation.

Available operations are:

  • GU_CLEAR
  • GU_AND
  • GU_AND_REVERSE
  • GU_COPY
  • GU_AND_INVERTED
  • GU_NOOP
  • GU_XOR
  • GU_OR
  • GU_NOR
  • GU_EQUIV
  • GU_INVERTED
  • GU_OR_REVERSE
  • GU_COPY_INVERTED
  • GU_OR_INVERTED
  • GU_NAND
  • GU_SET

This operation only has effect if GU_COLOR_LOGIC_OP is enabled.

Parameters
op- Operation to execute

References sendCommandi().

◆ sceGuMaterial()

void sceGuMaterial ( int  mode,
int  color 
)

References sendCommandi().

Referenced by sceGuColor().

◆ sceGuModelColor()

void sceGuModelColor ( unsigned int  emissive,
unsigned int  ambient,
unsigned int  diffuse,
unsigned int  specular 
)

References sendCommandi().

◆ sceGuMorphWeight()

void sceGuMorphWeight ( int  index,
float  weight 
)

Specify morph weight entry.

To enable vertex morphing, pass GU_VERTICES(n), where n is between 1-8. This will change the amount of vertices passed in the vertex array, and by setting the morph weights for every vertex entry in the array, you can blend between them.

Please see sceGuDrawArray() for vertex format information.

Parameters
index- Morph weight index (0-7)
weight- Weight to set

References sendCommandf().

◆ sceGuOffset()

void sceGuOffset ( unsigned int  x,
unsigned int  y 
)

Set virtual coordinate offset.

The PSP has a virtual coordinate-space of 4096x4096, this controls where rendering is performed

Example: Center the virtual coordinate range
sceGuOffset(2048-(480/2),2048-(480/2));
void sceGuOffset(unsigned int x, unsigned int y)
Set virtual coordinate offset.
Definition: sceGuOffset.c:11
Parameters
x- Offset (0-4095)
y- Offset (0-4095)

References sendCommandi(), x, and y.

◆ sceGuPatchDivide()

void sceGuPatchDivide ( unsigned int  ulevel,
unsigned int  vlevel 
)

Set dividing for patches (beziers and splines)

Parameters
ulevel- Number of division on u direction
vlevel- Number of division on v direction

References a0, a1, and sendCommandi().

Referenced by sceGuStart().

◆ sceGuPatchFrontFace()

void sceGuPatchFrontFace ( unsigned int  a0)

References a0, and sendCommandi().

◆ sceGuPatchPrim()

void sceGuPatchPrim ( int  prim)

Set primitive for patches (beziers and splines)

Parameters
prim- Desired primitive type (GU_POINTS | GU_LINE_STRIP | GU_TRIANGLE_STRIP)

References GU_LINE_STRIP, GU_POINTS, GU_TRIANGLE_STRIP, and sendCommandi().

◆ sceGuPixelMask()

void sceGuPixelMask ( unsigned int  mask)

Set mask for which bits of the pixels to write.

Parameters
mask- Which bits to filter against writes

References sendCommandi().

◆ sceGuScissor()

void sceGuScissor ( int  x,
int  y,
int  w,
int  h 
)

Set what to scissor within the current viewport.

Note that scissoring is only performed if the custom scissoring is enabled (GU_SCISSOR_TEST)

Parameters
x- Left of scissor region
y- Top of scissor region
w- Width of scissor region
h- Height of scissor region

References gu_contexts, gu_curr_context, GuContext::scissor_enable, GuContext::scissor_end, GuContext::scissor_start, sendCommandi(), w, x, and y.

◆ sceGuSendCommandf()

void sceGuSendCommandf ( int  cmd,
float  argument 
)

Send raw float-command to the GE.

The argument is converted into a 24-bit float before transfer.

Parameters
cmd- Which command to send
argument- Argument to pass along

References sendCommandf().

◆ sceGuSendCommandi()

void sceGuSendCommandi ( int  cmd,
int  argument 
)

Send raw command to the GE.

Only the 24 lower bits of the argument is passed along.

Parameters
cmd- Which command to send
argument- Argument to pass along

References sendCommandi().

◆ sceGuSendList()

void sceGuSendList ( int  mode,
const void *  list,
PspGeContext context 
)

Send a list to the GE directly.

Available modes are:

  • GU_TAIL - Place list last in the queue, so it executes in-order
  • GU_HEAD - Place list first in queue so that it executes as soon as possible
Parameters
mode- Whether to place the list first or last in queue
list- List to send
context- Temporary storage for the GE context

References PspGeListArgs::context, GuSettings::ge_callback_id, ge_list_executed, GU_HEAD, gu_settings, GU_TAIL, sceGeListEnQueue(), sceGeListEnQueueHead(), GuSettings::signal_offset, and PspGeListArgs::size.

◆ sceGuSetAllStatus()

void sceGuSetAllStatus ( int  status)

Set the status on all 22 available states.

Look at sceGuEnable() for a list of states

Parameters
status- Bit-mask (0-21) containing the status of all 22 states

References i, sceGuDisable(), and sceGuEnable().

◆ sceGuSetCallback()

void * sceGuSetCallback ( int  signal,
void(*)(int)  callback 
)

Setup signal handler.

Available signals are:

  • GU_CALLBACK_SIGNAL - Called when sceGuSignal is used
  • GU_CALLBACK_FINISH - Called when display list is finished
Parameters
signal- Signal index to install a handler for
callback- Callback to call when signal index is triggered
Returns
The old callback handler

References GuSettings::fin, GU_CALLBACK_FINISH, GU_CALLBACK_SIGNAL, gu_settings, and GuSettings::sig.

◆ sceGuSetDither()

void sceGuSetDither ( const ScePspIMatrix4 matrix)

Set ordered pixel dither matrix.

This dither matrix is only applied if GU_DITHER is enabled.

Parameters
matrix- Dither matrix

References sendCommandi(), ScePspIVector4::w, ScePspIMatrix4::w, ScePspIVector4::x, ScePspIMatrix4::x, ScePspIVector4::y, ScePspIMatrix4::y, ScePspIVector4::z, and ScePspIMatrix4::z.

Referenced by sceGuStart().

◆ sceGuSetMatrix()

void sceGuSetMatrix ( int  type,
const ScePspFMatrix4 matrix 
)

Set transform matrices.

Available matrices are:

  • GU_PROJECTION - View->Projection matrix
  • GU_VIEW - World->View matrix
  • GU_MODEL - Model->World matrix
  • GU_TEXTURE - Texture matrix
Parameters
type- Which matrix-type to set
matrix- Matrix to load

References i, sendCommandf(), and type.

◆ sceGuSetStatus()

void sceGuSetStatus ( int  state,
int  status 
)

Enable or disable GE state.

Look at sceGuEnable() for a list of states

Parameters
state- Which state to change
status- Wether to enable or disable the state

References sceGuDisable(), and sceGuEnable().

◆ sceGuShadeModel()

void sceGuShadeModel ( int  mode)

Set how primitives are shaded.

The available shading-methods are:

  • GU_FLAT - Primitives are flatshaded, the last vertex-color takes effet
  • GU_SMOOTH - Primtives are gouraud-shaded, all vertex-colors take effect
Parameters
mode- Which mode to use

References sendCommandi().

◆ sceGuSignal()

void sceGuSignal ( int  signal,
int  behavior 
)

Trigger signal to call code from the command stream.

Available behaviors are:

  • GU_BEHAVIOR_SUSPEND - Stops display list execution until callback function finished
  • GU_BEHAVIOR_CONTINUE - Do not stop display list execution during callback
Parameters
signal- Signal to trigger
behavior- Behavior type

References sendCommandi(), and sendCommandiStall().

◆ sceGuSpecular()

void sceGuSpecular ( float  power)

Set the specular power for the material.

Parameters
power- Specular power

References sendCommandf().

Referenced by sceGuStart().

◆ sceGuStart()

void sceGuStart ( int  cid,
void *  list 
)

Start filling a new display-context.

Contexts available are:

  • GU_DIRECT - Rendering is performed as list is filled
  • GU_CALL - List is setup to be called from the main list
  • GU_SEND - List is buffered for a later call to sceGuSendList()

The previous context-type is stored so that it can be restored at sceGuFinish().

Parameters
cid- Context Type
list- Pointer to display-list (16 byte aligned)

References GuDisplayList::current, GuDrawBuffer::frame_buffer, GuDrawBuffer::frame_width, GuSettings::ge_callback_id, ge_list_executed, GU_AMBIENT, gu_contexts, gu_curr_context, GU_DIFFUSE, gu_draw_buffer, gu_init, gu_list, gu_settings, GU_SPECULAR, GuContext::list, GuDisplayList::parent_context, sceGeListEnQueue(), sceGuColorMaterial(), sceGuPatchDivide(), sceGuSetDither(), sceGuSpecular(), sceGuTexScale(), sendCommandi(), GuSettings::signal_offset, and GuDisplayList::start.

◆ sceGuStencilFunc()

void sceGuStencilFunc ( int  func,
int  ref,
int  mask 
)

Set stencil function and reference value for stencil testing.

Available functions are:

  • GU_NEVER
  • GU_ALWAYS
  • GU_EQUAL
  • GU_NOTEQUAL
  • GU_LESS
  • GU_LEQUAL
  • GU_GREATER
  • GU_GEQUAL
Parameters
func- Test function
ref- The reference value for the stencil test
mask- Mask that is ANDed with both the reference value and stored stencil value when the test is done

References sendCommandi().

◆ sceGuStencilOp()

void sceGuStencilOp ( int  fail,
int  zfail,
int  zpass 
)

Set the stencil test actions.

Available actions are:

  • GU_KEEP - Keeps the current value
  • GU_ZERO - Sets the stencil buffer value to zero
  • GU_REPLACE - Sets the stencil buffer value to ref, as specified by sceGuStencilFunc()
  • GU_INCR - Increments the current stencil buffer value
  • GU_DECR - Decrease the current stencil buffer value
  • GU_INVERT - Bitwise invert the current stencil buffer value

As stencil buffer shares memory with framebuffer alpha, resolution of the buffer is directly in relation.

Parameters
fail- The action to take when the stencil test fails
zfail- The action to take when stencil test passes, but the depth test fails
zpass- The action to take when both stencil test and depth test passes

References sendCommandi().

◆ sceGuSwapBuffers()

◆ sceGuSync()

int sceGuSync ( int  mode,
int  what 
)

Wait until display list has finished executing.

Example: Wait for the currently executing display list
sceGuSync(0,0);
int sceGuSync(int mode, int what)
Wait until display list has finished executing.
Definition: sceGuSync.c:14

Available what are:

  • GU_SYNC_WHAT_DONE
  • GU_SYNC_WHAT_QUEUED
  • GU_SYNC_WHAT_DRAW
  • GU_SYNC_WHAT_STALL
  • GU_SYNC_WHAT_CANCEL

Available mode are:

  • GU_SYNC_FINISH - Wait until the last sceGuFinish command is reached
  • GU_SYNC_SIGNAL - Wait until the last (?) signal is executed
  • GU_SYNC_DONE - Wait until all commands currently in list are executed
  • GU_SYNC_LIST - Wait for the currently executed display list (GU_DIRECT)
  • GU_SYNC_SEND - Wait for the last send list
Parameters
mode- What to wait for
what- What to sync to
Returns
Unknown at this time

References ge_list_executed, sceGeDrawSync(), and sceGeListSync().

◆ sceGuTerm()

void sceGuTerm ( void  )

Shutdown the GU system.

Called when GU is no longer needed

References GuSettings::ge_callback_id, gu_settings, GuSettings::kernel_event_flag, sceGeUnsetCallback(), and sceKernelDeleteEventFlag().

◆ sceGuTexEnvColor()

void sceGuTexEnvColor ( unsigned int  color)

Specify the texture environment color.

This is used in the texture function when a constant color is needed.

See sceGuTexFunc() for more information.

Parameters
color- Constant color (0x00BBGGRR)

References sendCommandi().

◆ sceGuTexFilter()

void sceGuTexFilter ( int  min,
int  mag 
)

Set how the texture is filtered.

Available filters are:

  • GU_NEAREST
  • GU_LINEAR
  • GU_NEAREST_MIPMAP_NEAREST
  • GU_LINEAR_MIPMAP_NEAREST
  • GU_NEAREST_MIPMAP_LINEAR
  • GU_LINEAR_MIPMAP_LINEAR
Parameters
min- Minimizing filter
mag- Magnifying filter

References sendCommandi().

◆ sceGuTexFlush()

void sceGuTexFlush ( void  )

Flush texture page-cache.

Do this if you have copied/rendered into an area currently in the texture-cache

References sendCommandf().

Referenced by sceGuTexMode().

◆ sceGuTexFunc()

void sceGuTexFunc ( int  tfx,
int  tcc 
)

Set how textures are applied.

Key for the apply-modes:

  • Cv - Color value result
  • Ct - Texture color
  • Cf - Fragment color
  • Cc - Constant color (specified by sceGuTexEnvColor())

Available apply-modes are: (TFX)

  • GU_TFX_MODULATE - Cv=Ct*Cf TCC_RGB: Av=Af TCC_RGBA: Av=At*Af
  • GU_TFX_DECAL - TCC_RGB: Cv=Ct,Av=Af TCC_RGBA: Cv=Cf*(1-At)+Ct*At Av=Af
  • GU_TFX_BLEND - Cv=(Cf*(1-Ct))+(Cc*Ct) TCC_RGB: Av=Af TCC_RGBA: Av=At*Af
  • GU_TFX_REPLACE - Cv=Ct TCC_RGB: Av=Af TCC_RGBA: Av=At
  • GU_TFX_ADD - Cv=Cf+Ct TCC_RGB: Av=Af TCC_RGBA: Av=At*Af

The fields TCC_RGB and TCC_RGBA specify components that differ between the two different component modes.

  • GU_TFX_MODULATE - The texture is multiplied with the current diffuse fragment
  • GU_TFX_REPLACE - The texture replaces the fragment
  • GU_TFX_ADD - The texture is added on-top of the diffuse fragment

Available component-modes are: (TCC)

  • GU_TCC_RGB - The texture alpha does not have any effect
  • GU_TCC_RGBA - The texture alpha is taken into account
Parameters
tfx- Which apply-mode to use
tcc- Which component-mode to use

References GuContext::fragment_2x, gu_contexts, gu_curr_context, sendCommandi(), and GuContext::texture_function.

◆ sceGuTexImage()

void sceGuTexImage ( int  mipmap,
int  width,
int  height,
int  tbw,
const void *  tbp 
)

Set current texturemap.

Textures may reside in main RAM, but it has a huge speed-penalty. Swizzle textures to get maximum speed.

Note
Data must be aligned to 1 quad word (16 bytes)
Parameters
mipmap- Mipmap level
width- Width of texture (must be a power of 2)
height- Height of texture (must be a power of 2)
tbw- Texture Buffer Width (block-aligned)
tbp- Texture buffer pointer (16 byte aligned)

References sendCommandi().

◆ sceGuTexLevelMode()

void sceGuTexLevelMode ( unsigned int  mode,
float  bias 
)

Set texture-level mode (mipmapping)

Available modes are:

  • GU_TEXTURE_AUTO
  • GU_TEXTURE_CONST
  • GU_TEXTURE_SLOPE
Parameters
mode- Which mode to use
bias- Which mipmap bias to use

References sendCommandi().

◆ sceGuTexMapMode()

void sceGuTexMapMode ( int  mode,
unsigned int  a1,
unsigned int  a2 
)

Set the texture-mapping mode.

Available modes are:

  • GU_TEXTURE_COORDS
  • GU_TEXTURE_MATRIX
  • GU_ENVIRONMENT_MAP
Parameters
mode- Which mode to use
a1- Unknown
a2- Unknown

References a1, a2, gu_contexts, gu_curr_context, sendCommandi(), GuContext::texture_map_mode, and GuContext::texture_proj_map_mode.

◆ sceGuTexMode()

void sceGuTexMode ( int  tpsm,
int  maxmips,
int  a2,
int  swizzle 
)

Set texture-mode parameters.

Available texture-formats are:

  • GU_PSM_5650 - Hicolor, 16-bit
  • GU_PSM_5551 - Hicolor, 16-bit
  • GU_PSM_4444 - Hicolor, 16-bit
  • GU_PSM_8888 - Truecolor, 32-bit
  • GU_PSM_T4 - Indexed, 4-bit (2 pixels per byte)
  • GU_PSM_T8 - Indexed, 8-bit
Parameters
tpsm- Which texture format to use
maxmips- Number of mipmaps to use (0-8)
a2- Unknown, set to 0
swizzle- GU_TRUE(1) to swizzle texture-reads

References a2, gu_contexts, gu_curr_context, sceGuTexFlush(), sendCommandi(), and GuContext::texture_mode.

◆ sceGuTexOffset()

void sceGuTexOffset ( float  u,
float  v 
)

Set texture offset.

Note
Only used by the 3D T&L pipe, renders done with GU_TRANSFORM_2D are not affected by this.
Parameters
u- Offset to add to the U coordinate
v- Offset to add to the V coordinate

References sendCommandf().

◆ sceGuTexProjMapMode()

void sceGuTexProjMapMode ( int  mode)

Set texture projection-map mode.

Available modes are:

  • GU_POSITION
  • GU_UV
  • GU_NORMALIZED_NORMAL
  • GU_NORMAL
Parameters
mode- Which mode to use

References gu_contexts, gu_curr_context, sendCommandi(), GuContext::texture_map_mode, and GuContext::texture_proj_map_mode.

◆ sceGuTexScale()

void sceGuTexScale ( float  u,
float  v 
)

Set texture scale.

Note
Only used by the 3D T&L pipe, renders ton with GU_TRANSFORM_2D are not affected by this.
Parameters
u- Scalar to multiply U coordinate with
v- Scalar to multiply V coordinate with

References sendCommandf().

Referenced by sceGuStart().

◆ sceGuTexSlope()

void sceGuTexSlope ( float  slope)

References sendCommandf().

◆ sceGuTexSync()

void sceGuTexSync ( )

Synchronize rendering pipeline with image upload.

This will stall the rendering pipeline until the current image upload initiated by sceGuCopyImage() has completed.

References sendCommandi().

◆ sceGuTexWrap()

void sceGuTexWrap ( int  u,
int  v 
)

Set if the texture should repeat or clamp.

Available modes are:

  • GU_REPEAT - The texture repeats after crossing the border
  • GU_CLAMP - Texture clamps at the border
Parameters
u- Wrap-mode for the U direction
v- Wrap-mode for the V direction

References sendCommandi().

◆ sceGuViewport()

void sceGuViewport ( int  cx,
int  cy,
int  width,
int  height 
)

Set current viewport.

Example: Setup a viewport of size (480,272) with origo at (2048,2048)
sceGuViewport(2048,2048,480,272);
void sceGuViewport(int cx, int cy, int width, int height)
Set current viewport.
Definition: sceGuViewport.c:11
Parameters
cx- Center for horizontal viewport
cy- Center for vertical viewport
width- Width of viewport
height- Height of viewport

References sendCommandf().