1{$IFDEF OGC_INTERFACE} 2const 3 GX_FALSE = 0; 4 GX_TRUE = 1; 5 GX_DISABLE = 0; 6 GX_ENABLE = 1; 7 8 GX_CLIP_DISABLE = 1; 9 GX_CLIP_ENABLE = 0; 10 11 GX_FIFO_MINSIZE = ( 64 * 1024 ); (*!< Smallest usable graphics FIFO size. *) 12 GX_FIFO_HIWATERMARK = ( 16 * 1024 ); (*!< Default hi watermark for FIFO buffer control. *) 13 GX_FIFO_OBJSIZE = 128; 14 GX_PERSPECTIVE = 0; 15 GX_ORTHOGRAPHIC = 1; 16 GX_MT_NULL = 0; 17 GX_MT_XF_FLUSH = 1; 18 GX_MT_DL_SAVE_CTX = 2; 19 GX_XF_FLUSH_NONE = 0; 20 GX_XF_FLUSH_SAFE = 1; 21 GX_COLOR0 = 0; 22 GX_COLOR1 = 1; 23 GX_ALPHA0 = 2; 24 GX_ALPHA1 = 3; 25 GX_COLOR0A0 = 4; 26 GX_COLOR1A1 = 5; 27 GX_COLORZERO = 6; 28 GX_ALPHA_BUMP = 7; 29 GX_ALPHA_BUMPN = 8; 30 GX_COLORNULL = $ff; 31 32 GX_MTX2x4 = 0; 33 GX_MTX3x4 = 1; 34 GX_VTXFMT0 = 0; 35 GX_VTXFMT1 = 1; 36 GX_VTXFMT2 = 2; 37 GX_VTXFMT3 = 3; 38 GX_VTXFMT4 = 4; 39 GX_VTXFMT5 = 5; 40 GX_VTXFMT6 = 6; 41 GX_VTXFMT7 = 7; 42 GX_MAXVTXFMT = 8; 43 44 GX_NONE = 0; (*!< Input data is not used *) 45 46 GX_DIRECT = 1; (*!< Input data is set direct *) 47 GX_INDEX8 = 2; (*!< Input data is set by a 8bit index *) 48 GX_INDEX16 = 3; (*!< Input data is set by a 16bit index *) 49 GX_U8 = 0; (*!< Unsigned 8-bit integer *) 50 GX_S8 = 1; (*!< Signed 8-bit integer *) 51 GX_U16 = 2; (*!< Unsigned 16-bit integer *) 52 GX_S16 = 3; (*!< Signed 16-bit integer *) 53 GX_F32 = 4; (*!< 32-bit floating-point *) 54 GX_RGB565 = 0; (*!< 16-bit RGB *) 55 GX_RGB8 = 1; (*!< 24-bit RGB *) 56 GX_RGBX8 = 2; (*!< 32-bit RGBX *) 57 GX_RGBA4 = 3; (*!< 16-bit RGBA *) 58 GX_RGBA6 = 4; (*!< 24-bit RGBA *) 59 GX_RGBA8 = 5; (*!< 32-bit RGBA *) 60 GX_POS_XY = 0; (*!< X,Y position *) 61 GX_POS_XYZ = 1; (*!< X,Y,Z position *) 62 GX_NRM_XYZ = 0; (*!< X,Y,Z normal *) 63 GX_NRM_NBT = 1; 64 GX_NRM_NBT3 = 2; 65 GX_CLR_RGB = 0; (*!< RGB color *) 66 GX_CLR_RGBA = 1; (*!< RGBA color *) 67 GX_TEX_S = 0; (*!< One texture dimension *) 68 GX_TEX_ST = 1; (*!< Two texture dimensions *) 69 GX_VA_PTNMTXIDX = 0; 70 GX_VA_TEX0MTXIDX = 1; 71 GX_VA_TEX1MTXIDX = 2; 72 GX_VA_TEX2MTXIDX = 3; 73 GX_VA_TEX3MTXIDX = 4; 74 GX_VA_TEX4MTXIDX = 5; 75 GX_VA_TEX5MTXIDX = 6; 76 GX_VA_TEX6MTXIDX = 7; 77 GX_VA_TEX7MTXIDX = 8; 78 GX_VA_POS = 9; 79 GX_VA_NRM = 10; 80 GX_VA_CLR0 = 11; 81 GX_VA_CLR1 = 12; 82 GX_VA_TEX0 = 13; 83 GX_VA_TEX1 = 14; 84 GX_VA_TEX2 = 15; 85 GX_VA_TEX3 = 16; 86 GX_VA_TEX4 = 17; 87 GX_VA_TEX5 = 18; 88 GX_VA_TEX6 = 19; 89 GX_VA_TEX7 = 20; 90 GX_POSMTXARRAY = 21; 91 GX_NRMMTXARRAY = 22; 92 GX_TEXMTXARRAY = 23; 93 GX_LIGHTARRAY = 24; 94 GX_VA_NBT = 25; 95 GX_VA_MAXATTR = 26; 96 GX_VA_NULL = $ff; 97 GX_POINTS = $B8; (*!< Draws a series of points. Each vertex is a single point. *) 98 GX_LINES = $A8; (*!< Draws a series of unconnected line segments. Each pair of vertices makes a line. *) 99 GX_LINESTRIP = $B0; (*!< Draws a series of lines. Each vertex (besides the first) makes a line between it and the previous. *) 100 GX_TRIANGLES = $90; (*!< Draws a series of unconnected triangles. Three vertices make a single triangle. *) 101 GX_TRIANGLESTRIP = $98; (*!< Draws a series of triangles. Each triangle (besides the first) shares a side with the previous triangle. 102 * Each vertex (besides the first two) completes a triangle. *) 103 GX_TRIANGLEFAN = $A0; (*!< Draws a single triangle fan. The first vertex is the "centerpoint". The second and third vertex complete 104 * the first triangle. Each subsequent vertex completes another triangle which shares a side with the previous 105 * triangle (except the first triangle) and has the centerpoint vertex as one of the vertices. *) 106 GX_QUADS = $80; (*!< Draws a series of unconnected quads. Every four vertices completes a quad. Internally, each quad is 107 * translated into a pair of triangles. *) 108 GX_SRC_REG = 0; 109 GX_SRC_VTX = 1; 110 GX_LIGHT0 = $001; (*!< Light 0 *) 111 GX_LIGHT1 = $002; (*!< Light 2 *) 112 GX_LIGHT2 = $004; (*!< Light 3 *) 113 GX_LIGHT3 = $008; (*!< Light 4 *) 114 GX_LIGHT4 = $010; (*!< Light 5 *) 115 GX_LIGHT5 = $020; (*!< Light 6 *) 116 GX_LIGHT6 = $040; (*!< Light 7 *) 117 GX_LIGHT7 = $080; (*!< Light 8 *) 118 GX_MAXLIGHT = $100; (*!< All lights *) 119 GX_LIGHTNULL = $000; (*!< No lights *) 120 GX_DF_NONE = 0; 121 GX_DF_SIGNED = 1; 122 GX_DF_CLAMP = 2; 123 GX_AF_SPEC = 0; (*!< Specular computation *) 124 GX_AF_SPOT = 1; (*!< Spot light attenuation *) 125 GX_AF_NONE = 2; (*!< No attenuation *) 126 GX_PNMTX0 = 0; 127 GX_PNMTX1 = 3; 128 GX_PNMTX2 = 6; 129 GX_PNMTX3 = 9; 130 GX_PNMTX4 = 12; 131 GX_PNMTX5 = 15; 132 GX_PNMTX6 = 18; 133 GX_PNMTX7 = 21; 134 GX_PNMTX8 = 24; 135 GX_PNMTX9 = 27; 136 GX_TEXMTX0 = 30; 137 GX_TEXMTX1 = 33; 138 GX_TEXMTX2 = 36; 139 GX_TEXMTX3 = 39; 140 GX_TEXMTX4 = 42; 141 GX_TEXMTX5 = 45; 142 GX_TEXMTX6 = 48; 143 GX_TEXMTX7 = 51; 144 GX_TEXMTX8 = 54; 145 GX_TEXMTX9 = 57; 146 GX_IDENTITY = 60; 147 GX_DTTMTX0 = 64; 148 GX_DTTMTX1 = 67; 149 GX_DTTMTX2 = 70; 150 GX_DTTMTX3 = 73; 151 GX_DTTMTX4 = 76; 152 GX_DTTMTX5 = 79; 153 GX_DTTMTX6 = 82; 154 GX_DTTMTX7 = 85; 155 GX_DTTMTX8 = 88; 156 GX_DTTMTX9 = 91; 157 GX_DTTMTX10 = 94; 158 GX_DTTMTX11 = 97; 159 GX_DTTMTX12 = 100; 160 GX_DTTMTX13 = 103; 161 GX_DTTMTX14 = 106; 162 GX_DTTMTX15 = 109; 163 GX_DTTMTX16 = 112; 164 GX_DTTMTX17 = 115; 165 GX_DTTMTX18 = 118; 166 GX_DTTMTX19 = 121; 167 GX_DTTIDENTITY = 125; 168 GX_TEXCOORD0 = $0; 169 GX_TEXCOORD1 = $1; 170 GX_TEXCOORD2 = $2; 171 GX_TEXCOORD3 = $3; 172 GX_TEXCOORD4 = $4; 173 GX_TEXCOORD5 = $5; 174 GX_TEXCOORD6 = $6; 175 GX_TEXCOORD7 = $7; 176 GX_MAXCOORD = $8; 177 GX_TEXCOORDNULL = $ff; 178 _GX_TF_ZTF = $10; 179 _GX_TF_CTF = $20; 180 GX_TF_I4 = $0; 181 GX_TF_I8 = $1; 182 GX_TF_IA4 = $2; 183 GX_TF_IA8 = $3; 184 GX_TF_RGB565 = $4; 185 GX_TF_RGB5A3 = $5; 186 GX_TF_RGBA8 = $6; 187 GX_TF_CI4 = $8; 188 GX_TF_CI8 = $9; 189 GX_TF_CI14 = $a; 190 GX_TF_CMPR = $E; (*!< Compressed *) 191 GX_TL_IA8 = $00; 192 GX_TL_RGB565 = $01; 193 GX_TL_RGB5A3 = $02; 194 GX_CTF_R4 = ( $0 or _GX_TF_CTF ); (*!< For copying 4 bits from red *) 195 GX_CTF_RA4 = ( $2 or _GX_TF_CTF ); (*!< For copying 4 bits from red, 4 bits from alpha *) 196 GX_CTF_RA8 = ( $3 or _GX_TF_CTF ); (*!< For copying 8 bits from red, 8 bits from alpha *) 197 GX_CTF_YUVA8 = ( $6 or _GX_TF_CTF ); 198 GX_CTF_A8 = ( $7 or _GX_TF_CTF ); (*!< For copying 8 bits from alpha *) 199 GX_CTF_R8 = ( $8 or _GX_TF_CTF ); (*!< For copying 8 bits from red *) 200 GX_CTF_G8 = ( $9 or _GX_TF_CTF ); (*!< For copying 8 bits from green *) 201 GX_CTF_B8 = ( $A or _GX_TF_CTF ); (*!< For copying 8 bits from blue *) 202 GX_CTF_RG8 = ( $B or _GX_TF_CTF ); (*!< For copying 8 bits from red, 8 bits from green *) 203 GX_CTF_GB8 = ( $C or _GX_TF_CTF ); (*!< For copying 8 bits from green, 8 bits from blue *) 204 GX_TF_Z8 = ( $1 or _GX_TF_ZTF ); (*!< For texture copy, specifies upper 8 bits of Z *) 205 GX_TF_Z16 = ( $3 or _GX_TF_ZTF ); (*!< For texture copy, specifies upper 16 bits of Z *) 206 GX_TF_Z24X8 = ( $6 or _GX_TF_ZTF ); (*!< For texture copy, copies 24 Z bits and 0xFF *) 207 GX_CTF_Z4 = ( $0 or _GX_TF_ZTF or _GX_TF_CTF ); (*!< For copying 4 upper bits from Z *) 208 GX_CTF_Z8M = ( $9 or _GX_TF_ZTF or _GX_TF_CTF ); (*!< For copying the middle 8 bits of Z *) 209 GX_CTF_Z8L = ( $A or _GX_TF_ZTF or _GX_TF_CTF ); (*!< For copying the lower 8 bits of Z *) 210 GX_CTF_Z16L = ( $C or _GX_TF_ZTF or _GX_TF_CTF ); (*!< For copying the lower 16 bits of Z *) 211 GX_TF_A8 = GX_CTF_A8; 212 GX_TLUT_16 = 1; // number of 16 entry blocks. 213 GX_TLUT_64 = 4; 214 GX_TLUT_128 = 8; 215 GX_TLUT_256 = 16; 216 GX_TLUT_512 = 32; 217 GX_TLUT_1K = 64; 218 GX_TLUT_2K = 128; 219 GX_TLUT_4K = 256; 220 GX_TLUT_8K = 512; 221 GX_TLUT_16K = 1024; 222 GX_ZT_DISABLE = 0; 223 GX_ZT_ADD = 1; (*!< Add a Z texel to reference Z *) 224 GX_ZT_REPLACE = 2; (*!< Replace reference Z with Z texel *) 225 GX_MAX_ZTEXOP = 3; 226 GX_TG_MTX3x4 = 0; (*!< 2x4 matrix multiply on the input attribute and generate S,T texture coordinates. *) 227 GX_TG_MTX2x4 = 1; (*!< 3x4 matrix multiply on the input attribute and generate S,T,Q coordinates; S,T are then divided 228 * by Q to produce the actual 2D texture coordinates. *) 229 GX_TG_BUMP0 = 2; (*!< Use light 0 in the bump map calculation. *) 230 GX_TG_BUMP1 = 3; (*!< Use light 1 in the bump map calculation. *) 231 GX_TG_BUMP2 = 4; (*!< Use light 2 in the bump map calculation. *) 232 GX_TG_BUMP3 = 5; (*!< Use light 3 in the bump map calculation. *) 233 GX_TG_BUMP4 = 6; (*!< Use light 4 in the bump map calculation. *) 234 GX_TG_BUMP5 = 7; (*!< Use light 5 in the bump map calculation. *) 235 GX_TG_BUMP6 = 8; (*!< Use light 6 in the bump map calculation. *) 236 GX_TG_BUMP7 = 9; (*!< Use light 7 in the bump map calculation. *) 237 GX_TG_SRTG = 10; (*!< Coordinates generated from vertex lighting results; one of the color channel results is converted 238 * into texture coordinates. *) 239 GX_TG_POS = 0; 240 GX_TG_NRM = 1; 241 GX_TG_BINRM = 2; 242 GX_TG_TANGENT = 3; 243 GX_TG_TEX0 = 4; 244 GX_TG_TEX1 = 5; 245 GX_TG_TEX2 = 6; 246 GX_TG_TEX3 = 7; 247 GX_TG_TEX4 = 8; 248 GX_TG_TEX5 = 9; 249 GX_TG_TEX6 = 10; 250 GX_TG_TEX7 = 11; 251 GX_TG_TEXCOORD0 = 12; 252 GX_TG_TEXCOORD1 = 13; 253 GX_TG_TEXCOORD2 = 14; 254 GX_TG_TEXCOORD3 = 15; 255 GX_TG_TEXCOORD4 = 16; 256 GX_TG_TEXCOORD5 = 17; 257 GX_TG_TEXCOORD6 = 18; 258 GX_TG_COLOR0 = 19; 259 GX_TG_COLOR1 = 20; 260 GX_NEVER = 0; 261 GX_LESS = 1; 262 GX_EQUAL = 2; 263 GX_LEQUAL = 3; 264 GX_GREATER = 4; 265 GX_NEQUAL = 5; 266 GX_GEQUAL = 6; 267 GX_ALWAYS = 7; 268 GX_CLAMP = 0; 269 GX_REPEAT = 1; 270 GX_MIRROR = 2; 271 GX_MAXTEXWRAPMODE = 3; 272 273 GX_BM_NONE = 0; (*!< Write input directly to EFB *) 274 GX_BM_BLEND = 1; (*!< Blend using blending equation *) 275 GX_BM_LOGIC = 2; (*!< Blend using bitwise operation *) 276 GX_BM_SUBTRACT = 3; (*!< Input subtracts from existing pixel *) 277 GX_MAX_BLENDMODE = 4; 278 279 GX_BL_ZERO = 0; (*!< 0.0 *) 280 GX_BL_ONE = 1; (*!< 1.0 *) 281 GX_BL_SRCCLR = 2; (*!< source color *) 282 GX_BL_INVSRCCLR = 3; (*!< 1.0 - (source color) *) 283 GX_BL_SRCALPHA = 4; (*!< source alpha *) 284 GX_BL_INVSRCALPHA = 5; (*!< 1.0 - (source alpha) *) 285 GX_BL_DSTALPHA = 6; (*!< framebuffer alpha *) 286 GX_BL_INVDSTALPHA = 7; (*!< 1.0 - (FB alpha) *) 287 GX_BL_DSTCLR = GX_BL_SRCCLR; 288 GX_BL_INVDSTCLR = GX_BL_INVSRCCLR; 289 290 291 GX_LO_CLEAR = 0; (*!< 0 *) 292 GX_LO_AND = 1; (*!< src & dst *) 293 GX_LO_REVAND = 2; (*!< src & ~dst *) 294 GX_LO_COPY = 3; (*!< src *) 295 GX_LO_INVAND = 4; (*!< ~src & dst *) 296 GX_LO_NOOP = 5; (*!< dst *) 297 GX_LO_XOR = 6; (*!< src ^ dst *) 298 GX_LO_OR = 7; (*!< src | dst *) 299 GX_LO_NOR = 8; (*!< ~(src | dst) *) 300 GX_LO_EQUIV = 9; (*!< ~(src ^ dst) *) 301 GX_LO_INV = 10; (*!< ~dst *) 302 GX_LO_REVOR = 11; (*!< src | ~dst *) 303 GX_LO_INVCOPY = 12; (*!< ~src *) 304 GX_LO_INVOR = 13; (*!< ~src | dst *) 305 GX_LO_NAND = 14; (*!< ~(src & dst) *) 306 GX_LO_SET = 15; (*!< 1 *) 307 308 GX_TO_ZERO = 0; 309 GX_TO_SIXTEENTH = 1; 310 GX_TO_EIGHTH = 2; 311 GX_TO_FOURTH = 3; 312 GX_TO_HALF = 4; 313 GX_TO_ONE = 5; 314 GX_MAX_TEXOFFSET = 6; 315 316 GX_MODULATE = 0; (*!< <i>Cv</i>=<i>CrCt</i>; <i>Av</i>=<i>ArAt</i> *) 317 GX_DECAL = 1; (*!< <i>Cv</i>=(1-<i>At</i>)<i>Cr</i> + <i>AtCt</i>; <i>Av</i>=<i>Ar</i> *) 318 GX_BLEND = 2; (*!< <i>Cv=(1-<i>Ct</i>)<i>Cr</i> + <i>Ct</i>; <i>Av</i>=<i>AtAr</i> *) 319 GX_REPLACE = 3; (*!< <i>Cv=<i>Ct</i>; <i>Ar=<i>At</i> *) 320 GX_PASSCLR = 4; (*!< <i>Cv=<i>Cr</i>; <i>Av=<i>Ar</i> *) 321 322 GX_CC_CPREV = 0; (*!< Use the color value from previous TEV stage *) 323 GX_CC_APREV = 1; (*!< Use the alpha value from previous TEV stage *) 324 GX_CC_C0 = 2; (*!< Use the color value from the color/output register 0 *) 325 GX_CC_A0 = 3; (*!< Use the alpha value from the color/output register 0 *) 326 GX_CC_C1 = 4; (*!< Use the color value from the color/output register 1 *) 327 GX_CC_A1 = 5; (*!< Use the alpha value from the color/output register 1 *) 328 GX_CC_C2 = 6; (*!< Use the color value from the color/output register 2 *) 329 GX_CC_A2 = 7; (*!< Use the alpha value from the color/output register 2 *) 330 GX_CC_TEXC = 8; (*!< Use the color value from texture *) 331 GX_CC_TEXA = 9; (*!< Use the alpha value from texture *) 332 GX_CC_RASC = 10; (*!< Use the color value from rasterizer *) 333 GX_CC_RASA = 11; (*!< Use the alpha value from rasterizer *) 334 GX_CC_ONE = 12; 335 GX_CC_HALF = 13; 336 GX_CC_KONST = 14; 337 GX_CC_ZERO = 15; (*!< Use to pass zero value *) 338 339 GX_CA_APREV = 0; (*!< Use the alpha value from previous TEV stage *) 340 GX_CA_A0 = 1; (*!< Use the alpha value from the color/output register 0 *) 341 GX_CA_A1 = 2; (*!< Use the alpha value from the color/output register 1 *) 342 GX_CA_A2 = 3; (*!< Use the alpha value from the color/output register 2 *) 343 GX_CA_TEXA = 4; (*!< Use the alpha value from texture *) 344 GX_CA_RASA = 5; (*!< Use the alpha value from rasterizer *) 345 GX_CA_KONST = 6; 346 GX_CA_ZERO = 7; (*!< Use to pass zero value *) 347 348 GX_TEVSTAGE0 = 0; 349 GX_TEVSTAGE1 = 1; 350 GX_TEVSTAGE2 = 2; 351 GX_TEVSTAGE3 = 3; 352 GX_TEVSTAGE4 = 4; 353 GX_TEVSTAGE5 = 5; 354 GX_TEVSTAGE6 = 6; 355 GX_TEVSTAGE7 = 7; 356 GX_TEVSTAGE8 = 8; 357 GX_TEVSTAGE9 = 9; 358 GX_TEVSTAGE10 = 10; 359 GX_TEVSTAGE11 = 11; 360 GX_TEVSTAGE12 = 12; 361 GX_TEVSTAGE13 = 13; 362 GX_TEVSTAGE14 = 14; 363 GX_TEVSTAGE15 = 15; 364 GX_MAX_TEVSTAGE = 16; 365 366 GX_TEV_ADD = 0; 367 GX_TEV_SUB = 1; 368 GX_TEV_COMP_R8_GT = 8; 369 GX_TEV_COMP_R8_EQ = 9; 370 GX_TEV_COMP_GR16_GT = 10; 371 GX_TEV_COMP_GR16_EQ = 11; 372 GX_TEV_COMP_BGR24_GT = 12; 373 GX_TEV_COMP_BGR24_EQ = 13; 374 GX_TEV_COMP_RGB8_GT = 14; 375 GX_TEV_COMP_RGB8_EQ = 15; 376 GX_TEV_COMP_A8_GT = GX_TEV_COMP_RGB8_GT; // for alpha channel 377 378 GX_TB_ZERO = 0; 379 GX_TB_ADDHALF = 1; 380 GX_TB_SUBHALF = 2; 381 GX_MAX_TEVBIAS = 3; 382 383 GX_TC_LINEAR = 0; 384 GX_TC_GE = 1; 385 GX_TC_EQ = 2; 386 GX_TC_LE = 3; 387 GX_MAX_TEVCLAMPMODE = 4; 388 389 GX_CS_SCALE_1 = 0; 390 GX_CS_SCALE_2 = 1; 391 GX_CS_SCALE_4 = 2; 392 GX_CS_DIVIDE_2 = 3; 393 GX_MAX_TEVSCALE = 4; 394 395 GX_TEVPREV = 0; (*!< Default register for passing results from one stage to another. *) 396 GX_TEVREG0 = 1; 397 GX_TEVREG1 = 2; 398 GX_TEVREG2 = 3; 399 GX_MAX_TEVREG = 4; 400 401 GX_CULL_NONE = 0; (*!< Do not cull any primitives. *) 402 GX_CULL_FRONT = 1; (*!< Cull front-facing primitives. *) 403 GX_CULL_BACK = 2; (*!< Cull back-facing primitives. *) 404 GX_CULL_ALL = 3; (*!< Cull all primitives. *) 405 406 GX_TEXMAP0 = 0; (*!< Texture map slot 0 *) 407 GX_TEXMAP1 = 1; (*!< Texture map slot 1 *) 408 GX_TEXMAP2 = 2; (*!< Texture map slot 2 *) 409 GX_TEXMAP3 = 3; (*!< Texture map slot 3 *) 410 GX_TEXMAP4 = 4; (*!< Texture map slot 4 *) 411 GX_TEXMAP5 = 5; (*!< Texture map slot 5 *) 412 GX_TEXMAP6 = 6; (*!< Texture map slot 6 *) 413 GX_TEXMAP7 = 7; (*!< Texture map slot 7 *) 414 GX_MAX_TEXMAP = 8; 415 GX_TEXMAP_NULL = $ff; (*!< No texmap *) 416 GX_TEXMAP_DISABLE = $100; (*!< Disable texmap lookup for this texmap slot (use bitwise OR with a texture map slot). *) 417 418 GX_AOP_AND = 0; 419 GX_AOP_OR = 1; 420 GX_AOP_XOR = 2; 421 GX_AOP_XNOR = 3; 422 GX_MAX_ALPHAOP = 4; 423 424 GX_KCOLOR0 = 0; (*!< Constant register 0 *) 425 GX_KCOLOR1 = 1; (*!< Constant register 1 *) 426 GX_KCOLOR2 = 2; (*!< Constant register 2 *) 427 GX_KCOLOR3 = 3; (*!< Constant register 3 *) 428 GX_KCOLOR_MAX = 4; 429 430 GX_TEV_KCSEL_1 = $00; (*!< constant 1.0 *) 431 GX_TEV_KCSEL_7_8 = $01; (*!< constant 7/8 *) 432 GX_TEV_KCSEL_3_4 = $02; (*!< constant 3/4 *) 433 GX_TEV_KCSEL_5_8 = $03; (*!< constant 5/8 *) 434 GX_TEV_KCSEL_1_2 = $04; (*!< constant 1/2 *) 435 GX_TEV_KCSEL_3_8 = $05; (*!< constant 3/8 *) 436 GX_TEV_KCSEL_1_4 = $06; (*!< constant 1/4 *) 437 GX_TEV_KCSEL_1_8 = $07; (*!< constant 1/8 *) 438 GX_TEV_KCSEL_K0 = $0C; (*!< K0[RGB] register *) 439 GX_TEV_KCSEL_K1 = $0D; (*!< K1[RGB] register *) 440 GX_TEV_KCSEL_K2 = $0E; (*!< K2[RGB] register *) 441 GX_TEV_KCSEL_K3 = $0F; (*!< K3[RGB] register *) 442 GX_TEV_KCSEL_K0_R = $10; (*!< K0[RRR] register *) 443 GX_TEV_KCSEL_K1_R = $11; (*!< K1[RRR] register *) 444 GX_TEV_KCSEL_K2_R = $12; (*!< K2[RRR] register *) 445 GX_TEV_KCSEL_K3_R = $13; (*!< K3[RRR] register *) 446 GX_TEV_KCSEL_K0_G = $14; (*!< K0[GGG] register *) 447 GX_TEV_KCSEL_K1_G = $15; (*!< K1[GGG] register *) 448 GX_TEV_KCSEL_K2_G = $16; (*!< K2[GGG] register *) 449 GX_TEV_KCSEL_K3_G = $17; (*!< K3[GGG] register *) 450 GX_TEV_KCSEL_K0_B = $18; (*!< K0[BBB] register *) 451 GX_TEV_KCSEL_K1_B = $19; (*!< K1[BBB] register *) 452 GX_TEV_KCSEL_K2_B = $1A; (*!< K2[BBB] register *) 453 GX_TEV_KCSEL_K3_B = $1B; (*!< K3[RBB] register *) 454 GX_TEV_KCSEL_K0_A = $1C; (*!< K0[AAA] register *) 455 GX_TEV_KCSEL_K1_A = $1D; (*!< K1[AAA] register *) 456 GX_TEV_KCSEL_K2_A = $1E; (*!< K2[AAA] register *) 457 GX_TEV_KCSEL_K3_A = $1F; (*!< K3[AAA] register *) 458 459 GX_TEV_KASEL_1 = $00; (*!< constant 1.0 *) 460 GX_TEV_KASEL_7_8 = $01; (*!< constant 7/8 *) 461 GX_TEV_KASEL_3_4 = $02; (*!< constant 3/4 *) 462 GX_TEV_KASEL_5_8 = $03; (*!< constant 5/8 *) 463 GX_TEV_KASEL_1_2 = $04; (*!< constant 1/2 *) 464 GX_TEV_KASEL_3_8 = $05; (*!< constant 3/8 *) 465 GX_TEV_KASEL_1_4 = $06; (*!< constant 1/4 *) 466 GX_TEV_KASEL_1_8 = $07; (*!< constant 1/8 *) 467 GX_TEV_KASEL_K0_R = $10; (*!< K0[R] register *) 468 GX_TEV_KASEL_K1_R = $11; (*!< K1[R] register *) 469 GX_TEV_KASEL_K2_R = $12; (*!< K2[R] register *) 470 GX_TEV_KASEL_K3_R = $13; (*!< K3[R] register *) 471 GX_TEV_KASEL_K0_G = $14; (*!< K0[G] register *) 472 GX_TEV_KASEL_K1_G = $15; (*!< K1[G] register *) 473 GX_TEV_KASEL_K2_G = $16; (*!< K2[G] register *) 474 GX_TEV_KASEL_K3_G = $17; (*!< K3[G] register *) 475 GX_TEV_KASEL_K0_B = $18; (*!< K0[B] register *) 476 GX_TEV_KASEL_K1_B = $19; (*!< K1[B] register *) 477 GX_TEV_KASEL_K2_B = $1A; (*!< K2[B] register *) 478 GX_TEV_KASEL_K3_B = $1B; (*!< K3[B] register *) 479 GX_TEV_KASEL_K0_A = $1C; (*!< K0[A] register *) 480 GX_TEV_KASEL_K1_A = $1D; (*!< K1[A] register *) 481 GX_TEV_KASEL_K2_A = $1E; (*!< K2[A] register *) 482 GX_TEV_KASEL_K3_A = $1F; (*!< K3[A] register *) 483 484 GX_TEV_SWAP0 = 0; 485 GX_TEV_SWAP1 = 1; 486 GX_TEV_SWAP2 = 2; 487 GX_TEV_SWAP3 = 3; 488 GX_MAX_TEVSWAP = 4; 489 490 GX_CH_RED = 0; 491 GX_CH_GREEN = 1; 492 GX_CH_BLUE = 2; 493 GX_CH_ALPHA = 3; 494 495 GX_INDTEXSTAGE0 = 0; 496 GX_INDTEXSTAGE1 = 1; 497 GX_INDTEXSTAGE2 = 2; 498 GX_INDTEXSTAGE3 = 3; 499 GX_MAX_INDTEXSTAGE = 4; 500 501 GX_ITF_8 = 0; 502 GX_ITF_5 = 1; 503 GX_ITF_4 = 2; 504 GX_ITF_3 = 3; 505 GX_MAX_ITFORMAT = 4; 506 507 GX_ITB_NONE = 0; 508 GX_ITB_S = 1; 509 GX_ITB_T = 2; 510 GX_ITB_ST = 3; 511 GX_ITB_U = 4; 512 GX_ITB_SU = 5; 513 GX_ITB_TU = 6; 514 GX_ITB_STU = 7; 515 GX_MAX_ITBIAS = 8; 516 517 GX_ITM_OFF = 0; (*!< Specifies a matrix of all zeroes. *) 518 GX_ITM_0 = 1; (*!< Specifies indirect matrix 0, indirect scale 0. *) 519 GX_ITM_1 = 2; (*!< Specifies indirect matrix 1, indirect scale 1. *) 520 GX_ITM_2 = 3; (*!< Specifies indirect matrix 2, indirect scale 2. *) 521 GX_ITM_S0 = 5; (*!< Specifies dynamic S-type matrix, indirect scale 0. *) 522 GX_ITM_S1 = 6; (*!< Specifies dynamic S-type matrix, indirect scale 1. *) 523 GX_ITM_S2 = 7; (*!< Specifies dynamic S-type matrix, indirect scale 2. *) 524 GX_ITM_T0 = 9; (*!< Specifies dynamic T-type matrix, indirect scale 0. *) 525 GX_ITM_T1 = 10; (*!< Specifies dynamic T-type matrix, indirect scale 1. *) 526 GX_ITM_T2 = 11; (*!< Specifies dynamic T-type matrix, indirect scale 2. *) 527 528 GX_ITW_OFF = 0; 529 GX_ITW_256 = 1; 530 GX_ITW_128 = 2; 531 GX_ITW_64 = 3; 532 GX_ITW_32 = 4; 533 GX_ITW_16 = 5; 534 GX_ITW_0 = 6; 535 GX_MAX_ITWRAP = 7; 536 537 GX_ITBA_OFF = 0; 538 GX_ITBA_S = 1; 539 GX_ITBA_T = 2; 540 GX_ITBA_U = 3; 541 GX_MAX_ITBALPHA = 4; 542 543 GX_ITS_1 = 0; 544 GX_ITS_2 = 1; 545 GX_ITS_4 = 2; 546 GX_ITS_8 = 3; 547 GX_ITS_16 = 4; 548 GX_ITS_32 = 5; 549 GX_ITS_64 = 6; 550 GX_ITS_128 = 7; 551 GX_ITS_256 = 8; 552 GX_MAX_ITSCALE = 9; 553 554 GX_FOG_NONE = 0; 555 GX_FOG_PERSP_LIN = 2; 556 GX_FOG_PERSP_EXP = 4; 557 GX_FOG_PERSP_EXP2 = 5; 558 GX_FOG_PERSP_REVEXP = 6; 559 GX_FOG_PERSP_REVEXP2 = 7; 560 GX_FOG_ORTHO_LIN = 10; 561 GX_FOG_ORTHO_EXP = 12; 562 GX_FOG_ORTHO_EXP2 = 13; 563 GX_FOG_ORTHO_REVEXP = 14; 564 GX_FOG_ORTHO_REVEXP2 = 15; 565 GX_FOG_LIN = GX_FOG_PERSP_LIN; 566 GX_FOG_EXP = GX_FOG_PERSP_EXP; 567 GX_FOG_EXP2 = GX_FOG_PERSP_EXP2; 568 GX_FOG_REVEXP = GX_FOG_PERSP_REVEXP; 569 GX_FOG_REVEXP2 = GX_FOG_PERSP_REVEXP2; 570 571 GX_PF_RGB8_Z24 = 0; 572 GX_PF_RGBA6_Z24 = 1; 573 GX_PF_RGB565_Z16 = 2; 574 GX_PF_Z24 = 3; 575 GX_PF_Y8 = 4; 576 GX_PF_U8 = 5; 577 GX_PF_V8 = 6; 578 GX_PF_YUV420 = 7; 579 580 GX_ZC_LINEAR = 0; 581 GX_ZC_NEAR = 1; 582 GX_ZC_MID = 2; 583 GX_ZC_FAR = 3; 584 585 GX_CLAMP_NONE = 0; 586 GX_CLAMP_TOP = 1; 587 GX_CLAMP_BOTTOM = 2; 588 589 GX_GM_1_0 = 0; 590 GX_GM_1_7 = 1; 591 GX_GM_2_2 = 2; 592 593 GX_COPY_PROGRESSIVE = 0; 594 GX_COPY_INTLC_EVEN = 2; 595 GX_COPY_INTLC_ODD = 3; 596 597 GX_READ_00 = 0; (*!< Always read 0x00. *) 598 GX_READ_FF = 1; (*!< Always read 0xFF. *) 599 GX_READ_NONE = 2; (*!< Always read the real alpha value. *) 600 601 GX_TEXCACHE_32K = 0; 602 GX_TEXCACHE_128K = 1; 603 GX_TEXCACHE_512K = 2; 604 GX_TEXCACHE_NONE = 3; 605 606 GX_DA_OFF = 0; 607 GX_DA_GENTLE = 1; 608 GX_DA_MEDIUM = 2; 609 GX_DA_STEEP = 3; 610 611 GX_SP_OFF = 0; 612 GX_SP_FLAT = 1; 613 GX_SP_COS = 2; 614 GX_SP_COS2 = 3; 615 GX_SP_SHARP = 4; 616 GX_SP_RING1 = 5; 617 GX_SP_RING2 = 6; 618 619 GX_NEAR = 0; (*!< Point sampling, no mipmap *) 620 GX_LINEAR = 1; (*!< Bilinear filtering, no mipmap *) 621 GX_NEAR_MIP_NEAR = 2; (*!< Point sampling, discrete mipmap *) 622 GX_LIN_MIP_NEAR = 3; (*!< Bilinear filtering, discrete mipmap *) 623 GX_NEAR_MIP_LIN = 4; (*!< Point sampling, linear mipmap *) 624 GX_LIN_MIP_LIN = 5; (*!< Trilinear filtering *) 625 626 GX_ANISO_1 = 0; 627 GX_ANISO_2 = 1; 628 GX_ANISO_4 = 2; 629 GX_MAX_ANISOTROPY = 3; 630 631 GX_VC_POS = 0; 632 GX_VC_NRM = 1; 633 GX_VC_CLR0 = 2; 634 GX_VC_CLR1 = 3; 635 GX_VC_TEX0 = 4; 636 GX_VC_TEX1 = 5; 637 GX_VC_TEX2 = 6; 638 GX_VC_TEX3 = 7; 639 GX_VC_TEX4 = 8; 640 GX_VC_TEX5 = 9; 641 GX_VC_TEX6 = 10; 642 GX_VC_TEX7 = 11; 643 GX_VC_ALL = 15; 644 645 GX_PERF0_VERTICES = 0; (*!< Number of vertices processed by the GP. *) 646 GX_PERF0_CLIP_VTX = 1; (*!< Number of vertices that were clipped by the GP. *) 647 GX_PERF0_CLIP_CLKS = 2; (*!< Number of GP clocks spent clipping. *) 648 GX_PERF0_XF_WAIT_IN = 3; (*!< Number of cycles the XF is waiting on input. If the XF is waiting a large percentage 649 * of the total time, it may indicate that the CPU is not supplying data fast enough to 650 * keep the GP busy. *) 651 GX_PERF0_XF_WAIT_OUT = 4; (*!< Number of cycles the XF waits to send its output to the rest of the GP pipeline. If 652 * the XF cannot output, it may indicate that the GP is currently fill-rate limited. *) 653 GX_PERF0_XF_XFRM_CLKS = 5; (*!< Number of cycles the transform engine is busy. *) 654 GX_PERF0_XF_LIT_CLKS = 6; (*!< Number of cycles the lighting engine is busy. *) 655 GX_PERF0_XF_BOT_CLKS = 7; (*!< Number of cycles the bottom of the pipe (result combiner) is busy. *) 656 GX_PERF0_XF_REGLD_CLKS = 8; (*!< Number of cycles are spent loading XF state registers. *) 657 GX_PERF0_XF_REGRD_CLKS = 9; (*!< Number of cycles the XF reads the state registers. *) 658 GX_PERF0_CLIP_RATIO = 10; 659 GX_PERF0_TRIANGLES = 11; (*!< Number of triangles. *) 660 GX_PERF0_TRIANGLES_CULLED = 12; (*!< Number of triangles that <i>failed</i> the front-face/back-face culling test. *) 661 GX_PERF0_TRIANGLES_PASSED = 13; (*!< Number of triangles that <i>passed</i> the front-face/back-face culling test. *) 662 GX_PERF0_TRIANGLES_SCISSORED = 14; (*!< Number of triangles that are scissored. *) 663 GX_PERF0_TRIANGLES_0TEX = 15; 664 GX_PERF0_TRIANGLES_1TEX = 16; 665 GX_PERF0_TRIANGLES_2TEX = 17; 666 GX_PERF0_TRIANGLES_3TEX = 18; 667 GX_PERF0_TRIANGLES_4TEX = 19; 668 GX_PERF0_TRIANGLES_5TEX = 20; 669 GX_PERF0_TRIANGLES_6TEX = 21; 670 GX_PERF0_TRIANGLES_7TEX = 22; 671 GX_PERF0_TRIANGLES_8TEX = 23; 672 GX_PERF0_TRIANGLES_0CLR = 24; 673 GX_PERF0_TRIANGLES_1CLR = 25; 674 GX_PERF0_TRIANGLES_2CLR = 26; 675 GX_PERF0_QUAD_0CVG = 27; (*!< Number of quads having zero coverage. *) 676 GX_PERF0_QUAD_NON0CVG = 28; (*!< Number of quads having coverage greater than zero. *) 677 GX_PERF0_QUAD_1CVG = 29; (*!< Number of quads with 1 pixel coverage. *) 678 GX_PERF0_QUAD_2CVG = 30; (*!< Number of quads with 2 pixel coverage. *) 679 GX_PERF0_QUAD_3CVG = 31; (*!< Number of quads with 3 pixel coverage. *) 680 GX_PERF0_QUAD_4CVG = 32; (*!< Number of quads with 4 pixel coverage. *) 681 GX_PERF0_AVG_QUAD_CNT = 33; (*!< Average quad count; average based on what is unknown *) 682 GX_PERF0_CLOCKS = 34; (*!< Number of GP clocks that have elapsed since the previous call to GX_ReadGP0Metric(). *) 683 GX_PERF0_NONE = 35; (*!< Disables performance measurement for perf0 and resets the counter. *) 684 685 GX_PERF1_TEXELS = 0; (*!< Number of texels processed by the GP. *) 686 GX_PERF1_TX_IDLE = 1; (*!< Number of clocks that the texture unit (TX) is idle. *) 687 GX_PERF1_TX_REGS = 2; (*!< Number of GP clocks spent writing to state registers in the TX unit. *) 688 GX_PERF1_TX_MEMSTALL = 3; (*!< Number of GP clocks the TX unit is stalled waiting for main memory. *) 689 GX_PERF1_TC_CHECK1_2 = 4; 690 GX_PERF1_TC_CHECK3_4 = 5; 691 GX_PERF1_TC_CHECK5_6 = 6; 692 GX_PERF1_TC_CHECK7_8 = 7; 693 GX_PERF1_TC_MISS = 8; (*!< Number of texture cache misses in total? *) 694 GX_PERF1_VC_ELEMQ_FULL = 9; 695 GX_PERF1_VC_MISSQ_FULL = 10; 696 GX_PERF1_VC_MEMREQ_FULL = 11; 697 GX_PERF1_VC_STATUS7 = 12; 698 GX_PERF1_VC_MISSREP_FULL = 13; 699 GX_PERF1_VC_STREAMBUF_LOW = 14; 700 GX_PERF1_VC_ALL_STALLS = 15; 701 GX_PERF1_VERTICES = 16; (*!< Number of vertices processed by the GP. *) 702 GX_PERF1_FIFO_REQ = 17; (*!< Number of lines (32B) read from the GP FIFO. *) 703 GX_PERF1_CALL_REQ = 18; (*!< Number of lines (32B) read from called display lists. *) 704 GX_PERF1_VC_MISS_REQ = 19; (*!< Number vertex cache miss request. Each miss requests a 32B transfer from main memory. *) 705 GX_PERF1_CP_ALL_REQ = 20; (*!< Counts all requests (32B/request) from the GP Command Processor (CP). It should be equal to 706 * the sum of counts returned by <tt>GX_PERF1_FIFO_REQ</tt>, <tt>GX_PERF1_CALL_REQ</tt>, and <tt>GX_PERF1_VC_MISS_REQ</tt>. *) 707 GX_PERF1_CLOCKS = 21; (*!< Number of GP clocks that have elapsed since the last call to GX_ReadGP1Metric(). *) 708 GX_PERF1_NONE = 22; (*!< Disables performance measurement for perf1 and resets the counter. *) 709 710 GX_TLUT0 = 0; 711 GX_TLUT1 = 1; 712 GX_TLUT2 = 2; 713 GX_TLUT3 = 3; 714 GX_TLUT4 = 4; 715 GX_TLUT5 = 5; 716 GX_TLUT6 = 6; 717 GX_TLUT7 = 7; 718 GX_TLUT8 = 8; 719 GX_TLUT9 = 9; 720 GX_TLUT10 = 10; 721 GX_TLUT11 = 11; 722 GX_TLUT12 = 12; 723 GX_TLUT13 = 13; 724 GX_TLUT14 = 14; 725 GX_TLUT15 = 15; 726 GX_BIGTLUT0 = 16; 727 GX_BIGTLUT1 = 17; 728 GX_BIGTLUT2 = 18; 729 GX_BIGTLUT3 = 19; 730 731 GX_MAX_VTXDESC = GX_VA_MAXATTR; 732 GX_MAX_VTXDESC_LISTSIZE = ( GX_VA_MAXATTR + 1 ); 733 GX_MAX_VTXATTRFMT = GX_VA_MAXATTR; 734 GX_MAX_VTXATTRFMT_LISTSIZE = ( GX_VA_MAXATTR + 1 ); 735 GX_MAX_Z24 = $00ffffff; 736 737type 738 _wgpipe = record 739 case Integer of 740 0:(U8 : cuint8;); 741 1:(S8 : cint8;); 742 2:(U16 : cuint16;); 743 3:(S16 : cint16;); 744 4:(U32 : cuint32;); 745 5:(S32 : cint32;); 746 6:(F32 : cfloat;); 747 end; 748 TWGPipe = _wgpipe; 749 PWGPipe = ^TWGPipe; 750 751 _gx_color = record 752 r : cuint8; (*!< Red color component. *) 753 g : cuint8; (*!< Green color component. *) 754 b : cuint8; (*!< Blue alpha component. *) 755 a : cuint8; (*!< Alpha component. If a function does not use the alpha value, it is safely ignored. *) 756 end; 757 GXColor = _gx_color; 758 PGXColor = ^GXColor; 759 760 _gx_colors10 = record 761 r : cint16; (*!< Red color component. *) 762 g : cint16; (*!< Green color component. *) 763 b : cint16; (*!< Blue color component. *) 764 a : cint16; (*!< Alpha component. If a function does not use the alpha value, it is safely ignored. *) 765 end; 766 GXColorS10 = _gx_colors10; 767 PGXColorS10 = ^GXColorS10; 768 769 _gx_texobj = record 770 val : array [0..7] of cuint32; 771 end; 772 GXTexObj = _gx_texobj; 773 PGXTexObj = ^GXTexObj; 774 775 _gx_tlutobj = record 776 val : array [0..2] of cuint32; 777 end; 778 GXTlutObj = _gx_tlutobj; 779 PGXTlutObj = ^GXTlutObj; 780 781 782 _gx_texreg = record 783 val : array [0..3] of cuint32; 784 end; 785 GXTexRegion = _gx_texreg; 786 PGXTexRegion = ^GXTexRegion; 787 788 _gx_tlutreg = record 789 val : array [0..3] of cuint32; 790 end; 791 GXTlutRegion = _gx_tlutreg; 792 PGXTlutRegion = ^GXTlutRegion; 793 794 _gx_litobj = record 795 val : array [0..15] of cuint32; 796 end; 797 GXLightObj = _gx_litobj; 798 PGXLightObj = ^GXLightObj; 799 800 _vtx = record 801 x : f32; 802 y : f32; 803 z : f32; 804 s : cuint16; 805 t : cuint16; 806 rgba : cuint32; 807 end; 808 Vtx = _vtx; 809 PVtx = ^Vtx; 810 811 GXVtxDesc = record 812 attr : cuint8; (*!< \ref vtxattr for this element. *) 813 type_ : cuint8; (*!< \ref vtxattrin for this element. *) 814 end; 815 PGXVtxDesc = ^GXVtxDesc; 816 817 GXVtxAttrFmt = record 818 vtxattr : cuint32; (*!< \ref vtxattr for this element. *) 819 comptype : cuint32; (*!< \ref comptype for this element. *) 820 compsize : cuint32; (*!< \ref compsize for this element. *) 821 frac : cuint32; (*!< Number of fractional bits for a fixed-point number. *) 822 end; 823 PGXVtxAttrFmt = ^GXVtxAttrFmt; 824 825 826 GXFifoObj = record 827 pad : array [0..GX_FIFO_OBJSIZE-1] of cuint8; 828 end; 829 PGXFifoObj = ^GXFifoObj; 830 831 832 GXTexReg = record 833 dummy : array [0..3] of cuint8; 834 end; 835 PGXTexReg = ^GXTexReg; 836 837 GXFogAdjTbl = record 838 r : array [0..9] of cuint16; (*!< u4.8 format range parameter. *) 839 end; 840 PGXFogAdjTbl = ^GXFogAdjTbl; 841 842type 843 GXBreakPtCallback = procedure; cdecl; 844 GXDrawDoneCallback = procedure; cdecl; 845 GXDrawSyncCallback = procedure(token: cuint16); cdecl; 846 GXTexRegionCallback = function(obj: PGXTexObj; mapid: cuint8): PGXTexRegion; cdecl; 847 GXTlutRegionCallback = function(tlut_name: cuint32): PGXTlutRegion; cdecl; 848 849var 850 wgPipe : PWGPipe; cvar; external; 851 852function GX_Init(base: pointer; size: cuint32): PGXFifoObj; cdecl; external; 853 854 855procedure GX_InitFifoBase(fifo: PGXFifoObj; base: pointer; size: cuint32); cdecl; external; 856 857procedure GX_InitFifoLimits(fifo: PGXFifoObj; hiwatermark, lowatermark: cuint32); cdecl; external; 858 859procedure GX_InitFifoPtrs(fifo: PGXFifoObj; rd_ptr, wt_ptr: pointer); cdecl; external; 860 861procedure GX_GetFifoPtrs(fifo: PGXFifoObj; rd_ptr, wt_ptr: pointer); cdecl; external; 862 863procedure GX_SetCPUFifo(fifo: PGXFifoObj); cdecl; external; 864 865procedure GX_SetGPFifo(fifo: PGXFifoObj); cdecl; external; 866 867procedure GX_GetCPUFifo(fifo: PGXFifoObj); cdecl; external; 868 869procedure GX_GetGPFifo(fifo: PGXFifoObj); cdecl; external; 870 871function GX_GetFifoBase(fifo: PGXFifoObj): pointer; cdecl; external; 872 873function GX_GetFifoCount(fifo: PGXFifoObj): cuint32; cdecl; external; 874 875function GX_GetFifoSize(fifo: PGXFifoObj): cuint32; cdecl; external; 876 877function GX_GetFifoWrap(fifo: PGXFifoObj): cuint8; cdecl; external; 878 879function GX_SetDrawDoneCallback(cb: GXDrawDoneCallback): GXDrawDoneCallback; cdecl; external; 880 881function GX_SetBreakPtCallback(cb: GXBreakPtCallback): GXBreakPtCallback; cdecl; external; 882 883procedure GX_AbortFrame; cdecl; external; 884 885procedure GX_Flush; cdecl; external; 886 887procedure GX_SetMisc(token, value: cuint32); cdecl; external; 888 889procedure GX_SetDrawDone; cdecl; external; 890 891procedure GX_WaitDrawDone; cdecl; external; 892 893function GX_GetDrawSync: cuint16; cdecl; external; 894 895procedure GX_SetDrawSync(token: cuint16); cdecl; external; 896 897function GX_SetDrawSyncCallback(cb: GXDrawSyncCallback): GXDrawSyncCallback; cdecl; external; 898 899procedure GX_DisableBreakPt; cdecl; external; 900 901procedure GX_EnableBreakPt(break_pt: pointer); cdecl; external; 902 903procedure GX_DrawDone; cdecl; external; 904 905procedure GX_TexModeSync; cdecl; external; 906 907procedure GX_InvVtxCache; cdecl; external; 908 909procedure GX_ClearVtxDesc; cdecl; external; 910 911procedure GX_LoadProjectionMtx(mt: Mtx44; type_: cuint8); cdecl; external; 912 913procedure GX_SetViewport(xOrig, yOrig, wd, ht, nearZ, farZ: f32); cdecl; external; 914 915procedure GX_SetViewportJitter(xOrig, yOrig, wd, ht, nearZ, farZ: f32; 916 field: cuint32); cdecl; external; 917 918procedure GX_SetChanCtrl(channel: cint32; 919 enable, ambsrc, matsrc, litmask, diff_fn, attn_fn: cuint8); cdecl; external; 920 921procedure GX_SetChanAmbColor(channel: cint32; color: GXColor); cdecl; external; 922 923procedure GX_SetChanMatColor(channel: cint32; color: GXColor); cdecl; external; 924 925procedure GX_SetArray(attr: cuint32; ptr: pointer; stride: cuint8); cdecl; external; 926 927procedure GX_SetVtxAttrFmt(vtxfmt: cuint8; 928 vtxattr, comptype, compsize, frac: cuint32); cdecl; external; 929 930procedure GX_SetVtxAttrFmtv(vtxfmt: cuint8; attr_list: PGXVtxAttrFmt); cdecl; external; 931 932procedure GX_SetVtxDesc(attr, type_: cuint8); cdecl; external; 933 934procedure GX_SetVtxDescv(attr_list: PGXVtxDesc); cdecl; external; 935 936procedure GX_GetVtxDescv(attr_list: PGXVtxDesc); cdecl; external; 937 938function GX_EndDispList: cuint32; cdecl; external; 939 940procedure GX_Begin(primitve, vtxfmt: cuint8; vtxcnt: cuint16); cdecl; external; 941 942procedure GX_BeginDispList(list: pointer; size: cuint32); cdecl; external; 943 944procedure GX_CallDispList(list: pointer; nbytes: cuint32); cdecl; external; 945 946 947 948procedure GX_End(); inline; 949 950procedure GX_Position3f32(x, y, z: f32); inline; 951 952procedure GX_Position3u16(x, y, z: cuint16); inline; 953 954procedure GX_Position3s16(x, y, z: cint16); inline; 955 956procedure GX_Position3u8(x, y, z: cuint8); inline; 957 958procedure GX_Position3s8(x, y, z: cint8); inline; 959 960procedure GX_Position2f32(x, y: f32); inline; 961 962procedure GX_Position2u16(x, y: cuint16); inline; 963 964procedure GX_Position2s16(x, y: cint16); inline; 965 966procedure GX_Position2u8(x, y: cuint8); inline; 967 968procedure GX_Position2s8(x, y: cint8); inline; 969 970procedure GX_Position1x8(index: cuint8); inline; 971 972procedure GX_Position1x16(index: cuint16); inline; 973 974procedure GX_Normal3f32(nx, ny, nz: f32); inline; 975 976procedure GX_Normal3s16(nx, ny, nz: cint16); inline; 977 978procedure GX_Normal3s8(nx, ny, nz: cint8); inline; 979 980procedure GX_Normal1x8(index: cuint8); inline; 981 982procedure GX_Normal1x16(index: cuint16); inline; 983 984procedure GX_Color4u8(r, g, b, a: cuint8); inline; 985 986procedure GX_Color3u8(r, g, b: cuint8); inline; 987 988procedure GX_Color3f32(r, g, b: f32); inline; 989 990procedure GX_Color1u32(clr: cuint32); inline; 991 992procedure GX_Color1u16(clr: cuint16); inline; 993 994procedure GX_Color1x8(index: cuint8); inline; 995 996procedure GX_Color1x16(index: cuint16); inline; 997 998procedure GX_TexCoord2f32(s, t: f32); inline; 999 1000procedure GX_TexCoord2u16(s, t: cuint16); inline; 1001 1002procedure GX_TexCoord2s16(s, t: cint16); inline; 1003 1004procedure GX_TexCoord2u8(s, t: cuint8); inline; 1005 1006procedure GX_TexCoord2s8(s, t: cint8); inline; 1007 1008procedure GX_TexCoord1f32(s: f32); inline; 1009 1010procedure GX_TexCoord1u16(s: cuint16); inline; 1011 1012procedure GX_TexCoord1s16(s: cint16); inline; 1013 1014procedure GX_TexCoord1u8(s: cuint8); inline; 1015 1016procedure GX_TexCoord1s8(s: cint8); inline; 1017 1018procedure GX_TexCoord1x8(index: cuint8); inline; 1019 1020procedure GX_TexCoord1x16(index: cuint16); inline; 1021 1022procedure GX_MatrixIndex1x8(index: cuint8); inline; 1023 1024procedure GX_AdjustForOverscan(rmin, rmout: PGXRModeObj; hor, ver: cuint16); cdecl; external; 1025 1026procedure GX_LoadPosMtxImm(mt: Mtx; pnidx: cuint32); cdecl; external; 1027 1028procedure GX_LoadPosMtxIdx(mtxidx: cuint16; pnidx: cuint32); cdecl; external; 1029 1030 1031procedure GX_LoadNrmMtxImm(mt: Mtx; pnidx: cuint32); cdecl; external; 1032 1033 1034procedure GX_LoadNrmMtxIdx3x3(mtxidx: cuint16; pnidx: cuint32); cdecl; external; 1035 1036 1037procedure GX_LoadTexMtxImm(mt: Mtx; texidx: cuint32; type_: cuint8); cdecl; external; 1038 1039 1040procedure GX_LoadTexMtxIdx(mtxidx: cuint16; texidx: cuint32; type_: cuint8); cdecl; external; 1041 1042procedure GX_SetCurrentMtx(mtx: cuint32); cdecl; external; 1043 1044procedure GX_SetTevOp(tevstage, mode: cuint8); cdecl; external; 1045 1046procedure GX_SetTevColor(tev_regid: cuint8; color: GXColor); cdecl; external; 1047 1048procedure GX_SetTevColorS10(tev_regid: cuint8; color: GXColorS10); cdecl; external; 1049 1050procedure GX_SetTevColorIn(tevstage, a, b, c, d: cuint8); cdecl; external; 1051 1052procedure GX_SetTevAlphaIn(tevstage, a, b, c, d: cuint8); cdecl; external; 1053 1054procedure GX_SetTevColorOp( 1055 tevstage, tevop, tevbias, tevscale, clamp, tevregid: cuint8); cdecl; external; 1056 1057procedure GX_SetTevAlphaOp( 1058 tevstage, tevop, tevbias, tevscale, clamp, tevregid: cuint8); cdecl; external; 1059 1060procedure GX_SetNumTexGens(nr: cuint32); cdecl; external; 1061 1062procedure GX_SetTexCoordGen(texcoord: cuint16; 1063 tgen_typ, tgen_src, mtxsrc: cuint32); cdecl; external; 1064 1065procedure GX_SetTexCoordGen2(texcoord: cuint16; 1066 tgen_typ, tgen_src, mtxsrc, normalize, postmtx: cuint32); cdecl; external; 1067 1068procedure GX_SetZTexture(op, fmt: cuint8; bias: cuint32); cdecl; external; 1069 1070procedure GX_SetZMode(enable, func, update_enable: cuint8); cdecl; external; 1071 1072procedure GX_SetZCompLoc(before_tex: cuint8); cdecl; external; 1073 1074procedure GX_SetLineWidth(width, fmt: cuint8); cdecl; external; 1075 1076procedure GX_SetPointSize(width, fmt: cuint8); cdecl; external; 1077 1078procedure GX_SetBlendMode(type_, src_fact, dst_fact, op: cuint8); cdecl; external; 1079 1080procedure GX_SetCullMode(mode: cuint8); cdecl; external; 1081 1082procedure GX_SetCoPlanar(enable: cuint8); cdecl; external; 1083 1084procedure GX_EnableTexOffsets(coord, line_enable, point_enable: cuint8); cdecl; external; 1085 1086procedure GX_SetClipMode(mode: cuint8); cdecl; external; 1087 1088procedure GX_SetScissor(xOrigin, yOrigin, wd, ht: cuint32); cdecl; external; 1089 1090procedure GX_SetScissorBoxOffset(xoffset, yoffset: cint32); cdecl; external; 1091 1092procedure GX_SetNumChans(num: cuint8); cdecl; external; 1093 1094procedure GX_SetTevOrder(tevstage, texcoord: cuint8; texmap: cuint32; 1095 color: cuint8); cdecl; external; 1096 1097procedure GX_SetNumTevStages(num: cuint8); cdecl; external; 1098 1099procedure GX_SetAlphaCompare(comp0, ref0, aop, comp1, ref1: cuint8); cdecl; external; 1100 1101procedure GX_SetTevKColor(sel: cuint8; col: GXColor); cdecl; external; 1102 1103procedure GX_SetTevKColorSel(tevstage, sel: cuint8); cdecl; external; 1104 1105procedure GX_SetTevKAlphaSel(tevstage, sel: cuint8); cdecl; external; 1106 1107procedure GX_SetTevKColorS10(sel: cuint8; col: GXColorS10); cdecl; external; 1108 1109procedure GX_SetTevSwapMode(tevstage, ras_sel, tex_sel: cuint8); cdecl; external; 1110 1111procedure GX_SetTevSwapModeTable(swapid, r, g, b, a: cuint8); cdecl; external; 1112 1113procedure GX_SetTevIndirect( 1114 tevstage, indtexid, format, bias, mtxid, wrap_s, wrap_t, addprev, utclod, a: cuint8); cdecl; external; 1115 1116procedure GX_SetTevDirect(tevstage: cuint8); cdecl; external; 1117 1118procedure GX_SetNumIndStages(nstages: cuint8); cdecl; external; 1119 1120procedure GX_SetIndTexOrder(indtexstage, texcoord, texmap: cuint8); cdecl; external; 1121 1122procedure GX_SetIndTexCoordScale(indtexid, scale_s, scale_t: cuint8); cdecl; external; 1123 1124procedure GX_SetFog(type_: cuint8; startz, endz, nearz, farz: f32; col: GXColor); cdecl; external; 1125 1126procedure GX_SetFogRangeAdj(enable: cuint8; center: cuint16; 1127 table: PGXFogAdjTbl); cdecl; external; 1128 1129 1130procedure GX_SetFogColor(color: GXColor); cdecl; external; 1131 1132 1133procedure GX_InitFogAdjTable(table: PGXFogAdjTbl; width: cuint16; projmtx: f32); cdecl; external; 1134 1135procedure GX_SetIndTexMatrix(indtexmtx: cuint8; offset_mtx: f32; 1136 scale_exp: cint8); cdecl; external; 1137 1138procedure GX_SetTevIndBumpST(tevstage, indstage, mtx_sel: cuint8); cdecl; external; 1139 1140procedure GX_SetTevIndBumpXYZ(tevstage, indstage, mtx_sel: cuint8); cdecl; external; 1141 1142procedure GX_SetTevIndTile(tevstage, indtexid: cuint8; 1143 tilesize_x, tilesize_y, tilespacing_x, tilespacing_y: cuint16; 1144 indtexfmt, indtexmtx, bias_sel, alpha_sel: cuint8); cdecl; external; 1145 1146 1147(*! 1148 * \fn void GX_SetTevIndRepeat(u8 tevstage) 1149 * \brief Set a given TEV stage to use the same texture coordinates as were computed in the previous stage. 1150 * 1151 * \note This is only useful when the previous stage texture coordinates took more than one stage to compute, as is the case for GX_SetTevIndBumpST(). 1152 * 1153 * \param[in] tevstage \ref tevstage to modify 1154 * 1155 * \return none 1156 *) 1157 1158procedure GX_SetTevIndRepeat(tevstage: cuint8); cdecl; external; 1159 1160(*! 1161 * \fn void GX_SetColorUpdate(u8 enable) 1162 * \brief Enables or disables color-buffer updates when rendering into the Embedded Frame Buffer (EFB). 1163 * 1164 * \note This function also affects whether the color buffer is cleared during copies; see GX_CopyDisp() and GX_CopyTex(). 1165 * 1166 * \param[in] enable enables color-buffer updates with <tt>GX_TRUE</tt> 1167 * 1168 * \return none 1169 *) 1170 1171procedure GX_SetColorUpdate(enable: cuint8); cdecl; external; 1172 1173 1174(*! 1175 * \fn void GX_SetAlphaUpdate(u8 enable) 1176 * \brief Enables or disables alpha-buffer updates of the Embedded Frame Buffer (EFB). 1177 * 1178 * \note This function also affects whether the alpha buffer is cleared during copy operations; see GX_CopyDisp() and GX_CopyTex().<br><br> 1179 * 1180 * \note The only EFB pixel format supporting an alpha buffer is <tt>GX_PF_RGBA6_Z24</tt>; see GX_SetPixelFmt(). The alpha \a enable is ignored for non-alpha 1181 * pixel formats. 1182 * 1183 * \param[in] enable enables alpha-buffer updates with <tt>GX_TRUE</tt> 1184 * 1185 * \return none 1186 *) 1187 1188procedure GX_SetAlphaUpdate(enable: cuint8); cdecl; external; 1189 1190 1191(*! 1192 * \fn void GX_SetPixelFmt(u8 pix_fmt,u8 z_fmt) 1193 * \brief Sets the format of pixels in the Embedded Frame Buffer (EFB). 1194 * 1195 * \details There are two non-antialiased \a pix_fmts: <tt>GX_PF_RGB8_Z24</tt> and <tt>GX_PF_RGBA6_Z24</tt>. The stride of the EFB is fixed at 640 pixels. The 1196 * non-antialiased EFB has 528 lines available. 1197 * 1198 * When \a pix_fmt is set to <tt>GX_PF_RGB565_Z16</tt>, multi-sample antialiasing is enabled. In order to get proper results, one must also call GX_SetCopyFilter(). 1199 * The position of the subsamples and the antialiasing filter coefficients are set using GX_SetCopyFilter(). When antialiasing, three 16b color/Z 1200 * 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 1201 * compression type for 16-bit Z formats, which allows trading off Z precision for range. The following guidelines apply:<br><br> 1202 * 1203 * a) far/near ratio <= 2^16, use <tt>GX_ZC_LINEAR</tt><br> 1204 * b) far/near ratio <= 2^18, use <tt>GX_ZC_NEAR</tt><br> 1205 * c) far/near ratio <= 2^20, use <tt>GX_ZC_MID</tt><br> 1206 * d) far/near ratio <= 2^24, use <tt>GX_ZC_FAR</tt><br><br> 1207 * 1208 * 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. 1209 * 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. 1210 * 1211 * \note This function also controls antialiasing (AA) mode.<br><br> 1212 * 1213 * \note Since changing pixel format requires the pixel pipeline to be synchronized, the use of this function causes stall of the graphics processor as a result. Therefore, 1214 * you should avoid redundant calls of this function. 1215 * 1216 * \param[in] pix_fmt <tt>GX_PF_RGB8_Z24</tt> or <tt>GX_PF_RGBA6_Z24</tt> for non-AA, <tt>GX_PF_RGB565_Z16</tt> for AA 1217 * \param[in] z_fmt \ref zfmt to use 1218 * 1219 * \return none 1220 *) 1221 1222procedure GX_SetPixelFmt(pix_fmt, z_fmt: cuint8); cdecl; external; 1223 1224 1225(*! 1226 * \fn void GX_SetDither(u8 dither) 1227 * \brief Enables or disables dithering. 1228 * 1229 * \details A 4x4 Bayer matrix is used for dithering. 1230 * 1231 * \note Only valid when the pixel format (see GX_SetPixelFmt()) is either <tt>GX_PF_RGBA6_Z24</tt> or <tt>GX_PF_RGB565_Z16</tt>.<br><br> 1232 * 1233 * \note Dithering should probably be turned off if you are planning on using the result of rendering for comparisons (e.g. outline rendering 1234 * algorithm that writes IDs to the alpha channel, copies the alpha channel to a texture, and later compares the texture in the TEV). 1235 * 1236 * \param[in] dither enables dithering if <tt>GX_TRUE</tt> is given and pixel format is one of the two above, otherwise disabled 1237 * 1238 * \return none 1239 *) 1240 1241procedure GX_SetDither(dither: cuint8); cdecl; external; 1242 1243 1244(*! 1245 * \fn void GX_SetDstAlpha(u8 enable,u8 a) 1246 * \brief Sets a constant alpha value for writing to the Embedded Frame Buffer (EFB). 1247 * 1248 * \note To be effective, the EFB pixel type must have an alpha channel (see GX_SetPixelFmt()). The alpha compare operation (see 1249 * GX_SetAlphaCompare()) and blending operations (see GX_SetBlendMode()) still use source alpha (output from the last TEV stage) but when 1250 * writing the pixel color, the constant alpha will replace the pixel alpha in the EFB. 1251 * 1252 * \param[in] enable \a a will be written to the framebuffer if <tt>GX_ENABLE</tt> is here and frame buffer pixel format supports destination alpha 1253 * \param[in] a constant alpha value 1254 * 1255 * \return none 1256 *) 1257 1258procedure GX_SetDstAlpha(enable, a: cuint8); cdecl; external; 1259 1260 1261(*! 1262 * \fn void GX_SetFieldMask(u8 even_mask,u8 odd_mask) 1263 * \brief selectively enables and disables interlacing of the frame buffer image. 1264 * 1265 * \details This function is used when rendering fields to an interlaced Embedded Frame Buffer (EFB). 1266 * 1267 * \note When the mask is <tt>GX_FALSE</tt>, that field will not be written to the EFB, but the other field will be computed. In other words, you pay the 1268 * fill rate price of a frame to produce a field. 1269 * 1270 * \param[in] even_mask whether to write pixels with even Y coordinate 1271 * \param[in] odd_mask whether to write pixels with odd Y coordinate 1272 * 1273 * \return none 1274 *) 1275 1276procedure GX_SetFieldMask(even_mask, odd_mask: cuint8); cdecl; external; 1277 1278 1279(*! 1280 * \fn void GX_SetFieldMode(u8 field_mode,u8 half_aspect_ratio) 1281 * \brief Controls various rasterization and texturing parameters that relate to field-mode and double-strike rendering. 1282 * 1283 * \details 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 1284 * 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 1285 * 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 1286 * (the pixel aspect ratio is 1/2). 1287 * 1288 * \note The values set here usually come directly from the render mode. The \a field_rendering flags goes straight into \a field_mode. The \a half_aspect_ratio 1289 * parameter is true if the \a xfbHeight is half of the \a viHeight, false otherwise.<br><br> 1290 * 1291 * \note GX_Init() sets both fields according to the default render mode.<br><br> 1292 * 1293 * \note On production hardware (i.e. a retail GameCube), only line aspect-ratio adjustment is implemented. Points are not adjusted. 1294 * 1295 * \param[in] field_mode adjusts texture LOD computation as described above if true, otherwise does not 1296 * \param[in] half_aspect_ratio adjusts line aspect ratio accordingly, otherwise does not 1297 * 1298 * \return none 1299 *) 1300 1301procedure GX_SetFieldMode(field_mode, half_aspect_ratio: cuint8); cdecl; external; 1302 1303 1304(*! 1305 * \fn f32 GX_GetYScaleFactor(u16 efbHeight,u16 xfbHeight) 1306 * \brief Calculates an appropriate Y scale factor value for GX_SetDispCopyYScale() based on the height of the EFB and 1307 * the height of the XFB. 1308 * 1309 * \param[in] efbHeight Height of embedded framebuffer. Range from 2 to 528. Should be a multiple of 2. 1310 * \param[in] xfbHeight Height of external framebuffer. Range from 2 to 1024. Should be equal or greater than \a efbHeight. 1311 * 1312 * \return Y scale factor which can be used as argument of GX_SetDispCopyYScale(). 1313 *) 1314 1315function GX_GetYScaleFactor(efbHeight, xfbHeight: cuint16): f32; cdecl; external; 1316 1317 1318(*! 1319 * \fn u32 GX_SetDispCopyYScale(f32 yscale) 1320 * \brief Sets the vertical scale factor for the EFB to XFB copy operation. 1321 * 1322 * \details 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 1323 * have to call GX_SetDispCopySrc() prior to this function call if you want to get the number of lines by using this function. 1324 * 1325 * \param[in] yscale Vertical scale value. Range from 1.0 to 256.0. 1326 * 1327 * \return Number of lines that will be copied. 1328 *) 1329 1330function GX_SetDispCopyYScale(yscale: f32): cuint32; cdecl; external; 1331 1332 1333(*! 1334 * \fn void GX_SetDispCopySrc(u16 left,u16 top,u16 wd,u16 ht) 1335 * \brief Sets the source parameters for the EFB to XFB copy operation. 1336 * 1337 * \param[in] left left most source pixel to copy. Must be a multiple of 2 pixels. 1338 * \param[in] top top most source line to copy. Must be a multiple of 2 lines. 1339 * \param[in] wd width in pixels to copy. Must be a multiple of 2 pixels. 1340 * \param[in] ht height in lines to copy. Must be a multiple of 2 lines. 1341 * 1342 * \return none 1343 *) 1344 1345procedure GX_SetDispCopySrc(left, top, wd, ht: cuint16); cdecl; external; 1346 1347 1348(*! 1349 * \fn void GX_SetDispCopyDst(u16 wd,u16 ht) 1350 * \brief Sets the witdth and height of the display buffer in pixels. 1351 * 1352 * \details The application typical renders an image into the EFB(source) and then copies it into the XFB(destination) in main memory. \a wd 1353 * specifies the number of pixels between adjacent lines in the destination buffer and can be different than the width of the EFB. 1354 * 1355 * \param[in] wd Distance between successive lines in the XFB, in pixels. Must be a multiple of 16. 1356 * \param[in] ht Height of the XFB in lines. 1357 * 1358 * \return none 1359 *) 1360 1361procedure GX_SetDispCopyDst(wd, ht: cuint16); cdecl; external; 1362 1363 1364(*! 1365 * \fn void GX_SetCopyClamp(u8 clamp) 1366 * \brief Sets the vertical clamping mode to use during the EFB to XFB or texture copy. 1367 * 1368 * \param[in] clamp bit-wise OR of desired \ref xfbclamp. Use <tt>GX_CLAMP_NONE</tt> for no clamping. 1369 * 1370 * \return none 1371 *) 1372 1373procedure GX_SetCopyClamp(clamp: cuint8); cdecl; external; 1374 1375 1376(*! 1377 * \fn void GX_SetDispCopyGamma(u8 gamma) 1378 * \brief Sets the gamma correction applied to pixels during EFB to XFB copy operation. 1379 * 1380 * \param[in] gamma \ref gammamode 1381 * 1382 * \return none 1383 *) 1384 1385procedure GX_SetDispCopyGamma(gamma: cuint8); cdecl; external; 1386 1387 1388(*! 1389 * \fn void GX_SetCopyFilter(u8 aa,u8 sample_pattern[12][2],u8 vf,u8 vfilter[7]) 1390 * \brief Sets the subpixel sample patterns and vertical filter coefficients used to filter subpixels into pixels. 1391 * 1392 * \details This function normally uses the \a aa, \a sample_pattern and \a vfilter provided by the render mode struct:<br><br> 1393 * 1394 * \code GXRModeObj* rmode = VIDEO_GetPreferredMode(NULL); 1395 * GX_SetCopyFilter(rmode->aa,rmode->sample_pattern,GX_TRUE,rmode->vfilter); \endcode 1396 * 1397 * \note In order to make use of the \a sample_pattern, antialiasing must be enabled by setting the Embedded Frame Buffer (EFB) format to 1398 * <tt>GX_PF_RGB565_Z16</tt>; see GX_SetPixelFmt(). 1399 * 1400 * \param[in] aa utilizes \a sample_pattern if <tt>GX_TRUE</tt>, otherwise all sample points are centered 1401 * \param[in] sample_pattern array of coordinates for sample points; valid range is 1 - 11 inclusive 1402 * \param[in] vf use \a vfilter if <tt>GX_TRUE</tt>, otherwise use default 1-line filter 1403 * \param[in] vfilter vertical filter coefficients; valid coefficient range is 0 - 63 inclusive; sum should equal 64 1404 * 1405 * \return none 1406 *) 1407 1408type 1409 TSamplePattern = array [0..11, 0..1] of cuint8; 1410 TVFilter = array [0..6] of cuint8; 1411procedure GX_SetCopyFilter(aa: cuint8; sample_pattern: TSamplePattern; vf: cuint8; vfilter: TVFilter); cdecl; external; 1412 1413 1414(*! 1415 * \fn void GX_SetDispCopyFrame2Field(u8 mode) 1416 * \brief Determines which lines are read from the Embedded Frame Buffer (EFB) when using GX_CopyDisp(). 1417 * 1418 * \details Specifically, it determines whether all lines, only even lines, or only odd lines are read. 1419 * 1420 * \note The opposite function, which determines whether all lines, only even lines or only odd lines are <i>written</i> to the EFB, is GX_SetFieldMask().<br><br> 1421 * 1422 * \note Only applies to display copies, GX_CopyTex() always uses the <tt>GX_COPY_PROGRESSIVE</tt> mode. 1423 * 1424 * \param[in] mode \ref copymode to determine which field to copy (or both) 1425 * 1426 * \return none 1427 *) 1428 1429procedure GX_SetDispCopyFrame2Field(mode: cuint8); cdecl; external; 1430 1431 1432(*! 1433 * \fn void GX_SetCopyClear(GXColor color,u32 zvalue) 1434 * \brief Sets color and Z value to clear the EFB to during copy operations. 1435 * 1436 * \details These values are used during both display copies and texture copies. 1437 * 1438 * \param[in] color RGBA color (8-bit/component) to use during clear operation. 1439 * \param[in] zvalue 24-bit Z value to use during clear operation. Use the constant <tt>GX_MAX_Z24</tt> to specify the maximum depth value. 1440 * 1441 * \return none 1442 *) 1443 1444procedure GX_SetCopyClear(color: GXColor; zvalue: cuint32); cdecl; external; 1445 1446 1447(*! 1448 * \fn void GX_CopyDisp(void *dest,u8 clear) 1449 * \brief Copies the embedded framebuffer (EFB) to the external framebuffer(XFB) in main memory. 1450 * 1451 * \note The stride of the XFB is set using GX_SetDispCopyDst(). The source image in the EFB is described using GX_SetDispCopySrc().<br><br> 1452 * 1453 * \note The graphics processor will stall all graphics commands util the copy is complete.<br><br> 1454 * 1455 * \note If the \a clear flag is true, the color and Z buffers will be cleared during the copy. They will be cleared to the constant 1456 * values set using GX_SetCopyClear(). 1457 * 1458 * \param[in] dest pointer to the external framebuffer. \a dest should be 32B aligned. 1459 * \param[in] clear flag that indicates framebuffer should be cleared if <tt>GX_TRUE</tt>. 1460 * 1461 * \return none 1462 *) 1463 1464procedure GX_CopyDisp(dest: pointer; clear: cuint8); cdecl; external; 1465 1466 1467(*! 1468 * \fn void GX_SetTexCopySrc(u16 left,u16 top,u16 wd,u16 ht) 1469 * \brief Sets the source parameters for the Embedded Frame Buffer (EFB) to texture image copy. 1470 * 1471 * \param[in] left left-most source pixel to copy, multiple of two 1472 * \param[in] top top-most source line to copy, multiple of two 1473 * \param[in] wd width to copy in pixels, multiple of two 1474 * \param[in] ht height to copy in pixels, multiple of two 1475 * 1476 * \return none 1477 *) 1478 1479procedure GX_SetTexCopySrc(left, top, wd, ht: cuint16); cdecl; external; 1480 1481 1482(*! 1483 * \fn void GX_SetTexCopyDst(u16 wd,u16 ht,u32 fmt,u8 mipmap) 1484 * \brief This function sets the width and height of the destination texture buffer in texels. 1485 * 1486 * \details This function is useful when creating textures using the Graphics Processor (GP). If the \a clear flag is set to <tt>GX_TRUE</tt>, the 1487 * EFB will be cleared to the current color (see GX_SetCopyClear()) during the copy operation. 1488 * 1489 * \param[in] wd pointer to the image buffer in main memory. \a dest should be 32B aligned. 1490 * \param[in] ht flag that indicates framebuffer should be cleared if <tt>GX_TRUE</tt>. 1491 * \param[in] fmt \ref texfmt 1492 * \param[in] mipmap 1493 * 1494 * \return none 1495 *) 1496 1497procedure GX_SetTexCopyDst(wd, ht: cuint16; fmt: cuint32; mipmap: cuint8); cdecl; external; 1498 1499 1500(*! 1501 * \fn void GX_CopyTex(void *dest,u8 clear) 1502 * \brief Copies the embedded framebuffer (EFB) to the texture image buffer \a dest in main memory. 1503 * 1504 * \details This is useful when creating textures using the Graphics Processor (GP). If the \a clear flag is set to <tt>GX_TRUE</tt>, the EFB will be cleared 1505 * to the current color(see GX_SetCopyClear()) during the copy operation. 1506 * 1507 * \param[in] dest pointer to the image buffer in main memory. \a dest should be 32B aligned. 1508 * \param[in] clear flag that indicates framebuffer should be cleared if <tt>GX_TRUE</tt>. 1509 * 1510 * \return none 1511 *) 1512 1513procedure GX_CopyTex(dest: pointer; clear: cuint8); cdecl; external; 1514 1515 1516(*! 1517 * \fn void GX_PixModeSync() 1518 * \brief Causes the GPU to wait for the pipe to flush. 1519 * 1520 * \details 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 1521 * 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. 1522 * 1523 * \note The command is actually implemented by writing the control register that determines the format of the embedded frame buffer (EFB). As a result, care 1524 * should be used if this command is placed within a display list. 1525 * 1526 * \return none 1527 *) 1528 1529procedure GX_PixModeSync; cdecl; external; 1530 1531 1532(*! 1533 * \fn void GX_ClearBoundingBox() 1534 * \brief Clears the bounding box values before a new image is drawn. 1535 * 1536 * \details The graphics hardware keeps track of a bounding box of pixel coordinates that are drawn in the Embedded Frame Buffer (EFB). 1537 * 1538 * \return none 1539 *) 1540 1541procedure GX_ClearBoundingBox; cdecl; external; 1542 1543 1544(*! 1545 * \fn GX_PokeAlphaMode(u8 func,u8 threshold) 1546 * \brief Sets a threshold which is compared to the alpha of pixels written to the Embedded Frame Buffer (EFB) using the GX_Poke*() functions. 1547 * 1548 * \details The compare function order is:<br><br> 1549 * 1550 * src_alpha \a func \a threshold 1551 * 1552 * \note The alpha compare function can be used to conditionally write pixels to the EFB using the source alpha channel as a template. If the compare function is 1553 * true, the source color will be written to the EFB based on the result of the Z compare (see GX_PokeZMode()). If the alpha compare function is false, the source 1554 * color is not written to the EFB.<br><br> 1555 * 1556 * \note The alpha compare test happens before the Z compare and before blending (see GX_PokeBlendMode()). 1557 * 1558 * \param[in] func \ref compare to use 1559 * \param[in] threshold to which the source alpha will be compared to 1560 * 1561 * \return none 1562 *) 1563 1564procedure GX_PokeAlphaMode(func, threshold: cuint8); cdecl; external; 1565 1566 1567(*! 1568 * \fn void GX_PokeAlphaUpdate(u8 update_enable) 1569 * \brief Enables or disables alpha-buffer updates for GX_Poke*() functions. 1570 * 1571 * \details The normal rendering state (set by GX_SetAlphaUpdate()) is not affected. 1572 * 1573 * \param[in] update_enable enables alpha-buffer updates with <tt>GX_TRUE</tt>, otherwise does not 1574 * 1575 * \return none 1576 *) 1577 1578procedure GX_PokeAlphaUpdate(update_enable: cuint8); cdecl; external; 1579 1580 1581(*! 1582 * \fn void GX_PokeColorUpdate(u8 update_enable) 1583 * \brief Enables or disables color-buffer updates when writing the Embedded Frame Buffer (EFB) using the GX_Poke*() functions. 1584 * 1585 * \param[in] update_enable enables color-buffer updates with <tt>GX_TRUE</tt>, otherwise does not 1586 * 1587 * \return none 1588 *) 1589 1590procedure GX_PokeColorUpdate(update_enable: cuint8); cdecl; external; 1591 1592 1593(*! 1594 * \fn void GX_PokeDither(u8 dither) 1595 * \brief Enables dithering when writing the Embedded Frame Buffer (EFB) using GX_Poke*() functions. 1596 * 1597 * \note The \a dither enable is only valid when the pixel format (see GX_SetPixelFmt()) is either <tt>GX_PF_RGBA6_Z24</tt> or <tt>GX_PF_RGB565_Z16</tt>.<br><br> 1598 * 1599 * \note A 4x4 Bayer matrix is used for dithering. 1600 * 1601 * \param[in] if set to <tt>GX_TRUE</tt> and pixel format is one of the above, dithering is enabled; otherwise disabled 1602 * 1603 * \return none 1604 *) 1605 1606procedure GX_PokeDither(dither: cuint8); cdecl; external; 1607 1608 1609(*! 1610 * \fn void GX_PokeBlendMode(u8 type,u8 src_fact,u8 dst_fact,u8 op) 1611 * \brief Determines how the source image, is blended with the current Embedded Frame Buffer (EFB). 1612 * 1613 * \defails When type is set to <tt>GX_BM_NONE</tt>, no color data is written to the EFB. When type is set to <tt>GX_BM_BLEND</tt>, the source and EFB pixels 1614 * are blended using the following equation:<br><br> 1615 * 1616 * <i>dst_pix_clr</i> = <i>src_pix_clr</i> * \a src_fact + <i>dst_pix_clr</i> * \a dst_fact<br><br> 1617 * 1618 * When type is set to <tt>GX_BM_SUBTRACT</tt>, the destination pixel is computed as follows:<br><br> 1619 * 1620 * <i>dst_pix_clr</i> = <i>dst_pix_clr</i> - <i>src_pix_clr [clamped to zero]</i><br><br> 1621 * 1622 * Note that \a src_fact and \a dst_fact are not part of the equation. 1623 * 1624 * \note \a dst_fact can be used only when the frame buffer has <tt>GX_PF_RGBA6_Z24</tt> as the pixel format (see GX_SetPixelFmt()).<br><br> 1625 * 1626 * \note When type is set to <tt>GX_BM_LOGIC</tt>, the source and EFB pixels are blended using logical bitwise operations.<br><br> 1627 * 1628 * \note This function does not effect the normal rendering state; see GX_SetBlendMode(). 1629 * 1630 * \param[in] type \ref blendmode 1631 * \param[in] src_fact source \ref blendfactor; the pixel color produced by the graphics processor is multiplied by this factor 1632 * \param[in] dst_fact destination \ref blendfactor; the current frame buffer pixel color is multiplied by this factor 1633 * \param[in] op \ref logicop to use 1634 *) 1635 1636procedure GX_PokeBlendMode(type_, src_fact, dst_fact, op: cuint8); cdecl; external; 1637 1638 1639(*! 1640 * \fn void GX_PokeAlphaRead(u8 mode) 1641 * \brief Determines what value of alpha will be read from the Embedded Frame Buffer (EFB). 1642 * 1643 * \details The mode only applies to GX_Peek*() functions. 1644 * 1645 * \note This feature works no matter what pixel type (see GX_SetPixelFmt()) you are using. If you are using the EFB with alpha plane, it is 1646 * recommended that you use <tt>GX_READ_NONE</tt> so that you can read correct alpha value from the EFB. If you are using the EFB with no alpha, you should 1647 * set either of <tt>GX_READ_00</tt> or <tt>GX_READ_FF</tt> in order to get a certain value.<br><br> 1648 * 1649 * \param[in] mode \ref alphareadmode that determines value of alpha read from a frame buffer with no alpha channel. 1650 * 1651 * \return none 1652 *) 1653 1654procedure GX_PokeAlphaRead(mode: cuint8); cdecl; external; 1655 1656 1657(*! 1658 * \fn void GX_PokeDstAlpha(u8 enable,u8 a) 1659 * \brief Sets a constant alpha value for writing to the Embedded Frame Buffer (EFB). 1660 * 1661 * \details The EFB pixel type must have an alpha channel for this function to be effective (see GX_SetPixelFmt()). The blending operations (see 1662 * GX_PokeBlendMode()) still use source alpha but when writing the pixel color, the constant \a a will replace the pixel alpha in the EFB. 1663 * 1664 * \param[in] enable if set to <tt>GX_ENABLE</tt> and pixel format supports dest alpha, \a a will be written to the framebuffer 1665 * \param[in] a constant alpha value 1666 * 1667 * \return none 1668 *) 1669 1670procedure GX_PokeDstAlpha(enable, a: cuint8); cdecl; external; 1671 1672 1673(*! 1674 * \fn void GX_PokeARGB(u16 x,u16 y,GXColor color) 1675 * \brief Allows the CPU to write \a color directly to the Embedded Frame Buffer (EFB) at position \a x,\a y. 1676 * 1677 * \details The alpha value in \a color can be compared with the current alpha threshold (see GX_PokeAlphaMode()). The color will be blended 1678 * into the EFB using the blend mode set by GX_PokeBlendMode(). 1679 * 1680 * \note For an antialiased frame buffer, all 3 subsamples of a pixel are affected by the poke. 1681 * 1682 * \param[in] x coordinate, in pixels; must be 0 - 639 inclusive 1683 * \param[in] y coordinate, in lines; must be 0 - 527 inclusive 1684 * \param[in] color color to write at the location 1685 * 1686 * \return none 1687 *) 1688 1689procedure GX_PokeARGB(x, y: cuint16; color: GXColor); cdecl; external; 1690 1691 1692(*! 1693 * \fn void GX_PeekARGB(u16 x,u16 y,GXColor *color) 1694 * \brief Allows the CPU to read a color value directly from the Embedded Frame Buffer (EFB) at position \a x,\a y. 1695 * 1696 * \note For an antialiased frame buffer, only subsample 0 of a pixel is read. 1697 * 1698 * \param[in] x coordinate, in pixels; must be 0 - 639 inclusive 1699 * \param[in] y coordinate, in lines; must be 0 - 527 inclusive 1700 * \param[out] color struct to store color in 1701 * 1702 * \return none 1703 *) 1704 1705procedure GX_PeekARGB(x, y: cuint16; var color: GXColor); cdecl; external; 1706 1707 1708(*! 1709 * \fn void GX_PokeZ(u16 x,u16 y,u32 z) 1710 * \brief Allows the CPU to write a z value directly to the Embedded Frame Buffer (EFB) at position \a x,\a y. 1711 * 1712 * \details The \a z value can be compared with the current contents of the EFB. The Z compare fuction is set using GX_PokeZMode(). 1713 * 1714 * \note The \a z value should be in the range of 0x00000000 <= \a z < 0x00FFFFFF in the case of non-antialiased frame buffer. For an antialiased 1715 * frame buffer, the \a z value should be in the compressed 16-bit format (0x00000000 <= \a z <= 0x0000FFFF), and the poke will affect all 3 1716 * subsamples of a pixel. 1717 * 1718 * \param[in] x coordinate, in pixels; must be 0 - 639 inclusive 1719 * \param[in] y coordinate, in lines; must be 0 - 527 inclusive 1720 * \param[in] z value to write at position \a x,\a y in the EFB 1721 * 1722 * \return none 1723 *) 1724 1725procedure GX_PokeZ(x, y: cuint16; z: cuint32); cdecl; external; 1726 1727 1728(*! 1729 * \fn void GX_PeekZ(u16 x,u16 y,u32 *z) 1730 * \brief Allows the CPU to read a z value directly from the Embedded Frame Buffer (EFB) at position x,y. 1731 * 1732 * \details The z value is raw integer value from the Z buffer. 1733 * 1734 * \note The value range is 24-bit when reading from non-antialiased frame buffer. When reading from an antialiased frame buffer, subsample 1735 * 0 is read and returned. The value will be compressed 16-bit form in this case. 1736 * 1737 * \param[in] x coordinate, in pixels; must be 0 - 639 inclusive 1738 * \param[in] y coordinate, in lines; must be 0 - 527 inclusive 1739 * \param[out] z pointer to a returned Z value 1740 * 1741 * \return none 1742 *) 1743 1744procedure GX_PeekZ(x, y: cuint16; var z: cuint32); cdecl; external; 1745 1746 1747(*! 1748 * \fn void GX_PokeZMode(u8 comp_enable,u8 func,u8 update_enable) 1749 * \brief Sets the Z-buffer compare mode when writing the Embedded Frame Buffer (EFB). 1750 * 1751 * \details 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 1752 * result of the compare if Z update is enabled. 1753 * 1754 * When \a comp_enable is set to <tt>GX_DISABLE</tt>, poke Z buffering is disabled and the Z buffer is not updated. The \a func parameter determines the 1755 * 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 1756 * right. If the result of the comparison is false, the poked Z value is discarded. The parameter \a update_enable determines whether or not the 1757 * Z buffer is updated with the new Z value after a comparison is performed. 1758 * 1759 * \note The normal rendering Z mode (set by GX_SetZMode()) is not affected by this function.<br><br> 1760 * 1761 * \note Even if update_enable is <tt>GX_FALSE</tt>, compares may still be enabled. 1762 * 1763 * \param[in] comp_enable enables comparisons with source and destination Z values if <tt>GX_TRUE</tt> 1764 * \param[in] func \ref compare function to use 1765 * \param[in] update_enable enables Z-buffer updates when <tt>GX_TRUE</tt> 1766 * 1767 * \return none 1768 *) 1769 1770procedure GX_PokeZMode(comp_enable, func, update_enable: cuint8); cdecl; external; 1771 1772 1773(*! 1774 * \fn u32 GX_GetTexObjFmt(GXTexObj *obj) 1775 * \brief Returns the texture format described by texture object \a obj. 1776 * 1777 * \note Use GX_InitTexObj() or GX_InitTexObjCI() to initialize the texture format. 1778 * 1779 * \param[in] obj ptr to a texture object 1780 * 1781 * \return texture format of the given texture object 1782 *) 1783 1784function GX_GetTexObjFmt(obj: PGXTexObj): cuint32; cdecl; external; 1785 1786 1787(*! 1788 * \fn u32 GX_GetTexObjMipMap(GXTexObj *obj) 1789 * \brief Returns the texture mipmap enable described by texture object \a obj. 1790 * 1791 * \note Use GX_InitTexObj() or GX_InitTexObjCI() to initialize the texture mipmap enable. 1792 * 1793 * \param[in] obj ptr to a texture object 1794 * 1795 * \return mipmap enable flag 1796 *) 1797 1798function GX_GetTexObjMipMap(obj: PGXTexObj): cuint32; cdecl; external; 1799 1800 1801function GX_GetTexObjUserData(obj: PGXTexObj): pointer; cdecl; external; 1802 1803 1804(*! 1805 * \fn void* GX_GetTexObjData(GXTexObj *obj) 1806 * \brief Used to get a pointer to texture data from the \ref GXTexObj structure. 1807 * 1808 * \note The returned pointer is a physical address. 1809 * 1810 * \param[in] obj ptr to a texture object 1811 * 1812 * \return Physical pointer to texture data. 1813 *) 1814function GX_GetTexObjData(obj: PGXTexObj): pointer; cdecl; external; 1815 1816(*! 1817 * \fn u8 GX_GetTexObjWrapS(GXTexObj* obj) 1818 * \brief Returns the texture wrap s mode described by texture object \a obj. 1819 * 1820 * \note Use GX_InitTexObj() or GX_InitTexObjCI() to initialize the texture wrap s mode. 1821 * 1822 * \param[in] obj ptr to a texture object 1823 * 1824 * \return wrap s mode 1825 *) 1826function GX_GetTexObjWrapS(obj: PGXTexObj): cuint8; cdecl; external; 1827 1828(*! 1829 * \fn u8 GX_GetTexObjWrapT(GXTexObj* obj) 1830 * \brief Returns the texture wrap t mode described by texture object \a obj. 1831 * 1832 * \note Use GX_InitTexObj() or GX_InitTexObjCI() to initialize the texture wrap t mode. 1833 * 1834 * \param[in] obj ptr to a texture object 1835 * 1836 * \return wrap t mode 1837 *) 1838function GX_GetTexObjWrapT(obj: PGXTexObj): cuint8; cdecl; external; 1839 1840(*! 1841 * \fn u16 GX_GetTexObjHeight(GXTexObj* obj) 1842 * \brief Returns the texture height described by texture object \a obj. 1843 * 1844 * \note Use GX_InitTexObj() or GX_InitTexObjCI() to initialize the texture height. 1845 * 1846 * \param[in] obj ptr to a texture object 1847 * 1848 * \return texture height 1849 *) 1850function GX_GetTexObjHeight(obj: PGXTexObj): cuint16; cdecl; external; 1851 1852(*! 1853 * \fn u16 GX_GetTexObjWidth(GXTexObj* obj) 1854 * \brief Returns the texture width described by texture object \a obj. 1855 * 1856 * \note Use GX_InitTexObj() or GX_InitTexObjCI() to initialize the texture width. 1857 * 1858 * \param[in] obj ptr to a texture object 1859 * 1860 * \return texture width 1861 *) 1862function GX_GetTexObjWidth(obj: PGXTexObj): cuint16; cdecl; external; 1863 1864(*! 1865 * \fn void GX_GetTexObjAll(GXTexObj* obj, void** image_ptr, u16* width, u16* height, u8* format, u8* wrap_s, u8* wrap_t, u8* mipmap); 1866 * \brief 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(). 1867 * 1868 * \param[in] obj ptr to a texture object 1869 * \param[out] image_ptr Returns a physical pointer to the image data for a texture. 1870 * \param[out] width Returns the width of the texture or LOD 0 for mipmaps 1871 * \param[out] height Returns the height of the texture or LOD 0 for mipmaps 1872 * \param[out] format Returns the texel format 1873 * \param[out] mipmap Returns the mipmap enable flag. 1874 * 1875 * \return none 1876 *) 1877procedure GX_GetTexObjAll(obj: PGXTexObj; var image_ptr: Pointer; var width: cuint16; var height: cuint16; var format: cuint8; var wrap_s: cuint8; var wrap_t: cuint8; var mipmap: cuint8); cdecl; external; 1878 1879 1880(*! 1881 * \fn u32 GX_GetTexBufferSize(u16 wd,u16 ht,u32 fmt,u8 mipmap,u8 maxlod) 1882 * \brief Returns the amount of memory in bytes needed to store a texture of the given size and \a fmt. 1883 * 1884 * \details If the \a mipmap flag is <tt>GX_TRUE</tt>, then the size of buffer needed for the mipmap pyramid up to \a maxlod will be returned. 1885 * \a maxlod will be clamped to the number of LODs possible given the map \a wd and \a ht. For mipmaps, \a wd and \a ht must be a power of two. 1886 * 1887 * \note This function takes into account the tiling and padding requirements of the GameCube's native texture format. The resulting size can be used 1888 * along with memalign() to allocate texture buffers (see GX_CopyTex()). 1889 * 1890 * \param[in] wd width of the texture in texels 1891 * \param[in] ht height of the texture in texels 1892 * \param[in] fmt format of the texture; use GX_TexFmt() or GX_CITexFmt() to get it 1893 * \param[in] mipmap flag indicating whether or not the texture is a mipmap 1894 * 1895 * \return number of bytes needed for the texture, including tile padding 1896 *) 1897 1898function GX_GetTexBufferSize(wd, ht: cuint16; fmt: cuint32; 1899 mipmap, maxlod: cuint8): cuint32; cdecl; external; 1900 1901 1902(*! 1903 * \fn void GX_InvalidateTexAll() 1904 * \brief Invalidates the current caches of the Texture Memory (TMEM). 1905 * 1906 * \details It takes about 512 GP clocks to invalidate all the texture caches. 1907 * 1908 * \note Preloaded textures (see GX_PreloadEntireTexture()) are not affected. 1909 * 1910 * \return none 1911 *) 1912 1913procedure GX_InvalidateTexAll; cdecl; external; 1914 1915 1916(*! 1917 * \fn void GX_InvalidateTexRegion(GXTexRegion *region) 1918 * \brief Invalidates the texture cache in Texture Memory (TMEM) described by \a region. 1919 * 1920 * \details 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 1921 * is possibly cached in the texture region. 1922 * 1923 * \note In reality, this function invalidates the cache tags, forcing the texture cache to load new data. Preloaded textures (see 1924 * GX_PreloadEntireTexture()) do not use the tags.<br><br> 1925 * 1926 * \note The texture hardware can invalidate 4 tags each GP clock. Each tag represents a superline or 512B of TMEM. Therefore, it takes 16 1927 * GP clocks to invalidate a 32KB texture region. 1928 * 1929 * \param[in] region ptr to GXTexRegion object 1930 * 1931 * \return none 1932 *) 1933 1934procedure GX_InvalidateTexRegion(region: PGXTexRegion); cdecl; external; 1935 1936 1937(*! 1938 * \fn void GX_InitTexCacheRegion(GXTexRegion *region,u8 is32bmipmap,u32 tmem_even,u8 size_even,u32 tmem_odd,u8 size_odd) 1939 * \brief Initializes a texture memory (TMEM) region object for cache. 1940 * 1941 * \details 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 1942 * overlap; however, no two overlapping regions can be active at the same time. 1943 * 1944 * The possible sizes of a TMEM cache region are 32K, 128K or 512K. 1945 * 1946 * \note For pre-loaded textures, the region must be defined by using GX_InitTexPreloadRegion().<br><br> 1947 * 1948 * \note GX_Init() creates default texture regions, so it is not necessary for the application to use this function unless a different Texture Memory 1949 * configuration is desired. In that case, the application should also define a region allocator using GX_SetTexRegionCallback().<br><br> 1950 * 1951 * \note The function GX_InvalidateTexRegion() can be used to force the texture in main memory associated with this region to be reloaded. This will be 1952 * necessary whenever the texture data in main memory changes. You may invalidate all cached regions at once using GX_InvalidateTexAll(). 1953 * 1954 * \param[in] region ptr to a GXTexRegion struct 1955 * \param[in] is32bmipmap should be set to <tt>GX_TRUE</tt> to interpret parameters according to the 32b mipmap meaning. 1956 * \param[in] tmem_even base ptr in TMEM for even LODs; must be multiple of 2KB 1957 * \param[in] size_even even \ref texcachesize other than <tt>GX_TEXCACHE_NONE</tt> 1958 * \param[in] tmem_odd base ptr in TMEM for odd LODs; must be multiple of 2KB 1959 * \param[in] size_odd odd \ref texcachesize other than <tt>GX_TEXCACHE_NONE</tt> 1960 * 1961 * \return none 1962 *) 1963 1964procedure GX_InitTexCacheRegion(region: PGXTexRegion; is32bmipmap: cuint8; 1965 tmem_even: cuint32; size_even: cuint8; tmem_odd: cuint32; size_odd: cuint8); cdecl; external; 1966 1967 1968(*! 1969 * \fn void GX_InitTexPreloadRegion(GXTexRegion *region,u32 tmem_even,u32 size_even,u32 tmem_odd,u32 size_odd) 1970 * \brief Initializes a Texture Memory (TMEM) region object for preloading. 1971 * 1972 * \details The region is allocated in TMEM by the application and can be used only as a pre-loaded buffer. Cache regions must be allocated 1973 * by using GX_InitTexCacheRegion(). For pre-loaded textures, the size of the region must match the size of the texture. An application can 1974 * create many region objects and some of them can overlap; however, no two overlapping regions can be active at the same time. 1975 * 1976 * \note The maximum size of a region is 512K. 1977 * 1978 * \warning GX_Init() creates no region for preloading, so the application should allocate appropriate regions if preloading is necessary. It 1979 * is also required to create cache regions and its allocator by using GX_InitTexCacheRegion() and GX_SetTexRegionCallback(), otherwise new 1980 * cache regions may overwrite the preloaded areas. (Alternatively, if you do not use any color-index textures, you may preload textures into 1981 * the portion of texture memory normally allocated to color-index usage by the default allocator.) 1982 * 1983 * \param[in] region ptr to a GXTexRegion struct 1984 * \param[in] tmem_even base ptr in TMEM for even LODs; must be 32B aligned 1985 * \param[in] size_even size of the even cache, in bytes; should be multiple of 32B 1986 * \param[in] tmem_odd base ptr in TMEM for odd LODs; must be 32B aligned 1987 * \param[in] size_off size of the odd cache, in bytes; should be multiple of 32B 1988 * 1989 * \return none 1990 *) 1991 1992procedure GX_InitTexPreloadRegion(region: PGXTexRegion; 1993 tmem_even, size_even, tmem_odd, size_odd: cuint32); cdecl; external; 1994 1995 1996(*! 1997 * \fn void GX_InitTexObj(GXTexObj *obj,void *img_ptr,u16 wd,u16 ht,u8 fmt,u8 wrap_s,u8 wrap_t,u8 mipmap) 1998 * \brief Used to initialize or change a texture object for non-color index textures. 1999 * 2000 * \details Texture objects are used to describe all the parameters associated with a texture, including size, format, wrap modes, filter modes, 2001 * etc. It is the application's responsibility to provide memory for a texture object. Once initialized, a texture object can be associated with 2002 * one of eight active texture IDs using GX_LoadTexObj(). 2003 * 2004 * \note To initialize a texture object for color index format textures, use GX_InitTexObjCI().<br><br> 2005 * 2006 * \note If the mipmap flag is <tt>GX_TRUE</tt>, then the texture is a mipmap and the texture will be trilerped. If the mipmap flag is <tt>GX_FALSE</tt>, the texture 2007 * is not a mipmap and the texture will be bilerped. To override the filter modes and other mipmap controls, see GX_InitTexObjLOD(). 2008 * 2009 * \param[out] obj ptr to a texture object 2010 * \param[in] img_ptr ptr to the image data for a texture, aligned to 32B 2011 * \param[in] wd width of the texture, or LOD level 0 for mipmaps; max value is 1024; mipmaps must be a power of two 2012 * \param[in] ht height of the texture, or LOD level 0 for mipmaps; max value is 1024; mipmaps must be a power of two 2013 * \param[in] fmt \ref texfmt 2014 * \param[in] wrap_s texture coordinate wrapping strategy in the S direction; use <tt>GX_CLAMP</tt>, <tt>GX_REPEAT</tt> or <tt>GX_MIRROR</tt> 2015 * \param[in] wrap_t texture coordinate wrapping strategy in the T direction; use <tt>GX_CLAMP</tt>, <tt>GX_REPEAT</tt> or <tt>GX_MIRROR</tt> 2016 * \param[in] mipmap trilinear filtering will be used if <tt>GX_TRUE</tt>, otherwise bilinear is used 2017 * 2018 * \return none 2019 *) 2020 2021procedure GX_InitTexObj(obj: PGXTexObj; img_ptr: pointer; wd, ht: cuint16; 2022 fmt, wrap_s, wrap_t, mipmap: cuint8); cdecl; external; 2023 2024 2025(*! 2026 * \fn 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) 2027 * \brief Used to initialize or change a texture object when the texture is color index format. 2028 * 2029 * \details Texture objects are used to describe all the parameters associated with a texture, including size, format, wrap modes, filter modes, 2030 * etc. It is the application's responsibility to provide memory for a texture object. Once initialized, a texture object can be associated with 2031 * one of eight active texture IDs using GX_LoadTexObj(). 2032 * 2033 * \note If the \a mipmap flag is <tt>GX_TRUE</tt>, then the texture is a mipmap and the texture will be filtered using the <tt>GX_LIN_MIP_NEAR</tt> filter mode 2034 * (color index mipmaps cannot use the <tt>GX_LIN_MIP_LIN</tt> or <tt>GX_NEAR_MIP_LIN</tt> mode). If the \a mipmap flag is <tt>GX_FALSE</tt>, the texture is not a mipmap 2035 * and the texture will be bilerped. To override the filter modes and other mipmap controls, use GX_InitTexObjLOD(). Mipmap textures should 2036 * set the width and height to a power of two, but mipmaps do not need to be square.<br><br> 2037 * 2038 * \note Non-mipmap (planar) textures do not have to be a power of two. However, to use the <tt>GX_REPEAT</tt> or <tt>GX_MIRROR</tt> modes for \a wrap_s and \a wrap_t 2039 * the width and height, respectively, must be a power of two.<br><br> 2040 * 2041 * \note The \a tlut_name is used to indicate which texture lookup table (TLUT) to use for the index to color conversion. To load the TLUT into 2042 * texture memory, use GX_LoadTlut(). 2043 * 2044 * \param[in] obj ptr to a texture object 2045 * \param[in] img_ptr ptr to the image data for a texture, aligned to 32B 2046 * \param[in] wd width of the texture, or LOD level 0 for mipmaps; max value is 1024; mipmaps must be a power of two 2047 * \param[in] ht height of the texture, or LOD level 0 for mipmaps; max value is 1024; mipmaps must be a power of two 2048 * \param[in] fmt \ref texfmt 2049 * \param[in] wrap_s texture coordinate wrapping strategy in the S direction; use <tt>GX_CLAMP</tt>, <tt>GX_REPEAT</tt> or <tt>GX_MIRROR</tt> 2050 * \param[in] wrap_t texture coordinate wrapping strategy in the T direction; use <tt>GX_CLAMP</tt>, <tt>GX_REPEAT</tt> or <tt>GX_MIRROR</tt> 2051 * \param[in] mipmap if <tt>GX_TRUE</tt>, it is a mipmap texture, else it is a planar texture 2052 * \param[in] tlut_name TLUT name to use for this texture; default texture configuration recognizes \ref tlutname 2053 * 2054 * \return none 2055 *) 2056 2057procedure GX_InitTexObjCI(obj: PGXTexObj; img_ptr: pointer; wd, ht: cuint16; 2058 fmt, wrap_s, wrap_t, mipmap: cuint8; tlut_name: cuint32); cdecl; external; 2059 2060 2061(*! 2062 * \fn void GX_InitTexObjTlut(GXTexObj *obj,u32 tlut_name) 2063 * \brief Allows one to modify the TLUT that is associated with an existing texture object. 2064 * 2065 * \param[in] obj ptr to a texture object 2066 * \param[in] tlut_name TLUT name to use for this texture; default texture configuration recognizes \ref tlutname 2067 * 2068 * \return none 2069 *) 2070 2071procedure GX_InitTexObjTlut(obj: PGXTexObj; tlut_name: cuint32); cdecl; external; 2072 2073 2074(*! 2075 * \fn void GX_InitTexObjData(GXTexObj *obj,void *img_ptr) 2076 * \brief Allows one to modify the image data pointer for an existing texture object. 2077 * 2078 * \note The image format and size for the new data must agree with what they were when the texture object was first initialized using 2079 * GX_InitTexObj() or GX_InitTexObjCI(). 2080 * 2081 * \param[in] obj ptr to a texture object 2082 * \param[in] img_ptr ptr to the texture data in main memory 2083 * 2084 * \return none 2085 *) 2086 2087procedure GX_InitTexObjData(obj: PGXTexObj; img_ptr: pointer); cdecl; external; 2088 2089 2090(*! 2091 * \fn void GX_InitTexObjWrapMode(GXTexObj *obj,u8 wrap_s,u8 wrap_t) 2092 * \brief Allows one to modify the texture coordinate wrap modes for an existing texture object. 2093 * 2094 * \param[in] obj ptr to a texture object 2095 * \param[in] wrap_s texture coordinate wrapping strategy in the S direction; use <tt>GX_CLAMP</tt>, <tt>GX_REPEAT</tt> or <tt>GX_MIRROR</tt> 2096 * \param[in] wrap_t texture coordinate wrapping strategy in the T direction; use <tt>GX_CLAMP</tt>, <tt>GX_REPEAT</tt> or <tt>GX_MIRROR</tt> 2097 * 2098 * \return none 2099 *) 2100 2101procedure GX_InitTexObjWrapMode(obj: PGXTexObj; wrap_s, wrap_t: cuint8); cdecl; external; 2102 2103procedure GX_InitTexObjFilterMode(obj: PGXTexObj; minfilt, magfilt: cuint8); cdecl; external; 2104 2105procedure GX_InitTexObjMinLOD(obj: PGXTexObj; minlod: f32); cdecl; external; 2106 2107procedure GX_InitTexObjMaxLOD(obj: PGXTexObj; maxlod: f32); cdecl; external; 2108 2109procedure GX_InitTexObjLODBias(obj: PGXTexObj; lodbias: f32); cdecl; external; 2110 2111procedure GX_InitTexObjBiasClamp(obj: PGXTexObj; biasclamp: cuint8); cdecl; external; 2112 2113procedure GX_InitTexObjEdgeLOD(obj: PGXTexObj; edgelod: cuint8); cdecl; external; 2114 2115procedure GX_InitTexObjMaxAniso(obj: PGXTexObj; maxaniso: cuint8); cdecl; external; 2116 2117procedure GX_InitTexObjUserData(obj: PGXTexObj; userdata: pointer); cdecl; external; 2118 2119(*! 2120 * \fn void GX_LoadTexObj(GXTexObj *obj,u8 mapid) 2121 * \brief Loads the state describing a texture into one of eight hardware register sets. 2122 * 2123 * \details Before this happens, the texture object \a obj should be initialized using GX_InitTexObj() or GX_InitTexObjCI(). The \a id parameter refers to 2124 * the texture state register set. Once loaded, the texture can be used in any Texture Environment (TEV) stage using GX_SetTevOrder(). 2125 * 2126 * \note This function will call the functions set by GX_SetTexRegionCallback() (and GX_SetTlutRegionCallback() if the texture is color-index 2127 * format) to obtain the texture regions associated with this texture object. These callbacks are set to default functions by GX_Init(). 2128 * 2129 * \warning If the texture is a color-index texture, you <b>must</b> load the associated TLUT (using GX_LoadTlut()) before calling GX_LoadTexObj(). 2130 * 2131 * \param[in] obj ptr to a texture object 2132 * \param[in] mapid \ref texmapid, <tt>GX_TEXMAP0</tt> to <tt>GX_TEXMAP7</tt> only 2133 * 2134 * \return none 2135 *) 2136 2137procedure GX_LoadTexObj(obj: PGXTexObj; mapid: cuint8); cdecl; external; 2138 2139 2140(*! 2141 * \fn void GX_LoadTlut(GXTlutObj *obj,u32 tlut_name) 2142 * \brief Copies a Texture Look-Up Table (TLUT) from main memory to Texture Memory (TMEM). 2143 * 2144 * \details The \a tlut_name parameter is the name of a pre-allocated area of TMEM. The callback function set by GX_SetTlutRegionCallback() converts 2145 * the \a tlut_name into a \ref GXTlutRegion pointer. The TLUT is loaded in the TMEM region described by this pointer. The TLUT object \a obj describes the 2146 * location of the TLUT in main memory, the TLUT format, and the TLUT size. \a obj should have been previously initialized using GX_InitTlutObj(). 2147 * 2148 * \note GX_Init() sets a default callback to convert \a tlut_names from \ref tlutname to \ref GXTlutRegion pointers. The default configuration of 2149 * TMEM has 20 TLUTs, 16 each 256 entries by 16 bits, and 4 each 1k entries by 16 bits. This configuration can be overriden by calling 2150 * GX_InitTlutRegion() and GX_InitTexCacheRegion() to allocate TMEM. Then you can define your own region allocation scheme using GX_SetTlutRegionCallback() 2151 * and GX_SetTexRegionCallback(). 2152 * 2153 * \param[in] obj ptr to a TLUT object; application must allocate this 2154 * \param[in] tlut_name \ref tlutname 2155 * 2156 * \return none 2157 *) 2158 2159procedure GX_LoadTlut(obj: PGXTlutObj; tlut_name: cuint32); cdecl; external; 2160 2161 2162(*! 2163 * \fn void GX_LoadTexObjPreloaded(GXTexObj *obj,GXTexRegion *region,u8 mapid) 2164 * \brief Loads the state describing a preloaded texture into one of eight hardware register sets. 2165 * 2166 * \details Before this happens, the texture object \a obj should be initialized using GX_InitTexObj() or GX_InitTexObjCI(). The \a mapid parameter refers to 2167 * 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 2168 * (TEV) stage using GX_SetTevOrder(). 2169 * 2170 * \note GX_Init() initially calls GX_SetTevOrder() to make a simple texture pipeline that associates <tt>GX_TEXMAP0</tt> with <tt>GX_TEVSTAGE0</tt>, 2171 * <tt>GX_TEXMAP1</tt> with <tt>GX_TEVSTAGE1</tt>, etc.<br><br> 2172 * 2173 * \note GX_LoadTexObjPreloaded() will not call the functions set by GX_SetTexRegionCallback() (and GX_SetTlutRegionCallback() if the texture is color 2174 * index format) because the region is set explicitly; however, these callback functions must be aware of all regions that are preloaded. The default 2175 * callbacks set by GX_Init() assume there are no preloaded regions. 2176 * 2177 * \param[in] obj ptr to a texture object 2178 * \param[in] region ptr to a region object that describes an area of texture memory 2179 * \param[in] mapid \ref texmapid for reference in a TEV stage 2180 * 2181 * \return none 2182 *) 2183 2184procedure GX_LoadTexObjPreloaded(obj: PGXTexObj; region: PGXTexRegion; 2185 mapid: cuint8); cdecl; external; 2186 2187 2188(*! 2189 * \fn void GX_PreloadEntireTexture(GXTexObj *obj,GXTexRegion *region) 2190 * \brief Loads a given texture from DRAM into the texture memory. 2191 * 2192 * \details Accesses to this texture will bypass the texture cache tag look-up and instead read the texels directly from texture memory. The 2193 * texture region must be the same size as the texture (see GX_InitTexPreloadRegion()). 2194 * 2195 * \note This function loads the texture into texture memory, but to use it as a source for the Texture Environment (TEV) unit, you must first 2196 * call GX_LoadTexObjPreloaded(). The default configuration (as set by GX_Init()) of texture memory has no preloaded regions, so you must install 2197 * your own region allocator callbacks using GX_SetTexRegionCallback() and GX_SetTlutRegionCallback(). 2198 * 2199 * \param[in] obj ptr to object describing the texture to laod 2200 * \param[in] region TMEM texture region to load the texture into 2201 * 2202 * \return none 2203 *) 2204 2205procedure GX_PreloadEntireTexture(obj: PGXTexObj; region: PGXTexRegion); cdecl; external; 2206 2207 2208(*! 2209 * \fn void GX_InitTlutObj(GXTlutObj *obj,void *lut,u8 fmt,u16 entries) 2210 * \brief Initializes a Texture Look-Up Table (TLUT) object. 2211 * 2212 * \details The TLUT object describes the location of the TLUT in main memory, its format and the number of entries. The TLUT in main 2213 * memory described by this object can be loaded into a TLUT allocated in the texture memory using the GX_LoadTlut() function. 2214 * 2215 * \param[in] obj ptr to a TLUT object 2216 * \param[in] lut ptr to look-up table data; must be 32B aligned 2217 * \param[in] fmt format of the entries in the TLUt; <tt>GX_TL_IA8</tt>, <tt>GX_TL_RGB565</tt> or <tt>GX_TL_RGB5A3</tt> 2218 * \param[in] entries number of entries in this table; maximum is 16,384 2219 * 2220 * \return none 2221 *) 2222 2223procedure GX_InitTlutObj(obj: PGXTlutObj; lut: pointer; fmt: cuint8; 2224 entries: cuint16); cdecl; external; 2225 2226 2227(*! 2228 * \fn void GX_InitTlutRegion(GXTlutRegion *region,u32 tmem_addr,u8 tlut_sz) 2229 * \brief Initializes a Texture Look-Up Table (TLUT) region object. 2230 * 2231 * \note GX_Init() creates default TLUT regions, so the application does not need to call this function unless a new configuration 2232 * of Texture Memory is desired. In that case, the application should also set a new TLUT region allocator using GX_SetTlutRegionCallback(). 2233 * 2234 * \param[in] region obj ptr to a TLUT region struct; application must allocate this 2235 * \param[in] tmem_addr location of the TLU in TMEM; ptr must be aligned to table size 2236 * \param[in] tlut_sz size of the table 2237 * 2238 * \return none 2239 *) 2240 2241procedure GX_InitTlutRegion(region: PGXTlutRegion; tmem_addr: cuint32; 2242 tlut_sz: cuint8); cdecl; external; 2243 2244 2245(*! 2246 * \fn void GX_InitTexObjLOD(GXTexObj *obj,u8 minfilt,u8 magfilt,f32 minlod,f32 maxlod,f32 lodbias,u8 biasclamp,u8 edgelod,u8 maxaniso) 2247 * \brief Sets texture Level Of Detail (LOD) controls explicitly for a texture object. 2248 * 2249 * \details It is the application's responsibility to provide memory for a texture object. When initializing a texture object using GX_InitTexObj() 2250 * or GX_InitTexObjCI(), this information is set to default values based on the mipmap flag. This function allows the programmer to override those 2251 * defaults. 2252 * 2253 * \note This function should be called after GX_InitTexObj() or GX_InitTexObjCI() for a particular texture object.<br><br> 2254 * 2255 * \note Setting \a biasclamp prevents over-biasing the LOD when the polygon is perpendicular to the view direction.<br><br> 2256 * 2257 * \note \a edgelod should be set if \a biasclamp is set or \a maxaniso is set to <tt>GX_ANISO_2</tt> or <tt>GX_ANISO_4</tt>.<br><br> 2258 * 2259 * \note Theoretically, there is no performance difference amongst various magnification/minification filter settings except <tt>GX_LIN_MIP_LIN</tt> filter with 2260 * <tt>GX_TF_RGBA8</tt> texture format which takes twice as much as other formats. However, this argument is assuming an environment where texture cache always 2261 * hits. On real environments, you will see some performance differences by changing filter modes (especially minification filter) because cache-hit ratio 2262 * changes according to which filter mode is being used. 2263 * 2264 * \param[in] obj ptr to a texture object 2265 * \param[in] minfilt \ref texfilter to use when the texel/pixel ratio is >= 1.0 2266 * \param[in] magfilt \ref texfilter to use when the texel/pixel ratio is < 1.0; use only <tt>GX_NEAR</tt> or <tt>GX_LINEAR</tt> 2267 * \param[in] minlod minimum LOD value from 0.0 - 10.0 inclusive 2268 * \param[in] maxlod maximum LOD value from 0.0 - 10.0 inclusive 2269 * \param[in] lodbias bias to add to computed LOD value 2270 * \param[in] biasclamp if <tt>GX_ENABLE</tt>, clamp (LOD+lodbias) so that it is never less than the minimum extent of the pixel projected in texture space 2271 * \param[in] edgelod if <tt>GX_ENABLE</tt>, compute LOD using adjacent texels 2272 * \param[in] maxaniso \ref anisotropy to use 2273 * 2274 * \return none 2275 *) 2276 2277procedure GX_InitTexObjLOD(obj: PGXTexObj; minfilt, magfilt: cuint8; 2278 minlod, maxlod, lodbias: f32; biasclamp, edgelod, maxaniso: cuint8); cdecl; external; 2279 2280 2281(*! 2282 * \fn void GX_SetTexCoordScaleManually(u8 texcoord,u8 enable,u16 ss,u16 ts) 2283 * \brief Overrides the automatic texture coordinate scaling (based upon the associated map size) and lets one manually assign the scale values that 2284 * are used for a given \a texcoord. 2285 * 2286 * \details Setting the \a enable parameter to <tt>GX_TRUE</tt> gives this behavior. The given \a texcoord retains these manual scale values until this function is 2287 * called again. This function is also used to return a given texture coordinate back to normal, automatic scaling (by setting \a enable to <tt>GX_FALSE</tt>). 2288 * 2289 * \note A texture coordinate is scaled after being computed by the relevant texgen and before the actual texture lookup Normally, the scale value is set 2290 * according to the texture map that is associated with the texcoord by GX_SetTevOrder(). However, there are certain cases where a different scale value is 2291 * desirable. One such case is when using indirect tiled textures (see GX_SetTevIndTile()). 2292 * 2293 * \param[in] texcoord the \ref texcoordid being changed 2294 * \param[in] enable if <tt>GX_TRUE</tt>, scale will be set manually, otherwise set automatically and \a ss and \a ts ignored 2295 * \param[in] ss manual scale value for the S component of the coordinate 2296 * \param[in] ts manual scale value for the T component of the coordinate 2297 * 2298 * \return none 2299 *) 2300 2301procedure GX_SetTexCoordScaleManually(texcoord, enable: cuint8; ss, ts: cuint16); cdecl; external; 2302 2303 2304(*! 2305 * \fn void GX_SetTexCoordBias(u8 texcoord,u8 s_enable,u8 t_enable) 2306 * \brief Sets the texture coordinate bias of a particular texture. 2307 * 2308 * \details Range bias is used with texture coordinates applied in <tt>GX_REPEAT</tt> wrap mode in order to increase the precision of texture coordinates 2309 * 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 2310 * graphics pipeline, thus preserving bits for calculation later in the pipe. Since the coordinates are repeated, this bias by an integer should 2311 * have no effect upon the actual appearance of the texture. 2312 * 2313 * \note Texture coordinate range bias is something that is normally set automatically by the GX API (during GX_Begin()); however, when a texture 2314 * coordinate is being scaled manually (by using GX_SetTexCoordScaleManually()), the associated bias is no longer modified by GX. Thus, 2315 * GX_SetTexCoordBias() allows the bias to be changed while a texture coordinate is being manually controlled. 2316 * 2317 * \param[in] texcoord \ref texcoordid being changed 2318 * \param[in] s_enable enable or disable range bias in the S direction with <tt>GX_ENABLE</tt>/<tt>GX_DISABLE</tt> 2319 * \param[in] t_enable enable or disable range bias in the T direction with <tt>GX_ENABLE</tt>/<tt>GX_DISABLE</tt> 2320 * 2321 * \return none 2322 *) 2323 2324procedure GX_SetTexCoordBias(texcoord, s_enable, t_enable: cuint8); cdecl; external; 2325 2326 2327(*! 2328 * \fn GXTexRegionCallback GX_SetTexRegionCallback(GXTexRegionCallback cb) 2329 * \brief Sets the callback function called by GX_LoadTexObj() to obtain an available texture region. 2330 * 2331 * \details GX_Init() calls this function to set a default region-assignment policy. A programmer can override this default region assignment 2332 * by implementing his own callback function. A pointer to the texture object and the texture map ID that are passed 2333 * to GX_LoadTexObj() are provided to the callback function. 2334 * 2335 * \param[in] cb ptr to a function that takes a pointer to a GXTexObj and a \ref texmapid as a parameter and returns a pointer to a \ref GXTexRegion. 2336 * 2337 * \return pointer to the previously set callback 2338 *) 2339 2340function GX_SetTexRegionCallback(cb: GXTexRegionCallback): GXTexRegionCallback; cdecl; external; 2341 2342 2343(*! 2344 * \fn GXTlutRegionCallback GX_SetTlutRegionCallback(GXTlutRegionCallback cb) 2345 * \brief Sets the callback function called by GX_LoadTlut() to find the region into which to load the TLUT. 2346 * 2347 * \details GX_LoadTexObj() will also call \a cb to obtain the Texture Look-up Table (TLUT) region when the texture forma 2348 * is color-index. 2349 * 2350 * GX_Init() calls GX_SetTlutRegionCallback() to set a default TLUT index-to-region mapping. The name for the TLUT from the texture 2351 * object is provided as an argument to the callback. The callback should return a pointer to the \ref GXTlutRegion for this TLUT index. 2352 * 2353 * \note For a given \a tlut_name (in the \ref GXTlutRegionCallback struct), \a cb must always return the same \ref GXTlutRegion; this is because 2354 * GX_LoadTlut() will initialize data into the \ref GXTlutRegion which GX_LoadTexObj() will subsequently use. 2355 * 2356 * \param[in] cb ptr to a function that takes a u32 TLUT name as a parameter and returns a pointer to a \ref GXTlutRegion. 2357 * 2358 * \return pointer to the previously set callback 2359 *) 2360 2361function GX_SetTlutRegionCallback(cb: GXTlutRegionCallback) 2362 : GXTlutRegionCallback; cdecl; external; 2363 2364 2365(*! 2366 * \fn void GX_InitLightPos(GXLightObj *lit_obj,f32 x,f32 y,f32 z) 2367 * \brief Sets the position of the light in the light object. 2368 * 2369 * \details The GameCube graphics hardware supports local diffuse lights. The position of the light should be in the same space as a transformed 2370 * vertex position (i.e., view space). 2371 * 2372 * \note Although the hardware doesn't support parallel directional diffuse lights, it is possible to get "almost parallel" lights by setting 2373 * sufficient large values to position parameters (x, y and z) which makes the light position very far away from objects to be lit and all rays 2374 * considered almost parallel.<br><br> 2375 * 2376 * \note The memory for the light object must be allocated by the application; this function does not load any hardware registers directly. To 2377 * load a light object into a hardware light, use GX_LoadLightObj() or GX_LoadLightObjIdx(). 2378 * 2379 * \param[in] lit_obj ptr to the light object 2380 * \param[in] x X coordinate to place the light at 2381 * \param[in] y Y coordinate to place the light at 2382 * \param[in] z Z coordinate to place the light at 2383 * 2384 * \return none 2385 *) 2386 2387procedure GX_InitLightPos(lit_obj: PGXLightObj; x, y, z: f32); cdecl; external; 2388 2389 2390(*! 2391 * \fn void GX_InitLightColor(GXLightObj *lit_obj,GXColor col) 2392 * \brief Sets the color of the light in the light object. 2393 * 2394 * \note The memory for the light object should be allocated by the application; this function does not load any hardware register directly. To 2395 * load a light object into a hardware light, use GX_LoadLightObj() or GX_LoadLightObjIdx(). 2396 * 2397 * \param[in] lit_obj ptr to the light object 2398 * \param[in] col color to set the light to 2399 * 2400 * \return none 2401 *) 2402 2403procedure GX_InitLightColor(lit_obj: PGXLightObj; col: GXColor); cdecl; external; 2404 2405 2406(*! 2407 * \fn void GX_InitLightDir(GXLightObj *lit_obj,f32 nx,f32 ny,f32 nz) 2408 * \brief Sets the direction of a light in the light object. 2409 * 2410 * \details This direction is used when the light object is used as spotlight or a specular light (see the <i>attn_fn</i> parameter of GX_SetChanCtrl()). 2411 * 2412 * \note The coordinate space of the light normal should be consistent with a vertex normal transformed by a normal matrix; i.e., it should be 2413 * transformed to view space.<br><br> 2414 * 2415 * \note This function does not set the direction of parallel directional diffuse lights. If you want parallel diffuse lights, you may put the light 2416 * position very far from every objects to be lit. (See GX_InitLightPos() and GX_SetChanCtrl())<br><br> 2417 * 2418 * \note The memory for the light object must be allocated by the application; this function does not load any hardware registers. To load a light 2419 * object into a hardware light, use GX_LoadLightObj() or GX_LoadLightObjIdx(). 2420 * 2421 * \param[in] lit_obj ptr to the light object 2422 * \param[in] nx X coordinate of the light normal 2423 * \param[in] ny Y coordinate of the light normal 2424 * \param[in] nz Z coordinate of the light normal 2425 * 2426 * \return none 2427 *) 2428 2429procedure GX_InitLightDir(lit_obj: PGXLightObj; nx, ny, nz: f32); cdecl; external; 2430 2431 2432(*! 2433 * \fn void GX_LoadLightObj(GXLightObj *lit_obj,u8 lit_id) 2434 * \brief Loads a light object into a set of hardware registers associated with a \ref lightid. 2435 * 2436 * \details This function copies the light object data into the graphics FIFO through the CPU write-gather buffer mechanism. This guarantees that 2437 * the light object is coherent with the CPU cache. 2438 * 2439 * \note The light object must have been initialized first using the necessary GX_InitLight*() functions.<br><br> 2440 * 2441 * \note Another way to load a light object is with GX_LoadLightObjIdx(). 2442 * 2443 * \param[in] lit_obj ptr to the light object to load 2444 * \param[in] lit_id \ref lightid to load this light into 2445 * 2446 * \return none 2447 *) 2448 2449procedure GX_LoadLightObj(lit_obj: PGXLightObj; lit_id: cuint8); cdecl; external; 2450 2451 2452(*! 2453 * \fn void GX_LoadLightObjIdx(u32 litobjidx,u8 litid) 2454 * \brief Instructs the GP to fetch the light object at \a ltobjindx from an array. 2455 * 2456 * \details The light object is retrieved from the array to which <tt>GX_SetArray(GX_VA_LIGHTARRAY, ...)</tt> points. Then it loads the object into 2457 * the hardware register associated with \ref lightid. 2458 * 2459 * \note Data flows directly from the array in DRAM to the GP; therefore, the light object data may not be coherent with the CPU's cache. The 2460 * application is responsible for storing the light object data from the CPU cache (using DCStoreRange()) before calling GX_LoadLightObjIdx(). 2461 * 2462 * \param[in] litobjidx index to a light object 2463 * \param[in] litid \ref lightid to load this light into 2464 * 2465 * \return none 2466 *) 2467 2468procedure GX_LoadLightObjIdx(litobjidx: cuint32; litid: cuint8); cdecl; external; 2469 2470 2471(*! 2472 * \fn void GX_InitLightDistAttn(GXLightObj *lit_obj,f32 ref_dist,f32 ref_brite,u8 dist_fn) 2473 * \brief Sets coefficients for distance attenuation in a light object. 2474 * 2475 * \details This function uses three easy-to-control parameters instead of <i>k0</i>, <i>k1</i>, and <i>k2</i> in GX_InitLightAttn(). 2476 * 2477 * In this function, you can specify the brightness on an assumed reference point. The parameter \a ref_distance is distance between the light 2478 * and the reference point. The parameter \a ref_brite specifies ratio of the brightness on the reference point. The value for \a ref_dist should 2479 * be greater than 0 and that for \a ref_brite should be within 0 < \a ref_brite < 1, otherwise distance attenuation feature is turned off. The 2480 * parameter \a dist_fn defines type of the brightness decreasing curve by distance; <tt>GX_DA_OFF</tt> turns distance attenuation feature off. 2481 * 2482 * \note If you want more flexible control, it is better to use GX_InitLightAttn() and calculate appropriate coefficients.<br><br> 2483 * 2484 * \note This function sets parameters only for distance attenuation. Parameters for angular attenuation should be set by using 2485 * GX_InitLightSpot() or GX_InitLightAttnA().<br><br> 2486 * 2487 * \note This function does not load any hardware registers directly. To load a light object into a hardware light, use GX_LoadLightObj() or 2488 * GX_LoadLightObjIdx(). 2489 * 2490 * \param[in] lit_obj ptr to a light object 2491 * \param[in] ref_dist distance between the light and reference point 2492 * \param[in] red_brite brightness of the reference point 2493 * \param[in] dist_fn \ref distattnfn to use 2494 * 2495 * \return none 2496 *) 2497 2498procedure GX_InitLightDistAttn(lit_obj: PGXLightObj; ref_dist, ref_brite: f32; 2499 dist_fn: cuint8); cdecl; external; 2500 2501 2502(*! 2503 * \fn void GX_InitLightAttn(GXLightObj *lit_obj,f32 a0,f32 a1,f32 a2,f32 k0,f32 k1,f32 k2) 2504 * \brief Sts coefficients used in the lighting attenuation calculation in a given light object. 2505 * 2506 * \details The parameters \a a0, \a a1, and \a a2 are used for angular (spotlight) attenuation. The coefficients \a k0, \a k1, and \a k2 are used for 2507 * distance attenuation. The attenuation function is: 2508 * 2509 * <i>atten</i> = <i>clamp0</i>(\a a2^2 * <i>aattn</i>^2 + \a a1 * <i>aattn</i> + \a a0) / (\a k2 * <i>d</i>^2 + \a k1 * <i>d</i> + \a k0) 2510 * 2511 * where <i>aattn</i> is the cosine of the angle between the light direction and the vector from the light position to the vertex, and <i>d</i> is 2512 * the distance from the light position to the vertex when the channel attenuation function is <tt>GX_AF_SPOT</tt>. The light color will be 2513 * multiplied by the <i>atten</i> factor when the attenuation function for the color channel referencing this light is set to <tt>GX_AF_SPOT</tt> 2514 * (see GX_SetChanCtrl()). 2515 * 2516 * \note The convenience function GX_InitLightSpot() can be used to set the angle attenuation coefficents based on several spot light 2517 * types. The convenience function GX_InitLightDistAttn() can be used to set the distance attenuation coefficients using one of several 2518 * common attenuation functions.<br><br> 2519 * 2520 * \note The convenience macro GX_InitLightShininess() can be used to set the attenuation parameters for specular lights.<br><br> 2521 * 2522 * \note When the channel attenuation function is set to <tt>GX_AF_SPEC</tt>, the <i>aattn</i> and <i>d</i> parameter are equal to the dot product of the 2523 * eye-space vertex normal and the half-angle vector set by GX_InitSpecularDir().<br><br> 2524 * 2525 * \note This function does not load any hardware registers directly. To load a light object into a hardware light, use GX_LoadLightObj() 2526 * or GX_LoadLightObjIdx(). 2527 * 2528 * \param[in] lit_obj ptr to a light object 2529 * \param[in] a0 angle attenuation coefficient 2530 * \param[in] a1 angle attenuation coefficient 2531 * \param[in] a2 angle attenuation coefficient 2532 * \param[in] k0 distance attenuation coefficient 2533 * \param[in] k1 distance attenuation coefficient 2534 * \param[in] k2 distance attenuation coefficient 2535 * 2536 * \return none 2537 *) 2538 2539procedure GX_InitLightAttn(lit_obj: PGXLightObj; a0, a1, a2, k0, k1, k2: f32); cdecl; external; 2540 2541 2542(*! 2543 * \fn void GX_InitLightAttnA(GXLightObj *lit_obj,f32 a0,f32 a1,f32 a2) 2544 * \brief Sets coefficients used in the lighting angle attenuation calculation in a given light object. 2545 * 2546 * \details The parameters \a a0, \a a1, and \a a2 are used for angular (spotlight) attenuation. The attenuation 2547 * function is: 2548 * 2549 * <i>atten</i> = <i>clamp0</i>(\a a2^2 * <i>cos(theta)</i>^2 + \a a1 * <i>cos(theta)</i> + \a a0) / (\a k2 * <i>d</i>^2 + \a k1 * <i>d</i> + \a k0) 2550 * 2551 * where <i>cos(theta)</i> is the cosine of the angle between the light normal and the vector from the light position to the vertex, and <i>d</i> is the distance 2552 * from the light position to the vertex. The \a k0-\a 2 coefficients can be set using GX_InitLightAttnK(). You can set both the \a a0-\a 2 and \a k0-\a 2 coefficients 2553 * can be set using GX_InitLightAttn(). The light color will be multiplied by the <i>atten</i> factor when the attenuation function for the color channel 2554 * referencing this light is set to <tt>GX_AF_SPOT</tt> (see GX_SetChanCtrl()). 2555 * 2556 * \note The convenience function GX_InitLightSpot() can be used to set the angle attenuation coefficents based on several spot light types. The 2557 * convenience function GX_InitLightDistAttn() can be used to set the distance attenuation coefficients using one of several common attenuation functions.<br><br> 2558 * 2559 * \note This function does not load any hardware registers directly. To load a light object into a hardware light, use GX_LoadLightObj() or GX_LoadLightObjIdx(). 2560 * 2561 * \param[in] lit_obj ptr to a light object 2562 * \param[in] a0 angle attenuation coefficient 2563 * \param[in] a1 angle attenuation coefficient 2564 * \param[in] a2 angle attenuation coefficient 2565 * 2566 * \return none 2567 *) 2568 2569procedure GX_InitLightAttnA(lit_obj: PGXLightObj; a0, a1, a2: f32); cdecl; external; 2570 2571 2572(*! 2573 * \fn void GX_InitLightAttnK(GXLightObj *lit_obj,f32 k0,f32 k1,f32 k2) 2574 * \brief Sets coefficients used in the lighting distance attenuation calculation in a given light object. 2575 * 2576 * \details The coefficients \a k0, \a k1, and \a k2 are used for distance attenuation. The attenuation function is: 2577 * 2578 * <i>atten</i> = <i>clamp0</i>(\a a2^2 * <i>cos(theta)</i>^2 + \a a1 * <i>cos(theta)</i> + \a a0) / (\a k2 * <i>d</i>^2 + \a k1 * <i>d</i> + \a k0) 2579 * 2580 * where <i>cos(theta)</i> is the cosine of the angle between the light normal and the vector from the light position to the vertex, and <i>d</i> is the distance 2581 * from the light position to the vertex. The \a a0-\a 2 coefficients can be set using GX_InitLightAttnA(). You can set both the \a a0-\a 2 and \a k0-\a 2 coefficients 2582 * can be set using GX_InitLightAttn(). The light color will be multiplied by the <i>atten</i> factor when the attenuation function for the color channel 2583 * referencing this light is set to <tt>GX_AF_SPOT</tt> (see GX_SetChanCtrl()). 2584 * 2585 * \note The convenience function GX_InitLightSpot() can be used to set the angle attenuation coefficents based on several spot light types. The convenience 2586 * function GX_InitLightDistAttn() can be used to set the distance attenuation coefficients using one of several common attenuation functions.<br><br> 2587 * 2588 * \note Note that this function does not load any hardware registers directly. To load a light object into a hardware light, use GX_LoadLightObj() or 2589 * GX_LoadLightObjIdx(). 2590 * 2591 * \param[in] lit_obj ptr to a light object 2592 * \param[in] k0 distance attenuation coefficient 2593 * \param[in] k1 distance attenuation coefficient 2594 * \param[in] k2 distance attenuation coefficient 2595 * 2596 * \return none 2597 *) 2598 2599procedure GX_InitLightAttnK(lit_obj: PGXLightObj; k0, k1, k2: f32); cdecl; external; 2600 2601 2602(*! 2603 * \fn void GX_InitSpecularDirHA(GXLightObj *lit_obj,f32 nx,f32 ny,f32 nz,f32 hx,f32 hy,f32 hz) 2604 * \brief Sets the direction and half-angle vector of a specular light in the light object. 2605 * 2606 * \detail These vectors are used when the light object is used only as specular light. In contrast to GX_InitSpecularDir(), 2607 * which caclulates half-angle vector automatically by assuming the view vector as (0, 0, 1), this function allows users to 2608 * specify half-angle vector directly as input arguments. It is useful to do detailed control for orientation of highlights. 2609 * 2610 * \note This function does not load any hardware registers. To load a light object into a hardware light, use GX_LoadLightObj() 2611 * or GX_LoadLightObjIdx().<br><br> 2612 * 2613 * \note Other notes are similar to those described in GX_InitSpecularDir(). 2614 * 2615 * \param[in] lit_obj ptr to a light object 2616 * \param[in] nx X coordinate of the light normal 2617 * \param[in] ny Y coordinate of the light normal 2618 * \param[in] nz Z coordinate of the light normal 2619 * \param[in] hx X coordinate of half-angle 2620 * \param[in] hy Y coordinate of half-angle 2621 * \param[in] hz Z coordinate of half-angle 2622 * 2623 * \return none 2624 *) 2625 2626procedure GX_InitSpecularDirHA(lit_obj: PGXLightObj; 2627 nx, ny, nz, hx, hy, hz: f32); cdecl; external; 2628 2629 2630(*! 2631 * \fn void GX_InitSpecularDir(GXLightObj *lit_obj,f32 nx,f32 ny,f32 nz) 2632 * \brief Sets the direction of a specular light in the light object. 2633 * 2634 * \details This direction is used when the light object is used only as specular light. The coordinate space of the light normal 2635 * should be consistent with a vertex normal transformed by a normal matrix; i.e., it should be transformed to view space. 2636 * 2637 * \note This function should be used if and only if the light object is used as specular light. One specifies a specular light in 2638 * GX_SetChanCtrl() by setting the \ref attenfunc to <tt>GX_AF_SPEC</tt>. Furthermore, one must not use GX_InitLightDir() or 2639 * GX_InitLightPos() to set up a light object which will be used as a specular light since these functions will destroy the information 2640 * set by GX_InitSpecularDir(). In contrast to diffuse lights (including spotlights) that are considered local lights, a specular light 2641 * 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 2642 * can only specify directional information. 2643 * 2644 * \note This function does not load any hardware registers. To load a light object into a hardware light, use GX_LoadLightObj() 2645 * or GX_LoadLightObjIdx(). 2646 * 2647 * \param[in] lit_obj ptr to a light object 2648 * \param[in] nx X coordinate of the light normal 2649 * \param[in] ny Y coordinate of the light normal 2650 * \param[in] nz Z coordinate of the light normal 2651 * 2652 * \return none 2653 *) 2654 2655procedure GX_InitSpecularDir(lit_obj: PGXLightObj; nx, ny, nz: f32); cdecl; external; 2656 2657 2658(*! 2659 * \fn void GX_InitLightSpot(GXLightObj *lit_obj,f32 cut_off,u8 spotfn) 2660 * \brief Sets coefficients for angular (spotlight) attenuation in light object. 2661 * 2662 * \details This function uses two easy-to-control parameters instead of \a a0, \a a1, and \a a2 on GX_InitLightAttn(). 2663 * 2664 * \details The parameter \a cut_off specifies cutoff angle of the spotlight by degree. The spotlight works while the angle between the ray for a vertex and 2665 * the light direction given by GX_InitLightDir() is smaller than this cutoff angle. The value for \a cut_off should be within 0 < \a cut_off <= 90.0, otherwise 2666 * given light object doesn't become a spotlight. 2667 * 2668 * The parameter \a spotfn defines type of the illumination distribution within cutoff angle. The value <tt>GX_SP_OFF</tt> turns spotlight feature off even if 2669 * color channel setting is using <tt>GX_AF_SPOT</tt> (see GX_SetChanCtrl()). 2670 * 2671 * \note This function can generate only some kind of simple spotlights. If you want more flexible control, it is better to use GX_InitLightAttn() and calculate 2672 * appropriate coefficients.<br><br> 2673 * 2674 * \note This function sets parameters only for angular attenuation. Parameters for distance attenuation should be set by using GX_InitLightDistAttn() or 2675 * GX_InitLightAttnK().<br><br> 2676 * 2677 * \note This function does not load any hardware registers directly. To load a light object into a hardware light, use GX_LoadLightObj() or GX_LoadLightObjIdx(). 2678 * 2679 * \param[in] lit_obj ptr to a light object 2680 * \param[in] cut_off cutoff angle of the spotlight, in degrees 2681 * \param[in] spotfn \ref spotfn to use for this light 2682 * 2683 * \return none 2684 *) 2685 2686procedure GX_InitLightSpot(lit_obj: PGXLightObj; cut_off: f32; spotfn: cuint8); cdecl; external; 2687 2688 2689function GX_ReadClksPerVtx: cuint32; cdecl; external; 2690 2691function GX_GetOverflowCount: cuint32; cdecl; external; 2692 2693function GX_ResetOverflowCount: cuint32; cdecl; external; 2694 2695 2696(*! 2697 * \fn lwp_t GX_GetCurrentGXThread() 2698 * \brief Returns the current GX thread. 2699 * 2700 * \details The current GX thread should be the thread that is currently responsible for generating graphics data. By default, 2701 * the GX thread is the thread that invoked GX_Init(); however, it may be changed by calling GX_SetCurrentGXThread(). 2702 * 2703 * \note When graphics data is being generated in immediate mode (that is, the CPU FIFO = GP FIFO, and the GP is actively consuming 2704 * data), the high watermark may be triggered. When this happens, the high watermark interrupt handler will suspend the GX thread, thus 2705 * preventing any further graphics data from being generated. The low watermark interrupt handler will resume the thread. 2706 * 2707 * \return the current GX thread 2708 *) 2709 2710function GX_GetCurrentGXThread: lwp_t; cdecl; external; 2711 2712 2713(*! 2714 * \fn lwp_t GX_SetCurrentGXThread() 2715 * \brief Sets the current GX thread to the calling thread. 2716 * 2717 * \details The new thread should be the thread that will be responsible for generating graphics data. By default, the GX thread is 2718 * the thread that invoked GX_Init(); however, it may be changed by calling this function. 2719 * 2720 * \note It is a programming error to change GX thread while the current GX thread is suspended by a high water mark interrupt. This 2721 * indicates that you have two threads about to generate GX data.<br><br> 2722 * 2723 * \note When graphics data is being generated in immediate mode (that is, the CPU FIFO = GP FIFO, and the GP is actively consuming 2724 * data), the high watermark may be triggered. When this happens, the high watermark interrupt handler will suspend the GX thread, thus 2725 * preventing any further graphics data from being generated. The low watermark interrupt handler will resume the thread. 2726 * 2727 * \return the previous GX thread ID 2728 *) 2729 2730function GX_SetCurrentGXThread: lwp_t; cdecl; external; 2731 2732 2733(*! 2734 * \fn void GX_RestoreWriteGatherPipe() 2735 * \brief Restores the write-gather pipe. 2736 * 2737 * \details The CPU fifo that was attached at the time GX_RedirectWriteGatherPipe() was called will be re-attached. If there is data pending 2738 * 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 2739 * flushed out. 2740 * 2741 * \warning This function must be called between successive calls to GX_RedirectWriteGatherPipe(). 2742 * 2743 * \return none 2744 *) 2745 2746procedure GX_RestoreWriteGatherPipe; cdecl; external; 2747 2748 2749(*! 2750 * \fn void GX_SetGPMetric(u32 perf0,u32 perf1) 2751 * \brief Sets two performance metrics to measure in the GP. 2752 * 2753 * \details perf0 and perf1 are set to measure. The initial metrics measured are <tt>GX_PERF0_NONE</tt> and <tt>GX_PERF1_NONE</tt>, which return counts of zero 2754 * for the first call to GX_ReadGPMetric(). 2755 * 2756 * 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 2757 * counters, for example <tt>GX_PERF0_VERTICES</tt> and <tt>GX_PERF1_VERTICES</tt>. Ratios (the metric name ends in <tt>_RATIO</tt>) are multiplied by 2758 * 1000 (1000 = all misses/clips, etc., 0 = no misses/clips, etc.). 2759 * 2760 * \note GX_ReadGPMetric() and GX_ClearGPMetric() can be used in the callback associated with the draw sync interrupt (see GX_SetDrawSyncCallback()). 2761 * This function should not be used in the draw sync callback because it will insert tokens in the GP command stream at random times. 2762 * 2763 * \warning This function reads results from CPU-accessible registers in the GP, therefore, this command <i>must not</i> be used in a display list. In 2764 * addition, the performance counters in some cases are triggered by sending tokens through the Graphics FIFO to the GP. This implies that 2765 * the function should only be used in immediate mode (when the Graphics FIFO is connected to the CPU and the GP at the same time). It may 2766 * also be necessary to send a draw sync token using GX_SetDrawSync() or call GX_SetDrawDone() after GX_ReadGPMetric() to ensure that the 2767 * state has actually been processed by the GP. 2768 * 2769 * \param[in] perf0 \ref perf0metrics to measure 2770 * \param[in] perf1 \ref perf1metrics to measure 2771 * 2772 * \returns none 2773 *) 2774 2775procedure GX_SetGPMetric(perf0, perf1: cuint32); cdecl; external; 2776 2777 2778(*! 2779 * \fn void GX_ClearGPMetric() 2780 * \brief Clears the two virtual GP performance counters to zero. 2781 * 2782 * \note The counter's function is set using GX_SetGPMetric(); the counter's value is read using GX_ReadGPMetric(). Consult these for more details. 2783 * 2784 * \warning This function resets CPU accessible counters, so it should <b>not</b> be used in a display list. 2785 * 2786 * \return none 2787 *) 2788 2789procedure GX_ClearGPMetric; cdecl; external; 2790 2791 2792(*! 2793 * \fn void GX_InitXfRasMetric() 2794 * \brief Initialize the transformation unit (XF) rasterizer unit (RAS) to take performance measurements. 2795 * 2796 * \warning This function should be avoided; use the GP performance metric functions instead. 2797 * 2798 * \return none 2799 *) 2800 2801procedure GX_InitXfRasMetric; cdecl; external; 2802 2803 2804(*! 2805 * \fn void GX_ReadXfRasMetric(u32 *xfwaitin,u32 *xfwaitout,u32 *rasbusy,u32 *clks) 2806 * \brief Read performance metric values from the XF and RAS units. 2807 * 2808 * \warning This function should be avoided; use the GP performance metric functions instead.<br><br> 2809 * 2810 * \warning The parameters for this function are a best guess based on names and existing code. 2811 * 2812 * \param[out] xfwaitin Number of clocks the XF has waited for data to arrive? 2813 * \param[out] xfwaitout Number of clocks the XF has waited to push finished data down? 2814 * \param[out] rasbusy Number of clocks the RAS has spent being busy? 2815 * \param[out] clks Clocks that have passed since last count reset? 2816 * 2817 * \return none 2818 *) 2819 2820procedure GX_ReadXfRasMetric(var xfwaitin: cuint32; var xfwaitout: cuint32; var rasbusy: cuint32; var clks: cuint32); cdecl; external; 2821 2822 2823(*! 2824 * \fn void GX_ClearVCacheMetric() 2825 * \brief Clears the Vertex Cache performance counter. 2826 * 2827 * \details This function clears the performance counter by sending a special clear token via the Graphics FIFO. 2828 * 2829 * \note To set the metric for the counter, call GX_SetVCacheMetric(); to read the counter value, call GX_ReadVCacheMetric(). 2830 * 2831 * \return none 2832 *) 2833 2834procedure GX_ClearVCacheMetric; cdecl; external; 2835 2836 2837(*! 2838 * \fn void GX_ReadVCacheMetric(u32 *check,u32 *miss,u32 *stall) 2839 * \brief Returns Vertex Cache performance counters. 2840 * 2841 * \details Each call to this function resets the counter to zero. GX_SetVCacheMetric() sets the metric to be measured by 2842 * the Vertex Cache performance counter. 2843 * 2844 * \warning This function reads CPU-accessible registers in the GP and so should not be called in a display list. 2845 * 2846 * \param[out] check total number of accesses to the vertex cache 2847 * \param[out] miss total number of cache misses to the vertex cache 2848 * \param[out] stall number of GP clocks that the vertex cache was stalled 2849 * 2850 * \return none 2851 *) 2852 2853procedure GX_ReadVCacheMetric(var check: cuint32; var miss: cuint32; var stall: cuint32); cdecl; external; 2854 2855 2856(*! 2857 * \fn void GX_SetVCacheMetric(u32 attr) 2858 * \brief Sets the metric the Vertex Cache performance counter will measure. 2859 * 2860 * \details It is possible to monitor a particular attribute or all attributes using \a attr. 2861 * 2862 * \note To clear the counter, call GX_ClearVCacheMetric(); to read the counter value, call GX_ReadVCacheMetric(). 2863 * 2864 * \param[in] attr \ref vcachemetrics to measure 2865 * 2866 * \return none 2867 *) 2868 2869procedure GX_SetVCacheMetric(attr: cuint32); cdecl; external; 2870 2871 2872(*! 2873 * \fn void GX_GetGPStatus(u8 *overhi,u8 *underlow,u8 *readIdle,u8 *cmdIdle,u8 *brkpt) 2874 * \brief Reads the current status of the GP. 2875 * 2876 * \details \a overhi and \a underlow will indicate whether or not the watermarks have been reached. If the CPU and GP FIFOs 2877 * are the same, then \a overhi will indicate whether or not the current GX thread is suspended. The value of \a brkpt can be 2878 * used to determine if a breakpoint is in progress (i.e. GP reads are suspended; they are resumed by a call to 2879 * GX_DisableBreakPt()). A callback can also be used to notify your application that the break point has been reached. (see 2880 * GX_SetBreakPtCallback()) 2881 * 2882 * \param[out] overhi <tt>GX_TRUE</tt> if high watermark has been passed 2883 * \param[out] underlow <tt>GX_TRUE</tt> if low watermark has been passed 2884 * \param[out] readIdle <tt>GX_TRUE</tt> if the GP read unit is idle 2885 * \param[out] cmdIdle <tt>GX_TRUE</tt> if all commands have been flushed to XF 2886 * \param[out] brkpt <tt>GX_TRUE</tt> if FIFO has reached a breakpoint and GP reads have been stopped 2887 * 2888 * \return none 2889 *) 2890 2891procedure GX_GetGPStatus(var overhi: cuint32; var underlow: cuint8; var readIdle: cuint8; var cmdIdle: cuint8; var brkpt: cuint8); cdecl; external; 2892 2893 2894(*! 2895 * \fn void GX_ReadGPMetric(u32 *cnt0,u32 *cnt1) 2896 * \brief Returns the count of the previously set performance metrics. 2897 * 2898 * \note The performance metrics can be set using GX_SetGPMetric(); the counters can be cleared using GX_ClearGPMetric().<br><br> 2899 * 2900 * \note GX_ReadGPMetric() and GX_ClearGPMetric() can be used in the callback associated with the draw sync interrupt (see GX_SetDrawSyncCallback()). 2901 * The function GX_SetGPMetric() should <b>not</b> be used in the draw sync callback because it will insert tokens in the GP command stream at random times.<br><br> 2902 * 2903 * \warning This function reads results from CPU-accessible registers in the GP, therefore, this command <i>must not</i> be used in a display list. It 2904 * may also be necessary to send a draw sync token using GX_SetDrawSync() or GX_SetDrawDone() before GX_ReadGPMetric() is called to ensure that the 2905 * state has actually been processed by the GP. 2906 * 2907 * \param[out] cnt0 current value of GP counter 0 2908 * \param[out] cnt1 current value of GP counter 1 2909 * 2910 * \return none 2911 *) 2912 2913procedure GX_ReadGPMetric(var cnt0: cuint32; var cnt1: cuint32); cdecl; external; 2914 2915 2916(*! 2917 * \fn void GX_ReadBoundingBox(u16 *t,u16 *b,u16 *l,u16 *r) 2918 * \brief Returns the bounding box of pixel coordinates that are drawn in the Embedded Framebuffer (EFB). 2919 * 2920 * \details This function reads the bounding box values. GX_ClearBoundingBox() can be used reset the values of the bounding box. 2921 * 2922 * \note Since the hardware can only test the bounding box in quads (2x2 pixel blocks), the result of this function may contain error 2923 * of plus or minus 1 pixel. Also because of this, <b>left</b> and <b>top</b> are always even-numbered and <b>right</b> and <b>bottom</b> 2924 * are always odd-numbered. 2925 * 2926 * \param[out] top uppermost line in the bounding box 2927 * \param[out] bottom lowest line in the bounding box 2928 * \param[out] left leftmost pixel in the bounding box 2929 * \param[out] right rightmost pixel in the bounding box 2930 * 2931 * \return none 2932 *) 2933 2934procedure GX_ReadBoundingBox(var top: cuint16; var bottom: cuint16; var left: cuint16; var right: cuint16); cdecl; external; 2935 2936 2937(*! 2938 * \fn volatile void* GX_RedirectWriteGatherPipe(void *ptr) 2939 * \brief Temporarily points the CPU's write-gather pipe at a new location. 2940 * 2941 * \details After calling this function, subsequent writes to the address returned by this function (or the WGPipe union) 2942 * will be gathered and sent to a destination buffer. The write pointer is automatically incremented by the GP. The write 2943 * gather pipe can be restored by calling GX_RestoreWriteGatherPipe(). This function cannot be called between a 2944 * GX_Begin()/GX_End() pair. 2945 * 2946 * \note The destination buffer, referred to by \a ptr, must be 32 byte aligned. The amount of data written should 2947 * also be 32-byte aligned. If it is not, zeroes will be added to pad the destination buffer to 32 bytes. No part of the 2948 * destination buffer should be modified inside the CPU caches - this may introduce cache incoherency problems.<br><br> 2949 * 2950 * \note The write gather pipe is one of the fastest ways to move data out of the CPU (the other being the locked cache DMA). 2951 * In general, you are compute-bound when sending data from the CPU.<br><br> 2952 * 2953 * \note This function is cheaper than trying to create a fake CPU fifo around a destination buffer, which requires calls to 2954 * GX_SetCPUFifo(), GX_InitFifoBase(), etc. This function performs very light weight state saves by assuming that the CPU and 2955 * GP FIFOs never change. 2956 * 2957 * \warning <b>No GX commands can be called until the write gather pipe is restored. You MUST call 2958 * GX_RestoreWriteGatherPipe() before calling this function again, or else the final call to restore the pipe will fail.</b> 2959 * 2960 * \param[in] ptr to destination buffer, 32-byte aligned 2961 * 2962 * \return real address of the write-gather "port". All writes to this address will be gathered by the CPU write gather pipe. 2963 * You may also use the WGPipe union. If you do not use the WGPipe union, ensure that your local variable is volatile. 2964 *) 2965 2966function GX_RedirectWriteGatherPipe(ptr: pointer): pointer; cdecl; external; 2967 2968 2969 2970procedure GX_InitLightPosv(lo: PGXLightObj; vec: pointer); inline; 2971procedure GX_InitLightDirv(lo: PGXLightObj; vec: pointer); inline; 2972procedure GX_InitSpecularDirv(lo: PGXLightObj; vec: pointer); inline; 2973procedure GX_InitSpecularDirHAv(lo: PGXLightObj; vec0, vec1: pointer); inline; 2974procedure GX_InitLightShininess(lobj: PGXLightObj; shininess: f32); inline; 2975 2976 2977{$ENDIF OGC_INTERFACE} 2978 2979 2980 2981{$IFDEF OGC_IMPLEMENTATION} 2982procedure GX_End(); inline; 2983begin 2984end; 2985 2986procedure GX_Position3f32(x, y, z: f32); inline; 2987begin 2988 wgPipe^.F32 := x; 2989 wgPipe^.F32 := y; 2990 wgPipe^.F32 := z; 2991end; 2992 2993procedure GX_Position3u16(x, y, z: cuint16); inline; 2994begin 2995 wgPipe^.U16 := x; 2996 wgPipe^.U16 := y; 2997 wgPipe^.U16 := z; 2998end; 2999 3000procedure GX_Position3s16(x, y, z: cint16); inline; 3001begin 3002 wgPipe^.S16 := x; 3003 wgPipe^.S16 := y; 3004 wgPipe^.S16 := z; 3005end; 3006 3007procedure GX_Position3u8(x, y, z: cuint8); inline; 3008begin 3009 wgPipe^.U8 := x; 3010 wgPipe^.U8 := y; 3011 wgPipe^.U8 := z; 3012end; 3013 3014procedure GX_Position3s8(x, y, z: cint8); inline; 3015begin 3016 wgPipe^.S8 := x; 3017 wgPipe^.S8 := y; 3018 wgPipe^.S8 := z; 3019end; 3020 3021procedure GX_Position2f32(x, y: f32); inline; 3022begin 3023 wgPipe^.F32 := x; 3024 wgPipe^.F32 := y; 3025end; 3026 3027procedure GX_Position2u16(x, y: cuint16); inline; 3028begin 3029 wgPipe^.U16 := x; 3030 wgPipe^.U16 := y; 3031end; 3032 3033procedure GX_Position2s16(x, y: cint16); inline; 3034begin 3035 wgPipe^.S16 := x; 3036 wgPipe^.S16 := y; 3037end; 3038 3039procedure GX_Position2u8(x, y: cuint8); inline; 3040begin 3041 wgPipe^.U8 := x; 3042 wgPipe^.U8 := y; 3043end; 3044 3045procedure GX_Position2s8(x, y: cint8); inline; 3046begin 3047 wgPipe^.S8 := x; 3048 wgPipe^.S8 := y; 3049end; 3050 3051procedure GX_Position1x8(index: cuint8); inline; 3052begin 3053 wgPipe^.U8 := index; 3054end; 3055 3056procedure GX_Position1x16(index: cuint16); inline; 3057begin 3058 wgPipe^.U16 := index; 3059end; 3060 3061procedure GX_Normal3f32(nx, ny, nz: f32); inline; 3062begin 3063 wgPipe^.F32 := nx; 3064 wgPipe^.F32 := ny; 3065 wgPipe^.F32 := nz; 3066end; 3067 3068procedure GX_Normal3s16(nx, ny, nz: cint16); inline; 3069begin 3070 wgPipe^.S16 := nx; 3071 wgPipe^.S16 := ny; 3072 wgPipe^.S16 := nz; 3073end; 3074 3075procedure GX_Normal3s8(nx, ny, nz: cint8); inline; 3076begin 3077 wgPipe^.S8 := nx; 3078 wgPipe^.S8 := ny; 3079 wgPipe^.S8 := nz; 3080end; 3081 3082procedure GX_Normal1x8(index: cuint8); inline; 3083begin 3084 wgPipe^.U8 := index; 3085end; 3086 3087procedure GX_Normal1x16(index: cuint16); inline; 3088begin 3089 wgPipe^.U16 := index; 3090end; 3091 3092procedure GX_Color4u8(r, g, b, a: cuint8); inline; 3093begin 3094 wgPipe^.U8 := r; 3095 wgPipe^.U8 := g; 3096 wgPipe^.U8 := b; 3097 wgPipe^.U8 := a; 3098end; 3099 3100procedure GX_Color3u8(r, g, b: cuint8); inline; 3101begin 3102 wgPipe^.U8 := r; 3103 wgPipe^.U8 := g; 3104 wgPipe^.U8 := b; 3105end; 3106 3107procedure GX_Color3f32(r, g, b: f32); inline; 3108begin 3109 wgPipe^.U8 := cuint8(trunc(r * 255.0)); 3110 wgPipe^.U8 := cuint8(trunc(g * 255.0)); 3111 wgPipe^.U8 := cuint8(trunc(b * 255.0)); 3112end; 3113 3114procedure GX_Color1u32(clr: cuint32); inline; 3115begin 3116 wgPipe^.U32 := clr; 3117end; 3118 3119procedure GX_Color1u16(clr: cuint16); inline; 3120begin 3121 wgPipe^.U16 := clr; 3122end; 3123 3124procedure GX_Color1x8(index: cuint8); inline; 3125begin 3126 wgPipe^.U8 := index; 3127end; 3128 3129procedure GX_Color1x16(index: cuint16); inline; 3130begin 3131 wgPipe^.U16 := index; 3132end; 3133 3134procedure GX_TexCoord2f32(s, t: f32); inline; 3135begin 3136 wgPipe^.F32 := s; 3137 wgPipe^.F32 := t; 3138end; 3139 3140procedure GX_TexCoord2u16(s, t: cuint16); inline; 3141begin 3142 wgPipe^.U16 := s; 3143 wgPipe^.U16 := t; 3144end; 3145 3146procedure GX_TexCoord2s16(s, t: cint16); inline; 3147begin 3148 wgPipe^.S16 := s; 3149 wgPipe^.S16 := t; 3150end; 3151 3152procedure GX_TexCoord2u8(s, t: cuint8); inline; 3153begin 3154 wgPipe^.U8 := s; 3155 wgPipe^.U8 := t; 3156end; 3157 3158procedure GX_TexCoord2s8(s, t: cint8); inline; 3159begin 3160 wgPipe^.S8 := s; 3161 wgPipe^.S8 := t; 3162end; 3163 3164procedure GX_TexCoord1f32(s: f32); inline; 3165begin 3166 wgPipe^.F32 := s; 3167end; 3168 3169procedure GX_TexCoord1u16(s: cuint16); inline; 3170begin 3171 wgPipe^.U16 := s; 3172end; 3173 3174procedure GX_TexCoord1s16(s: cint16); inline; 3175begin 3176 wgPipe^.S16 := s; 3177end; 3178 3179procedure GX_TexCoord1u8(s: cuint8); inline; 3180begin 3181 wgPipe^.U8 := s; 3182end; 3183 3184procedure GX_TexCoord1s8(s: cint8); inline; 3185begin 3186 wgPipe^.S8 := s; 3187end; 3188 3189procedure GX_TexCoord1x8(index: cuint8); inline; 3190begin 3191 wgPipe^.U8 := index; 3192end; 3193 3194procedure GX_TexCoord1x16(index: cuint16); inline; 3195begin 3196 wgPipe^.U16 := index; 3197end; 3198 3199procedure GX_MatrixIndex1x8(index: cuint8); inline; 3200begin 3201 wgPipe^.U8 := index; 3202end; 3203 3204procedure GX_InitLightPosv(lo: PGXLightObj; vec: pointer); inline; 3205begin 3206 GX_InitLightPos(lo, f32(pointer(vec)^), f32(pointer(vec + 1)^), f32(pointer(vec + 2)^)); 3207end; 3208 3209 3210procedure GX_InitLightDirv(lo: PGXLightObj; vec: pointer); inline; 3211begin 3212 GX_InitLightDir(lo, f32(pointer(vec)^), f32(pointer(vec + 1)^), f32(pointer(vec + 2)^)); 3213end; 3214 3215procedure GX_InitSpecularDirv(lo: PGXLightObj; vec: pointer); inline; 3216begin 3217 GX_InitSpecularDir(lo, f32(pointer(vec)^), f32(pointer(vec + 1)^), f32(pointer(vec + 2)^)); 3218end; 3219 3220procedure GX_InitSpecularDirHAv(lo: PGXLightObj; vec0, vec1: pointer); inline; 3221begin 3222 GX_InitSpecularDirHA(lo, 3223 f32(pointer(vec0)^), f32(pointer(vec0 + 1)^), f32(pointer(vec0 + 2)^), 3224 f32(pointer(vec1)^), f32(pointer(vec1 + 1)^), f32(pointer(vec1 + 2)^)); 3225end; 3226 3227 3228procedure GX_InitLightShininess(lobj: PGXLightObj; shininess: f32); inline; 3229begin 3230 GX_InitLightAttn(lobj, 0.0, 0.0, 1.0, shininess / 2.0, 0.0, 1.0 - shininess / 2.0 ); 3231end; 3232 3233{$ENDIF OGC_IMPLEMENTATION} 3234 3235 3236