gx.inc 127 KB

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