libogc
v2.9.0
|
GX subsystem. More...
Data Structures | |
struct | _gx_color |
struct | _gx_colors10 |
struct | _gx_litobj |
struct | _gx_texobj |
struct | _gx_texreg |
struct | _gx_tlutobj |
struct | _gx_tlutreg |
struct | _vtx |
union | _wgpipe |
struct | GXFifoObj |
Object describing a graphics FIFO. More... | |
struct | GXFogAdjTbl |
Fog range adjustment parameter table. More... | |
struct | GXTexReg |
struct | GXVtxAttrFmt |
Structure describing the attribute format for one attribute. More... | |
struct | GXVtxDesc |
Structure describing how a single vertex attribute will be referenced. More... | |
Macros | |
#define | _GX_TF_CTF 0x20 |
#define | _GX_TF_ZTF 0x10 |
#define | GX_AF_NONE 2 |
#define | GX_AF_SPEC 0 |
#define | GX_AF_SPOT 1 |
#define | GX_ALPHA0 2 |
#define | GX_ALPHA1 3 |
#define | GX_ALPHA_BUMP 7 |
#define | GX_ALPHA_BUMPN 8 |
#define | GX_ALWAYS 7 |
#define | GX_ANISO_1 0 |
#define | GX_ANISO_2 1 |
#define | GX_ANISO_4 2 |
#define | GX_AOP_AND 0 |
#define | GX_AOP_OR 1 |
#define | GX_AOP_XNOR 3 |
#define | GX_AOP_XOR 2 |
#define | GX_BIGTLUT0 16 |
#define | GX_BIGTLUT1 17 |
#define | GX_BIGTLUT2 18 |
#define | GX_BIGTLUT3 19 |
#define | GX_BL_DSTALPHA 6 |
#define | GX_BL_DSTCLR GX_BL_SRCCLR |
#define | GX_BL_INVDSTALPHA 7 |
#define | GX_BL_INVDSTCLR GX_BL_INVSRCCLR |
#define | GX_BL_INVSRCALPHA 5 |
#define | GX_BL_INVSRCCLR 3 |
#define | GX_BL_ONE 1 |
#define | GX_BL_SRCALPHA 4 |
#define | GX_BL_SRCCLR 2 |
#define | GX_BL_ZERO 0 |
#define | GX_BLEND 2 |
#define | GX_BM_BLEND 1 |
#define | GX_BM_LOGIC 2 |
#define | GX_BM_NONE 0 |
#define | GX_BM_SUBTRACT 3 |
#define | GX_CA_A0 1 |
#define | GX_CA_A1 2 |
#define | GX_CA_A2 3 |
#define | GX_CA_APREV 0 |
#define | GX_CA_KONST 6 |
#define | GX_CA_RASA 5 |
#define | GX_CA_TEXA 4 |
#define | GX_CA_ZERO 7 |
#define | GX_CC_A0 3 |
#define | GX_CC_A1 5 |
#define | GX_CC_A2 7 |
#define | GX_CC_APREV 1 |
#define | GX_CC_C0 2 |
#define | GX_CC_C1 4 |
#define | GX_CC_C2 6 |
#define | GX_CC_CPREV 0 |
#define | GX_CC_HALF 13 |
#define | GX_CC_KONST 14 |
#define | GX_CC_ONE 12 |
#define | GX_CC_RASA 11 |
#define | GX_CC_RASC 10 |
#define | GX_CC_TEXA 9 |
#define | GX_CC_TEXC 8 |
#define | GX_CC_ZERO 15 |
#define | GX_CH_ALPHA 3 |
#define | GX_CH_BLUE 2 |
#define | GX_CH_GREEN 1 |
#define | GX_CH_RED 0 |
#define | GX_CLAMP 0 |
#define | GX_CLAMP_BOTTOM 2 |
#define | GX_CLAMP_NONE 0 |
#define | GX_CLAMP_TOP 1 |
#define | GX_CLIP_DISABLE 1 |
#define | GX_CLIP_ENABLE 0 |
#define | GX_CLR_RGB 0 |
#define | GX_CLR_RGBA 1 |
#define | GX_COLOR0 0 |
#define | GX_COLOR0A0 4 |
#define | GX_COLOR1 1 |
#define | GX_COLOR1A1 5 |
#define | GX_COLORNULL 0xff |
#define | GX_COLORZERO 6 |
#define | GX_COPY_INTLC_EVEN 2 |
#define | GX_COPY_INTLC_ODD 3 |
#define | GX_COPY_PROGRESSIVE 0 |
#define | GX_CS_DIVIDE_2 3 |
#define | GX_CS_SCALE_1 0 |
#define | GX_CS_SCALE_2 1 |
#define | GX_CS_SCALE_4 2 |
#define | GX_CTF_A8 (0x7|_GX_TF_CTF) |
#define | GX_CTF_B8 (0xA|_GX_TF_CTF) |
#define | GX_CTF_G8 (0x9|_GX_TF_CTF) |
#define | GX_CTF_GB8 (0xC|_GX_TF_CTF) |
#define | GX_CTF_R4 (0x0|_GX_TF_CTF) |
#define | GX_CTF_R8 (0x8|_GX_TF_CTF) |
#define | GX_CTF_RA4 (0x2|_GX_TF_CTF) |
#define | GX_CTF_RA8 (0x3|_GX_TF_CTF) |
#define | GX_CTF_RG8 (0xB|_GX_TF_CTF) |
#define | GX_CTF_YUVA8 (0x6|_GX_TF_CTF) |
#define | GX_CTF_Z16L (0xC|_GX_TF_ZTF|_GX_TF_CTF) |
#define | GX_CTF_Z4 (0x0|_GX_TF_ZTF|_GX_TF_CTF) |
#define | GX_CTF_Z8L (0xA|_GX_TF_ZTF|_GX_TF_CTF) |
#define | GX_CTF_Z8M (0x9|_GX_TF_ZTF|_GX_TF_CTF) |
#define | GX_CULL_ALL 3 |
#define | GX_CULL_BACK 2 |
#define | GX_CULL_FRONT 1 |
#define | GX_CULL_NONE 0 |
#define | GX_DA_GENTLE 1 |
#define | GX_DA_MEDIUM 2 |
#define | GX_DA_OFF 0 |
#define | GX_DA_STEEP 3 |
#define | GX_DECAL 1 |
#define | GX_DF_CLAMP 2 |
#define | GX_DF_NONE 0 |
#define | GX_DF_SIGNED 1 |
#define | GX_DIRECT 1 |
#define | GX_DISABLE 0 |
#define | GX_DTTIDENTITY 125 |
#define | GX_DTTMTX0 64 |
#define | GX_DTTMTX1 67 |
#define | GX_DTTMTX10 94 |
#define | GX_DTTMTX11 97 |
#define | GX_DTTMTX12 100 |
#define | GX_DTTMTX13 103 |
#define | GX_DTTMTX14 106 |
#define | GX_DTTMTX15 109 |
#define | GX_DTTMTX16 112 |
#define | GX_DTTMTX17 115 |
#define | GX_DTTMTX18 118 |
#define | GX_DTTMTX19 121 |
#define | GX_DTTMTX2 70 |
#define | GX_DTTMTX3 73 |
#define | GX_DTTMTX4 76 |
#define | GX_DTTMTX5 79 |
#define | GX_DTTMTX6 82 |
#define | GX_DTTMTX7 85 |
#define | GX_DTTMTX8 88 |
#define | GX_DTTMTX9 91 |
#define | GX_ENABLE 1 |
#define | GX_EQUAL 2 |
#define | GX_F32 4 |
#define | GX_FALSE 0 |
#define | GX_FIFO_HIWATERMARK (16*1024) |
#define | GX_FIFO_MINSIZE (64*1024) |
#define | GX_FIFO_OBJSIZE 128 |
#define | GX_FOG_EXP GX_FOG_PERSP_EXP |
#define | GX_FOG_EXP2 GX_FOG_PERSP_EXP2 |
#define | GX_FOG_LIN GX_FOG_PERSP_LIN |
#define | GX_FOG_NONE 0 |
#define | GX_FOG_ORTHO_EXP 12 |
#define | GX_FOG_ORTHO_EXP2 13 |
#define | GX_FOG_ORTHO_LIN 10 |
#define | GX_FOG_ORTHO_REVEXP 14 |
#define | GX_FOG_ORTHO_REVEXP2 15 |
#define | GX_FOG_PERSP_EXP 4 |
#define | GX_FOG_PERSP_EXP2 5 |
#define | GX_FOG_PERSP_LIN 2 |
#define | GX_FOG_PERSP_REVEXP 6 |
#define | GX_FOG_PERSP_REVEXP2 7 |
#define | GX_FOG_REVEXP GX_FOG_PERSP_REVEXP |
#define | GX_FOG_REVEXP2 GX_FOG_PERSP_REVEXP2 |
#define | GX_GEQUAL 6 |
#define | GX_GM_1_0 0 |
#define | GX_GM_1_7 1 |
#define | GX_GM_2_2 2 |
#define | GX_GREATER 4 |
#define | GX_IDENTITY 60 |
#define | GX_INDEX16 3 |
#define | GX_INDEX8 2 |
#define | GX_INDTEXSTAGE0 0 |
#define | GX_INDTEXSTAGE1 1 |
#define | GX_INDTEXSTAGE2 2 |
#define | GX_INDTEXSTAGE3 3 |
#define | GX_InitLightDirv(lo, vec) (GX_InitLightDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2))) |
Sets the direction of a light in the light object using a vector structure. More... | |
#define | GX_InitLightPosv(lo, vec) (GX_InitLightPos((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2))) |
Sets the position of the light in the light object using a vector structure. More... | |
#define | GX_InitLightShininess(lobj, shininess) |
Sets shininess of a per-vertex specular light. More... | |
#define | GX_InitSpecularDirHAv(lo, vec0, vec1) |
Sets the direction and half-angle vector of a specular light in the light object using a vector. More... | |
#define | GX_InitSpecularDirv(lo, vec) (GX_InitSpecularDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2))) |
Sets the direction of a specular light in the light object using a vector. More... | |
#define | GX_ITB_NONE 0 |
#define | GX_ITB_S 1 |
#define | GX_ITB_ST 3 |
#define | GX_ITB_STU 7 |
#define | GX_ITB_SU 5 |
#define | GX_ITB_T 2 |
#define | GX_ITB_TU 6 |
#define | GX_ITB_U 4 |
#define | GX_ITBA_OFF 0 |
#define | GX_ITBA_S 1 |
#define | GX_ITBA_T 2 |
#define | GX_ITBA_U 3 |
#define | GX_ITF_3 3 |
#define | GX_ITF_4 2 |
#define | GX_ITF_5 1 |
#define | GX_ITF_8 0 |
#define | GX_ITM_0 1 |
#define | GX_ITM_1 2 |
#define | GX_ITM_2 3 |
#define | GX_ITM_OFF 0 |
#define | GX_ITM_S0 5 |
#define | GX_ITM_S1 6 |
#define | GX_ITM_S2 7 |
#define | GX_ITM_T0 9 |
#define | GX_ITM_T1 10 |
#define | GX_ITM_T2 11 |
#define | GX_ITS_1 0 |
#define | GX_ITS_128 7 |
#define | GX_ITS_16 4 |
#define | GX_ITS_2 1 |
#define | GX_ITS_256 8 |
#define | GX_ITS_32 5 |
#define | GX_ITS_4 2 |
#define | GX_ITS_64 6 |
#define | GX_ITS_8 3 |
#define | GX_ITW_0 6 |
#define | GX_ITW_128 2 |
#define | GX_ITW_16 5 |
#define | GX_ITW_256 1 |
#define | GX_ITW_32 4 |
#define | GX_ITW_64 3 |
#define | GX_ITW_OFF 0 |
#define | GX_KCOLOR0 0 |
#define | GX_KCOLOR1 1 |
#define | GX_KCOLOR2 2 |
#define | GX_KCOLOR3 3 |
#define | GX_KCOLOR_MAX 4 |
#define | GX_LEQUAL 3 |
#define | GX_LESS 1 |
#define | GX_LIGHT0 0x001 |
#define | GX_LIGHT1 0x002 |
#define | GX_LIGHT2 0x004 |
#define | GX_LIGHT3 0x008 |
#define | GX_LIGHT4 0x010 |
#define | GX_LIGHT5 0x020 |
#define | GX_LIGHT6 0x040 |
#define | GX_LIGHT7 0x080 |
#define | GX_LIGHTARRAY 24 |
#define | GX_LIGHTNULL 0x000 |
#define | GX_LIN_MIP_LIN 5 |
#define | GX_LIN_MIP_NEAR 3 |
#define | GX_LINEAR 1 |
#define | GX_LINES 0xA8 |
#define | GX_LINESTRIP 0xB0 |
#define | GX_LO_AND 1 |
#define | GX_LO_CLEAR 0 |
#define | GX_LO_COPY 3 |
#define | GX_LO_EQUIV 9 |
#define | GX_LO_INV 10 |
#define | GX_LO_INVAND 4 |
#define | GX_LO_INVCOPY 12 |
#define | GX_LO_INVOR 13 |
#define | GX_LO_NAND 14 |
#define | GX_LO_NOOP 5 |
#define | GX_LO_NOR 8 |
#define | GX_LO_OR 7 |
#define | GX_LO_REVAND 2 |
#define | GX_LO_REVOR 11 |
#define | GX_LO_SET 15 |
#define | GX_LO_XOR 6 |
#define | GX_MAX_ALPHAOP 4 |
#define | GX_MAX_ANISOTROPY 3 |
#define | GX_MAX_BLENDMODE 4 |
#define | GX_MAX_INDTEXSTAGE 4 |
#define | GX_MAX_ITBALPHA 4 |
#define | GX_MAX_ITBIAS 8 |
#define | GX_MAX_ITFORMAT 4 |
#define | GX_MAX_ITSCALE 9 |
#define | GX_MAX_ITWRAP 7 |
#define | GX_MAX_TEVBIAS 3 |
#define | GX_MAX_TEVCLAMPMODE 4 |
#define | GX_MAX_TEVREG 4 |
#define | GX_MAX_TEVSCALE 4 |
#define | GX_MAX_TEVSTAGE 16 |
#define | GX_MAX_TEVSWAP 4 |
#define | GX_MAX_TEXMAP 8 |
#define | GX_MAX_TEXOFFSET 6 |
#define | GX_MAX_VTXATTRFMT GX_VA_MAXATTR |
#define | GX_MAX_VTXATTRFMT_LISTSIZE (GX_VA_MAXATTR+1) |
#define | GX_MAX_VTXDESC GX_VA_MAXATTR |
#define | GX_MAX_VTXDESC_LISTSIZE (GX_VA_MAXATTR+1) |
#define | GX_MAX_Z24 0x00ffffff |
#define | GX_MAX_ZTEXOP 3 |
#define | GX_MAXCOORD 0x8 |
#define | GX_MAXLIGHT 0x100 |
#define | GX_MAXTEXWRAPMODE 3 |
#define | GX_MAXVTXFMT 8 |
#define | GX_MIRROR 2 |
#define | GX_MODULATE 0 |
#define | GX_MT_DL_SAVE_CTX 2 |
#define | GX_MT_NULL 0 |
#define | GX_MT_XF_FLUSH 1 |
#define | GX_MTX2x4 1 |
#define | GX_MTX3x4 0 |
#define | GX_NEAR 0 |
#define | GX_NEAR_MIP_LIN 4 |
#define | GX_NEAR_MIP_NEAR 2 |
#define | GX_NEQUAL 5 |
#define | GX_NEVER 0 |
#define | GX_NONE 0 |
#define | GX_NRM_NBT 1 |
#define | GX_NRM_NBT3 2 |
#define | GX_NRM_XYZ 0 |
#define | GX_NRMMTXARRAY 22 |
#define | GX_ORTHOGRAPHIC 1 |
#define | GX_PASSCLR 4 |
#define | GX_PERF0_AVG_QUAD_CNT 33 |
#define | GX_PERF0_CLIP_CLKS 2 |
#define | GX_PERF0_CLIP_RATIO 10 |
#define | GX_PERF0_CLIP_VTX 1 |
#define | GX_PERF0_CLOCKS 34 |
#define | GX_PERF0_NONE 35 |
#define | GX_PERF0_QUAD_0CVG 27 |
#define | GX_PERF0_QUAD_1CVG 29 |
#define | GX_PERF0_QUAD_2CVG 30 |
#define | GX_PERF0_QUAD_3CVG 31 |
#define | GX_PERF0_QUAD_4CVG 32 |
#define | GX_PERF0_QUAD_NON0CVG 28 |
#define | GX_PERF0_TRIANGLES 11 |
#define | GX_PERF0_TRIANGLES_0CLR 24 |
#define | GX_PERF0_TRIANGLES_0TEX 15 |
#define | GX_PERF0_TRIANGLES_1CLR 25 |
#define | GX_PERF0_TRIANGLES_1TEX 16 |
#define | GX_PERF0_TRIANGLES_2CLR 26 |
#define | GX_PERF0_TRIANGLES_2TEX 17 |
#define | GX_PERF0_TRIANGLES_3TEX 18 |
#define | GX_PERF0_TRIANGLES_4TEX 19 |
#define | GX_PERF0_TRIANGLES_5TEX 20 |
#define | GX_PERF0_TRIANGLES_6TEX 21 |
#define | GX_PERF0_TRIANGLES_7TEX 22 |
#define | GX_PERF0_TRIANGLES_8TEX 23 |
#define | GX_PERF0_TRIANGLES_CULLED 12 |
#define | GX_PERF0_TRIANGLES_PASSED 13 |
#define | GX_PERF0_TRIANGLES_SCISSORED 14 |
#define | GX_PERF0_VERTICES 0 |
#define | GX_PERF0_XF_BOT_CLKS 7 |
#define | GX_PERF0_XF_LIT_CLKS 6 |
#define | GX_PERF0_XF_REGLD_CLKS 8 |
#define | GX_PERF0_XF_REGRD_CLKS 9 |
#define | GX_PERF0_XF_WAIT_IN 3 |
#define | GX_PERF0_XF_WAIT_OUT 4 |
#define | GX_PERF0_XF_XFRM_CLKS 5 |
#define | GX_PERF1_CALL_REQ 18 |
#define | GX_PERF1_CLOCKS 21 |
#define | GX_PERF1_CP_ALL_REQ 20 |
#define | GX_PERF1_FIFO_REQ 17 |
#define | GX_PERF1_NONE 22 |
#define | GX_PERF1_TC_CHECK1_2 4 |
#define | GX_PERF1_TC_CHECK3_4 5 |
#define | GX_PERF1_TC_CHECK5_6 6 |
#define | GX_PERF1_TC_CHECK7_8 7 |
#define | GX_PERF1_TC_MISS 8 |
#define | GX_PERF1_TEXELS 0 |
#define | GX_PERF1_TX_IDLE 1 |
#define | GX_PERF1_TX_MEMSTALL 3 |
#define | GX_PERF1_TX_REGS 2 |
#define | GX_PERF1_VC_ALL_STALLS 15 |
#define | GX_PERF1_VC_ELEMQ_FULL 9 |
#define | GX_PERF1_VC_MEMREQ_FULL 11 |
#define | GX_PERF1_VC_MISS_REQ 19 |
#define | GX_PERF1_VC_MISSQ_FULL 10 |
#define | GX_PERF1_VC_MISSREP_FULL 13 |
#define | GX_PERF1_VC_STATUS7 12 |
#define | GX_PERF1_VC_STREAMBUF_LOW 14 |
#define | GX_PERF1_VERTICES 16 |
#define | GX_PERSPECTIVE 0 |
#define | GX_PF_RGB565_Z16 2 |
#define | GX_PF_RGB8_Z24 0 |
#define | GX_PF_RGBA6_Z24 1 |
#define | GX_PF_U8 5 |
#define | GX_PF_V8 6 |
#define | GX_PF_Y8 4 |
#define | GX_PF_YUV420 7 |
#define | GX_PF_Z24 3 |
#define | GX_PNMTX0 0 |
#define | GX_PNMTX1 3 |
#define | GX_PNMTX2 6 |
#define | GX_PNMTX3 9 |
#define | GX_PNMTX4 12 |
#define | GX_PNMTX5 15 |
#define | GX_PNMTX6 18 |
#define | GX_PNMTX7 21 |
#define | GX_PNMTX8 24 |
#define | GX_PNMTX9 27 |
#define | GX_POINTS 0xB8 |
#define | GX_POS_XY 0 |
#define | GX_POS_XYZ 1 |
#define | GX_POSMTXARRAY 21 |
#define | GX_QUADS 0x80 |
#define | GX_READ_00 0 |
#define | GX_READ_FF 1 |
#define | GX_READ_NONE 2 |
#define | GX_REPEAT 1 |
#define | GX_REPLACE 3 |
#define | GX_RGB565 0 |
#define | GX_RGB8 1 |
#define | GX_RGBA4 3 |
#define | GX_RGBA6 4 |
#define | GX_RGBA8 5 |
#define | GX_RGBX8 2 |
#define | GX_S16 3 |
#define | GX_S8 1 |
#define | GX_SP_COS 2 |
#define | GX_SP_COS2 3 |
#define | GX_SP_FLAT 1 |
#define | GX_SP_OFF 0 |
#define | GX_SP_RING1 5 |
#define | GX_SP_RING2 6 |
#define | GX_SP_SHARP 4 |
#define | GX_SRC_REG 0 |
#define | GX_SRC_VTX 1 |
#define | GX_TB_ADDHALF 1 |
#define | GX_TB_SUBHALF 2 |
#define | GX_TB_ZERO 0 |
#define | GX_TC_EQ 2 |
#define | GX_TC_GE 1 |
#define | GX_TC_LE 3 |
#define | GX_TC_LINEAR 0 |
#define | GX_TEV_ADD 0 |
#define | GX_TEV_COMP_A8_EQ GX_TEV_COMP_RGB8_EQ |
#define | GX_TEV_COMP_A8_GT GX_TEV_COMP_RGB8_GT |
#define | GX_TEV_COMP_BGR24_EQ 13 |
#define | GX_TEV_COMP_BGR24_GT 12 |
#define | GX_TEV_COMP_GR16_EQ 11 |
#define | GX_TEV_COMP_GR16_GT 10 |
#define | GX_TEV_COMP_R8_EQ 9 |
#define | GX_TEV_COMP_R8_GT 8 |
#define | GX_TEV_COMP_RGB8_EQ 15 |
#define | GX_TEV_COMP_RGB8_GT 14 |
#define | GX_TEV_KASEL_1 0x00 |
#define | GX_TEV_KASEL_1_2 0x04 |
#define | GX_TEV_KASEL_1_4 0x06 |
#define | GX_TEV_KASEL_1_8 0x07 |
#define | GX_TEV_KASEL_3_4 0x02 |
#define | GX_TEV_KASEL_3_8 0x05 |
#define | GX_TEV_KASEL_5_8 0x03 |
#define | GX_TEV_KASEL_7_8 0x01 |
#define | GX_TEV_KASEL_K0_A 0x1C |
#define | GX_TEV_KASEL_K0_B 0x18 |
#define | GX_TEV_KASEL_K0_G 0x14 |
#define | GX_TEV_KASEL_K0_R 0x10 |
#define | GX_TEV_KASEL_K1_A 0x1D |
#define | GX_TEV_KASEL_K1_B 0x19 |
#define | GX_TEV_KASEL_K1_G 0x15 |
#define | GX_TEV_KASEL_K1_R 0x11 |
#define | GX_TEV_KASEL_K2_A 0x1E |
#define | GX_TEV_KASEL_K2_B 0x1A |
#define | GX_TEV_KASEL_K2_G 0x16 |
#define | GX_TEV_KASEL_K2_R 0x12 |
#define | GX_TEV_KASEL_K3_A 0x1F |
#define | GX_TEV_KASEL_K3_B 0x1B |
#define | GX_TEV_KASEL_K3_G 0x17 |
#define | GX_TEV_KASEL_K3_R 0x13 |
#define | GX_TEV_KCSEL_1 0x00 |
#define | GX_TEV_KCSEL_1_2 0x04 |
#define | GX_TEV_KCSEL_1_4 0x06 |
#define | GX_TEV_KCSEL_1_8 0x07 |
#define | GX_TEV_KCSEL_3_4 0x02 |
#define | GX_TEV_KCSEL_3_8 0x05 |
#define | GX_TEV_KCSEL_5_8 0x03 |
#define | GX_TEV_KCSEL_7_8 0x01 |
#define | GX_TEV_KCSEL_K0 0x0C |
#define | GX_TEV_KCSEL_K0_A 0x1C |
#define | GX_TEV_KCSEL_K0_B 0x18 |
#define | GX_TEV_KCSEL_K0_G 0x14 |
#define | GX_TEV_KCSEL_K0_R 0x10 |
#define | GX_TEV_KCSEL_K1 0x0D |
#define | GX_TEV_KCSEL_K1_A 0x1D |
#define | GX_TEV_KCSEL_K1_B 0x19 |
#define | GX_TEV_KCSEL_K1_G 0x15 |
#define | GX_TEV_KCSEL_K1_R 0x11 |
#define | GX_TEV_KCSEL_K2 0x0E |
#define | GX_TEV_KCSEL_K2_A 0x1E |
#define | GX_TEV_KCSEL_K2_B 0x1A |
#define | GX_TEV_KCSEL_K2_G 0x16 |
#define | GX_TEV_KCSEL_K2_R 0x12 |
#define | GX_TEV_KCSEL_K3 0x0F |
#define | GX_TEV_KCSEL_K3_A 0x1F |
#define | GX_TEV_KCSEL_K3_B 0x1B |
#define | GX_TEV_KCSEL_K3_G 0x17 |
#define | GX_TEV_KCSEL_K3_R 0x13 |
#define | GX_TEV_SUB 1 |
#define | GX_TEV_SWAP0 0 |
#define | GX_TEV_SWAP1 1 |
#define | GX_TEV_SWAP2 2 |
#define | GX_TEV_SWAP3 3 |
#define | GX_TEVPREV 0 |
#define | GX_TEVREG0 1 |
#define | GX_TEVREG1 2 |
#define | GX_TEVREG2 3 |
#define | GX_TEVSTAGE0 0 |
#define | GX_TEVSTAGE1 1 |
#define | GX_TEVSTAGE10 10 |
#define | GX_TEVSTAGE11 11 |
#define | GX_TEVSTAGE12 12 |
#define | GX_TEVSTAGE13 13 |
#define | GX_TEVSTAGE14 14 |
#define | GX_TEVSTAGE15 15 |
#define | GX_TEVSTAGE2 2 |
#define | GX_TEVSTAGE3 3 |
#define | GX_TEVSTAGE4 4 |
#define | GX_TEVSTAGE5 5 |
#define | GX_TEVSTAGE6 6 |
#define | GX_TEVSTAGE7 7 |
#define | GX_TEVSTAGE8 8 |
#define | GX_TEVSTAGE9 9 |
#define | GX_TEX_S 0 |
#define | GX_TEX_ST 1 |
#define | GX_TEXCACHE_128K 1 |
#define | GX_TEXCACHE_32K 0 |
#define | GX_TEXCACHE_512K 2 |
#define | GX_TEXCACHE_NONE 3 |
#define | GX_TEXCOORD0 0x0 |
#define | GX_TEXCOORD1 0x1 |
#define | GX_TEXCOORD2 0x2 |
#define | GX_TEXCOORD3 0x3 |
#define | GX_TEXCOORD4 0x4 |
#define | GX_TEXCOORD5 0x5 |
#define | GX_TEXCOORD6 0x6 |
#define | GX_TEXCOORD7 0x7 |
#define | GX_TEXCOORDNULL 0xff |
#define | GX_TEXMAP0 0 |
#define | GX_TEXMAP1 1 |
#define | GX_TEXMAP2 2 |
#define | GX_TEXMAP3 3 |
#define | GX_TEXMAP4 4 |
#define | GX_TEXMAP5 5 |
#define | GX_TEXMAP6 6 |
#define | GX_TEXMAP7 7 |
#define | GX_TEXMAP_DISABLE 0x100 |
#define | GX_TEXMAP_NULL 0xff |
#define | GX_TEXMTX0 30 |
#define | GX_TEXMTX1 33 |
#define | GX_TEXMTX2 36 |
#define | GX_TEXMTX3 39 |
#define | GX_TEXMTX4 42 |
#define | GX_TEXMTX5 45 |
#define | GX_TEXMTX6 48 |
#define | GX_TEXMTX7 51 |
#define | GX_TEXMTX8 54 |
#define | GX_TEXMTX9 57 |
#define | GX_TEXMTXARRAY 23 |
#define | GX_TF_A8 GX_CTF_A8 |
#define | GX_TF_CI14 0xa |
#define | GX_TF_CI4 0x8 |
#define | GX_TF_CI8 0x9 |
#define | GX_TF_CMPR 0xE |
#define | GX_TF_I4 0x0 |
#define | GX_TF_I8 0x1 |
#define | GX_TF_IA4 0x2 |
#define | GX_TF_IA8 0x3 |
#define | GX_TF_RGB565 0x4 |
#define | GX_TF_RGB5A3 0x5 |
#define | GX_TF_RGBA8 0x6 |
#define | GX_TF_Z16 (0x3|_GX_TF_ZTF) |
#define | GX_TF_Z24X8 (0x6|_GX_TF_ZTF) |
#define | GX_TF_Z8 (0x1|_GX_TF_ZTF) |
#define | GX_TG_BINRM 2 |
#define | GX_TG_BUMP0 2 |
#define | GX_TG_BUMP1 3 |
#define | GX_TG_BUMP2 4 |
#define | GX_TG_BUMP3 5 |
#define | GX_TG_BUMP4 6 |
#define | GX_TG_BUMP5 7 |
#define | GX_TG_BUMP6 8 |
#define | GX_TG_BUMP7 9 |
#define | GX_TG_COLOR0 19 |
#define | GX_TG_COLOR1 20 |
#define | GX_TG_MTX2x4 1 |
#define | GX_TG_MTX3x4 0 |
#define | GX_TG_NRM 1 |
#define | GX_TG_POS 0 |
#define | GX_TG_SRTG 10 |
#define | GX_TG_TANGENT 3 |
#define | GX_TG_TEX0 4 |
#define | GX_TG_TEX1 5 |
#define | GX_TG_TEX2 6 |
#define | GX_TG_TEX3 7 |
#define | GX_TG_TEX4 8 |
#define | GX_TG_TEX5 9 |
#define | GX_TG_TEX6 10 |
#define | GX_TG_TEX7 11 |
#define | GX_TG_TEXCOORD0 12 |
#define | GX_TG_TEXCOORD1 13 |
#define | GX_TG_TEXCOORD2 14 |
#define | GX_TG_TEXCOORD3 15 |
#define | GX_TG_TEXCOORD4 16 |
#define | GX_TG_TEXCOORD5 17 |
#define | GX_TG_TEXCOORD6 18 |
#define | GX_TL_IA8 0x00 |
#define | GX_TL_RGB565 0x01 |
#define | GX_TL_RGB5A3 0x02 |
#define | GX_TLUT0 0 |
#define | GX_TLUT1 1 |
#define | GX_TLUT10 10 |
#define | GX_TLUT11 11 |
#define | GX_TLUT12 12 |
#define | GX_TLUT13 13 |
#define | GX_TLUT14 14 |
#define | GX_TLUT15 15 |
#define | GX_TLUT2 2 |
#define | GX_TLUT3 3 |
#define | GX_TLUT4 4 |
#define | GX_TLUT5 5 |
#define | GX_TLUT6 6 |
#define | GX_TLUT7 7 |
#define | GX_TLUT8 8 |
#define | GX_TLUT9 9 |
#define | GX_TLUT_128 8 |
#define | GX_TLUT_16 1 |
#define | GX_TLUT_16K 1024 |
#define | GX_TLUT_1K 64 |
#define | GX_TLUT_256 16 |
#define | GX_TLUT_2K 128 |
#define | GX_TLUT_32 2 |
#define | GX_TLUT_4K 256 |
#define | GX_TLUT_512 32 |
#define | GX_TLUT_64 4 |
#define | GX_TLUT_8K 512 |
#define | GX_TO_EIGHTH 2 |
#define | GX_TO_FOURTH 3 |
#define | GX_TO_HALF 4 |
#define | GX_TO_ONE 5 |
#define | GX_TO_SIXTEENTH 1 |
#define | GX_TO_ZERO 0 |
#define | GX_TRIANGLEFAN 0xA0 |
#define | GX_TRIANGLES 0x90 |
#define | GX_TRIANGLESTRIP 0x98 |
#define | GX_TRUE 1 |
#define | GX_U16 2 |
#define | GX_U8 0 |
#define | GX_VA_CLR0 11 |
#define | GX_VA_CLR1 12 |
#define | GX_VA_MAXATTR 26 |
#define | GX_VA_NBT 25 |
#define | GX_VA_NRM 10 |
#define | GX_VA_NULL 0xff |
#define | GX_VA_POS 9 |
#define | GX_VA_PTNMTXIDX 0 |
#define | GX_VA_TEX0 13 |
#define | GX_VA_TEX0MTXIDX 1 |
#define | GX_VA_TEX1 14 |
#define | GX_VA_TEX1MTXIDX 2 |
#define | GX_VA_TEX2 15 |
#define | GX_VA_TEX2MTXIDX 3 |
#define | GX_VA_TEX3 16 |
#define | GX_VA_TEX3MTXIDX 4 |
#define | GX_VA_TEX4 17 |
#define | GX_VA_TEX4MTXIDX 5 |
#define | GX_VA_TEX5 18 |
#define | GX_VA_TEX5MTXIDX 6 |
#define | GX_VA_TEX6 19 |
#define | GX_VA_TEX6MTXIDX 7 |
#define | GX_VA_TEX7 20 |
#define | GX_VA_TEX7MTXIDX 8 |
#define | GX_VC_ALL 15 |
#define | GX_VC_CLR0 2 |
#define | GX_VC_CLR1 3 |
#define | GX_VC_NRM 1 |
#define | GX_VC_POS 0 |
#define | GX_VC_TEX0 4 |
#define | GX_VC_TEX1 5 |
#define | GX_VC_TEX2 6 |
#define | GX_VC_TEX3 7 |
#define | GX_VC_TEX4 8 |
#define | GX_VC_TEX5 9 |
#define | GX_VC_TEX6 10 |
#define | GX_VC_TEX7 11 |
#define | GX_VTXFMT0 0 |
#define | GX_VTXFMT1 1 |
#define | GX_VTXFMT2 2 |
#define | GX_VTXFMT3 3 |
#define | GX_VTXFMT4 4 |
#define | GX_VTXFMT5 5 |
#define | GX_VTXFMT6 6 |
#define | GX_VTXFMT7 7 |
#define | GX_XF_FLUSH_NONE 0 |
#define | GX_XF_FLUSH_SAFE 1 |
#define | GX_ZC_FAR 3 |
#define | GX_ZC_LINEAR 0 |
#define | GX_ZC_MID 2 |
#define | GX_ZC_NEAR 1 |
#define | GX_ZT_ADD 1 |
#define | GX_ZT_DISABLE 0 |
#define | GX_ZT_REPLACE 2 |
Typedefs | |
typedef void(* | GXBreakPtCallback) (void) |
function pointer typedef for the GP breakpoint-token callback | |
typedef struct _gx_color | GXColor |
Structure used to pass colors to some GX functions. | |
typedef struct _gx_colors10 | GXColorS10 |
Structure used to pass signed 10-bit colors to some GX functions. | |
typedef void(* | GXDrawDoneCallback) (void) |
function pointer typedef for the GP drawdone-token callback | |
typedef void(* | GXDrawSyncCallback) (u16 token) |
function pointer typedef for the drawsync-token callback More... | |
typedef struct _gx_litobj | GXLightObj |
Object containing information on a light. More... | |
typedef struct _gx_texobj | GXTexObj |
Object containing information about a texture. More... | |
typedef struct _gx_texreg | GXTexRegion |
Object containing information on a texture cache region. More... | |
typedef GXTexRegion *(* | GXTexRegionCallback) (GXTexObj *obj, u8 mapid) |
function pointer typedef for the texture region callback More... | |
typedef struct _gx_tlutobj | GXTlutObj |
Object containing information on a TLUT. More... | |
typedef struct _gx_tlutreg | GXTlutRegion |
Object containing information on a TLUT cache region. More... | |
typedef GXTlutRegion *(* | GXTlutRegionCallback) (u32 tlut_name) |
function pointer typedef for the TLUT region callback More... | |
typedef struct _vtx | Vtx |
typedef union _wgpipe | WGPipe |
Functions | |
void | GX_AbortFrame (void) |
Aborts the current frame. More... | |
void | GX_AdjustForOverscan (GXRModeObj *rmin, GXRModeObj *rmout, u16 hor, u16 ver) |
Takes a given render mode and returns a version that is reduced in size to account for overscan. More... | |
void | GX_Begin (u8 primitve, u8 vtxfmt, u16 vtxcnt) |
Begins drawing of a graphics primitive. More... | |
void | GX_BeginDispList (void *list, u32 size) |
Begins a display list and disables writes to the FIFO currently attached to the CPU. More... | |
void | GX_CallDispList (void *list, u32 nbytes) |
Causes the GP to execute graphics commands from the display list instead of from the GP FIFO. More... | |
void | GX_ClearBoundingBox (void) |
Clears the bounding box values before a new image is drawn. More... | |
void | GX_ClearGPMetric (void) |
Clears the two virtual GP performance counters to zero. More... | |
void | GX_ClearVCacheMetric (void) |
Clears the Vertex Cache performance counter. More... | |
void | GX_ClearVtxDesc (void) |
Clears all vertex attributes of the current vertex descriptor to GX_NONE. More... | |
void | GX_CopyDisp (void *dest, u8 clear) |
Copies the embedded framebuffer (EFB) to the external framebuffer(XFB) in main memory. More... | |
void | GX_CopyTex (void *dest, u8 clear) |
Copies the embedded framebuffer (EFB) to the texture image buffer dest in main memory. More... | |
void | GX_DisableBreakPt (void) |
Allows reads from the FIFO currently attached to the Graphics Processor (GP) to resume. More... | |
void | GX_DrawDone (void) |
Sends a DrawDone command to the GP and stalls until its subsequent execution. More... | |
void | GX_EnableBreakPt (void *break_pt) |
Sets a breakpoint that causes the GP to halt when encountered. More... | |
void | GX_EnableTexOffsets (u8 coord, u8 line_enable, u8 point_enable) |
Enables a special texture offset feature for points and lines. More... | |
u32 | GX_EndDispList (void) |
Ends a display list and resumes writing graphics commands to the CPU FIFO. More... | |
void | GX_Flush (void) |
Flushes all commands to the GP. More... | |
void | GX_GetCPUFifo (GXFifoObj *fifo) |
Copies the information from the currently attached CPU FIFO into fifo. More... | |
lwp_t | GX_GetCurrentGXThread (void) |
Returns the current GX thread. More... | |
u16 | GX_GetDrawSync (void) |
Returns the value of the token register, which is written using the GX_SetDrawSync() function. More... | |
void * | GX_GetFifoBase (const GXFifoObj *fifo) |
Get the base address for a given fifo. More... | |
u32 | GX_GetFifoCount (const GXFifoObj *fifo) |
Returns number of cache lines in the FIFO. More... | |
void | GX_GetFifoPtrs (const GXFifoObj *fifo, void **rd_ptr, void **wt_ptr) |
Returns the current value of the Graphics FIFO read and write pointers. More... | |
u32 | GX_GetFifoSize (const GXFifoObj *fifo) |
Get the size of a given fifo. More... | |
u8 | GX_GetFifoWrap (const GXFifoObj *fifo) |
Returns a non-zero value if the write pointer has passed the TOP of the FIFO. More... | |
void | GX_GetGPFifo (GXFifoObj *fifo) |
Copies the information from the currently attached GP FIFO info fifo. More... | |
void | GX_GetGPStatus (u8 *overhi, u8 *underlow, u8 *readIdle, u8 *cmdIdle, u8 *brkpt) |
Reads the current status of the GP. More... | |
u32 | GX_GetOverflowCount (void) |
u32 | GX_GetTexBufferSize (u16 wd, u16 ht, u32 fmt, u8 mipmap, u8 maxlod) |
Returns the amount of memory in bytes needed to store a texture of the given size and fmt. More... | |
void | GX_GetTexObjAll (const GXTexObj *obj, void **image_ptr, u16 *width, u16 *height, u8 *format, u8 *wrap_s, u8 *wrap_t, u8 *mipmap) |
Returns the parameters described by a texture object. Texture objects are used to describe all the parameters associated with a texture, including size, format, wrap modes, filter modes, etc. Texture objects are initialized using either GX_InitTexObj() or, for color index format textures, GX_InitTexObjCI(). More... | |
void * | GX_GetTexObjData (const GXTexObj *obj) |
Used to get a pointer to texture data from the GXTexObj structure. More... | |
void | GX_GetTexObjFilterMode (const GXTexObj *obj, u8 *minfilt, u8 *magfilt) |
Returns the filter mode for the texture object obj. More... | |
u32 | GX_GetTexObjFmt (const GXTexObj *obj) |
Returns the texture format described by texture object obj. More... | |
u16 | GX_GetTexObjHeight (const GXTexObj *obj) |
Returns the texture height described by texture object obj. More... | |
void | GX_GetTexObjLOD (const GXTexObj *obj, f32 *minlod, f32 *maxlod) |
Returns the min and max LOD values for the texture object obj. More... | |
u32 | GX_GetTexObjMipMap (const GXTexObj *obj) |
Returns the texture mipmap enable described by texture object obj. More... | |
void * | GX_GetTexObjUserData (const GXTexObj *obj) |
Used to get a pointer to user data from the GXTexObj structure. More... | |
u16 | GX_GetTexObjWidth (const GXTexObj *obj) |
Returns the texture width described by texture object obj. More... | |
u8 | GX_GetTexObjWrapS (const GXTexObj *obj) |
Returns the texture wrap s mode described by texture object obj. More... | |
u8 | GX_GetTexObjWrapT (const GXTexObj *obj) |
Returns the texture wrap t mode described by texture object obj. More... | |
void | GX_GetVtxDescv (GXVtxDesc *attr_list) |
Gets the type of multiple attributes. More... | |
f32 | GX_GetYScaleFactor (u16 efbHeight, u16 xfbHeight) |
Calculates an appropriate Y scale factor value for GX_SetDispCopyYScale() based on the height of the EFB and the height of the XFB. More... | |
GXFifoObj * | GX_Init (void *base, u32 size) |
Initializes the graphics processor to its initial state. More... | |
void | GX_InitFifoBase (GXFifoObj *fifo, void *base, u32 size) |
Describes the area of main memory that will be used for this fifo. More... | |
void | GX_InitFifoLimits (GXFifoObj *fifo, u32 hiwatermark, u32 lowatermark) |
Sets the high and low water mark for the fifo. More... | |
void | GX_InitFifoPtrs (GXFifoObj *fifo, void *rd_ptr, void *wt_ptr) |
Sets the fifo read and write pointers. More... | |
void | GX_InitFogAdjTable (GXFogAdjTbl *table, u16 width, f32 projmtx[4][4]) |
Generates the standard range adjustment table and puts the results into table. More... | |
void | GX_InitLightAttn (GXLightObj *lit_obj, f32 a0, f32 a1, f32 a2, f32 k0, f32 k1, f32 k2) |
Sts coefficients used in the lighting attenuation calculation in a given light object. More... | |
void | GX_InitLightAttnA (GXLightObj *lit_obj, f32 a0, f32 a1, f32 a2) |
Sets coefficients used in the lighting angle attenuation calculation in a given light object. More... | |
void | GX_InitLightAttnK (GXLightObj *lit_obj, f32 k0, f32 k1, f32 k2) |
Sets coefficients used in the lighting distance attenuation calculation in a given light object. More... | |
void | GX_InitLightColor (GXLightObj *lit_obj, GXColor col) |
Sets the color of the light in the light object. More... | |
void | GX_InitLightDir (GXLightObj *lit_obj, f32 nx, f32 ny, f32 nz) |
Sets the direction of a light in the light object. More... | |
void | GX_InitLightDistAttn (GXLightObj *lit_obj, f32 ref_dist, f32 ref_brite, u8 dist_fn) |
Sets coefficients for distance attenuation in a light object. More... | |
void | GX_InitLightPos (GXLightObj *lit_obj, f32 x, f32 y, f32 z) |
Sets the position of the light in the light object. More... | |
void | GX_InitLightSpot (GXLightObj *lit_obj, f32 cut_off, u8 spotfn) |
Sets coefficients for angular (spotlight) attenuation in light object. More... | |
void | GX_InitSpecularDir (GXLightObj *lit_obj, f32 nx, f32 ny, f32 nz) |
Sets the direction of a specular light in the light object. More... | |
void | GX_InitSpecularDirHA (GXLightObj *lit_obj, f32 nx, f32 ny, f32 nz, f32 hx, f32 hy, f32 hz) |
Sets the direction and half-angle vector of a specular light in the light object. More... | |
void | GX_InitTexCacheRegion (GXTexRegion *region, u8 is32bmipmap, u32 tmem_even, u8 size_even, u32 tmem_odd, u8 size_odd) |
Initializes a texture memory (TMEM) region object for cache. More... | |
void | GX_InitTexObj (GXTexObj *obj, void *img_ptr, u16 wd, u16 ht, u8 fmt, u8 wrap_s, u8 wrap_t, u8 mipmap) |
Used to initialize or change a texture object for non-color index textures. More... | |
void | GX_InitTexObjBiasClamp (GXTexObj *obj, u8 biasclamp) |
Enables bias clamping for texture LOD. More... | |
void | GX_InitTexObjCI (GXTexObj *obj, void *img_ptr, u16 wd, u16 ht, u8 fmt, u8 wrap_s, u8 wrap_t, u8 mipmap, u32 tlut_name) |
Used to initialize or change a texture object when the texture is color index format. More... | |
void | GX_InitTexObjData (GXTexObj *obj, void *img_ptr) |
Allows one to modify the image data pointer for an existing texture object. More... | |
void | GX_InitTexObjEdgeLOD (GXTexObj *obj, u8 edgelod) |
Changes LOD computing mode. More... | |
void | GX_InitTexObjFilterMode (GXTexObj *obj, u8 minfilt, u8 magfilt) |
Sets the filter mode for a texture. More... | |
void | GX_InitTexObjLOD (GXTexObj *obj, u8 minfilt, u8 magfilt, f32 minlod, f32 maxlod, f32 lodbias, u8 biasclamp, u8 edgelod, u8 maxaniso) |
Sets texture Level Of Detail (LOD) controls explicitly for a texture object. More... | |
void | GX_InitTexObjLODBias (GXTexObj *obj, f32 lodbias) |
Sets the LOD bias for a given texture. More... | |
void | GX_InitTexObjMaxAniso (GXTexObj *obj, u8 maxaniso) |
Sets the maximum anisotropic filter to use for a texture. More... | |
void | GX_InitTexObjMaxLOD (GXTexObj *obj, f32 maxlod) |
Sets the maximum LOD for a given texture. More... | |
void | GX_InitTexObjMinLOD (GXTexObj *obj, f32 minlod) |
Sets the minimum LOD for a given texture. More... | |
void | GX_InitTexObjTlut (GXTexObj *obj, u32 tlut_name) |
Allows one to modify the TLUT that is associated with an existing texture object. More... | |
void | GX_InitTexObjUserData (GXTexObj *obj, void *userdata) |
Used to set a pointer to user data in the GXTexObj structure. More... | |
void | GX_InitTexObjWrapMode (GXTexObj *obj, u8 wrap_s, u8 wrap_t) |
Allows one to modify the texture coordinate wrap modes for an existing texture object. More... | |
void | GX_InitTexPreloadRegion (GXTexRegion *region, u32 tmem_even, u32 size_even, u32 tmem_odd, u32 size_odd) |
Initializes a Texture Memory (TMEM) region object for preloading. More... | |
void | GX_InitTlutObj (GXTlutObj *obj, void *lut, u8 fmt, u16 entries) |
Initializes a Texture Look-Up Table (TLUT) object. More... | |
void | GX_InitTlutRegion (GXTlutRegion *region, u32 tmem_addr, u8 tlut_sz) |
Initializes a Texture Look-Up Table (TLUT) region object. More... | |
void | GX_InitXfRasMetric (void) |
Initialize the transformation unit (XF) rasterizer unit (RAS) to take performance measurements. More... | |
void | GX_InvalidateTexAll (void) |
Invalidates the current caches of the Texture Memory (TMEM). More... | |
void | GX_InvalidateTexRegion (GXTexRegion *region) |
Invalidates the texture cache in Texture Memory (TMEM) described by region. More... | |
void | GX_InvVtxCache (void) |
Invalidates the vertex cache. More... | |
void | GX_LoadLightObj (const GXLightObj *lit_obj, u8 lit_id) |
Loads a light object into a set of hardware registers associated with a Light ID. More... | |
void | GX_LoadLightObjIdx (u32 litobjidx, u8 litid) |
Instructs the GP to fetch the light object at ltobjindx from an array. More... | |
void | GX_LoadNrmMtxIdx3x3 (u16 mtxidx, u32 pnidx) |
Loads a 3x3 normal matrix into matrix memory at location pnidx from a 3x3 matrix located at index mtxidx from the array in main memory. More... | |
void | GX_LoadNrmMtxImm (Mtx mt, u32 pnidx) |
Used to load a normal transform matrix into matrix memory at location pnidx from the 4x3 matrix mt. More... | |
void | GX_LoadNrmMtxImm3x3 (Mtx33 mt, u32 pnidx) |
Used to load a normal transform matrix into matrix memory at location pnidx from the 3x3 matrix mt. More... | |
void | GX_LoadPosMtxIdx (u16 mtxidx, u32 pnidx) |
Loads a 3x4 modelview matrix at index mtxidx from the array in main memory. More... | |
void | GX_LoadPosMtxImm (Mtx mt, u32 pnidx) |
Used to load a 3x4 modelview matrix mt into matrix memory at location pnidx. More... | |
void | GX_LoadProjectionMtx (Mtx44 mt, u8 type) |
Sets the projection matrix. More... | |
void | GX_LoadTexMtxIdx (u16 mtxidx, u32 texidx, u8 type) |
Loads a texture matrix at index mtxidx from the array in main memory. More... | |
void | GX_LoadTexMtxImm (Mtx mt, u32 texidx, u8 type) |
Loads a texture matrix mt into the matrix memory at location texidx. More... | |
void | GX_LoadTexObj (GXTexObj *obj, u8 mapid) |
Loads the state describing a texture into one of eight hardware register sets. More... | |
void | GX_LoadTexObjPreloaded (GXTexObj *obj, GXTexRegion *region, u8 mapid) |
Loads the state describing a preloaded texture into one of eight hardware register sets. More... | |
void | GX_LoadTlut (GXTlutObj *obj, u32 tlut_name) |
Copies a Texture Look-Up Table (TLUT) from main memory to Texture Memory (TMEM). More... | |
void | GX_PeekARGB (u16 x, u16 y, GXColor *color) |
Allows the CPU to read a color value directly from the Embedded Frame Buffer (EFB) at position x,y. More... | |
void | GX_PeekZ (u16 x, u16 y, u32 *z) |
Allows the CPU to read a z value directly from the Embedded Frame Buffer (EFB) at position x,y. More... | |
void | GX_PixModeSync (void) |
Causes the GPU to wait for the pipe to flush. More... | |
void | GX_PokeAlphaMode (u8 func, u8 threshold) |
Sets a threshold which is compared to the alpha of pixels written to the Embedded Frame Buffer (EFB) using the GX_Poke*() functions. More... | |
void | GX_PokeAlphaRead (u8 mode) |
Determines what value of alpha will be read from the Embedded Frame Buffer (EFB). More... | |
void | GX_PokeAlphaUpdate (u8 update_enable) |
Enables or disables alpha-buffer updates for GX_Poke*() functions. More... | |
void | GX_PokeARGB (u16 x, u16 y, GXColor color) |
Allows the CPU to write color directly to the Embedded Frame Buffer (EFB) at position x,y. More... | |
void | GX_PokeBlendMode (u8 type, u8 src_fact, u8 dst_fact, u8 op) |
Determines how the source image, is blended with the current Embedded Frame Buffer (EFB). More... | |
void | GX_PokeColorUpdate (u8 update_enable) |
Enables or disables color-buffer updates when writing the Embedded Frame Buffer (EFB) using the GX_Poke*() functions. More... | |
void | GX_PokeDither (u8 dither) |
Enables dithering when writing the Embedded Frame Buffer (EFB) using GX_Poke*() functions. More... | |
void | GX_PokeDstAlpha (u8 enable, u8 a) |
Sets a constant alpha value for writing to the Embedded Frame Buffer (EFB). More... | |
void | GX_PokeZ (u16 x, u16 y, u32 z) |
Allows the CPU to write a z value directly to the Embedded Frame Buffer (EFB) at position x,y. More... | |
void | GX_PokeZMode (u8 comp_enable, u8 func, u8 update_enable) |
Sets the Z-buffer compare mode when writing the Embedded Frame Buffer (EFB). More... | |
void | GX_PreloadEntireTexture (GXTexObj *obj, GXTexRegion *region) |
Loads a given texture from DRAM into the texture memory. More... | |
void | GX_ReadBoundingBox (u16 *top, u16 *bottom, u16 *left, u16 *right) |
Returns the bounding box of pixel coordinates that are drawn in the Embedded Framebuffer (EFB). More... | |
u32 | GX_ReadClksPerVtx (void) |
void | GX_ReadGPMetric (u32 *cnt0, u32 *cnt1) |
Returns the count of the previously set performance metrics. More... | |
void | GX_ReadVCacheMetric (u32 *check, u32 *miss, u32 *stall) |
Returns Vertex Cache performance counters. More... | |
void | GX_ReadXfRasMetric (u32 *xfwaitin, u32 *xfwaitout, u32 *rasbusy, u32 *clks) |
Read performance metric values from the XF and RAS units. More... | |
volatile void * | GX_RedirectWriteGatherPipe (void *ptr) |
Temporarily points the CPU's write-gather pipe at a new location. More... | |
u32 | GX_ResetOverflowCount (void) |
void | GX_RestoreWriteGatherPipe (void) |
Restores the write-gather pipe. More... | |
void | GX_SetAlphaCompare (u8 comp0, u8 ref0, u8 aop, u8 comp1, u8 ref1) |
Sets the parameters for the alpha compare function which uses the alpha output from the last active TEV stage. More... | |
void | GX_SetAlphaUpdate (u8 enable) |
Enables or disables alpha-buffer updates of the Embedded Frame Buffer (EFB). More... | |
void | GX_SetArray (u32 attr, void *ptr, u8 stride) |
Sets the array base pointer and stride for a single attribute. More... | |
void | GX_SetBlendMode (u8 type, u8 src_fact, u8 dst_fact, u8 op) |
Determines how the source image, generated by the graphics processor, is blended with the Embedded Frame Buffer (EFB). More... | |
GXBreakPtCallback | GX_SetBreakPtCallback (GXBreakPtCallback cb) |
Registers cb as a function to be invoked when a break point is encountered. More... | |
void | GX_SetChanAmbColor (s32 channel, GXColor color) |
Sets the ambient color register for color channel chan. More... | |
void | GX_SetChanCtrl (s32 channel, u8 enable, u8 ambsrc, u8 matsrc, u8 litmask, u8 diff_fn, u8 attn_fn) |
Sets the lighting controls for a particular color channel. More... | |
void | GX_SetChanMatColor (s32 channel, GXColor color) |
Sets the material color register for color channel chan. More... | |
void | GX_SetClipMode (u8 mode) |
Enables or disables clipping of geometry. More... | |
void | GX_SetColorUpdate (u8 enable) |
Enables or disables color-buffer updates when rendering into the Embedded Frame Buffer (EFB). More... | |
void | GX_SetCoPlanar (u8 enable) |
Enables or disables coplanar triangle processing. More... | |
void | GX_SetCopyClamp (u8 clamp) |
Sets the vertical clamping mode to use during the EFB to XFB or texture copy. More... | |
void | GX_SetCopyClear (GXColor color, u32 zvalue) |
Sets color and Z value to clear the EFB to during copy operations. More... | |
void | GX_SetCopyFilter (u8 aa, u8 sample_pattern[12][2], u8 vf, u8 vfilter[7]) |
Sets the subpixel sample patterns and vertical filter coefficients used to filter subpixels into pixels. More... | |
void | GX_SetCPUFifo (GXFifoObj *fifo) |
Attaches a FIFO to the CPU. More... | |
void | GX_SetCullMode (u8 mode) |
Enables or disables culling of geometry based on its orientation to the viewer. More... | |
lwp_t | GX_SetCurrentGXThread (void) |
Sets the current GX thread to the calling thread. More... | |
void | GX_SetCurrentMtx (u32 mtx) |
Selects a specific matrix to use for transformations. More... | |
void | GX_SetDispCopyDst (u16 wd, u16 ht) |
Sets the witdth and height of the display buffer in pixels. More... | |
void | GX_SetDispCopyFrame2Field (u8 mode) |
Determines which lines are read from the Embedded Frame Buffer (EFB) when using GX_CopyDisp(). More... | |
void | GX_SetDispCopyGamma (u8 gamma) |
Sets the gamma correction applied to pixels during EFB to XFB copy operation. More... | |
void | GX_SetDispCopySrc (u16 left, u16 top, u16 wd, u16 ht) |
Sets the source parameters for the EFB to XFB copy operation. More... | |
u32 | GX_SetDispCopyYScale (f32 yscale) |
Sets the vertical scale factor for the EFB to XFB copy operation. More... | |
void | GX_SetDither (u8 dither) |
Enables or disables dithering. More... | |
void | GX_SetDrawDone (void) |
Sends a DrawDone command to the GP. More... | |
GXDrawDoneCallback | GX_SetDrawDoneCallback (GXDrawDoneCallback cb) |
Installs a callback that is invoked whenever a DrawDone command is encountered by the GP. More... | |
void | GX_SetDrawSync (u16 token) |
This function sends a token into the command stream. More... | |
GXDrawSyncCallback | GX_SetDrawSyncCallback (GXDrawSyncCallback cb) |
Installs a callback that is invoked whenever a DrawSync token is encountered by the graphics pipeline. More... | |
void | GX_SetDstAlpha (u8 enable, u8 a) |
Sets a constant alpha value for writing to the Embedded Frame Buffer (EFB). More... | |
void | GX_SetFieldMask (u8 even_mask, u8 odd_mask) |
selectively enables and disables interlacing of the frame buffer image. More... | |
void | GX_SetFieldMode (u8 field_mode, u8 half_aspect_ratio) |
Controls various rasterization and texturing parameters that relate to field-mode and double-strike rendering. More... | |
void | GX_SetFog (u8 type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor col) |
Enables fog. More... | |
void | GX_SetFogColor (GXColor color) |
Sets the fog color. More... | |
void | GX_SetFogRangeAdj (u8 enable, u16 center, GXFogAdjTbl *table) |
Enables or disables horizontal fog-range adjustment. More... | |
void | GX_SetGPFifo (GXFifoObj *fifo) |
Attaches fifo to the GP. More... | |
void | GX_SetGPMetric (u32 perf0, u32 perf1) |
Sets two performance metrics to measure in the GP. More... | |
void | GX_SetIndTexCoordScale (u8 indtexid, u8 scale_s, u8 scale_t) |
Allows the sharing of a texcoord between an indirect stage and a regular TEV stage. More... | |
void | GX_SetIndTexMatrix (u8 indtexmtx, f32 offset_mtx[2][3], s8 scale_exp) |
Sets one of the three static indirect matrices and the associated scale factor. More... | |
void | GX_SetIndTexOrder (u8 indtexstage, u8 texcoord, u8 texmap) |
Used to specify the texcoord and texmap to used with a given indirect lookup. More... | |
void | GX_SetLineWidth (u8 width, u8 fmt) |
Sets the width of line primitives. More... | |
void | GX_SetMisc (u32 token, u32 value) |
Sets miscellanous settings in the GP. More... | |
void | GX_SetNumChans (u8 num) |
Sets the number of color channels that are output to the TEV stages. More... | |
void | GX_SetNumIndStages (u8 nstages) |
Used to set how many indirect lookups will take place. More... | |
void | GX_SetNumTevStages (u8 num) |
Enables a consecutive number of TEV stages. More... | |
void | GX_SetNumTexGens (u32 nr) |
Sets the number of texture coordinates that are generated and available for use in the Texture Environment TEV stages. More... | |
void | GX_SetPixelFmt (u8 pix_fmt, u8 z_fmt) |
Sets the format of pixels in the Embedded Frame Buffer (EFB). More... | |
void | GX_SetPointSize (u8 width, u8 fmt) |
Sets the size of point primitives. More... | |
void | GX_SetScissor (u32 xOrigin, u32 yOrigin, u32 wd, u32 ht) |
Sets the scissor rectangle. More... | |
void | GX_SetScissorBoxOffset (s32 xoffset, s32 yoffset) |
Repositions the scissorbox rectangle within the Embedded Frame Buffer (EFB) memory space. More... | |
void | GX_SetTevAlphaIn (u8 tevstage, u8 a, u8 b, u8 c, u8 d) |
Sets the alpha input sources for one tevstage of the Texture Environment (TEV) alpha combiner. More... | |
void | GX_SetTevAlphaOp (u8 tevstage, u8 tevop, u8 tevbias, u8 tevscale, u8 clamp, u8 tevregid) |
Sets the tevop, tevbias, tevscale and clamp-mode operation for the alpha combiner for this tevstage of the TEV unit. More... | |
void | GX_SetTevColor (u8 tev_regid, GXColor color) |
Used to set one of the primary color registers in the TEV unit. More... | |
void | GX_SetTevColorIn (u8 tevstage, u8 a, u8 b, u8 c, u8 d) |
Sets the color input sources for one tevstage of the Texture Environment (TEV) color combiner. More... | |
void | GX_SetTevColorOp (u8 tevstage, u8 tevop, u8 tevbias, u8 tevscale, u8 clamp, u8 tevregid) |
Sets the tevop, tevbias, tevscale and clamp-mode operation for the color combiner for this tevstage of the TEV unit. More... | |
void | GX_SetTevColorS10 (u8 tev_regid, GXColorS10 color) |
Used to set one of the constant color registers in the TEV unit. More... | |
void | GX_SetTevDirect (u8 tevstage) |
Used to turn off all indirect texture processing for the specified regular TEV stage. More... | |
void | GX_SetTevIndBumpST (u8 tevstage, u8 indstage, u8 mtx_sel) |
Sets up an environment-mapped bump-mapped indirect lookup. More... | |
void | GX_SetTevIndBumpXYZ (u8 tevstage, u8 indstage, u8 mtx_sel) |
Sets up an environment-mapped bump-mapped indirect lookup. More... | |
void | GX_SetTevIndirect (u8 tevstage, u8 indtexid, u8 format, u8 bias, u8 mtxid, u8 wrap_s, u8 wrap_t, u8 addprev, u8 utclod, u8 a) |
Controls how the results from an indirect lookup will be used to modify a given regular TEV stage lookup. More... | |
void | GX_SetTevIndRepeat (u8 tevstage) |
Set a given TEV stage to use the same texture coordinates as were computed in the previous stage. More... | |
void | GX_SetTevIndTile (u8 tevstage, u8 indtexid, u16 tilesize_x, u16 tilesize_y, u16 tilespacing_x, u16 tilespacing_y, u8 indtexfmt, u8 indtexmtx, u8 bias_sel, u8 alpha_sel) |
Used to implement tiled texturing using indirect textures. More... | |
void | GX_SetTevIndWarp (u8 tevstage, u8 indtexid, u8 bias_flag, u8 replace_tex, u8 mtxid) |
Used to warp a normal texture lookup using an indirect texture map with 8-bit offsets. More... | |
void | GX_SetTevKAlphaSel (u8 tevstage, u8 sel) |
Selects a "konstant" alpha input to be used in a given TEV stage. More... | |
void | GX_SetTevKColor (u8 sel, GXColor col) |
Sets one of the "konstant" color registers in the TEV unit. More... | |
void | GX_SetTevKColorS10 (u8 sel, GXColorS10 col) |
Used to set one of the constant color registers in the Texture Environment (TEV) unit. More... | |
void | GX_SetTevKColorSel (u8 tevstage, u8 sel) |
Selects a "konstant" color input to be used in a given TEV stage. More... | |
void | GX_SetTevOp (u8 tevstage, u8 mode) |
Simplified function to set various TEV parameters for this tevstage based on a predefined combiner mode. More... | |
void | GX_SetTevOrder (u8 tevstage, u8 texcoord, u32 texmap, u8 color) |
Specifies the texture and rasterized color that will be available as inputs to this TEV tevstage. More... | |
void | GX_SetTevSwapMode (u8 tevstage, u8 ras_sel, u8 tex_sel) |
Selects a set of swap modes for the rasterized color and texture color for a given TEV stage. More... | |
void | GX_SetTevSwapModeTable (u8 swapid, u8 r, u8 g, u8 b, u8 a) |
Sets up the TEV color swap table. More... | |
void | GX_SetTexCoordBias (u8 texcoord, u8 s_enable, u8 t_enable) |
Sets the texture coordinate bias of a particular texture. More... | |
void | GX_SetTexCoordCylWrap (u8 texcoord, u8 s_enable, u8 t_enable) |
void | GX_SetTexCoordGen (u16 texcoord, u32 tgen_typ, u32 tgen_src, u32 mtxsrc) |
Specifies how texture coordinates are generated. More... | |
void | GX_SetTexCoordGen2 (u16 texcoord, u32 tgen_typ, u32 tgen_src, u32 mtxsrc, u32 normalize, u32 postmtx) |
An extension of GX_SetTexCoordGen(). It allows one to specify additional texgen options. More... | |
void | GX_SetTexCoordScaleManually (u8 texcoord, u8 enable, u16 ss, u16 ts) |
Overrides the automatic texture coordinate scaling (based upon the associated map size) and lets one manually assign the scale values that are used for a given texcoord. More... | |
void | GX_SetTexCopyDst (u16 wd, u16 ht, u32 fmt, u8 mipmap) |
This function sets the width and height of the destination texture buffer in texels. More... | |
void | GX_SetTexCopySrc (u16 left, u16 top, u16 wd, u16 ht) |
Sets the source parameters for the Embedded Frame Buffer (EFB) to texture image copy. More... | |
GXTexRegionCallback | GX_SetTexRegionCallback (GXTexRegionCallback cb) |
Sets the callback function called by GX_LoadTexObj() to obtain an available texture region. More... | |
GXTlutRegionCallback | GX_SetTlutRegionCallback (GXTlutRegionCallback cb) |
Sets the callback function called by GX_LoadTlut() to find the region into which to load the TLUT. More... | |
void | GX_SetVCacheMetric (u32 attr) |
Sets the metric the Vertex Cache performance counter will measure. More... | |
void | GX_SetViewport (f32 xOrig, f32 yOrig, f32 wd, f32 ht, f32 nearZ, f32 farZ) |
Sets the viewport rectangle in screen coordinates. More... | |
void | GX_SetViewportJitter (f32 xOrig, f32 yOrig, f32 wd, f32 ht, f32 nearZ, f32 farZ, u32 field) |
Sets the viewport and adjusts the viewport's line offset for interlaced field rendering. More... | |
void | GX_SetVtxAttrFmt (u8 vtxfmt, u32 vtxattr, u32 comptype, u32 compsize, u32 frac) |
Sets the attribute format (vtxattr) for a single attribute in the Vertex Attribute Table (VAT). More... | |
void | GX_SetVtxAttrFmtv (u8 vtxfmt, GXVtxAttrFmt *attr_list) |
Sets multiple attribute formats within a single vertex format. More... | |
void | GX_SetVtxDesc (u8 attr, u8 type) |
Sets the type of a single attribute (attr) in the current vertex descriptor. More... | |
void | GX_SetVtxDescv (GXVtxDesc *attr_list) |
Sets the type of multiple attributes. More... | |
void | GX_SetZCompLoc (u8 before_tex) |
Sets whether Z buffering happens before or after texturing. More... | |
void | GX_SetZMode (u8 enable, u8 func, u8 update_enable) |
Sets the Z-buffer compare mode. More... | |
void | GX_SetZTexture (u8 op, u8 fmt, u32 bias) |
Controls Z texture operations. More... | |
void | GX_TexModeSync (void) |
Inserts a synchronization command into the graphics FIFO. When the Graphics Processor sees this command, it will allow the texture pipeline to flush before continuing. More... | |
void | GX_WaitDrawDone (void) |
Stalls until DrawDone is encountered by the GP. More... | |
Variables | |
WGPipe *const | wgPipe |
GX subsystem.
#define GX_FIFO_HIWATERMARK (16*1024) |
Default hi watermark for FIFO buffer control.
#define GX_FIFO_MINSIZE (64*1024) |
Smallest usable graphics FIFO size.
#define GX_InitLightDirv | ( | lo, | |
vec | |||
) | (GX_InitLightDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2))) |
Sets the direction of a light in the light object using a vector structure.
This direction is used when the light object is used as a spotlight or a specular light, see the attn_fn parameter of GX_SetChanCtrl().
[in] | lo | ptr to the light object |
[in] | vec | struct or array of three values for the direction |
#define GX_InitLightPosv | ( | lo, | |
vec | |||
) | (GX_InitLightPos((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2))) |
Sets the position of the light in the light object using a vector structure.
[in] | lo | ptr to the light object |
[in] | vec | struct or array of three values for the position |
#define GX_InitLightShininess | ( | lobj, | |
shininess | |||
) |
Sets shininess of a per-vertex specular light.
In reality, shininess is a property of the material being lit, not the light. However, in the Graphics Processor, the specular calculation is implemented by reusing the diffuse angle/distance attenuation function, so shininess is determined by the light attenuation parameters (see GX_InitLightAttn()). Note that the equation is attempting to approximate the function (N*H)^shininess. Since the attenuation equation is only a ratio of quadratics, a true exponential function is not possible. To enable the specular calculation, you must set the attenuation parameter of the lighting channel to GX_AF_SPEC
using GX_SetChanCtrl().
[in] | lobj | ptr to the light object |
[in] | shininess | shininess parameter |
#define GX_InitSpecularDirHAv | ( | lo, | |
vec0, | |||
vec1 | |||
) |
Sets the direction and half-angle vector of a specular light in the light object using a vector.
These vectors are used when the light object is used only as specular light.
[in] | lo | ptr to the light object |
[in] | vec0 | struct or array of three values for the direction |
[in] | vec1 | struct or array of three values for the half-angle |
#define GX_InitSpecularDirv | ( | lo, | |
vec | |||
) | (GX_InitSpecularDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2))) |
Sets the direction of a specular light in the light object using a vector.
This direction is used when the light object is used only as specular light.
GX_AF_SPEC
. Furthermore, one must not use GX_InitLightDir() or GX_InitLightPos() to set up a light object which will be used as a specular light since these functions will destroy the information set by GX_InitSpecularDir(). In contrast to diffuse lights (including spotlights) that are considered local lights, a specular light is a parallel light (i.e. the specular light is infinitely far away such that all the rays of the light are parallel), and thus one can only specify directional information.[in] | lo | ptr to the light object |
[in] | vec | struct or array of three values for the direction |
void(* GXDrawSyncCallback)(u16 token) |
function pointer typedef for the drawsync-token callback
[out] | token | tokenvalue most recently encountered. |
Object containing information on a light.
This structure contains precompiled register state setting commands and data. The application must use the GX_InitLight*() functions to initialize or change this object. The proper size of the object is returned by
but the internal data representation is not visible to the application.
struct _gx_texobj GXTexObj |
Object containing information about a texture.
This structure contains precompiled register state setting commands and data. The application must use the GX_InitTexObj*() function to initialize or change this object. The proper size of the object is returned by
but the internal data representation is not visible to the application.
struct _gx_texreg GXTexRegion |
Object containing information on a texture cache region.
This structure contains precompiled register state setting commands and data. The application must use the GX_InitTexCacheRegion() function to initialize or change this object. The proper size of the object is returned by
but the internal data representation is not visible to the application.
GXTexRegion *(* GXTexRegionCallback)(GXTexObj *obj, u8 mapid) |
function pointer typedef for the texture region callback
[out] | token | tokenvalue most recently encountered. |
struct _gx_tlutobj GXTlutObj |
Object containing information on a TLUT.
This structure contains precompiled register state setting commands and data. The application must use the GX_InitTlutObj() function to initialize or change this object. The proper size of the object is returned by
but the internal data representation is not visible to the application.
struct _gx_tlutreg GXTlutRegion |
Object containing information on a TLUT cache region.
This structure contains precompiled register state setting commands and data. The application must use the GX_InitTlutRegion() function to initialize or change this object. The proper size of the object is returned by
but the internal data representation is not visible to the application.
GXTlutRegion *(* GXTlutRegionCallback)(u32 tlut_name) |
function pointer typedef for the TLUT region callback
[out] | token | tokenvalue most recently encountered. |
void GX_AbortFrame | ( | void | ) |
Aborts the current frame.
This command will reset the entire graphics pipeline, including any commands in the graphics FIFO.
void GX_AdjustForOverscan | ( | GXRModeObj * | rmin, |
GXRModeObj * | rmout, | ||
u16 | hor, | ||
u16 | ver | ||
) |
Takes a given render mode and returns a version that is reduced in size to account for overscan.
The number of pixels specified by hor is subtracted from each side of the screen, and the number of pixels specified by ver is subtracted from both the top and the bottom of the screen. The active screen area is centered within what the render mode specified before the adjustment.
[in] | rmin | rmode that is being copied |
[in] | rmout | rmode to hold the adjusted version. Needs to be allocated but can be uninitialized. |
[in] | hor | pixels to trim from each side of the screen |
[in] | ver | pixels to tim from top and bottom of the screen |
Begins drawing of a graphics primitive.
To draw a graphics primitive, a stream of vertex data matching the description of both GX_SetVtxDesc() and GX_SetVtxAttrFmt() is enclosed between GX_Begin()/GX_End() pairs. The number of vertices between GX_Begin() and GX_End() must match that specified by the vtxcnt parameter. The type of the primitive will determine the minimum number of vertices required. For example, a GX_TRIANGLES
primitive must have at least 3 vertices.
[in] | primitve | Primitive type to draw |
[in] | vtxfmt | Vertex format index to use |
[in] | vtxcnt | number of vertices being drawn; maximum is 65536 |
void GX_BeginDispList | ( | void * | list, |
u32 | size | ||
) |
Begins a display list and disables writes to the FIFO currently attached to the CPU.
After this function is called, GX API functions that normally send command or data into the CPU FIFO will send them to the display list buffer instead of the FIFO until GX_EndDispList() is called. Writes to the CPU FIFO will be re-enabled when the function GX_EndDispList() executes.
Basically you can put most of GX API commands into a display list. However, since the use of display list can bypass all state coherences controlled by GX API in run-time, sometimes it brings some state collisions or incoherences that may lead to unexpected behavior or even graphics pipeline hang. The most recommended safe way is putting only primitives (regions enclosed by GX_Begin() and GX_End()) that don't cause any state collisions.
[in] | list | 32-byte aligned buffer to hold the list |
[in] | size | size of the buffer, multiple of 32 |
void GX_CallDispList | ( | void * | list, |
u32 | nbytes | ||
) |
Causes the GP to execute graphics commands from the display list instead of from the GP FIFO.
When the number of bytes specified by nbytes have been read, the graphics processor will resume executing commands from the graphics FIFO. Graphics commands from a display list are prefetched into a separate 4KB FIFO. This prevents any data prefetched for the main graphics command stream from being lost during the display list call.
[in] | list | 32-byte aligned pointer to the display list buffer |
[in] | nbytes | number of bytes in the display list. Use the return value of GX_EndDispList() here. |
void GX_ClearBoundingBox | ( | void | ) |
Clears the bounding box values before a new image is drawn.
The graphics hardware keeps track of a bounding box of pixel coordinates that are drawn in the Embedded Frame Buffer (EFB).
void GX_ClearGPMetric | ( | void | ) |
Clears the two virtual GP performance counters to zero.
void GX_ClearVCacheMetric | ( | void | ) |
Clears the Vertex Cache performance counter.
This function clears the performance counter by sending a special clear token via the Graphics FIFO.
void GX_ClearVtxDesc | ( | void | ) |
Clears all vertex attributes of the current vertex descriptor to GX_NONE.
void GX_CopyDisp | ( | void * | dest, |
u8 | clear | ||
) |
Copies the embedded framebuffer (EFB) to the external framebuffer(XFB) in main memory.
[in] | dest | pointer to the external framebuffer. dest should be 32B aligned. |
[in] | clear | flag that indicates framebuffer should be cleared if GX_TRUE . |
void GX_CopyTex | ( | void * | dest, |
u8 | clear | ||
) |
Copies the embedded framebuffer (EFB) to the texture image buffer dest in main memory.
This is useful when creating textures using the Graphics Processor (GP). If the clear flag is set to GX_TRUE
, the EFB will be cleared to the current color(see GX_SetCopyClear()) during the copy operation.
[in] | dest | pointer to the image buffer in main memory. dest should be 32B aligned. |
[in] | clear | flag that indicates framebuffer should be cleared if GX_TRUE . |
void GX_DisableBreakPt | ( | void | ) |
Allows reads from the FIFO currently attached to the Graphics Processor (GP) to resume.
See GX_EnableBreakPt() for an explanation of the FIFO break point feature.
void GX_DrawDone | ( | void | ) |
Sends a DrawDone command to the GP and stalls until its subsequent execution.
void GX_EnableBreakPt | ( | void * | break_pt | ) |
Sets a breakpoint that causes the GP to halt when encountered.
[in] | break_pt | address for GP to break on when read. |
Enables a special texture offset feature for points and lines.
When a point's size is defined using GX_SetPointSize() or a line's width is described using GX_SetLineWidth(), you can also specify a second parameter. The parameter fmt is added to the texture coordinate(s), if any, to obtain texture coordinates at the other corners of a point or line. The fmts are added after the texture coordinate generation operation; see GX_SetTexCoordGen(). This function enables this operation for a particular texture coordinate. Offset operations for points and lines are enabled separately. If the enables are false, the same texture coordinate is used for every vertex of the line or point.
[in] | coord | texture coordinate slot |
[in] | line_enable | enable or disable tex offset calculation for lines |
[in] | point_enable | enable or disable tex offset calculation for points |
u32 GX_EndDispList | ( | void | ) |
Ends a display list and resumes writing graphics commands to the CPU FIFO.
This function returns the size of the display list written to the display list buffer since GX_BeginDispList() was called. If the display list size exceeds the size of the buffer allocated, a zero length size will be returned. The display list size is a multiple of 32B and any unsed commands in the last 32B will be padded with GX_NOP
. The size returned should be passed to GX_CallDispList() when the display list needs to be executed.
void GX_Flush | ( | void | ) |
Flushes all commands to the GP.
Specifically, it flushes the write-gather FIFO in the CPU to make sure that all commands are sent to the GP.
void GX_GetCPUFifo | ( | GXFifoObj * | fifo | ) |
Copies the information from the currently attached CPU FIFO into fifo.
[out] | fifo | the object to copy the current CPU FIFO object data into |
lwp_t GX_GetCurrentGXThread | ( | void | ) |
Returns the current GX thread.
The current GX thread should be the thread that is currently responsible for generating graphics data. By default, the GX thread is the thread that invoked GX_Init(); however, it may be changed by calling GX_SetCurrentGXThread().
u16 GX_GetDrawSync | ( | void | ) |
Returns the value of the token register, which is written using the GX_SetDrawSync() function.
void * GX_GetFifoBase | ( | const GXFifoObj * | fifo | ) |
Get the base address for a given fifo.
[in] | fifo | the object to get the address from |
Returns number of cache lines in the FIFO.
[in] | fifo | the FIFO to get the count from |
void GX_GetFifoPtrs | ( | const GXFifoObj * | fifo, |
void ** | rd_ptr, | ||
void ** | wt_ptr | ||
) |
Returns the current value of the Graphics FIFO read and write pointers.
[in] | fifo | pointer to a FIFO struct |
[out] | rd_ptr | address of the FIFO read pointer |
[out] | wt_ptr | address of the FIFO write pointer |
Get the size of a given fifo.
[in] | fifo | the object to get the size from |
Returns a non-zero value if the write pointer has passed the TOP of the FIFO.
Returns true only if the FIFO is attached to the CPU and the FIFO write pointer has passed the top of the FIFO. Use the return value to detect whether or not an overflow has occured by initializing the FIFO's write pointer to the base of the FIFO before sending any commands to the FIFO.
[in] | fifo | the object to get the wrap status from |
void GX_GetGPFifo | ( | GXFifoObj * | fifo | ) |
Copies the information from the currently attached GP FIFO info fifo.
[out] | fifo | the object to copy the current GP FIFO object data into |
Reads the current status of the GP.
overhi and underlow will indicate whether or not the watermarks have been reached. If the CPU and GP FIFOs are the same, then overhi will indicate whether or not the current GX thread is suspended. The value of brkpt can be used to determine if a breakpoint is in progress (i.e. GP reads are suspended; they are resumed by a call to GX_DisableBreakPt()). A callback can also be used to notify your application that the break point has been reached. (see GX_SetBreakPtCallback())
[out] | overhi | GX_TRUE if high watermark has been passed |
[out] | underlow | GX_TRUE if low watermark has been passed |
[out] | readIdle | GX_TRUE if the GP read unit is idle |
[out] | cmdIdle | GX_TRUE if all commands have been flushed to XF |
[out] | brkpt | GX_TRUE if FIFO has reached a breakpoint and GP reads have been stopped |
Returns the amount of memory in bytes needed to store a texture of the given size and fmt.
If the mipmap flag is GX_TRUE
, then the size of buffer needed for the mipmap pyramid up to maxlod will be returned. maxlod will be clamped to the number of LODs possible given the map wd and ht. For mipmaps, wd and ht must be a power of two.
[in] | wd | width of the texture in texels |
[in] | ht | height of the texture in texels |
[in] | fmt | format of the texture; use GX_TexFmt() or GX_CITexFmt() to get it |
[in] | mipmap | flag indicating whether or not the texture is a mipmap |
[in] | maxlod | if mipmap is GX_TRUE, texture size will include mipmap pyramid up to this value |
void GX_GetTexObjAll | ( | const GXTexObj * | obj, |
void ** | image_ptr, | ||
u16 * | width, | ||
u16 * | height, | ||
u8 * | format, | ||
u8 * | wrap_s, | ||
u8 * | wrap_t, | ||
u8 * | mipmap | ||
) |
Returns the parameters described by a texture object. Texture objects are used to describe all the parameters associated with a texture, including size, format, wrap modes, filter modes, etc. Texture objects are initialized using either GX_InitTexObj() or, for color index format textures, GX_InitTexObjCI().
[in] | obj | ptr to a texture object |
[out] | image_ptr | Returns a physical pointer to the image data for a texture. |
[out] | width | Returns the width of the texture or LOD 0 for mipmaps |
[out] | height | Returns the height of the texture or LOD 0 for mipmaps |
[out] | format | Returns the texel format |
[out] | mipmap | Returns the mipmap enable flag. |
void * GX_GetTexObjData | ( | const GXTexObj * | obj | ) |
Used to get a pointer to texture data from the GXTexObj structure.
[in] | obj | ptr to a texture object |
Returns the filter mode for the texture object obj.
[in] | obj | ptr to a texture object |
[out] | minfilt | minification filter mode; will be one of Texture filter types |
[out] | maxfilt | magnification filter mode; will be GX_NEAR or GX_LINEAR |
Returns the texture format described by texture object obj.
[in] | obj | ptr to a texture object |
Returns the texture height described by texture object obj.
[in] | obj | ptr to a texture object |
void GX_GetTexObjLOD | ( | const GXTexObj * | obj, |
f32 * | minlod, | ||
f32 * | maxlod | ||
) |
Returns the min and max LOD values for the texture object obj.
[in] | obj | ptr to a texture object |
[out] | minlod | minimum LOD value from 0.0 - 10.0 inclusive |
[out] | maxlod | maximum LOD value from 0.0 - 10.0 inclusive |
Returns the texture mipmap enable described by texture object obj.
[in] | obj | ptr to a texture object |
void * GX_GetTexObjUserData | ( | const GXTexObj * | obj | ) |
Used to get a pointer to user data from the GXTexObj structure.
You can use this function to retrieve private data structures from the texture object. This pointer is set using GX_InitTexObjUserData().
[in] | obj | ptr to object to read data from |
Returns the texture width described by texture object obj.
[in] | obj | ptr to a texture object |
Returns the texture wrap s mode described by texture object obj.
[in] | obj | ptr to a texture object |
Returns the texture wrap t mode described by texture object obj.
[in] | obj | ptr to a texture object |
void GX_GetVtxDescv | ( | GXVtxDesc * | attr_list | ) |
Gets the type of multiple attributes.
This function saves the attributes that are current set. This is usually used in conjunction with GX_SetVtxDescv
GX_MAX_VTXATTRFMT_LISTSIZE
must be used to allocate memory for attr_list [in] | attr_list | array of pointers to GXVtxDesc structs |
Calculates an appropriate Y scale factor value for GX_SetDispCopyYScale() based on the height of the EFB and the height of the XFB.
[in] | efbHeight | Height of embedded framebuffer. Range from 2 to 528. Should be a multiple of 2. |
[in] | xfbHeight | Height of external framebuffer. Range from 2 to 1024. Should be equal or greater than efbHeight. |
Initializes the graphics processor to its initial state.
This function sets the default state of the graphics processor and should be called before any other GX functions. This function sets up an immediate-mode method of communicating graphics commands from the CPU to the Graphics Processor (GP). This function will initialize a FIFO and attach it to both the CPU and GP. The CPU will write commands to the FIFO and the GP will read the commands. This function returns a pointer to the initialized FIFO. The application must allocate the memory for the FIFO. The parameter base is a pointer to the allocated main memory and must be aligned to 32B. size is the size of the FIFO in bytes and must be a multiple of 32B. Refer to additional notes in GX_InitFifoBase() concerning the FIFO memory.
[in] | base | pointer to the GX FIFO buffer base address. Must be aligned on a 32 Byte boundery. |
[in] | size | size of buffer. Must be a multiple of 32. |
Describes the area of main memory that will be used for this fifo.
The Graphics FIFO is the mechanism used to communicate graphics commands from the CPU to the Graphics Processor (GP). The FIFO base pointer should be 32-byte aligned. memalign() can return 32-byte aligned pointers. The size should also be a multiple of 32B.
The CPU's write-gather pipe is used to write data to the FIFO. Therefore, the FIFO memory area must be forced out of the CPU cache prior to being used. DCInvalidateRange() may be used for this purpose. Due to the mechanics of flushing the write-gather pipe, the FIFO memory area should be at least 32 bytes larger than the maximum expected amount of data stored. Up to 32 NOPs may be written at the end during flushing.
GX_FIFO_MINSIZE
.[in] | fifo | the fifo struct to use |
[in] | base | ptr to the base of allocation; must be 32-byte aligned |
[in] | size | size of the FIFO in bytes; must be multiple of 32; size must be GX_FIFO_MINSIZE or larger |
Sets the high and low water mark for the fifo.
The high and low water marks are used in immediate-mode, i.e. when the fifo is attached to both the CPU and Graphics Processor (GP) (see GX_SetCPUFifo() and GX_SetGPFifo()).
The hardware keeps track of the number of bytes between the read and write pointers. This number represents how full the FIFO is, and when it is greater than or equal to the hiwatermark, the hardware issues an interrupt. The GX API will suspend sending graphics to the Graphics FIFO until it has emptied to a certain point. The lowatermark is used to set the point at which the FIFO is empty enough to resume sending graphics commands to the FIFO. Both hiwatermark and lowatermark should be in multiples of 32B. The count for lowatermark should be less than hiwatermark. Of course, hiwatermark and lowatermark must be less than the size of the FIFO.
[in] | fifo | the fifo struct to use |
[in] | hiwatermark | number of bytes to be queued before libogc stops writing commands to the FIFO |
[in] | lowatermark | number of bytes to be queued before libogc resumes writing commands to the FIFO |
void GX_InitFifoPtrs | ( | GXFifoObj * | fifo, |
void * | rd_ptr, | ||
void * | wt_ptr | ||
) |
Sets the fifo read and write pointers.
[in] | fifo | the fifo struct to use |
[in] | rd_ptr | the pointer to use for the FIFO read pointer; must be 32-byte aligned |
[in] | wt_ptr | the pointer to use for the FIFO write pointer; must be 32-byte aligned |
void GX_InitFogAdjTable | ( | GXFogAdjTbl * | table, |
u16 | width, | ||
f32 | projmtx[4][4] | ||
) |
Generates the standard range adjustment table and puts the results into table.
This table can be used by GX_SetFogRangeAdj() to adjust the eye-space Z used for fog based upon the X position of the pixels being rendered. The Y direction is not compensated. This effectively increases the fog density at the edges of the screen, making for a more realistic fog effect. The width of the viewport is specified using width. The projmtx parameter is the projection matrix that is used to render into the viewport. It must be specified so that the function can compute the X extent of the viewing frustum in eye space.
[in] | table | range adjustment parameter table |
[in] | width | width of the viewport |
[in] | projmtx | projection matrix used to render into the viewport |
void GX_InitLightAttn | ( | GXLightObj * | lit_obj, |
f32 | a0, | ||
f32 | a1, | ||
f32 | a2, | ||
f32 | k0, | ||
f32 | k1, | ||
f32 | k2 | ||
) |
Sts coefficients used in the lighting attenuation calculation in a given light object.
The parameters a0, a1, and a2 are used for angular (spotlight) attenuation. The coefficients k0, k1, and k2 are used for distance attenuation. The attenuation function is:
atten = clamp0(a2^2 * aattn^2 + a1 * aattn + a0) / (k2 * d^2 + k1 * d + k0)
where aattn is the cosine of the angle between the light direction and the vector from the light position to the vertex, and d is the distance from the light position to the vertex when the channel attenuation function is GX_AF_SPOT
. The light color will be multiplied by the atten factor when the attenuation function for the color channel referencing this light is set to GX_AF_SPOT
(see GX_SetChanCtrl()).
GX_AF_SPEC
, the aattn and d parameter are equal to the dot product of the eye-space vertex normal and the half-angle vector set by GX_InitSpecularDir().[in] | lit_obj | ptr to a light object |
[in] | a0 | angle attenuation coefficient |
[in] | a1 | angle attenuation coefficient |
[in] | a2 | angle attenuation coefficient |
[in] | k0 | distance attenuation coefficient |
[in] | k1 | distance attenuation coefficient |
[in] | k2 | distance attenuation coefficient |
void GX_InitLightAttnA | ( | GXLightObj * | lit_obj, |
f32 | a0, | ||
f32 | a1, | ||
f32 | a2 | ||
) |
Sets coefficients used in the lighting angle attenuation calculation in a given light object.
The parameters a0, a1, and a2 are used for angular (spotlight) attenuation. The attenuation function is:
atten = clamp0(a2^2 * cos(theta)^2 + a1 * cos(theta) + a0) / (k2 * d^2 + k1 * d + k0)
where cos(theta) is the cosine of the angle between the light normal and the vector from the light position to the vertex, and d is the distance from the light position to the vertex. The k0-2 coefficients can be set using GX_InitLightAttnK(). You can set both the a0-2 and k0-2 coefficients can be set using GX_InitLightAttn(). The light color will be multiplied by the atten factor when the attenuation function for the color channel referencing this light is set to GX_AF_SPOT
(see GX_SetChanCtrl()).
[in] | lit_obj | ptr to a light object |
[in] | a0 | angle attenuation coefficient |
[in] | a1 | angle attenuation coefficient |
[in] | a2 | angle attenuation coefficient |
void GX_InitLightAttnK | ( | GXLightObj * | lit_obj, |
f32 | k0, | ||
f32 | k1, | ||
f32 | k2 | ||
) |
Sets coefficients used in the lighting distance attenuation calculation in a given light object.
The coefficients k0, k1, and k2 are used for distance attenuation. The attenuation function is:
atten = clamp0(a2^2 * cos(theta)^2 + a1 * cos(theta) + a0) / (k2 * d^2 + k1 * d + k0)
where cos(theta) is the cosine of the angle between the light normal and the vector from the light position to the vertex, and d is the distance from the light position to the vertex. The a0-2 coefficients can be set using GX_InitLightAttnA(). You can set both the a0-2 and k0-2 coefficients can be set using GX_InitLightAttn(). The light color will be multiplied by the atten factor when the attenuation function for the color channel referencing this light is set to GX_AF_SPOT
(see GX_SetChanCtrl()).
[in] | lit_obj | ptr to a light object |
[in] | k0 | distance attenuation coefficient |
[in] | k1 | distance attenuation coefficient |
[in] | k2 | distance attenuation coefficient |
void GX_InitLightColor | ( | GXLightObj * | lit_obj, |
GXColor | col | ||
) |
Sets the color of the light in the light object.
[in] | lit_obj | ptr to the light object |
[in] | col | color to set the light to |
void GX_InitLightDir | ( | GXLightObj * | lit_obj, |
f32 | nx, | ||
f32 | ny, | ||
f32 | nz | ||
) |
Sets the direction of a light in the light object.
This direction is used when the light object is used as spotlight or a specular light (see the attn_fn parameter of GX_SetChanCtrl()).
[in] | lit_obj | ptr to the light object |
[in] | nx | X coordinate of the light normal |
[in] | ny | Y coordinate of the light normal |
[in] | nz | Z coordinate of the light normal |
void GX_InitLightDistAttn | ( | GXLightObj * | lit_obj, |
f32 | ref_dist, | ||
f32 | ref_brite, | ||
u8 | dist_fn | ||
) |
Sets coefficients for distance attenuation in a light object.
This function uses three easy-to-control parameters instead of k0, k1, and k2 in GX_InitLightAttn().
In this function, you can specify the brightness on an assumed reference point. The parameter ref_distance is distance between the light and the reference point. The parameter ref_brite specifies ratio of the brightness on the reference point. The value for ref_dist should be greater than 0 and that for ref_brite should be within 0 < ref_brite < 1, otherwise distance attenuation feature is turned off. The parameter dist_fn defines type of the brightness decreasing curve by distance; GX_DA_OFF
turns distance attenuation feature off.
[in] | lit_obj | ptr to a light object |
[in] | ref_dist | distance between the light and reference point |
[in] | ref_brite | brightness of the reference point |
[in] | dist_fn | Brightness decreasing function to use |
void GX_InitLightPos | ( | GXLightObj * | lit_obj, |
f32 | x, | ||
f32 | y, | ||
f32 | z | ||
) |
Sets the position of the light in the light object.
The GameCube graphics hardware supports local diffuse lights. The position of the light should be in the same space as a transformed vertex position (i.e., view space).
[in] | lit_obj | ptr to the light object |
[in] | x | X coordinate to place the light at |
[in] | y | Y coordinate to place the light at |
[in] | z | Z coordinate to place the light at |
void GX_InitLightSpot | ( | GXLightObj * | lit_obj, |
f32 | cut_off, | ||
u8 | spotfn | ||
) |
Sets coefficients for angular (spotlight) attenuation in light object.
This function uses two easy-to-control parameters instead of a0, a1, and a2 on GX_InitLightAttn().
The parameter cut_off specifies cutoff angle of the spotlight by degree. The spotlight works while the angle between the ray for a vertex and the light direction given by GX_InitLightDir() is smaller than this cutoff angle. The value for cut_off should be within 0 < cut_off <= 90.0, otherwise given light object doesn't become a spotlight.
The parameter spotfn defines type of the illumination distribution within cutoff angle. The value GX_SP_OFF
turns spotlight feature off even if color channel setting is using GX_AF_SPOT
(see GX_SetChanCtrl()).
[in] | lit_obj | ptr to a light object |
[in] | cut_off | cutoff angle of the spotlight, in degrees |
[in] | spotfn | Spot illumination distribution function to use for this light |
void GX_InitSpecularDir | ( | GXLightObj * | lit_obj, |
f32 | nx, | ||
f32 | ny, | ||
f32 | nz | ||
) |
Sets the direction of a specular light in the light object.
This direction is used when the light object is used only as specular light. The coordinate space of the light normal should be consistent with a vertex normal transformed by a normal matrix; i.e., it should be transformed to view space.
GX_AF_SPEC
. Furthermore, one must not use GX_InitLightDir() or GX_InitLightPos() to set up a light object which will be used as a specular light since these functions will destroy the information set by GX_InitSpecularDir(). In contrast to diffuse lights (including spotlights) that are considered local lights, a specular light is a parallel light (i.e. the specular light is infinitely far away such that all the rays of the light are parallel), and thus one can only specify directional information.[in] | lit_obj | ptr to a light object |
[in] | nx | X coordinate of the light normal |
[in] | ny | Y coordinate of the light normal |
[in] | nz | Z coordinate of the light normal |
void GX_InitSpecularDirHA | ( | GXLightObj * | lit_obj, |
f32 | nx, | ||
f32 | ny, | ||
f32 | nz, | ||
f32 | hx, | ||
f32 | hy, | ||
f32 | hz | ||
) |
Sets the direction and half-angle vector of a specular light in the light object.
These vectors are used when the light object is used only as specular light. In contrast to GX_InitSpecularDir(), which caclulates half-angle vector automatically by assuming the view vector as (0, 0, 1), this function allows users to specify half-angle vector directly as input arguments. It is useful to do detailed control for orientation of highlights.
[in] | lit_obj | ptr to a light object |
[in] | nx | X coordinate of the light normal |
[in] | ny | Y coordinate of the light normal |
[in] | nz | Z coordinate of the light normal |
[in] | hx | X coordinate of half-angle |
[in] | hy | Y coordinate of half-angle |
[in] | hz | Z coordinate of half-angle |
void GX_InitTexCacheRegion | ( | GXTexRegion * | region, |
u8 | is32bmipmap, | ||
u32 | tmem_even, | ||
u8 | size_even, | ||
u32 | tmem_odd, | ||
u8 | size_odd | ||
) |
Initializes a texture memory (TMEM) region object for cache.
The region is allocated by the application and can be used as a cache. An application can create many region objects and some of them can overlap; however, no two overlapping regions can be active at the same time.
The possible sizes of a TMEM cache region are 32K, 128K or 512K.
[in] | region | ptr to a GXTexRegion struct |
[in] | is32bmipmap | should be set to GX_TRUE to interpret parameters according to the 32b mipmap meaning. |
[in] | tmem_even | base ptr in TMEM for even LODs; must be multiple of 2KB |
[in] | size_even | even Texture cache size other than GX_TEXCACHE_NONE |
[in] | tmem_odd | base ptr in TMEM for odd LODs; must be multiple of 2KB |
[in] | size_odd | odd Texture cache size other than GX_TEXCACHE_NONE |
void GX_InitTexObj | ( | GXTexObj * | obj, |
void * | img_ptr, | ||
u16 | wd, | ||
u16 | ht, | ||
u8 | fmt, | ||
u8 | wrap_s, | ||
u8 | wrap_t, | ||
u8 | mipmap | ||
) |
Used to initialize or change a texture object for non-color index textures.
Texture objects are used to describe all the parameters associated with a texture, including size, format, wrap modes, filter modes, etc. It is the application's responsibility to provide memory for a texture object. Once initialized, a texture object can be associated with one of eight active texture IDs using GX_LoadTexObj().
GX_TRUE
, then the texture is a mipmap and the texture will be trilerped. If the mipmap flag is GX_FALSE
, the texture is not a mipmap and the texture will be bilerped. To override the filter modes and other mipmap controls, see GX_InitTexObjLOD().[out] | obj | ptr to a texture object |
[in] | img_ptr | ptr to the image data for a texture, aligned to 32B |
[in] | wd | width of the texture, or LOD level 0 for mipmaps; max value is 1024; mipmaps must be a power of two |
[in] | ht | height of the texture, or LOD level 0 for mipmaps; max value is 1024; mipmaps must be a power of two |
[in] | fmt | Texture format |
[in] | wrap_s | texture coordinate wrapping strategy in the S direction; use GX_CLAMP , GX_REPEAT or GX_MIRROR |
[in] | wrap_t | texture coordinate wrapping strategy in the T direction; use GX_CLAMP , GX_REPEAT or GX_MIRROR |
[in] | mipmap | trilinear filtering will be used if GX_TRUE , otherwise bilinear is used |
Enables bias clamping for texture LOD.
If biasclamp is GX_ENABLE, the sum of LOD and lodbias (given in GX_InitTexObjLODBias()) is clamped so that it is never less than the minimum extent of the pixel projected in texture space. This prevents over-biasing the LOD when the polygon is perpendicular to the view direction.
[in] | obj | texture to set the bias clamp value for |
[in] | biasclamp | whether or not to enable the bias clamp |
void GX_InitTexObjCI | ( | GXTexObj * | obj, |
void * | img_ptr, | ||
u16 | wd, | ||
u16 | ht, | ||
u8 | fmt, | ||
u8 | wrap_s, | ||
u8 | wrap_t, | ||
u8 | mipmap, | ||
u32 | tlut_name | ||
) |
Used to initialize or change a texture object when the texture is color index format.
Texture objects are used to describe all the parameters associated with a texture, including size, format, wrap modes, filter modes, etc. It is the application's responsibility to provide memory for a texture object. Once initialized, a texture object can be associated with one of eight active texture IDs using GX_LoadTexObj().
GX_TRUE
, then the texture is a mipmap and the texture will be filtered using the GX_LIN_MIP_NEAR
filter mode (color index mipmaps cannot use the GX_LIN_MIP_LIN
or GX_NEAR_MIP_LIN
mode). If the mipmap flag is GX_FALSE
, the texture is not a mipmap and the texture will be bilerped. To override the filter modes and other mipmap controls, use GX_InitTexObjLOD(). Mipmap textures should set the width and height to a power of two, but mipmaps do not need to be square.GX_REPEAT
or GX_MIRROR
modes for wrap_s and wrap_t the width and height, respectively, must be a power of two.[in] | obj | ptr to a texture object |
[in] | img_ptr | ptr to the image data for a texture, aligned to 32B |
[in] | wd | width of the texture, or LOD level 0 for mipmaps; max value is 1024; mipmaps must be a power of two |
[in] | ht | height of the texture, or LOD level 0 for mipmaps; max value is 1024; mipmaps must be a power of two |
[in] | fmt | Texture format |
[in] | wrap_s | texture coordinate wrapping strategy in the S direction; use GX_CLAMP , GX_REPEAT or GX_MIRROR |
[in] | wrap_t | texture coordinate wrapping strategy in the T direction; use GX_CLAMP , GX_REPEAT or GX_MIRROR |
[in] | mipmap | if GX_TRUE , it is a mipmap texture, else it is a planar texture |
[in] | tlut_name | TLUT name to use for this texture; default texture configuration recognizes TLUT name |
void GX_InitTexObjData | ( | GXTexObj * | obj, |
void * | img_ptr | ||
) |
Allows one to modify the image data pointer for an existing texture object.
[in] | obj | ptr to a texture object |
[in] | img_ptr | ptr to the texture data in main memory |
Changes LOD computing mode.
When set to GX_ENABLE, the LOD is computed using adjacent texels; when GX_DISABLE, diagonal texels are used instead. This should be set to GX_ENABLE if you use bias clamping (see GX_InitTexObjBiasClamp()) or anisotropic filtering (GX_ANISO_2 or GX_ANISO_4 for GX_InitTexObjMaxAniso() argument).
[in] | obj | texture to set the edge LOD for |
[in] | edgelod | mode to set LOD computation to |
Sets the filter mode for a texture.
When the ratio of texels for this texture to pixels is not 1:1, the filter type for minfilt or magfilt is used.
[in] | obj | texture object to set the filters for |
[in] | minfilt | filter mode to use when the texel/pixel ratio is >= 1.0; needs to be one of Texture filter types. |
[in] | magfilt | filter mode to use when the texel/pixel ratio is < 1.0; needs to be GX_NEAR or GX_LINEAR |
void GX_InitTexObjLOD | ( | GXTexObj * | obj, |
u8 | minfilt, | ||
u8 | magfilt, | ||
f32 | minlod, | ||
f32 | maxlod, | ||
f32 | lodbias, | ||
u8 | biasclamp, | ||
u8 | edgelod, | ||
u8 | maxaniso | ||
) |
Sets texture Level Of Detail (LOD) controls explicitly for a texture object.
It is the application's responsibility to provide memory for a texture object. When initializing a texture object using GX_InitTexObj() or GX_InitTexObjCI(), this information is set to default values based on the mipmap flag. This function allows the programmer to override those defaults.
GX_ANISO_2
or GX_ANISO_4
.GX_LIN_MIP_LIN
filter with GX_TF_RGBA8
texture format which takes twice as much as other formats. However, this argument is assuming an environment where texture cache always hits. On real environments, you will see some performance differences by changing filter modes (especially minification filter) because cache-hit ratio changes according to which filter mode is being used.[in] | obj | ptr to a texture object |
[in] | minfilt | Texture filter types to use when the texel/pixel ratio is >= 1.0 |
[in] | magfilt | Texture filter types to use when the texel/pixel ratio is < 1.0; use only GX_NEAR or GX_LINEAR |
[in] | minlod | minimum LOD value from 0.0 - 10.0 inclusive |
[in] | maxlod | maximum LOD value from 0.0 - 10.0 inclusive |
[in] | lodbias | bias to add to computed LOD value |
[in] | biasclamp | if GX_ENABLE , clamp (LOD+lodbias) so that it is never less than the minimum extent of the pixel projected in texture space |
[in] | edgelod | if GX_ENABLE , compute LOD using adjacent texels |
[in] | maxaniso | Maximum anisotropy filter control to use |
void GX_InitTexObjLODBias | ( | GXTexObj * | obj, |
f32 | lodbias | ||
) |
Sets the LOD bias for a given texture.
The LOD computed by the graphics hardware can be biased using this function. The lodbias is added to the computed lod and the result is clamped between the values given to GX_InitTexObjMinLOD() and GX_InitTexObjMaxLOD(). If GX_ENABLE is given to GX_InitTexObjBiasClamp(), the effect of lodbias will diminish as the polygon becomes more perpendicular to the view direction.
[in] | obj | texture to set the LOD bias for |
[in] | lodbias | bias to add to computed LOD value |
Sets the maximum anisotropic filter to use for a texture.
Anisotropic filtering is accomplished by iterating the square filter along the direction of anisotropy to better approximate the quadralateral. This type of filtering results in sharper textures at the expense of multiple cycles per quad. The hardware will only use multiple cycles when necessary, and the maximum number of cycles is clamped by the maxaniso parameter, so setting maxaniso to GX_ANISO_2 will use at most 2 filter cycles per texture.
[in] | obj | texture to set the max anisotropy value to |
[in] | maxaniso | the maximum anistropic filter to use; must be one of Maximum anisotropy filter control |
void GX_InitTexObjMaxLOD | ( | GXTexObj * | obj, |
f32 | maxlod | ||
) |
Sets the maximum LOD for a given texture.
void GX_InitTexObjMaxLOD(GXTexObj *obj,f32 maxlod)
[in] | obj | texture to set the maximum LOD for |
[in] | maxlod | maximum LOD value; the hardware will use MIN(max_lod, lod); range is 0.0 to 10.0. |
void GX_InitTexObjMinLOD | ( | GXTexObj * | obj, |
f32 | minlod | ||
) |
Sets the minimum LOD for a given texture.
[in] | obj | texture to set the minimum LOD for |
[in] | minlod | minimum LOD value; the hardware will use MAX(min_lod, lod); range is 0.0 to 10.0. |
Allows one to modify the TLUT that is associated with an existing texture object.
[in] | obj | ptr to a texture object |
[in] | tlut_name | TLUT name to use for this texture; default texture configuration recognizes TLUT name |
GX_InitTexObjUserData | ( | GXTexObj * | obj, |
void * | userdata | ||
) |
Used to set a pointer to user data in the GXTexObj structure.
You can use this function to attach private data structures to the texture object. This pointer can be retrieved using GX_GetTexObjUserData().
[in] | obj | ptr to a texture object |
[in] | userdata | pointer to your data to attach to this texture |
Allows one to modify the texture coordinate wrap modes for an existing texture object.
[in] | obj | ptr to a texture object |
[in] | wrap_s | texture coordinate wrapping strategy in the S direction; use GX_CLAMP , GX_REPEAT or GX_MIRROR |
[in] | wrap_t | texture coordinate wrapping strategy in the T direction; use GX_CLAMP , GX_REPEAT or GX_MIRROR |
void GX_InitTexPreloadRegion | ( | GXTexRegion * | region, |
u32 | tmem_even, | ||
u32 | size_even, | ||
u32 | tmem_odd, | ||
u32 | size_odd | ||
) |
Initializes a Texture Memory (TMEM) region object for preloading.
The region is allocated in TMEM by the application and can be used only as a pre-loaded buffer. Cache regions must be allocated by using GX_InitTexCacheRegion(). For pre-loaded textures, the size of the region must match the size of the texture. An application can create many region objects and some of them can overlap; however, no two overlapping regions can be active at the same time.
[in] | region | ptr to a GXTexRegion struct |
[in] | tmem_even | base ptr in TMEM for even LODs; must be 32B aligned |
[in] | size_even | size of the even cache, in bytes; should be multiple of 32B |
[in] | tmem_odd | base ptr in TMEM for odd LODs; must be 32B aligned |
[in] | size_odd | size of the odd cache, in bytes; should be multiple of 32B |
Initializes a Texture Look-Up Table (TLUT) object.
The TLUT object describes the location of the TLUT in main memory, its format and the number of entries. The TLUT in main memory described by this object can be loaded into a TLUT allocated in the texture memory using the GX_LoadTlut() function.
[in] | obj | ptr to a TLUT object |
[in] | lut | ptr to look-up table data; must be 32B aligned |
[in] | fmt | format of the entries in the TLUt; GX_TL_IA8 , GX_TL_RGB565 or GX_TL_RGB5A3 |
[in] | entries | number of entries in this table; maximum is 16,384 |
void GX_InitTlutRegion | ( | GXTlutRegion * | region, |
u32 | tmem_addr, | ||
u8 | tlut_sz | ||
) |
Initializes a Texture Look-Up Table (TLUT) region object.
[in] | region | obj ptr to a TLUT region struct; application must allocate this |
[in] | tmem_addr | location of the TLU in TMEM; ptr must be aligned to table size |
[in] | tlut_sz | size of the table |
void GX_InitXfRasMetric | ( | void | ) |
Initialize the transformation unit (XF) rasterizer unit (RAS) to take performance measurements.
void GX_InvalidateTexAll | ( | void | ) |
Invalidates the current caches of the Texture Memory (TMEM).
It takes about 512 GP clocks to invalidate all the texture caches.
void GX_InvalidateTexRegion | ( | GXTexRegion * | region | ) |
Invalidates the texture cache in Texture Memory (TMEM) described by region.
This function should be called when the CPU is used to modify a texture in main memory, or a new texture is loaded into main memory that is possibly cached in the texture region.
[in] | region | ptr to GXTexRegion object |
void GX_InvVtxCache | ( | void | ) |
Invalidates the vertex cache.
Specifically, this functions invalidates the vertex cache tags. This function should be used whenever you relocate or modify data that is read by, or may be cached by, the vertex cache. The invalidate is very fast, taking only two Graphics Processor (GP) clock cycles to complete.
GX_INDEX8
or GX_INDEX16
in the current vertex descriptor (see GX_SetVtxDesc()) is indexed. Direct data bypasses the vertex cache. Direct data is any attribute that is set to GX_DIRECT
in the current vertex descriptor.void GX_LoadLightObj | ( | const GXLightObj * | lit_obj, |
u8 | lit_id | ||
) |
Loads a light object into a set of hardware registers associated with a Light ID.
This function copies the light object data into the graphics FIFO through the CPU write-gather buffer mechanism. This guarantees that the light object is coherent with the CPU cache.
[in] | lit_obj | ptr to the light object to load |
[in] | lit_id | Light ID to load this light into |
Instructs the GP to fetch the light object at ltobjindx from an array.
The light object is retrieved from the array to which GX_SetArray(GX_VA_LIGHTARRAY, ...)
points. Then it loads the object into the hardware register associated with Light ID.
[in] | litobjidx | index to a light object |
[in] | litid | Light ID to load this light into |
Loads a 3x3 normal matrix into matrix memory at location pnidx from a 3x3 matrix located at index mtxidx from the array in main memory.
The array is set by set by GX_SetArray(), and the matrix is loaded into matrix memory at index pnidx. This matrix can be used to transform normals in model space to view space, either by making the matrix the current one (see GX_SetCurrentMtx()), or by setting a matrix pnidx for each vertex (see GX_SetVtxDesc()). The matrix will be loaded through the vertex cache. You can also load a position matrix (GX_LoadPosMtxImm() or GX_LoadPosMtxIdx()) to the same pnidx.
[in] | mtxidx | index to the matrix array to load |
[in] | pnidx | Position-normal matrix index to load into |
Used to load a normal transform matrix into matrix memory at location pnidx from the 4x3 matrix mt.
This matrix is used to transform normals in model space to view space, either by making it the current matrix (see GX_SetCurrentMtx()), or by setting a matrix pnidx for each vertex. The parameter mt is a pointer to a 3x4 (row x column) matrix. The translation terms in the 3x4 matrix are not needed for normal rotation and are ignored during the load. The parameter pnidx is used to refer to the matrix location (see Position-normal matrix index) in matrix memory.
[in] | mt | the matrix to load |
[in] | pnidx | Position-normal matrix index to load into |
Used to load a normal transform matrix into matrix memory at location pnidx from the 3x3 matrix mt.
This matrix is used to transform normals in model space to view space, either by making it the current matrix (see GX_SetCurrentMtx()), or by setting a matrix pnidx for each vertex. The parameter mt is a pointer to a 3x3 (row x column) matrix. The translation terms in the 3x3 matrix are not needed for normal rotation and are ignored during the load. The parameter pnidx is used to refer to the matrix location (see Position-normal matrix index) in matrix memory.
[in] | mt | the matrix to load |
[in] | pnidx | Position-normal matrix index to load into |
Loads a 3x4 modelview matrix at index mtxidx from the array in main memory.
The array is set by GX_SetArray(), and the matrix is loaded into matrix memory at index pnidx (see Position-normal matrix index). This modelview matrix is used to transform positions in model space to view space, either by making the matrix the current one (see GX_SetCurrentMtx()) or by setting a matrix pnidx for each vertex (see GX_SetVtxDesc()). The matrix will be loaded through the vertex cache.
You can also load a normal matrix (GX_LoadNrmMtxImm() or GX_LoadNrmMtxIdx3x3()) to the same pnidx. Generally, the normal matrix will be the inverse transpose of the position matrix. The normal matrix is used during vertex lighting. In cases where the modelview and inverse transpose of the modelview (excluding translation) are the same, you can load the same matrix for both position and normal transforms. Since indexed matrix loads are through the vertex cache, you will only incur the main memory bandwidth load of one matrix load.
[in] | mtxidx | index to the matrix array to load |
[in] | pnidx | Position-normal matrix index to load into |
Used to load a 3x4 modelview matrix mt into matrix memory at location pnidx.
This matrix can be used to transform positions in model space to view space, either by making the matrix the current one (see GX_SetCurrentMtx()), or by setting a matrix pnidx for each vertex. The parameter mt is a pointer to a 3x4 (row x column) matrix. The parameter pnidx is used to refer to the matrix location (see Position-normal matrix index) in matrix memory.
You can also load a normal matrix (GX_LoadNrmMtxImm() or GX_LoadNrmMtxIdx3x3()) to the same pnidx. Generally, the normal matrix will be the inverse transpose of the position matrix. The normal matrix is used during vertex lighting. In cases where the modelview and inverse transpose of the modelview (excluding translation) are the same, you can load the same matrix for both position and normal transforms.
[in] | mt | the matrix to load |
[in] | pnidx | Position-normal matrix index to load into |
Sets the projection matrix.
GX_PERSPECTIVE
or GX_ORTHOGRAPHIC
.[in] | mt | matrix to use for the perspective |
[in] | type | which perspective type to use |
Loads a texture matrix at index mtxidx from the array in main memory.
The array is set by GX_SetArray(), and the matrix is loaded into matrix memory at location texid. The loaded matrix can be either 2x4 or 3x4 as indicated by type. This matrix can be used to generate texture coordinates from positions, normals, and input texture coordinates (see GX_SetTexCoordGen()). The matrix is loaded through the vertex cache. The size of the matrix to load is indicated by its type. Texture matrices can be either 2x4 or 3x4. GX_MTX_2x4
matrices can be used for simple translations and/or rotations of texture coordinates; GX_MTX_3x4
matrices are used when projection is required.
[in] | mtxidx | index to the matrix array to load |
[in] | texidx | Texture matrix index |
[in] | type | Matrix type |
Loads a texture matrix mt into the matrix memory at location texidx.
The matrix loaded can be either a 2x4 or 3x4 matrix as indicated by type. You can use the loaded matrix to transform texture coordinates, or to generate texture coordinates from position or normal vectors. Such generated texture coordinates are used for projected textures, reflection mapping, etc. See GX_SetTexCoordGen() for more details.
Texture matrices can be either 2x4 or 3x4. GX_MTX_2x4
matrices can be used for simple translations and/or rotations of texture coordinates. GX_MTX_3x4
matrices are used when projection is required.
GX_IDENTITY
matrix is preloaded by GX_Init().[in] | mt | the matrix to load |
[in] | texidx | Texture matrix index |
[in] | type | Matrix type |
Loads the state describing a texture into one of eight hardware register sets.
Before this happens, the texture object obj should be initialized using GX_InitTexObj() or GX_InitTexObjCI(). The id parameter refers to the texture state register set. Once loaded, the texture can be used in any Texture Environment (TEV) stage using GX_SetTevOrder().
[in] | obj | ptr to a texture object |
[in] | mapid | texture map slot, GX_TEXMAP0 to GX_TEXMAP7 only |
void GX_LoadTexObjPreloaded | ( | GXTexObj * | obj, |
GXTexRegion * | region, | ||
u8 | mapid | ||
) |
Loads the state describing a preloaded texture into one of eight hardware register sets.
Before this happens, the texture object obj should be initialized using GX_InitTexObj() or GX_InitTexObjCI(). The mapid parameter refers to the texture state register set. The texture should be loaded beforehand using GX_PreloadEntireTexture(). Once loaded, the texture can be used in any Texture Environment (TEV) stage using GX_SetTevOrder().
GX_TEXMAP0
with GX_TEVSTAGE0
, GX_TEXMAP1
with GX_TEVSTAGE1
, etc.[in] | obj | ptr to a texture object |
[in] | region | ptr to a region object that describes an area of texture memory |
[in] | mapid | texture map slot for reference in a TEV stage |
Copies a Texture Look-Up Table (TLUT) from main memory to Texture Memory (TMEM).
The tlut_name parameter is the name of a pre-allocated area of TMEM. The callback function set by GX_SetTlutRegionCallback() converts the tlut_name into a GXTlutRegion pointer. The TLUT is loaded in the TMEM region described by this pointer. The TLUT object obj describes the location of the TLUT in main memory, the TLUT format, and the TLUT size. obj should have been previously initialized using GX_InitTlutObj().
[in] | obj | ptr to a TLUT object; application must allocate this |
[in] | tlut_name | TLUT name |
Allows the CPU to read a color value directly from the Embedded Frame Buffer (EFB) at position x,y.
[in] | x | coordinate, in pixels; must be 0 - 639 inclusive |
[in] | y | coordinate, in lines; must be 0 - 527 inclusive |
[out] | color | struct to store color in |
Allows the CPU to read a z value directly from the Embedded Frame Buffer (EFB) at position x,y.
The z value is raw integer value from the Z buffer.
[in] | x | coordinate, in pixels; must be 0 - 639 inclusive |
[in] | y | coordinate, in lines; must be 0 - 527 inclusive |
[out] | z | pointer to a returned Z value |
void GX_PixModeSync | ( | void | ) |
Causes the GPU to wait for the pipe to flush.
This function inserts a synchronization command into the graphics FIFO. When the GPU sees this command it will allow the rest of the pipe to flush before continuing. This command is useful in certain situation such as after using GX_CopyTex() and before a primitive that uses the copied texture.
Sets a threshold which is compared to the alpha of pixels written to the Embedded Frame Buffer (EFB) using the GX_Poke*() functions.
The compare function order is:
src_alpha func threshold
[in] | func | Compare type to use |
[in] | threshold | to which the source alpha will be compared to |
void GX_PokeAlphaRead | ( | u8 | mode | ) |
Determines what value of alpha will be read from the Embedded Frame Buffer (EFB).
The mode only applies to GX_Peek*() functions.
GX_READ_NONE
so that you can read correct alpha value from the EFB. If you are using the EFB with no alpha, you should set either of GX_READ_00
or GX_READ_FF
in order to get a certain value.[in] | mode | Alpha read mode that determines value of alpha read from a frame buffer with no alpha channel. |
void GX_PokeAlphaUpdate | ( | u8 | update_enable | ) |
Enables or disables alpha-buffer updates for GX_Poke*() functions.
The normal rendering state (set by GX_SetAlphaUpdate()) is not affected.
[in] | update_enable | enables alpha-buffer updates with GX_TRUE , otherwise does not |
Allows the CPU to write color directly to the Embedded Frame Buffer (EFB) at position x,y.
The alpha value in color can be compared with the current alpha threshold (see GX_PokeAlphaMode()). The color will be blended into the EFB using the blend mode set by GX_PokeBlendMode().
[in] | x | coordinate, in pixels; must be 0 - 639 inclusive |
[in] | y | coordinate, in lines; must be 0 - 527 inclusive |
[in] | color | color to write at the location |
Determines how the source image, is blended with the current Embedded Frame Buffer (EFB).
When type is set to GX_BM_NONE
, no color data is written to the EFB. When type is set to GX_BM_BLEND
, the source and EFB pixels are blended using the following equation:
dst_pix_clr = src_pix_clr * src_fact + dst_pix_clr * dst_fact<br>
When type is set to GX_BM_SUBTRACT
, the destination pixel is computed as follows:
dst_pix_clr = dst_pix_clr - src_pix_clr [clamped to zero]
Note that src_fact and dst_fact are not part of the equation.
GX_PF_RGBA6_Z24
as the pixel format (see GX_SetPixelFmt()).GX_BM_LOGIC
, the source and EFB pixels are blended using logical bitwise operations.[in] | type | Blending type |
[in] | src_fact | source Blending control; the pixel color produced by the graphics processor is multiplied by this factor |
[in] | dst_fact | destination Blending control; the current frame buffer pixel color is multiplied by this factor |
[in] | op | Logical operation type to use |
void GX_PokeColorUpdate | ( | u8 | update_enable | ) |
Enables or disables color-buffer updates when writing the Embedded Frame Buffer (EFB) using the GX_Poke*() functions.
[in] | update_enable | enables color-buffer updates with GX_TRUE , otherwise does not |
void GX_PokeDither | ( | u8 | dither | ) |
Enables dithering when writing the Embedded Frame Buffer (EFB) using GX_Poke*() functions.
GX_PF_RGBA6_Z24
or GX_PF_RGB565_Z16
.[in] | dither | if set to GX_TRUE and pixel format is one of the above, dithering is enabled; otherwise disabled |
Sets a constant alpha value for writing to the Embedded Frame Buffer (EFB).
The EFB pixel type must have an alpha channel for this function to be effective (see GX_SetPixelFmt()). The blending operations (see GX_PokeBlendMode()) still use source alpha but when writing the pixel color, the constant a will replace the pixel alpha in the EFB.
[in] | enable | if set to GX_ENABLE and pixel format supports dest alpha, a will be written to the framebuffer |
[in] | a | constant alpha value |
Allows the CPU to write a z value directly to the Embedded Frame Buffer (EFB) at position x,y.
The z value can be compared with the current contents of the EFB. The Z compare fuction is set using GX_PokeZMode().
[in] | x | coordinate, in pixels; must be 0 - 639 inclusive |
[in] | y | coordinate, in lines; must be 0 - 527 inclusive |
[in] | z | value to write at position x,y in the EFB |
Sets the Z-buffer compare mode when writing the Embedded Frame Buffer (EFB).
The result of the Z compare is used to conditionally write color values to the EFB. The Z value will be updated according to the result of the compare if Z update is enabled.
When comp_enable is set to GX_DISABLE
, poke Z buffering is disabled and the Z buffer is not updated. The func parameter determines the comparison that is performed. In the comparison function, the poked Z value is on the left while the Z value from the Z buffer is on the right. If the result of the comparison is false, the poked Z value is discarded. The parameter update_enable determines whether or not the Z buffer is updated with the new Z value after a comparison is performed.
GX_FALSE
, compares may still be enabled.[in] | comp_enable | enables comparisons with source and destination Z values if GX_TRUE |
[in] | func | Compare type function to use |
[in] | update_enable | enables Z-buffer updates when GX_TRUE |
void GX_PreloadEntireTexture | ( | GXTexObj * | obj, |
GXTexRegion * | region | ||
) |
Loads a given texture from DRAM into the texture memory.
Accesses to this texture will bypass the texture cache tag look-up and instead read the texels directly from texture memory. The texture region must be the same size as the texture (see GX_InitTexPreloadRegion()).
[in] | obj | ptr to object describing the texture to laod |
[in] | region | TMEM texture region to load the texture into |
Returns the bounding box of pixel coordinates that are drawn in the Embedded Framebuffer (EFB).
This function reads the bounding box values. GX_ClearBoundingBox() can be used reset the values of the bounding box.
[out] | top | uppermost line in the bounding box |
[out] | bottom | lowest line in the bounding box |
[out] | left | leftmost pixel in the bounding box |
[out] | right | rightmost pixel in the bounding box |
Returns the count of the previously set performance metrics.
[out] | cnt0 | current value of GP counter 0 |
[out] | cnt1 | current value of GP counter 1 |
Returns Vertex Cache performance counters.
Each call to this function resets the counter to zero. GX_SetVCacheMetric() sets the metric to be measured by the Vertex Cache performance counter.
[out] | check | total number of accesses to the vertex cache |
[out] | miss | total number of cache misses to the vertex cache |
[out] | stall | number of GP clocks that the vertex cache was stalled |
Read performance metric values from the XF and RAS units.
[out] | xfwaitin | Number of clocks the XF has waited for data to arrive? |
[out] | xfwaitout | Number of clocks the XF has waited to push finished data down? |
[out] | rasbusy | Number of clocks the RAS has spent being busy? |
[out] | clks | Clocks that have passed since last count reset? |
volatile void * GX_RedirectWriteGatherPipe | ( | void * | ptr | ) |
Temporarily points the CPU's write-gather pipe at a new location.
After calling this function, subsequent writes to the address returned by this function (or the WGPipe union) will be gathered and sent to a destination buffer. The write pointer is automatically incremented by the GP. The write gather pipe can be restored by calling GX_RestoreWriteGatherPipe(). This function cannot be called between a GX_Begin()/GX_End() pair.
[in] | ptr | to destination buffer, 32-byte aligned |
void GX_RestoreWriteGatherPipe | ( | void | ) |
Restores the write-gather pipe.
The CPU fifo that was attached at the time GX_RedirectWriteGatherPipe() was called will be re-attached. If there is data pending in the write gather pipe (e.g. if the amount of data written was not a multiple of 32 bytes), the data will be padded with zeroes and flushed out.
Sets the parameters for the alpha compare function which uses the alpha output from the last active TEV stage.
The alpha compare operation is:
alpha_pass = (alpha_src (comp0) ref0) (op) (alpha_src (comp1) ref1)
where alpha_src is the alpha from the last active TEV stage. As an example, you can implement these equations:
alpha_pass = (alpha_src > ref0) AND (alpha_src < ref1)
or
alpha_pass = (alpha_src > ref0) OR (alpha_src < ref1)
[in] | comp0 | Compare type subfunction 0 |
[in] | ref0 | reference val for subfunction 0 |
[in] | aop | Alpha combine control for combining subfunctions 0 and 1; must not be GX_MAX_ALPHAOP |
[in] | comp1 | Compare type subfunction 1 |
[in] | ref1 | reference val for subfunction 1 |
void GX_SetAlphaUpdate | ( | u8 | enable | ) |
Enables or disables alpha-buffer updates of the Embedded Frame Buffer (EFB).
GX_PF_RGBA6_Z24
; see GX_SetPixelFmt(). The alpha enable is ignored for non-alpha pixel formats.[in] | enable | enables alpha-buffer updates with GX_TRUE |
Sets the array base pointer and stride for a single attribute.
The array base and stride are used to compute the address of indexed attribute data using the equation:
attr_addr = ptr + attr_idx * stride
When drawing a graphics primitive that has been enabled to use indexed attributes (see GX_SetVtxDesc()), attr_idx is supplied in the vertex data. The format and size of the data in the array must also be described using GX_SetVtxAttrFmt(). You can also index other data, such as matrices (see GX_LoadPosMtxIdx(), GX_LoadNrmMtxIdx3x3(), and GX_LoadTexMtxIdx()), and light objects (see GX_LoadLightObjIdx()). In the case of matrices and light objects, the size and format of the data to be loaded is implied by the function call.
There is a base pointer, ptr, for each type of attribute as well as for light data and matrices. Each attribute can be stored in its own array for maximum data compression (i.e., removal of redundant attribute data). The stride is in byte units and is the distance between attributes in the array.
[in] | attr | Vertex attribute array type that the array is storing |
[in] | ptr | pointer to the array itself |
[in] | stride | stride (in bytes) between each element in the array |
Determines how the source image, generated by the graphics processor, is blended with the Embedded Frame Buffer (EFB).
When type is set to GX_BM_NONE
, the source data is written directly to the EFB. When type is set to GX_BM_BLEND
, the source color and EFB pixels are blended using the following equation:
dst_pix_clr = src_pix_clr * src_fact + dst_pix_clr * dst_fact
The GX_BL_DSTALPHA
/ GX_BL_INVDSTALPHA
can be used only when the EFB has GX_PF_RGBA6_Z24
as the pixel format (see GX_SetPixelFmt()). If the pixel format is GX_PF_RGBA6_Z24
then the src_fact and dst_fact are also applied to the alpha channel. To write the alpha channel to the EFB you must call GX_SetAlphaUpdate().
When type is set to GX_BM_LOGIC
, the source and EFB pixels are blended using logical bitwise operations. When type is set to GX_BM_SUBTRACT
, the destination pixel is computed as follows:
dst_pix_clr = dst_pix_clr - src_pix_clr [clamped to zero]
Note that src_fact and dst_fact are not part of this equation.
[in] | type | Blending type |
[in] | src_fact | Blending control |
[in] | dst_fact | Blending control |
[in] | op | Logical operation type |
GXBreakPtCallback GX_SetBreakPtCallback | ( | GXBreakPtCallback | cb | ) |
Registers cb as a function to be invoked when a break point is encountered.
[in] | cb | function to be invoked when the breakpoint is encountered; NULL means no function will run |
Sets the ambient color register for color channel chan.
This color will be used by the channel as the ambient color if the ambient source, set by GX_SetChanCtrl(), is GX_SRC_REG
.
[in] | channel | channel to set |
[in] | color | color to set it to |
void GX_SetChanCtrl | ( | s32 | channel, |
u8 | enable, | ||
u8 | ambsrc, | ||
u8 | matsrc, | ||
u8 | litmask, | ||
u8 | diff_fn, | ||
u8 | attn_fn | ||
) |
Sets the lighting controls for a particular color channel.
The color channel can have one or more (up to 8) lights associated with it, set using litmask. The diff_fn and attn_fn parameters control the lighting equation for all lights associated with this channel; the ambsrc and matsrc can be used to select whether the input source colors come from register colors or vertex colors. When the channel enable is set to GX_FALSE
, the material color source (set by matsrc) is passed through as the channel's output color. When the channel enable is GX_TRUE
, the output color depends on the settings of the other controls (i.e., the lighting equation). GX_Init() sets the enable for all channels to GX_FALSE
. This function only configures the lighting channel; to output the result of the channel computation, use GX_SetNumChans().
GX_COLOR0
and GX_ALPHA0
are controlled separately for lighting, they are rasterized together as one RGBA color, effectively GX_COLOR0A0
. The same is true for GX_COLOR1
and GX_ALPHA1
– effectively, they are rasterized as GX_COLOR1A1
. Since there is only one rasterizer for color in the graphics hardware, you must choose which color to rasterize for each stage in the Texture Environment (TEV) unit. This is accomplished using GX_SetTevOrder().GX_COLOR1A1
, two colors per vertex must be supplied, i.e. both GX_VA_CLR0
and GX_VA_CLR1
must be enabled in the current vertex descriptor. If only GX_VA_CLR0
or GX_VA_CLR1
is enabled in the current vertex descriptor, the vertex color is directed to the channel GX_VA_COLOR0A0
.GX_SRC_REG
, the color set by GX_SetChanAmbColor() is used as the ambient color. When matsrc is GX_SRC_REG
, the color set by GX_SetChanMatColor() is used as the material color.[in] | channel | color channel to use |
[in] | enable | whether or not to enable lighting for this channel |
[in] | ambsrc | source for the ambient color |
[in] | matsrc | source for the material color |
[in] | litmask | Light ID or IDs to associate with this channel |
[in] | diff_fn | Diffuse function to use |
[in] | attn_fn | Attenuation function to use |
Sets the material color register for color channel chan.
This color will be used by the channel as the material color if the material source, set by GX_SetChanCtrl(), is GX_SRC_REG
.
[in] | channel | channel to set |
[in] | color | color to set it to |
void GX_SetClipMode | ( | u8 | mode | ) |
Enables or disables clipping of geometry.
This may help performance issues that occur when objects are far-clipped; however, any near-clipped objects will be rendered incorrectly.
GX_CLIP_ENABLE
.[in] | mode | Clipping mode |
void GX_SetColorUpdate | ( | u8 | enable | ) |
Enables or disables color-buffer updates when rendering into the Embedded Frame Buffer (EFB).
[in] | enable | enables color-buffer updates with GX_TRUE |
void GX_SetCoPlanar | ( | u8 | enable | ) |
Enables or disables coplanar triangle processing.
While coplanar mode is enabled, all subsequent triangles (called decal triangles) will have the same Z coefficients as the reference plane. Coplanar mode should be enabled immediately after a reference triangle is drawn.
GX_SetCullMode(GX_CULL_ALL)
to create an invisible reference plane; however, the reference triangle must not be completely out of view, i.e. trivially rejected by clipping.[in] | enable | when GX_ENABLE , coplanar mode is enabled; GX_DISABLE disables this mode |
void GX_SetCopyClamp | ( | u8 | clamp | ) |
Sets the vertical clamping mode to use during the EFB to XFB or texture copy.
[in] | clamp | bit-wise OR of desired XFB clamp modes. Use GX_CLAMP_NONE for no clamping. |
Sets color and Z value to clear the EFB to during copy operations.
These values are used during both display copies and texture copies.
[in] | color | RGBA color (8-bit/component) to use during clear operation. |
[in] | zvalue | 24-bit Z value to use during clear operation. Use the constant GX_MAX_Z24 to specify the maximum depth value. |
Sets the subpixel sample patterns and vertical filter coefficients used to filter subpixels into pixels.
This function normally uses the aa, sample_pattern and vfilter provided by the render mode struct:
GX_PF_RGB565_Z16
; see GX_SetPixelFmt().[in] | aa | utilizes sample_pattern if GX_TRUE , otherwise all sample points are centered |
[in] | sample_pattern | array of coordinates for sample points; valid range is 1 - 11 inclusive |
[in] | vf | use vfilter if GX_TRUE , otherwise use default 1-line filter |
[in] | vfilter | vertical filter coefficients; valid coefficient range is 0 - 63 inclusive; sum should equal 64 |
void GX_SetCPUFifo | ( | GXFifoObj * | fifo | ) |
Attaches a FIFO to the CPU.
[in] | fifo | fifo struct containing info on the FIFO to attach |
void GX_SetCullMode | ( | u8 | mode | ) |
Enables or disables culling of geometry based on its orientation to the viewer.
Primitives in which the vertex order is clockwise to the viewer are considered front-facing.
GX_CULL_BACK
.[in] | mode | Backface culling mode |
lwp_t GX_SetCurrentGXThread | ( | void | ) |
Sets the current GX thread to the calling thread.
The new thread should be the thread that will be responsible for generating graphics data. By default, the GX thread is the thread that invoked GX_Init(); however, it may be changed by calling this function.
void GX_SetCurrentMtx | ( | u32 | mtx | ) |
Selects a specific matrix to use for transformations.
The matrix mtx specified will be used to select the current modelview transform matrix and normal transform matrix, as long as a matrix index is not present in the vertex data (see GX_SetVtxDesc()). If the current vertex descriptor enables GX_VA_PTNMTXIDX
, the matrix mtx specified by this function will be overwritten when the vertices are drawn.
[in] | mtx | Position-normal matrix index |
Sets the witdth and height of the display buffer in pixels.
The application typical renders an image into the EFB(source) and then copies it into the XFB(destination) in main memory. wd specifies the number of pixels between adjacent lines in the destination buffer and can be different than the width of the EFB.
[in] | wd | Distance between successive lines in the XFB, in pixels. Must be a multiple of 16. |
[in] | ht | Height of the XFB in lines. |
void GX_SetDispCopyFrame2Field | ( | u8 | mode | ) |
Determines which lines are read from the Embedded Frame Buffer (EFB) when using GX_CopyDisp().
Specifically, it determines whether all lines, only even lines, or only odd lines are read.
GX_COPY_PROGRESSIVE
mode.[in] | mode | EFB copy mode to determine which field to copy (or both) |
void GX_SetDispCopyGamma | ( | u8 | gamma | ) |
Sets the gamma correction applied to pixels during EFB to XFB copy operation.
[in] | gamma | Gamma values |
Sets the source parameters for the EFB to XFB copy operation.
[in] | left | left most source pixel to copy. Must be a multiple of 2 pixels. |
[in] | top | top most source line to copy. Must be a multiple of 2 lines. |
[in] | wd | width in pixels to copy. Must be a multiple of 2 pixels. |
[in] | ht | height in lines to copy. Must be a multiple of 2 lines. |
u32 GX_SetDispCopyYScale | ( | f32 | yscale | ) |
Sets the vertical scale factor for the EFB to XFB copy operation.
The number of actual lines copied is returned, based on the current EFB height. You can use this number to allocate the proper XFB size. You have to call GX_SetDispCopySrc() prior to this function call if you want to get the number of lines by using this function.
[in] | yscale | Vertical scale value. Range from 1.0 to 256.0. |
void GX_SetDither | ( | u8 | dither | ) |
Enables or disables dithering.
A 4x4 Bayer matrix is used for dithering.
GX_PF_RGBA6_Z24
or GX_PF_RGB565_Z16
.[in] | dither | enables dithering if GX_TRUE is given and pixel format is one of the two above, otherwise disabled |
void GX_SetDrawDone | ( | void | ) |
Sends a DrawDone command to the GP.
When all previous commands have been processed and the pipeline is empty, a DrawDone status bit will be set, and an interrupt will occur. You can receive notification of this event by installing a callback on the interrupt with GX_SetDrawDoneCallback(), or you can poll the status bit with GX_WaitDrawDone(). This function also flushes the write-gather FIFO in the CPU to make sure that all commands are sent to the graphics processor.
GXDrawDoneCallback GX_SetDrawDoneCallback | ( | GXDrawDoneCallback | cb | ) |
Installs a callback that is invoked whenever a DrawDone command is encountered by the GP.
The DrawDone command is sent by GX_SetDrawDone().
[in] | cb | callback to be invoked when DrawDone is encountered |
void GX_SetDrawSync | ( | u16 | token | ) |
This function sends a token into the command stream.
When the token register is set, an interrupt will also be received by the CPU. You can install a callback on this interrupt with GX_SetDrawSyncCallback(). Draw syncs can be used to notify the CPU that the graphics processor is finished using a shared resource (a vertex array for instance).
[in] | token | 16-bit value to write to the token register. |
GXDrawSyncCallback GX_SetDrawSyncCallback | ( | GXDrawSyncCallback | cb | ) |
Installs a callback that is invoked whenever a DrawSync token is encountered by the graphics pipeline.
The callback's argument is the value of the token most recently encountered. Since it is possible to miss tokens (graphics processing does not stop while the callback is running), your code should be capable of deducing if any tokens have been missed.
[in] | cb | callback to be invoked when the DrawSync tokens are encountered in the graphics pipeline. |
Sets a constant alpha value for writing to the Embedded Frame Buffer (EFB).
[in] | enable | a will be written to the framebuffer if GX_ENABLE is here and frame buffer pixel format supports destination alpha |
[in] | a | constant alpha value |
selectively enables and disables interlacing of the frame buffer image.
This function is used when rendering fields to an interlaced Embedded Frame Buffer (EFB).
GX_FALSE
, that field will not be written to the EFB, but the other field will be computed. In other words, you pay the fill rate price of a frame to produce a field.[in] | even_mask | whether to write pixels with even Y coordinate |
[in] | odd_mask | whether to write pixels with odd Y coordinate |
Controls various rasterization and texturing parameters that relate to field-mode and double-strike rendering.
In field-mode rendering, one must adjust the vertical part of the texture LOD computation to account for the fact that pixels cover only half of the space from one rendered scan line to the next (with the other half of the space filled by a pixel from the other field). In both field-mode and double-strike rendering, one must adjust the aspect ratio for points and lines to account for the fact that pixels will be double-height when displayed (the pixel aspect ratio is 1/2).
[in] | field_mode | adjusts texture LOD computation as described above if true, otherwise does not |
[in] | half_aspect_ratio | adjusts line aspect ratio accordingly, otherwise does not |
Enables fog.
Using type, the programmer may select one of several functions to control the fog density as a function of range to a quad (2x2 pixels). Range is cosine corrected Z in the x-z plane (eye coordinates), but is not corrected in the y direction (see GX_SetFogRangeAdj()). The parameters startz and endz allow further control over the fog behavior. The parameters nearz and farz should be set consistent with the projection matrix parameters. Note that these parameters are defined in eye-space. The fog color, in RGBX format (i.e. the alpha component is ignored), is set using the col parameter. This will be the color of the pixel when fully fogged.
[in] | type | Fog equation control to use |
[in] | startz | minimum Z value at which the fog function is active |
[in] | endz | maximum Z value at which the fog function is active |
[in] | nearz | near plane (which should match the projection matrix parameters) |
[in] | farz | far plane (which should match the projection matrix parameters) |
[in] | col | fog color; alpha component is ignored |
GX_SetFogColor | ( | GXColor | color | ) |
Sets the fog color.
color is the color that a pixel will be if fully fogged. Alpha channel is ignored.
[in] | color | color to set fog to |
void GX_SetFogRangeAdj | ( | u8 | enable, |
u16 | center, | ||
GXFogAdjTbl * | table | ||
) |
Enables or disables horizontal fog-range adjustment.
This adjustment is a factor that is multiplied by the eye-space Z used for fog computation; it is based upon the X position of the pixels being rendered. The Y direction is not compensated. This effectively increases the fog density at the edges of the screen, making for a more realistic fog effect. The adjustment is computed per quad (2x2 pixels), not per-pixel. The center of the viewport is specified using center. The range adjustment table is specified using table. The range adjust function is mirrored horizontally about the center.
[in] | enable | enables adjustment when GX_ENABLE is passed; disabled with GX_DISABLE |
[in] | center | centers the range adjust function; normally corresponds with the center of the viewport |
[in] | table | range adjustment parameter table |
void GX_SetGPFifo | ( | GXFifoObj * | fifo | ) |
Attaches fifo to the GP.
[in] | fifo | struct containing info on the FIFO to attach |
Sets two performance metrics to measure in the GP.
perf0 and perf1 are set to measure. The initial metrics measured are GX_PERF0_NONE
and GX_PERF1_NONE
, which return counts of zero for the first call to GX_ReadGPMetric().
Each performance counter has a unique set of events or ratios that it can count. In some cases the same metric can be counted using both counters, for example GX_PERF0_VERTICES
and GX_PERF1_VERTICES
. Ratios (the metric name ends in _RATIO
) are multiplied by 1000 (1000 = all misses/clips, etc., 0 = no misses/clips, etc.).
[in] | perf0 | Performance counter 0 metric to measure |
[in] | perf1 | Performance counter 1 metric to measure |
Allows the sharing of a texcoord between an indirect stage and a regular TEV stage.
It allows the texture coordinates to be scaled down for use with an indirect map that is smaller than the corresponding regular map.
[in] | indtexid | Indirect texture stage being affected |
[in] | scale_s | Indirect texture scale factor for the S coord |
[in] | scale_t | Indirect texture scale factor for the T coord |
Sets one of the three static indirect matrices and the associated scale factor.
The indirect matrix and scale is used to process the results of an indirect lookup in order to produce offsets to use during a regular lookup. The matrix is multiplied by the [S T U] offsets that have been extracted (and optionally biased) from the indirect lookup color. In this matrix-vector multiply, the matrix is on the left and the [S T U] column vector is on the right.
[in] | indtexmtx | Indirect texture matrix that is being affected |
[in] | offset_mtx | values to assign to the indirect matrix |
[in] | scale_exp | exponent to use for the associated scale factor |
Used to specify the texcoord and texmap to used with a given indirect lookup.
[in] | indtexstage | Indirect texture stage being affected |
[in] | texcoord | texture coordinate slot to be used for this stage |
[in] | texmap | texture map slot to be used for this stage |
Sets the width of line primitives.
The parameter fmt is added to the texture coordinate to obtain texture coordinates at the other corners of a wide line. The fmt values are added after the texture coordinate generation operation; see GX_SetTexCoordGen().
[in] | width | width of the line in 1/16th pixel increments; maximum width is 42.5 px |
[in] | fmt | Texture offset value |
Sets miscellanous settings in the GP.
[in] | token | setting to change |
[in] | value | value to change the setting to |
void GX_SetNumChans | ( | u8 | num | ) |
Sets the number of color channels that are output to the TEV stages.
Color channels are the mechanism used to compute per-vertex lighting effects. Color channels are controlled using GX_SetChanCtrl(). Color channels are linked to specific TEV stages using GX_SetTevOrder().
This function basically defines the number of per-vertex colors that get rasterized. If num is set to 0, then at least one texture coordinate must be generated (see GX_SetNumTexGens()). If num is set to 1, then channel GX_COLOR0A0
will be rasterized. If num is set to 2 (the maximum value), then GX_COLOR0A0
and GX_COLOR1A1
will be rasterized.
[in] | num | number of color channels to rasterize; number must be 0, 1 or 2 |
void GX_SetNumIndStages | ( | u8 | nstages | ) |
Used to set how many indirect lookups will take place.
The results from these indirect lookups may then be used to alter the lookups for any number of regular TEV stages.
[in] | nstages | number of indirect lookup stages |
void GX_SetNumTevStages | ( | u8 | num | ) |
Enables a consecutive number of TEV stages.
The output pixel color (before fogging and blending) is the result from the last stage. The last TEV stage must write to register GX_TEVPREV
; see GX_SetTevColorOp() and GX_SetTevAlphaOp(). At least one TEV stage must be enabled. If a Z-texture is enabled, the Z texture must be looked up on the last stage; see GX_SetZTexture().
[in] | num | number of active TEV stages, between 1 and 16 inclusive |
void GX_SetNumTexGens | ( | u32 | nr | ) |
Sets the number of texture coordinates that are generated and available for use in the Texture Environment TEV stages.
Texture coordinates are generated from input data as described by GX_SetTexCoordGen(). The generated texture coordinates are linked to specific textures and specific TEV stages using GX_SetTevOrder().
GX_TEXCOORD0
. A maximum of 8 texture coordinates may be generated. If nr is set to 0, no texture coordinates will be generated. In this case, at least one color channel must be output (see GX_SetNumChans()).[in] | nr | number of tex coords to generate, between 0 and 8 inclusive |
Sets the format of pixels in the Embedded Frame Buffer (EFB).
There are two non-antialiased pix_fmts: GX_PF_RGB8_Z24
and GX_PF_RGBA6_Z24
. The stride of the EFB is fixed at 640 pixels. The non-antialiased EFB has 528 lines available.
When pix_fmt is set to GX_PF_RGB565_Z16
, multi-sample antialiasing is enabled. In order to get proper results, one must also call GX_SetCopyFilter(). The position of the subsamples and the antialiasing filter coefficients are set using GX_SetCopyFilter(). When antialiasing, three 16b color/Z samples are computed for each pixel, and the total available number of pixels in the EFB is reduced by half (640 pixels x 264 lines). This function also sets the compression type for 16-bit Z formats, which allows trading off Z precision for range. The following guidelines apply:
a) far/near ratio <= 2^16, use GX_ZC_LINEAR
b) far/near ratio <= 2^18, use GX_ZC_NEAR
c) far/near ratio <= 2^20, use GX_ZC_MID
d) far/near ratio <= 2^24, use GX_ZC_FAR
It is always best to use as little compression as possible (choice "a" is least compressed, choice "d" is most compressed). You get less precision with higher compression. The "far" in the above list does not necessarily refer to the far clipping plane. You should think of it as the farthest object you want correct occlusion for.
[in] | pix_fmt | GX_PF_RGB8_Z24 or GX_PF_RGBA6_Z24 for non-AA, GX_PF_RGB565_Z16 for AA |
[in] | z_fmt | Compressed Z format to use |
Sets the size of point primitives.
The parameter fmt is added to the texture coordinate(s), if any, to obtain texture coordinates at the other corners of a point. The fmts are added after the texture coordinate generation operation; see GX_SetTexCoordGen().
[in] | width | width of the point in 1/16th pixel increments; maximum width is 42.5 px |
[in] | fmt | Texture offset value |
Sets the scissor rectangle.
The scissor rectangle specifies an area of the screen outside of which all primitives are culled. This function sets the scissor rectangle in screen coordinates. The screen origin (xOrigin=0, yOrigin=0) is at the top left corner of the display.
The values may be within the range of 0 - 2047 inclusive. Using values that extend beyond the EFB size is allowable since the scissor box may be repositioned within the EFB using GX_SetScissorBoxOffset().
[in] | xOrigin | left-most coord in screen coordinates |
[in] | yOrigin | top-most coord in screen coordinates |
[in] | wd | width of the scissorbox in screen coordinates |
[in] | ht | height of the scissorbox in screen coordinates |
Repositions the scissorbox rectangle within the Embedded Frame Buffer (EFB) memory space.
The offsets are subtracted from the screen coordinates to determine the actual EFB coordinates where the pixels are stored. Thus with positive offsets, the scissor box may be shifted left and/or up; and with negative offsets, the scissor box may be shifted right and/or down.
The intended use for this command is to make it easy to do two-pass antialiased rendering. To draw the top half of the screen, the scissor box is set to the top and the offset set to zero. To draw the bottom half, the scissor box is set to the bottom, and the offset is set to shift the scissor box back up to the top.
Another use for the offset is to displace how an image is rendered with respect to the dither matrix. Since the dither matrix is 4x4, a yoffset of -2 shifts the image down by 2 lines with respect to the matrix. This can be useful for field-rendering mode.
[in] | xoffset | number of pixels to shift the scissorbox left, between -342 - 382 inclusive; must be even |
[in] | yoffset | number of pixels to shift the scissorbox up, between -342 - 494 inclusive; must be even |
Sets the alpha input sources for one tevstage of the Texture Environment (TEV) alpha combiner.
There are fewer alpha inputs than color inputs, and there are no color channels available in the alpha combiner.
[in] | tevstage | TEV stage |
[in] | a | TEV alpha combiner input |
[in] | b | TEV alpha combiner input |
[in] | c | TEV alpha combiner input |
[in] | d | TEV alpha combiner input |
Sets the tevop, tevbias, tevscale and clamp-mode operation for the alpha combiner for this tevstage of the TEV unit.
This function also specifies the register, tevregid, that will contain the result of the alpha combiner function. The alpha combiner function is:
\a tevregid = (d (\a tevop) ((1.0 - c)*a + c*b) + \a tevbias) * \a tevscale;<br><br>
The input sources a,b,c and d are set using GX_SetTevAlphaIn().
[in] | tevstage | TEV stage. |
[in] | tevop | TEV combiner operator |
[in] | tevbias | TEV bias value. |
[in] | tevscale | TEV scale value. |
[in] | clamp | Clamp results when GX_TRUE . |
[in] | tevregid | TEV color/output register |
Used to set one of the primary color registers in the TEV unit.
These registers are available to all TEV stages. At least one of these registers is used to pass the output of one TEV stage to the next in a multi-texture configuration. The application is responsible for allocating these registers so that no collisions in usage occur.
[in] | tev_regid | TEV color/output register. |
[in] | color | Constant color value. |
Sets the color input sources for one tevstage of the Texture Environment (TEV) color combiner.
This includes constant (register) colors and alphas, texture color/alpha, rasterized color/alpha (the result of per-vertex lighting), and a few useful constants.
[in] | tevstage | TEV stage |
[in] | a | TEV color combiner input |
[in] | b | TEV color combiner input |
[in] | c | TEV color combiner input |
[in] | d | TEV color combiner input |
Sets the tevop, tevbias, tevscale and clamp-mode operation for the color combiner for this tevstage of the TEV unit.
This function also specifies the register, tevregid, that will contain the result of the color combiner function. The color combiner function is:
\a tevregid = (d (\a tevop) ((1.0 - c)*a + c*b) + \a tevbias) * \a tevscale;<br><br>
The input sources a,b,c and d are set using GX_SetTevColorIn().
[in] | tevstage | TEV stage. |
[in] | tevop | TEV combiner operator |
[in] | tevbias | TEV bias value. |
[in] | tevscale | TEV scale value. |
[in] | clamp | Clamp results when GX_TRUE . |
[in] | tevregid | TEV color/output register |
void GX_SetTevColorS10 | ( | u8 | tev_regid, |
GXColorS10 | color | ||
) |
Used to set one of the constant color registers in the TEV unit.
These registers are available to all TEV stages. At least one of these registers is used to pass the output of one TEV stage to the next in a multi-texture configuration. The application is responsible for allocating these registers so that no collisions in usage occur.
[in] | tev_regid | TEV color/output register. |
[in] | color | Constant color value in S10 format. |
void GX_SetTevDirect | ( | u8 | tevstage | ) |
Used to turn off all indirect texture processing for the specified regular TEV stage.
[in] | tevstage | the TEV stage to change |
Sets up an environment-mapped bump-mapped indirect lookup.
The indirect map specifies offsets in (S,T) space. This kind of lookup requires 3 TEV stages to compute. As a result of all this work, a simple 2D bump map is properly oriented to the surface to which it is applied. It is used to alter a normal-based texgen which then looks up an environment map. The environment map may be a simple light map, or else it may be a reflection map of the surrounding scenery.
[in] | tevstage | TEV stage that is being affected |
[in] | indstage | Indirect texture stage results to use with this TEV stage |
[in] | mtx_sel | which Indirect texture matrix to multiply the offsets with |
Sets up an environment-mapped bump-mapped indirect lookup.
The indirect map specifies offsets in object (X, Y, Z) space. This kind of lookup requires only one TEV stage to compute; however, the bump map (indirect map) used is geometry-specific. Thus there is a space/computation tradeoff between using this function and using GX_SetTevIndBumpST().
[in] | tevstage | TEV stage that is being affected |
[in] | indstage | Indirect texture stage results to use with this TEV stage |
[in] | mtx_sel | which Indirect texture matrix to multiply the offsets with |
void GX_SetTevIndirect | ( | u8 | tevstage, |
u8 | indtexid, | ||
u8 | format, | ||
u8 | bias, | ||
u8 | mtxid, | ||
u8 | wrap_s, | ||
u8 | wrap_t, | ||
u8 | addprev, | ||
u8 | utclod, | ||
u8 | a | ||
) |
Controls how the results from an indirect lookup will be used to modify a given regular TEV stage lookup.
[in] | tevstage | TEV stage being affected |
[in] | indtexid | Indirect texture stage results to use with this TEV stage |
[in] | format | Indirect texture format, i.e. how many bits to extract from the indirect result color to use in indirect offsets and the indirect "bump" alpha |
[in] | bias | Indirect texture bias select to be applied to each component of the indirect offset |
[in] | mtxid | which Indirect texture matrix and scale value to multiply the offsets with |
[in] | wrap_s | Indirect texture wrap value to use with the S component of the regular texture coordinate |
[in] | wrap_t | Indirect texture wrap value to use with the T component of the regular texture coordinate |
[in] | addprev | whether the tex coords results from the previous TEV stage should be added in |
[in] | utclod | whether to the unmodified (GX_TRUE ) or modified (GX_FALSE ) tex coords for mipmap LOD computation |
[in] | a | which offset component will supply the Indirect texture bump alpha select, if any |
void GX_SetTevIndRepeat | ( | u8 | tevstage | ) |
Set a given TEV stage to use the same texture coordinates as were computed in the previous stage.
[in] | tevstage | TEV stage to modify |
void GX_SetTevIndTile | ( | u8 | tevstage, |
u8 | indtexid, | ||
u16 | tilesize_x, | ||
u16 | tilesize_y, | ||
u16 | tilespacing_x, | ||
u16 | tilespacing_y, | ||
u8 | indtexfmt, | ||
u8 | indtexmtx, | ||
u8 | bias_sel, | ||
u8 | alpha_sel | ||
) |
Used to implement tiled texturing using indirect textures.
It will set up the correct values in the given indirect matrix; you only need to specify which matrix slot to use.
[in] | tevstage | TEV stage that is being affected |
[in] | indtexid | Indirect texture stage results to use with this TEV stage |
[in] | tilesize_x | size of the tile in the X dimension |
[in] | tilesize_y | size of the tile in the Y dimension |
[in] | tilespacing_x | spacing of the tiles (in the tile-definition map) in the X dimension |
[in] | tilespacing_y | spacing of the tiles (in the tile-definition map) in the Y dimension |
[in] | indtexfmt | Indirect texture format to use |
[in] | indtexmtx | Indirect texture matrix to multiply the offsets with |
[in] | bias_sel | Indirect texture bias select to indicate tile stacking direction for pseudo-3D textures |
[in] | alpha_sel | which Indirect texture bump alpha select will supply the indirect "bump" alpha, if any (for pseudo-3D textures). |
Used to warp a normal texture lookup using an indirect texture map with 8-bit offsets.
[in] | tevstage | TEV stage that is being affected |
[in] | indtexid | Indirect texture stage results to use with this TEV stage |
[in] | bias_flag | biases the indirect texture map offsets by -128 if the value is GX_TRUE |
[in] | replace_tex | GX_TRUE makes the indirect texture map offsets replace the input texture coordinates rather than offset them as with GX_FALSE |
[in] | mtxid | which Indirect texture matrix to use for warping the texture |
Selects a "konstant" alpha input to be used in a given TEV stage.
The constant alpha input is used only if GX_CA_KONST
is selected for an input for that TEV stage. Only one constant alpha selection is available for a given TEV stage, though it may be used for more than one input.
[in] | tevstage | TEV stage |
[in] | sel | TEV constant alpha selection |
Sets one of the "konstant" color registers in the TEV unit.
These registers are available to all TEV stages. They are constant in the sense that they cannot be written to be the TEV itself.
[in] | sel | TEV constant color register |
[in] | col | constant color value |
void GX_SetTevKColorS10 | ( | u8 | sel, |
GXColorS10 | col | ||
) |
Used to set one of the constant color registers in the Texture Environment (TEV) unit.
These registers are available to all TEV stages. At least one of these registers is used to pass the output of one TEV stage to the next in a multi-texture configuration.
[in] | sel | TEV color/output register |
[in] | col | constant color value |
Selects a "konstant" color input to be used in a given TEV stage.
The constant color input is used only if GX_CC_KONST
is selected for an input for that TEV stage. Only one constant color selection is available for a given TEV stage, though it may be used for more than one input.
[in] | tevstage | TEV stage |
[in] | sel | TEV constant color selection |
Simplified function to set various TEV parameters for this tevstage based on a predefined combiner mode.
This is a convenience function designed to make initial programming of the Texture Environment unit (TEV) easier. This function calls GX_SetTevColorIn(), GX_SetTevColorOp(), GX_SetTevAlphaIn() and GX_SetTevAlphaOp() with predefined arguments to implement familiar texture combining functions.
[in] | tevstage | TEV stage. |
[in] | mode | TEV combiner operation |
Specifies the texture and rasterized color that will be available as inputs to this TEV tevstage.
The texture coordinate texcoord is generated from input attributes using the GX_SetTexCoordGen() function and is used to look up the texture map, previously loaded by GX_LoadTexObj(). The color to rasterize for this tevstage is also specified. The color is the result of per-vertex lighting which is controlled by GX_SetChanCtrl().
This function will scale the normalized texture coordinates produced by GX_SetTexCoordGen() according to the size of the texture map in the function call. For this reason, texture coordinates can only be broadcast to multiple texture maps if and only if the maps are the same size. In some cases, you may want to generate a texture coordinate having a certain scale, but disable the texture lookup (this comes up when generating texture coordinates for indirect bump mapping). To accomplish this, use the GX_TEXMAP_DISABLE
flag:
This will scale GX_TEXCOORD0
using GX_TEXMAP3
but disable the lookup of GX_TEXMAP3
.
GX_TEVSTAGE0
, use GX_SetNumTevStages().GX_COLOR_ZERO
, you always get zero as rasterized color. If you specify GX_ALPHA_BUMP
or GX_ALPHA_BUMPN
, you can use "Bump alpha" component from indirect texture unit as rasterized color input (see GX_SetTevIndirect() for details about how to configure bump alpha). Since bump alpha contains only 5-bit data, GX_ALPHA_BUMP
shifts them to higher bits, which makes the value range 0-248. Meanwhile GX_ALPHA_BUMPN
performs normalization and you can get the value range 0-255.[in] | tevstage | TEV stage |
[in] | texcoord | texture coordinate slot |
[in] | texmap | texture map slot |
[in] | color | Color channel ID |
Selects a set of swap modes for the rasterized color and texture color for a given TEV stage.
This allows the color components of these inputs to be rearranged or duplicated.
[in] | tevstage | TEV stage |
[in] | ras_sel | selects a swap mode for the rasterized color input. |
[in] | tex_sel | selects a swap mode for the texture color input. |
Sets up the TEV color swap table.
The swap table allows the rasterized color and texture color to be swapped component-wise. An entry in the table specifies how the input color components map to the output color components.
[in] | swapid | TEV color swap table entry |
[in] | r | input color component that should be mapped to the red output component. |
[in] | g | input color component that should be mapped to the green output component. |
[in] | b | input color component that should be mapped to the blue output component. |
[in] | a | input color component that should be mapped to the alpha output component. |
Sets the texture coordinate bias of a particular texture.
Range bias is used with texture coordinates applied in GX_REPEAT
wrap mode in order to increase the precision of texture coordinates that spread out over a large range. The texture coordinate values for a primitive are biased (by an equal integer) towards zero early in the graphics pipeline, thus preserving bits for calculation later in the pipe. Since the coordinates are repeated, this bias by an integer should have no effect upon the actual appearance of the texture.
[in] | texcoord | texture coordinate slot being changed |
[in] | s_enable | enable or disable range bias in the S direction with GX_ENABLE /GX_DISABLE |
[in] | t_enable | enable or disable range bias in the T direction with GX_ENABLE /GX_DISABLE |
Specifies how texture coordinates are generated.
Output texture coordinates are usually the result of some transform of an input attribute; either position, normal, or texture coordinate. You can also generate texture coordinates from the output color channel of the per-vertex lighting calculations. In C-language syntax the texture coordinate generation function would look like this:
texcoord = tgen_typ(tgen_src, mtxsrc);
The current vertex descriptor as set by GX_SetVtxDesc() only describes the data input to the graphics processor. Using this function, you can create new output texture coordinates from the input data. The texcoord parameter is used to give the output texture coordinate a name. This texture coordinate can be bound to a texture using GX_SetTevOrder(). GX_SetNumTexGens() specifies a consecutive number of texture coordinates, starting at GX_TEXCOORD0
, that are available to GX_SetTevOrder().
Texture matrix index defines a default set of texture matrix names that can be supplied as mtxsrc. The matrix names are actually row addresses (4 floats per row) in the matrix memory that indicate the first row of a loaded matrix. The user may define another memory map of matrix memory to suit their needs. Keep in mind, however, that modelview matrices (see GX_LoadPosMtxImm() and Position-normal matrix index) and texture matrices share matrix memory.
GX_IDENTITY
matrix in order to appear as if input coordinates are passed unchanged through to the texture hardware.There are 8 output texture coordinates that can be referenced in any of the 16 TEV stages. There are a maximum of 8 input texture coordinates.
[in] | texcoord | texture coordinate slot |
[in] | tgen_typ | Texture coordinate generation type |
[in] | tgen_src | Texture coordinate source |
[in] | mtxsrc | Texture matrix index |
void GX_SetTexCoordGen2 | ( | u16 | texcoord, |
u32 | tgen_typ, | ||
u32 | tgen_src, | ||
u32 | mtxsrc, | ||
u32 | normalize, | ||
u32 | postmtx | ||
) |
An extension of GX_SetTexCoordGen(). It allows one to specify additional texgen options.
The first four arguments are identical to those for GX_SetTexCoordGen() and function in the same way. All requirements for the first four arguments are the same as they are for that function as well. The new options only apply for "ordinary" texgens, where the texgen type is GX_TG_MTX2x4
or GX_TG_MTX3x4
. They do not work for light-based texgens or emboss texgens.
The normalize argument allows the computed texcoord to be normalized after the multiplication by mtxsrc (the first-pass transformation). After the optional normalization step, the texcoord is then multiplied by the 3x4 matrix postmtx. This matrix is refered to as the post-transform matrix.
The result of this step is the texture coordinate that is used to look up the texture.
GX_TG_MTX2x4
, there are certain limitations. In this special performance case, normalization is not performed (even if specified).[in] | texcoord | texture coordinate slot |
[in] | tgen_typ | Texture coordinate generation type |
[in] | tgen_src | Texture coordinate source |
[in] | mtxsrc | Texture matrix index |
[in] | normalize | if GX_TRUE , normalize tex coord after first-pass transform. Only used with GX_TG_MTX* . |
[in] | postmtx | Post-transform texture matrix index |
Overrides the automatic texture coordinate scaling (based upon the associated map size) and lets one manually assign the scale values that are used for a given texcoord.
Setting the enable parameter to GX_TRUE
gives this behavior. The given texcoord retains these manual scale values until this function is called again. This function is also used to return a given texture coordinate back to normal, automatic scaling (by setting enable to GX_FALSE
).
[in] | texcoord | the texture coordinate slot being changed |
[in] | enable | if GX_TRUE , scale will be set manually, otherwise set automatically and ss and ts ignored |
[in] | ss | manual scale value for the S component of the coordinate |
[in] | ts | manual scale value for the T component of the coordinate |
This function sets the width and height of the destination texture buffer in texels.
This function sets the width (wd) and height (ht) of the destination texture buffer in texels. The application may render an image into the EFB and then copy it into a texture buffer in main memory. wd specifies the number of texels between adjacent lines in the texture buffer and can be different than the width of the source image. This function also sets the texture format (fmt) to be created during the copy operation. An optional box filter can be enabled using mipmap. This flag will scale the source image by 1/2.
Normally, the width of the EFB and destination wd are the same. When rendering smaller images that get copied and composited into a larger texture buffer, however, the EFB width and texture buffer wd are not necessarily the same.
The Z buffer can be copied to a Z texture format by setting fmt to GX_TF_Z24X8
. This operation is only valid when the EFB format is GX_PF_RGB8_Z24
or GX_PF_RGBA6_Z24
.
The alpha channel can be copied from an EFB with format GX_PF_RGBA6_Z24
by setting fmt to GX_TF_A8
.
[in] | wd | distance between successive lines in the texture buffer, in texels; must be a multiple of the texture tile width, which depends on fmt. |
[in] | ht | height of the texture buffer |
[in] | fmt | Texture format |
[in] | mipmap | flag that indicates framebuffer should be cleared if GX_TRUE . |
Sets the source parameters for the Embedded Frame Buffer (EFB) to texture image copy.
The GP will copy textures into the tiled texture format specified in GX_CopyTex(). The GP always copies tiles (32B) so image widths and heights that are not a multiple of the tile width will be padded with undefined data in the copied image
[in] | left | left-most source pixel to copy, multiple of two |
[in] | top | top-most source line to copy, multiple of two |
[in] | wd | width to copy in pixels, multiple of two |
[in] | ht | height to copy in pixels, multiple of two |
GXTexRegionCallback GX_SetTexRegionCallback | ( | GXTexRegionCallback | cb | ) |
Sets the callback function called by GX_LoadTexObj() to obtain an available texture region.
GX_Init() calls this function to set a default region-assignment policy. A programmer can override this default region assignment by implementing his own callback function. A pointer to the texture object and the texture map ID that are passed to GX_LoadTexObj() are provided to the callback function.
[in] | cb | ptr to a function that takes a pointer to a GXTexObj and a texture map slot as a parameter and returns a pointer to a GXTexRegion. |
GXTlutRegionCallback GX_SetTlutRegionCallback | ( | GXTlutRegionCallback | cb | ) |
Sets the callback function called by GX_LoadTlut() to find the region into which to load the TLUT.
GX_LoadTexObj() will also call cb to obtain the Texture Look-up Table (TLUT) region when the texture forma is color-index.
GX_Init() calls GX_SetTlutRegionCallback() to set a default TLUT index-to-region mapping. The name for the TLUT from the texture object is provided as an argument to the callback. The callback should return a pointer to the GXTlutRegion for this TLUT index.
[in] | cb | ptr to a function that takes a u32 TLUT name as a parameter and returns a pointer to a GXTlutRegion. |
void GX_SetVCacheMetric | ( | u32 | attr | ) |
Sets the metric the Vertex Cache performance counter will measure.
It is possible to monitor a particular attribute or all attributes using attr.
[in] | attr | Vertex cache performance counter to measure |
void GX_SetViewport | ( | f32 | xOrig, |
f32 | yOrig, | ||
f32 | wd, | ||
f32 | ht, | ||
f32 | nearZ, | ||
f32 | farZ | ||
) |
Sets the viewport rectangle in screen coordinates.
The screen origin (xOrig = 0.0f, yOrig = 0.0f) is at the top left corner of the display. Floating point arguments allow the viewport to be adjusted by 1/2 line for interlaced field rendering modes; see GX_SetViewportJitter(). The viewport depth parameters are normalized coordinates from 0.0f - 1.0f. The GX API will convert the depth range values to proper scale values depending on the type and format of the Z-buffer.
[in] | xOrig | left-most X coordinate on the screen |
[in] | yOrig | top-most Y coordinate on the screen |
[in] | wd | width of the viewport |
[in] | ht | height of the viewport |
[in] | nearZ | value to use for near depth scale |
[in] | farZ | value to use for far depth scale |
void GX_SetViewportJitter | ( | f32 | xOrig, |
f32 | yOrig, | ||
f32 | wd, | ||
f32 | ht, | ||
f32 | nearZ, | ||
f32 | farZ, | ||
u32 | field | ||
) |
Sets the viewport and adjusts the viewport's line offset for interlaced field rendering.
Depending on whether the viewport starts on an even or odd line, and whether the next field to be rendered is even or odd, the viewport may be adjusted by half a line. This has the same effect as slightly tilting the camera down and is necessary for interlaced rendering. No other camera adjustment (i.e. don't change the projection matrix) is needed for interlaced field rendering.
[in] | xOrig | left-most X coordinate on the screen |
[in] | yOrig | top-most Y coordinate on the screen |
[in] | wd | width of the viewport |
[in] | ht | height of the viewport |
[in] | nearZ | value to use for near depth scale |
[in] | farZ | value to use for far depth scale |
[in] | field | whether the next field is even (0) or odd (1) |
Sets the attribute format (vtxattr) for a single attribute in the Vertex Attribute Table (VAT).
Each attribute format describes the data type (comptype), number of elements (compsize), and fixed point format (frac), if required. The are eight vertex formats available in the VAT. The vertex format describes the format of all attributes in a vertex. The application can pre-program all eight vertex formats and then select one of them during the actual drawing of geometry (See GX_Begin()). Note that all vertices used to draw a particular graphics primitive will have the same format. The vertex format set using this function, along with the current vertex descriptor set using GX_SetVtxDesc(), completely define the vertex data format.
GX_VA_NRM
and GX_VA_NBT
attributes share the same type. Also, the frac for these attributes is fixed according to the type. The component count (compsize) for GX_VA_NRM
must be set to GX_NRM_XYZ
. The component count for GX_VA_NBT
must be set to GX_NRM_NBT
or GX_NRM_NBT3
.[in] | vtxfmt | Vertex format index |
[in] | vtxattr | Vertex attribute array type |
[in] | comptype | Attribute component type |
[in] | compsize | Number of components in an attribute |
[in] | frac | number of fractional bits in a fixed-point number |
void GX_SetVtxAttrFmtv | ( | u8 | vtxfmt, |
GXVtxAttrFmt * | attr_list | ||
) |
Sets multiple attribute formats within a single vertex format.
This is useful when you need to set all the attributes in a vertex format at once (e.g., during graphics initialization).
GX_MAX_VTXATTRFMT_LISTSIZE
should be used to allocate the list. You can get a current vertex format using GX_GetVtxAttrFmtv().[in] | vtxfmt | Vertex format index |
[in] | attr_list | pointer to array of GXVtxAttrFmt structs to draw from |
Sets the type of a single attribute (attr) in the current vertex descriptor.
The current vertex descriptor defines which attributes are present in a vertex and how each attribute is referenced. The current vertex descriptor is used by the Graphics Processor (GP) to interpret the graphics command stream produced by the GX API. In particular, the current vertex descriptor is used to parse the vertex data that is present in the command stream.
[in] | attr | Vertex attribute array type |
[in] | type | Vertex data input type |
void GX_SetVtxDescv | ( | GXVtxDesc * | attr_list | ) |
Sets the type of multiple attributes.
This function is used when more than one attribute needs to be set (e.g., during initialization of geometry).
GX_MAX_VTXATTRFMT_LISTSIZE
can be used to allocate memory for attr_list [in] | attr_list | array of pointers to GXVtxDesc structs; last element of the array should be GX_VA_NULL |
void GX_SetZCompLoc | ( | u8 | before_tex | ) |
Sets whether Z buffering happens before or after texturing.
Normally, Z buffering should happen before texturing, as this enables better performance by not texturing pixels that are not visible; however, when alpha compare is used, Z buffering must be done after texturing (see GX_SetAlphaCompare()).
[in] | before_tex | Enables Z-buffering before texturing when set to GX_TRUE ; otherwise, Z-buffering takes place after texturing. |
Sets the Z-buffer compare mode.
The result of the Z compare is used to conditionally write color values to the Embedded Frame Buffer (EFB).
When enable is set to GX_DISABLE
, Z buffering is disabled and the Z buffer is not updated.
The func parameter determines the comparison that is performed. In the comparison function, the newly rasterized Z value is on the left while the Z value from the Z buffer is on the right. If the result of the comparison is false, the newly rasterized pixel is discarded.
The parameter update_enable determines whether or not the Z buffer is updated with the new Z value after a comparison is performed. This parameter also affects whether the Z buffer is cleared during copy operations (see GX_CopyDisp() and GX_CopyTex()).
[in] | enable | Enables comparisons with source and destination Z values if GX_TRUE ; disables compares otherwise. |
[in] | func | Compare type |
[in] | update_enable | Enables Z-buffer updates when GX_TRUE ; otherwise, Z-buffer updates are disabled, but compares may still be enabled. |
Controls Z texture operations.
Z textures can be used to implement image-based rendering algorithms. A composite image consisting of color and depth image planes can be merged into the Embedded Frame Buffer (EFB).
Normally, the Z for a quad (2x2) of pixels is computed as a reference Z and two slopes. Once Z texturing is enabled, the Z is computed by adding a Z texel to the reference Z (op = GX_ZT_ADD
) or by replacing the reference Z with the Z texel value (op = GX_ZT_REPLACE
).
Z textures are always the output from the last active Texture Environment (TEV) stage (see GX_SetNumTevStages()) when enabled. When Z texturing is enabled, the texture color of the last TEV stage is not available, but all other color inputs and operations are available. The pixel color is always output from the last active TEV stage. You cannot use the TEV to operate on the Z texture, it is fed directly into the Z texture logic.
Z texel formats can be unsigned 8-bit (GX_TF_Z8
), 16-bit (GX_TF_Z16
), or 24-bit (GX_TF_Z24X8
(32-bit texture)) are used. The Graphics Processor converts the Z-textures to 24-bit values by placing the texel value in the least-significant bits and inserting zero's in the remaining most-significant bits. The 24-bit constant bias is added to the Z texture. If the pixel format is GX_PF_RGB565_Z16 the 24-bit result is converted to the current 16-bit Z format before comparing with the EFB's Z.
[in] | op | Z Texture operator to perform |
[in] | fmt | Z Texture format to use |
[in] | bias | Bias value. Format is 24bit unsigned. |
void GX_TexModeSync | ( | void | ) |
Inserts a synchronization command into the graphics FIFO. When the Graphics Processor sees this command, it will allow the texture pipeline to flush before continuing.
This command is necessary when changing the usage of regions of texture memory from preloaded or TLUT to cached areas. It makes sure that the texture pipeline is finished with that area of the texture memory prior to changing its usage. This function should be called prior to drawing any primitives that uses the texture memory region in its new mode. It is not necessary to call this command when changing texture memory regions from cached to preloaded (or TLUT), since the commands to load the regions with data will cause the necessary synchronization to happen automatically.
void GX_WaitDrawDone | ( | void | ) |
Stalls until DrawDone is encountered by the GP.
It means all graphics commands sent before this DrawDone command have executed and the last pixel has been written to the frame buffer. You may want to execute some non-graphics operations between executing GX_SetDrawDone() and this function, but if you simply want to wait and have nothing to execute, you can use GX_DrawDone().