-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
gx.h
5283 lines (4881 loc) · 235 KB
/
gx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef __GX_H__
#define __GX_H__
/*!
* \file gx.h
* \brief GX subsystem
*
*/
#include <gctypes.h>
#include "lwp.h"
#include "gx_struct.h"
#include "gu.h"
#define GX_FALSE 0
#define GX_TRUE 1
#define GX_DISABLE 0
#define GX_ENABLE 1
/*! \addtogroup clipmode Clipping mode
* @{
*/
#define GX_CLIP_DISABLE 1
#define GX_CLIP_ENABLE 0
/*! @} */
#define GX_FIFO_MINSIZE (64*1024) /*!< Smallest usable graphics FIFO size. */
#define GX_FIFO_HIWATERMARK (16*1024) /*!< Default hi watermark for FIFO buffer control. */
#define GX_FIFO_OBJSIZE 128
#define GX_PERSPECTIVE 0
#define GX_ORTHOGRAPHIC 1
#define GX_MT_NULL 0
#define GX_MT_XF_FLUSH 1
#define GX_MT_DL_SAVE_CTX 2
#define GX_XF_FLUSH_NONE 0
#define GX_XF_FLUSH_SAFE 1
/*! \addtogroup channelid Color channel ID
* @{
*/
#define GX_COLOR0 0
#define GX_COLOR1 1
#define GX_ALPHA0 2
#define GX_ALPHA1 3
#define GX_COLOR0A0 4
#define GX_COLOR1A1 5
#define GX_COLORZERO 6
#define GX_ALPHA_BUMP 7
#define GX_ALPHA_BUMPN 8
#define GX_COLORNULL 0xff
/*! @} */
/*! \addtogroup mtxtype Matrix type
* @{
*/
#define GX_MTX3x4 0
#define GX_MTX2x4 1
/*! @} */
/*! \addtogroup vtxfmt Vertex format index
* @{
*/
#define GX_VTXFMT0 0
#define GX_VTXFMT1 1
#define GX_VTXFMT2 2
#define GX_VTXFMT3 3
#define GX_VTXFMT4 4
#define GX_VTXFMT5 5
#define GX_VTXFMT6 6
#define GX_VTXFMT7 7
#define GX_MAXVTXFMT 8
/*! @} */
/*! \addtogroup vtxattrin Vertex data input type
* @{
*/
#define GX_NONE 0 /*!< Input data is not used */
#define GX_DIRECT 1 /*!< Input data is set direct */
#define GX_INDEX8 2 /*!< Input data is set by a 8bit index */
#define GX_INDEX16 3 /*!< Input data is set by a 16bit index */
/*! @} */
/*! \addtogroup compsize Number of components in an attribute
* @{
*/
#define GX_U8 0 /*!< Unsigned 8-bit integer */
#define GX_S8 1 /*!< Signed 8-bit integer */
#define GX_U16 2 /*!< Unsigned 16-bit integer */
#define GX_S16 3 /*!< Signed 16-bit integer */
#define GX_F32 4 /*!< 32-bit floating-point */
#define GX_RGB565 0 /*!< 16-bit RGB */
#define GX_RGB8 1 /*!< 24-bit RGB */
#define GX_RGBX8 2 /*!< 32-bit RGBX */
#define GX_RGBA4 3 /*!< 16-bit RGBA */
#define GX_RGBA6 4 /*!< 24-bit RGBA */
#define GX_RGBA8 5 /*!< 32-bit RGBA */
/*! @} */
/*! \addtogroup comptype Attribute component type
* @{
*/
#define GX_POS_XY 0 /*!< X,Y position */
#define GX_POS_XYZ 1 /*!< X,Y,Z position */
#define GX_NRM_XYZ 0 /*!< X,Y,Z normal */
#define GX_NRM_NBT 1
#define GX_NRM_NBT3 2
#define GX_CLR_RGB 0 /*!< RGB color */
#define GX_CLR_RGBA 1 /*!< RGBA color */
#define GX_TEX_S 0 /*!< One texture dimension */
#define GX_TEX_ST 1 /*!< Two texture dimensions */
/*! @} */
/*! \addtogroup vtxattr Vertex attribute array type
* @{
*/
#define GX_VA_PTNMTXIDX 0
#define GX_VA_TEX0MTXIDX 1
#define GX_VA_TEX1MTXIDX 2
#define GX_VA_TEX2MTXIDX 3
#define GX_VA_TEX3MTXIDX 4
#define GX_VA_TEX4MTXIDX 5
#define GX_VA_TEX5MTXIDX 6
#define GX_VA_TEX6MTXIDX 7
#define GX_VA_TEX7MTXIDX 8
#define GX_VA_POS 9
#define GX_VA_NRM 10
#define GX_VA_CLR0 11
#define GX_VA_CLR1 12
#define GX_VA_TEX0 13
#define GX_VA_TEX1 14
#define GX_VA_TEX2 15
#define GX_VA_TEX3 16
#define GX_VA_TEX4 17
#define GX_VA_TEX5 18
#define GX_VA_TEX6 19
#define GX_VA_TEX7 20
#define GX_POSMTXARRAY 21
#define GX_NRMMTXARRAY 22
#define GX_TEXMTXARRAY 23
#define GX_LIGHTARRAY 24
#define GX_VA_NBT 25
#define GX_VA_MAXATTR 26
#define GX_VA_NULL 0xff
/*! @} */
/*! \addtogroup primtype Primitive type
* \brief Collection of primitive types that can be drawn by the GP.
*
* \note Which type you use depends on your needs; however, performance can increase by using triangle strips or fans instead of discrete triangles.
* @{
*/
#define GX_POINTS 0xB8 /*!< Draws a series of points. Each vertex is a single point. */
#define GX_LINES 0xA8 /*!< Draws a series of unconnected line segments. Each pair of vertices makes a line. */
#define GX_LINESTRIP 0xB0 /*!< Draws a series of lines. Each vertex (besides the first) makes a line between it and the previous. */
#define GX_TRIANGLES 0x90 /*!< Draws a series of unconnected triangles. Three vertices make a single triangle. */
#define GX_TRIANGLESTRIP 0x98 /*!< Draws a series of triangles. Each triangle (besides the first) shares a side with the previous triangle.
* Each vertex (besides the first two) completes a triangle. */
#define GX_TRIANGLEFAN 0xA0 /*!< Draws a single triangle fan. The first vertex is the "centerpoint". The second and third vertex complete
* the first triangle. Each subsequent vertex completes another triangle which shares a side with the previous
* triangle (except the first triangle) and has the centerpoint vertex as one of the vertices. */
#define GX_QUADS 0x80 /*!< Draws a series of unconnected quads. Every four vertices completes a quad. Internally, each quad is
* translated into a pair of triangles. */
/*! @} */
#define GX_SRC_REG 0
#define GX_SRC_VTX 1
/*! \addtogroup lightid Light ID
* @{
*/
#define GX_LIGHT0 0x001 /*!< Light 0 */
#define GX_LIGHT1 0x002 /*!< Light 2 */
#define GX_LIGHT2 0x004 /*!< Light 3 */
#define GX_LIGHT3 0x008 /*!< Light 4 */
#define GX_LIGHT4 0x010 /*!< Light 5 */
#define GX_LIGHT5 0x020 /*!< Light 6 */
#define GX_LIGHT6 0x040 /*!< Light 7 */
#define GX_LIGHT7 0x080 /*!< Light 8 */
#define GX_MAXLIGHT 0x100 /*!< All lights */
#define GX_LIGHTNULL 0x000 /*!< No lights */
/*! @} */
/*! \addtogroup difffn Diffuse function
* @{
*/
#define GX_DF_NONE 0
#define GX_DF_SIGNED 1
#define GX_DF_CLAMP 2
/*! @} */
/*! \addtogroup attenfunc Attenuation function
* @{
*/
#define GX_AF_SPEC 0 /*!< Specular computation */
#define GX_AF_SPOT 1 /*!< Spot light attenuation */
#define GX_AF_NONE 2 /*!< No attenuation */
/*! @} */
/* pos,nrm,tex,dtt matrix */
/*! \addtogroup pnmtx Position-normal matrix index
* @{
*/
#define GX_PNMTX0 0
#define GX_PNMTX1 3
#define GX_PNMTX2 6
#define GX_PNMTX3 9
#define GX_PNMTX4 12
#define GX_PNMTX5 15
#define GX_PNMTX6 18
#define GX_PNMTX7 21
#define GX_PNMTX8 24
#define GX_PNMTX9 27
/*! @} */
/*! \addtogroup texmtx Texture matrix index
* @{
*/
#define GX_TEXMTX0 30
#define GX_TEXMTX1 33
#define GX_TEXMTX2 36
#define GX_TEXMTX3 39
#define GX_TEXMTX4 42
#define GX_TEXMTX5 45
#define GX_TEXMTX6 48
#define GX_TEXMTX7 51
#define GX_TEXMTX8 54
#define GX_TEXMTX9 57
#define GX_IDENTITY 60
/*! @} */
/*! \addtogroup dttmtx Post-transform texture matrix index
* @{
*/
#define GX_DTTMTX0 64
#define GX_DTTMTX1 67
#define GX_DTTMTX2 70
#define GX_DTTMTX3 73
#define GX_DTTMTX4 76
#define GX_DTTMTX5 79
#define GX_DTTMTX6 82
#define GX_DTTMTX7 85
#define GX_DTTMTX8 88
#define GX_DTTMTX9 91
#define GX_DTTMTX10 94
#define GX_DTTMTX11 97
#define GX_DTTMTX12 100
#define GX_DTTMTX13 103
#define GX_DTTMTX14 106
#define GX_DTTMTX15 109
#define GX_DTTMTX16 112
#define GX_DTTMTX17 115
#define GX_DTTMTX18 118
#define GX_DTTMTX19 121
#define GX_DTTIDENTITY 125
/*! @} */
/* tex coord id
used by: XF: 0x1040,0x1050
BP: 0x30
*/
/*! \addtogroup texcoordid texture coordinate slot
* @{
*/
#define GX_TEXCOORD0 0x0
#define GX_TEXCOORD1 0x1
#define GX_TEXCOORD2 0x2
#define GX_TEXCOORD3 0x3
#define GX_TEXCOORD4 0x4
#define GX_TEXCOORD5 0x5
#define GX_TEXCOORD6 0x6
#define GX_TEXCOORD7 0x7
#define GX_MAXCOORD 0x8
#define GX_TEXCOORDNULL 0xff
/*! @} */
/* tex format */
#define _GX_TF_ZTF 0x10
#define _GX_TF_CTF 0x20
/*! \addtogroup texfmt Texture format
* @{
*/
#define GX_TF_I4 0x0
#define GX_TF_I8 0x1
#define GX_TF_IA4 0x2
#define GX_TF_IA8 0x3
#define GX_TF_RGB565 0x4
#define GX_TF_RGB5A3 0x5
#define GX_TF_RGBA8 0x6
#define GX_TF_CI4 0x8
#define GX_TF_CI8 0x9
#define GX_TF_CI14 0xa
#define GX_TF_CMPR 0xE /*!< Compressed */
#define GX_TL_IA8 0x00
#define GX_TL_RGB565 0x01
#define GX_TL_RGB5A3 0x02
#define GX_CTF_R4 (0x0|_GX_TF_CTF) /*!< For copying 4 bits from red */
#define GX_CTF_RA4 (0x2|_GX_TF_CTF) /*!< For copying 4 bits from red, 4 bits from alpha */
#define GX_CTF_RA8 (0x3|_GX_TF_CTF) /*!< For copying 8 bits from red, 8 bits from alpha */
#define GX_CTF_YUVA8 (0x6|_GX_TF_CTF)
#define GX_CTF_A8 (0x7|_GX_TF_CTF) /*!< For copying 8 bits from alpha */
#define GX_CTF_R8 (0x8|_GX_TF_CTF) /*!< For copying 8 bits from red */
#define GX_CTF_G8 (0x9|_GX_TF_CTF) /*!< For copying 8 bits from green */
#define GX_CTF_B8 (0xA|_GX_TF_CTF) /*!< For copying 8 bits from blue */
#define GX_CTF_RG8 (0xB|_GX_TF_CTF) /*!< For copying 8 bits from red, 8 bits from green */
#define GX_CTF_GB8 (0xC|_GX_TF_CTF) /*!< For copying 8 bits from green, 8 bits from blue */
/*! \addtogroup ztexfmt Z Texture format
* @{
*/
#define GX_TF_Z8 (0x1|_GX_TF_ZTF) /*!< For texture copy, specifies upper 8 bits of Z */
#define GX_TF_Z16 (0x3|_GX_TF_ZTF) /*!< For texture copy, specifies upper 16 bits of Z */
#define GX_TF_Z24X8 (0x6|_GX_TF_ZTF) /*!< For texture copy, copies 24 Z bits and 0xFF */
/*! @} */
#define GX_CTF_Z4 (0x0|_GX_TF_ZTF|_GX_TF_CTF) /*!< For copying 4 upper bits from Z */
#define GX_CTF_Z8M (0x9|_GX_TF_ZTF|_GX_TF_CTF) /*!< For copying the middle 8 bits of Z */
#define GX_CTF_Z8L (0xA|_GX_TF_ZTF|_GX_TF_CTF) /*!< For copying the lower 8 bits of Z */
#define GX_CTF_Z16L (0xC|_GX_TF_ZTF|_GX_TF_CTF) /*!< For copying the lower 16 bits of Z */
#define GX_TF_A8 GX_CTF_A8
/*! @} */
/* gx tlut size */
#define GX_TLUT_16 1 // number of 16 entry blocks.
#define GX_TLUT_32 2
#define GX_TLUT_64 4
#define GX_TLUT_128 8
#define GX_TLUT_256 16
#define GX_TLUT_512 32
#define GX_TLUT_1K 64
#define GX_TLUT_2K 128
#define GX_TLUT_4K 256
#define GX_TLUT_8K 512
#define GX_TLUT_16K 1024
/*! \addtogroup ztexop Z Texture operator
* @{
*/
#define GX_ZT_DISABLE 0
#define GX_ZT_ADD 1 /*!< Add a Z texel to reference Z */
#define GX_ZT_REPLACE 2 /*!< Replace reference Z with Z texel */
#define GX_MAX_ZTEXOP 3
/*! @} */
/*! \addtogroup texgentyp Texture coordinate generation type
* @{
*/
#define GX_TG_MTX3x4 0 /*!< 3x4 matrix multiply on the input attribute and generate S,T,Q coordinates; S,T are then divided
* by Q to produce the actual 2D texture coordinates. */
#define GX_TG_MTX2x4 1 /*!< 2x4 matrix multiply on the input attribute and generate S,T texture coordinates. */
#define GX_TG_BUMP0 2 /*!< Use light 0 in the bump map calculation. */
#define GX_TG_BUMP1 3 /*!< Use light 1 in the bump map calculation. */
#define GX_TG_BUMP2 4 /*!< Use light 2 in the bump map calculation. */
#define GX_TG_BUMP3 5 /*!< Use light 3 in the bump map calculation. */
#define GX_TG_BUMP4 6 /*!< Use light 4 in the bump map calculation. */
#define GX_TG_BUMP5 7 /*!< Use light 5 in the bump map calculation. */
#define GX_TG_BUMP6 8 /*!< Use light 6 in the bump map calculation. */
#define GX_TG_BUMP7 9 /*!< Use light 7 in the bump map calculation. */
#define GX_TG_SRTG 10 /*!< Coordinates generated from vertex lighting results; one of the color channel results is converted
* into texture coordinates. */
/*! @} */
/*! \addtogroup texgensrc Texture coordinate source
* @{
*/
#define GX_TG_POS 0
#define GX_TG_NRM 1
#define GX_TG_BINRM 2
#define GX_TG_TANGENT 3
#define GX_TG_TEX0 4
#define GX_TG_TEX1 5
#define GX_TG_TEX2 6
#define GX_TG_TEX3 7
#define GX_TG_TEX4 8
#define GX_TG_TEX5 9
#define GX_TG_TEX6 10
#define GX_TG_TEX7 11
#define GX_TG_TEXCOORD0 12
#define GX_TG_TEXCOORD1 13
#define GX_TG_TEXCOORD2 14
#define GX_TG_TEXCOORD3 15
#define GX_TG_TEXCOORD4 16
#define GX_TG_TEXCOORD5 17
#define GX_TG_TEXCOORD6 18
#define GX_TG_COLOR0 19
#define GX_TG_COLOR1 20
/*! @} */
/*! \addtogroup compare Compare type
* @{
*/
#define GX_NEVER 0
#define GX_LESS 1
#define GX_EQUAL 2
#define GX_LEQUAL 3
#define GX_GREATER 4
#define GX_NEQUAL 5
#define GX_GEQUAL 6
#define GX_ALWAYS 7
/*! @} */
/* Text Wrap Mode */
#define GX_CLAMP 0
#define GX_REPEAT 1
#define GX_MIRROR 2
#define GX_MAXTEXWRAPMODE 3
/*! \addtogroup blendmode Blending type
* @{
*/
#define GX_BM_NONE 0 /*!< Write input directly to EFB */
#define GX_BM_BLEND 1 /*!< Blend using blending equation */
#define GX_BM_LOGIC 2 /*!< Blend using bitwise operation */
#define GX_BM_SUBTRACT 3 /*!< Input subtracts from existing pixel */
#define GX_MAX_BLENDMODE 4
/*! @} */
/*! \addtogroup blendfactor Blending control
* \details Each pixel (source or destination) is multiplied by any of these controls.
* @{
*/
#define GX_BL_ZERO 0 /*!< 0.0 */
#define GX_BL_ONE 1 /*!< 1.0 */
#define GX_BL_SRCCLR 2 /*!< source color */
#define GX_BL_INVSRCCLR 3 /*!< 1.0 - (source color) */
#define GX_BL_SRCALPHA 4 /*!< source alpha */
#define GX_BL_INVSRCALPHA 5 /*!< 1.0 - (source alpha) */
#define GX_BL_DSTALPHA 6 /*!< framebuffer alpha */
#define GX_BL_INVDSTALPHA 7 /*!< 1.0 - (FB alpha) */
#define GX_BL_DSTCLR GX_BL_SRCCLR
#define GX_BL_INVDSTCLR GX_BL_INVSRCCLR
/*! @} */
/*! \addtogroup logicop Logical operation type
* \details Destination (dst) acquires the value of one of these operations, given in C syntax.
* @{
*/
#define GX_LO_CLEAR 0 /*!< 0 */
#define GX_LO_AND 1 /*!< src & dst */
#define GX_LO_REVAND 2 /*!< src & ~dst */
#define GX_LO_COPY 3 /*!< src */
#define GX_LO_INVAND 4 /*!< ~src & dst */
#define GX_LO_NOOP 5 /*!< dst */
#define GX_LO_XOR 6 /*!< src ^ dst */
#define GX_LO_OR 7 /*!< src | dst */
#define GX_LO_NOR 8 /*!< ~(src | dst) */
#define GX_LO_EQUIV 9 /*!< ~(src ^ dst) */
#define GX_LO_INV 10 /*!< ~dst */
#define GX_LO_REVOR 11 /*!< src | ~dst */
#define GX_LO_INVCOPY 12 /*!< ~src */
#define GX_LO_INVOR 13 /*!< ~src | dst */
#define GX_LO_NAND 14 /*!< ~(src & dst) */
#define GX_LO_SET 15 /*!< 1 */
/*! @} */
/*! \addtogroup texoff Texture offset value
* \brief Used for texturing points or lines.
* @{
*/
#define GX_TO_ZERO 0
#define GX_TO_SIXTEENTH 1
#define GX_TO_EIGHTH 2
#define GX_TO_FOURTH 3
#define GX_TO_HALF 4
#define GX_TO_ONE 5
#define GX_MAX_TEXOFFSET 6
/*! @} */
/*! \addtogroup tevdefmode TEV combiner operation
* \brief Color/Alpha combiner modes for GX_SetTevOp().
*
* \details For these equations, <i>Cv</i> is the output color for the stage, <i>Cr</i> is the output color of previous stage, and <i>Ct</i> is the texture color. <i>Av</i> is the output
* alpha for a stage, <i>Ar</i> is the output alpha of previous stage, and <i>At</i> is the texture alpha. As a special case, rasterized color
* (<tt>GX_CC_RASC</tt>) is used as <i>Cr</i> and rasterized alpha (<tt>GX_CA_RASA</tt>) is used as <i>Ar</i> at the first TEV stage because there is no previous stage.
*
* @{
*/
#define GX_MODULATE 0 /*!< <i>Cv</i>=<i>CrCt</i>; <i>Av</i>=<i>ArAt</i> */
#define GX_DECAL 1 /*!< <i>Cv</i>=(1-<i>At</i>)<i>Cr</i> + <i>AtCt</i>; <i>Av</i>=<i>Ar</i> */
#define GX_BLEND 2 /*!< <i>Cv=(1-<i>Ct</i>)<i>Cr</i> + <i>Ct</i>; <i>Av</i>=<i>AtAr</i> */
#define GX_REPLACE 3 /*!< <i>Cv=<i>Ct</i>; <i>Ar=<i>At</i> */
#define GX_PASSCLR 4 /*!< <i>Cv=<i>Cr</i>; <i>Av=<i>Ar</i> */
/*! @} */
/*! \addtogroup tevcolorarg TEV color combiner input
* @{
*/
#define GX_CC_CPREV 0 /*!< Use the color value from previous TEV stage */
#define GX_CC_APREV 1 /*!< Use the alpha value from previous TEV stage */
#define GX_CC_C0 2 /*!< Use the color value from the color/output register 0 */
#define GX_CC_A0 3 /*!< Use the alpha value from the color/output register 0 */
#define GX_CC_C1 4 /*!< Use the color value from the color/output register 1 */
#define GX_CC_A1 5 /*!< Use the alpha value from the color/output register 1 */
#define GX_CC_C2 6 /*!< Use the color value from the color/output register 2 */
#define GX_CC_A2 7 /*!< Use the alpha value from the color/output register 2 */
#define GX_CC_TEXC 8 /*!< Use the color value from texture */
#define GX_CC_TEXA 9 /*!< Use the alpha value from texture */
#define GX_CC_RASC 10 /*!< Use the color value from rasterizer */
#define GX_CC_RASA 11 /*!< Use the alpha value from rasterizer */
#define GX_CC_ONE 12
#define GX_CC_HALF 13
#define GX_CC_KONST 14
#define GX_CC_ZERO 15 /*!< Use to pass zero value */
/*! @} */
/*! \addtogroup tevalphaarg TEV alpha combiner input
* @{
*/
#define GX_CA_APREV 0 /*!< Use the alpha value from previous TEV stage */
#define GX_CA_A0 1 /*!< Use the alpha value from the color/output register 0 */
#define GX_CA_A1 2 /*!< Use the alpha value from the color/output register 1 */
#define GX_CA_A2 3 /*!< Use the alpha value from the color/output register 2 */
#define GX_CA_TEXA 4 /*!< Use the alpha value from texture */
#define GX_CA_RASA 5 /*!< Use the alpha value from rasterizer */
#define GX_CA_KONST 6
#define GX_CA_ZERO 7 /*!< Use to pass zero value */
/*! @} */
/*! \addtogroup tevstage TEV stage
* \details The GameCube's Graphics Processor (GP) can use up to 16 stages to compute a texel for a particular surface.
* By default, each texture will use two stages, but it can be configured through various functions calls.
*
* \note This is different from \ref texmapid s, where textures are loaded into.
* @{
*/
#define GX_TEVSTAGE0 0
#define GX_TEVSTAGE1 1
#define GX_TEVSTAGE2 2
#define GX_TEVSTAGE3 3
#define GX_TEVSTAGE4 4
#define GX_TEVSTAGE5 5
#define GX_TEVSTAGE6 6
#define GX_TEVSTAGE7 7
#define GX_TEVSTAGE8 8
#define GX_TEVSTAGE9 9
#define GX_TEVSTAGE10 10
#define GX_TEVSTAGE11 11
#define GX_TEVSTAGE12 12
#define GX_TEVSTAGE13 13
#define GX_TEVSTAGE14 14
#define GX_TEVSTAGE15 15
#define GX_MAX_TEVSTAGE 16
/*! @} */
/*! \addtogroup tevop TEV combiner operator
* @{
*/
#define GX_TEV_ADD 0
#define GX_TEV_SUB 1
#define GX_TEV_COMP_R8_GT 8
#define GX_TEV_COMP_R8_EQ 9
#define GX_TEV_COMP_GR16_GT 10
#define GX_TEV_COMP_GR16_EQ 11
#define GX_TEV_COMP_BGR24_GT 12
#define GX_TEV_COMP_BGR24_EQ 13
#define GX_TEV_COMP_RGB8_GT 14
#define GX_TEV_COMP_RGB8_EQ 15
#define GX_TEV_COMP_A8_GT GX_TEV_COMP_RGB8_GT // for alpha channel
#define GX_TEV_COMP_A8_EQ GX_TEV_COMP_RGB8_EQ // for alpha channel
/*! @} */
/*! \addtogroup tevbias TEV bias value
* @{
*/
#define GX_TB_ZERO 0
#define GX_TB_ADDHALF 1
#define GX_TB_SUBHALF 2
#define GX_MAX_TEVBIAS 3
/*! @} */
/*! \addtogroup tevclampmode TEV clamping mode
* \note These modes are used for a function which is not implementable on production (i.e. retail) GameCube hardware.
* @{
*/
#define GX_TC_LINEAR 0
#define GX_TC_GE 1
#define GX_TC_EQ 2
#define GX_TC_LE 3
#define GX_MAX_TEVCLAMPMODE 4
/*! @} */
/*! \addtogroup tevscale TEV scale value
* @{
*/
#define GX_CS_SCALE_1 0
#define GX_CS_SCALE_2 1
#define GX_CS_SCALE_4 2
#define GX_CS_DIVIDE_2 3
#define GX_MAX_TEVSCALE 4
/*! @} */
/*! \addtogroup tevcoloutreg TEV color/output register
* @{
*/
#define GX_TEVPREV 0 /*!< Default register for passing results from one stage to another. */
#define GX_TEVREG0 1
#define GX_TEVREG1 2
#define GX_TEVREG2 3
#define GX_MAX_TEVREG 4
/*! @} */
/*! \addtogroup cullmode Backface culling mode
* @{
*/
#define GX_CULL_NONE 0 /*!< Do not cull any primitives. */
#define GX_CULL_FRONT 1 /*!< Cull front-facing primitives. */
#define GX_CULL_BACK 2 /*!< Cull back-facing primitives. */
#define GX_CULL_ALL 3 /*!< Cull all primitives. */
/*! @} */
/*! \addtogroup texmapid texture map slot
* \brief Texture map slots to hold textures in.
*
* \details The GameCube's Graphics Processor (GP) can apply up to eight textures to a single surface. Those textures
* are assigned one of these slots. Various operations used on or with a particular texture will also take one of these
* items, including operations regarding texture coordinate generation (although not necessarily on the same slot).
*
* \note This is different from \ref tevstage s, which are the actual quanta for work with textures.
* @{
*/
#define GX_TEXMAP0 0 /*!< Texture map slot 0 */
#define GX_TEXMAP1 1 /*!< Texture map slot 1 */
#define GX_TEXMAP2 2 /*!< Texture map slot 2 */
#define GX_TEXMAP3 3 /*!< Texture map slot 3 */
#define GX_TEXMAP4 4 /*!< Texture map slot 4 */
#define GX_TEXMAP5 5 /*!< Texture map slot 5 */
#define GX_TEXMAP6 6 /*!< Texture map slot 6 */
#define GX_TEXMAP7 7 /*!< Texture map slot 7 */
#define GX_MAX_TEXMAP 8
#define GX_TEXMAP_NULL 0xff /*!< No texmap */
#define GX_TEXMAP_DISABLE 0x100 /*!< Disable texmap lookup for this texmap slot (use bitwise OR with a texture map slot). */
/*! @} */
/*! \addtogroup alphaop Alpha combine control
* @{
*/
#define GX_AOP_AND 0
#define GX_AOP_OR 1
#define GX_AOP_XOR 2
#define GX_AOP_XNOR 3
#define GX_MAX_ALPHAOP 4
/*! @} */
/*! \addtogroup tevkcolorid TEV constant color register
* @{
*/
#define GX_KCOLOR0 0 /*!< Constant register 0 */
#define GX_KCOLOR1 1 /*!< Constant register 1 */
#define GX_KCOLOR2 2 /*!< Constant register 2 */
#define GX_KCOLOR3 3 /*!< Constant register 3 */
#define GX_KCOLOR_MAX 4
/*! @} */
/*! \addtogroup tevkcolorsel TEV constant color selection
* @{
*/
#define GX_TEV_KCSEL_1 0x00 /*!< constant 1.0 */
#define GX_TEV_KCSEL_7_8 0x01 /*!< constant 7/8 */
#define GX_TEV_KCSEL_3_4 0x02 /*!< constant 3/4 */
#define GX_TEV_KCSEL_5_8 0x03 /*!< constant 5/8 */
#define GX_TEV_KCSEL_1_2 0x04 /*!< constant 1/2 */
#define GX_TEV_KCSEL_3_8 0x05 /*!< constant 3/8 */
#define GX_TEV_KCSEL_1_4 0x06 /*!< constant 1/4 */
#define GX_TEV_KCSEL_1_8 0x07 /*!< constant 1/8 */
#define GX_TEV_KCSEL_K0 0x0C /*!< K0[RGB] register */
#define GX_TEV_KCSEL_K1 0x0D /*!< K1[RGB] register */
#define GX_TEV_KCSEL_K2 0x0E /*!< K2[RGB] register */
#define GX_TEV_KCSEL_K3 0x0F /*!< K3[RGB] register */
#define GX_TEV_KCSEL_K0_R 0x10 /*!< K0[RRR] register */
#define GX_TEV_KCSEL_K1_R 0x11 /*!< K1[RRR] register */
#define GX_TEV_KCSEL_K2_R 0x12 /*!< K2[RRR] register */
#define GX_TEV_KCSEL_K3_R 0x13 /*!< K3[RRR] register */
#define GX_TEV_KCSEL_K0_G 0x14 /*!< K0[GGG] register */
#define GX_TEV_KCSEL_K1_G 0x15 /*!< K1[GGG] register */
#define GX_TEV_KCSEL_K2_G 0x16 /*!< K2[GGG] register */
#define GX_TEV_KCSEL_K3_G 0x17 /*!< K3[GGG] register */
#define GX_TEV_KCSEL_K0_B 0x18 /*!< K0[BBB] register */
#define GX_TEV_KCSEL_K1_B 0x19 /*!< K1[BBB] register */
#define GX_TEV_KCSEL_K2_B 0x1A /*!< K2[BBB] register */
#define GX_TEV_KCSEL_K3_B 0x1B /*!< K3[RBB] register */
#define GX_TEV_KCSEL_K0_A 0x1C /*!< K0[AAA] register */
#define GX_TEV_KCSEL_K1_A 0x1D /*!< K1[AAA] register */
#define GX_TEV_KCSEL_K2_A 0x1E /*!< K2[AAA] register */
#define GX_TEV_KCSEL_K3_A 0x1F /*!< K3[AAA] register */
/*! @} */
/*! \addtogroup tevkalphasel TEV constant alpha selection
* @{
*/
#define GX_TEV_KASEL_1 0x00 /*!< constant 1.0 */
#define GX_TEV_KASEL_7_8 0x01 /*!< constant 7/8 */
#define GX_TEV_KASEL_3_4 0x02 /*!< constant 3/4 */
#define GX_TEV_KASEL_5_8 0x03 /*!< constant 5/8 */
#define GX_TEV_KASEL_1_2 0x04 /*!< constant 1/2 */
#define GX_TEV_KASEL_3_8 0x05 /*!< constant 3/8 */
#define GX_TEV_KASEL_1_4 0x06 /*!< constant 1/4 */
#define GX_TEV_KASEL_1_8 0x07 /*!< constant 1/8 */
#define GX_TEV_KASEL_K0_R 0x10 /*!< K0[R] register */
#define GX_TEV_KASEL_K1_R 0x11 /*!< K1[R] register */
#define GX_TEV_KASEL_K2_R 0x12 /*!< K2[R] register */
#define GX_TEV_KASEL_K3_R 0x13 /*!< K3[R] register */
#define GX_TEV_KASEL_K0_G 0x14 /*!< K0[G] register */
#define GX_TEV_KASEL_K1_G 0x15 /*!< K1[G] register */
#define GX_TEV_KASEL_K2_G 0x16 /*!< K2[G] register */
#define GX_TEV_KASEL_K3_G 0x17 /*!< K3[G] register */
#define GX_TEV_KASEL_K0_B 0x18 /*!< K0[B] register */
#define GX_TEV_KASEL_K1_B 0x19 /*!< K1[B] register */
#define GX_TEV_KASEL_K2_B 0x1A /*!< K2[B] register */
#define GX_TEV_KASEL_K3_B 0x1B /*!< K3[B] register */
#define GX_TEV_KASEL_K0_A 0x1C /*!< K0[A] register */
#define GX_TEV_KASEL_K1_A 0x1D /*!< K1[A] register */
#define GX_TEV_KASEL_K2_A 0x1E /*!< K2[A] register */
#define GX_TEV_KASEL_K3_A 0x1F /*!< K3[A] register */
/*! @} */
/*! \addtogroup tevswapsel TEV color swap table entry
* @{
*/
#define GX_TEV_SWAP0 0
#define GX_TEV_SWAP1 1
#define GX_TEV_SWAP2 2
#define GX_TEV_SWAP3 3
#define GX_MAX_TEVSWAP 4
/*! @} */
/* tev color chan */
#define GX_CH_RED 0
#define GX_CH_GREEN 1
#define GX_CH_BLUE 2
#define GX_CH_ALPHA 3
/*! \addtogroup indtexstage Indirect texture stage
* @{
*/
#define GX_INDTEXSTAGE0 0
#define GX_INDTEXSTAGE1 1
#define GX_INDTEXSTAGE2 2
#define GX_INDTEXSTAGE3 3
#define GX_MAX_INDTEXSTAGE 4
/*! @} */
/*! \addtogroup indtexformat Indirect texture format
* \details Bits for the indirect offsets are extracted from the high end of each component byte. Bits for the bump alpha
* are extraced off the low end of the byte. For <tt>GX_ITF_8</tt>, the byte is duplicated for the offset and the bump alpha.
* @{
*/
#define GX_ITF_8 0
#define GX_ITF_5 1
#define GX_ITF_4 2
#define GX_ITF_3 3
#define GX_MAX_ITFORMAT 4
/*! @} */
/*! \addtogroup indtexbias Indirect texture bias select
* \brief Indicates which components of the indirect offset should receive a bias value.
*
* \details The bias is fixed at -128 for <tt>GX_ITF_8</tt> and +1 for the other formats. The bias happens prior to the indirect matrix multiply.
* @{
*/
#define GX_ITB_NONE 0
#define GX_ITB_S 1
#define GX_ITB_T 2
#define GX_ITB_ST 3
#define GX_ITB_U 4
#define GX_ITB_SU 5
#define GX_ITB_TU 6
#define GX_ITB_STU 7
#define GX_MAX_ITBIAS 8
/*! @} */
/*! \addtogroup indtexmtx Indirect texture matrix
* @{
*/
#define GX_ITM_OFF 0 /*!< Specifies a matrix of all zeroes. */
#define GX_ITM_0 1 /*!< Specifies indirect matrix 0, indirect scale 0. */
#define GX_ITM_1 2 /*!< Specifies indirect matrix 1, indirect scale 1. */
#define GX_ITM_2 3 /*!< Specifies indirect matrix 2, indirect scale 2. */
#define GX_ITM_S0 5 /*!< Specifies dynamic S-type matrix, indirect scale 0. */
#define GX_ITM_S1 6 /*!< Specifies dynamic S-type matrix, indirect scale 1. */
#define GX_ITM_S2 7 /*!< Specifies dynamic S-type matrix, indirect scale 2. */
#define GX_ITM_T0 9 /*!< Specifies dynamic T-type matrix, indirect scale 0. */
#define GX_ITM_T1 10 /*!< Specifies dynamic T-type matrix, indirect scale 1. */
#define GX_ITM_T2 11 /*!< Specifies dynamic T-type matrix, indirect scale 2. */
/*! @} */
/*! \addtogroup indtexwrap Indirect texture wrap value
* \brief Indicates whether the regular texture coordinate should be wrapped before being added to the offset.
*
* \details <tt>GX_ITW_OFF</tt> specifies no wrapping. <tt>GX_ITW_0</tt> will zero out the regular texture coordinate.
* @{
*/
#define GX_ITW_OFF 0
#define GX_ITW_256 1
#define GX_ITW_128 2
#define GX_ITW_64 3
#define GX_ITW_32 4
#define GX_ITW_16 5
#define GX_ITW_0 6
#define GX_MAX_ITWRAP 7
/*! @} */
/*! \addtogroup indtexalphasel Indirect texture bump alpha select
* \brief Indicates which offset component should provide the "bump" alpha output for the given TEV stage.
*
* \note Bump alpha is not available for TEV stage 0.
* @{
*/
#define GX_ITBA_OFF 0
#define GX_ITBA_S 1
#define GX_ITBA_T 2
#define GX_ITBA_U 3
#define GX_MAX_ITBALPHA 4
/*! @} */
/*! \addtogroup indtexscale Indirect texture scale
* \brief Specifies an additional scale value that may be applied to the texcoord used for an indirect initial lookup (not a TEV stage regular lookup).
*
* \details The scale value is a fraction; thus <tt>GX_ITS_32</tt> means to divide the texture coordinate values by 32.
* @{
*/
#define GX_ITS_1 0
#define GX_ITS_2 1
#define GX_ITS_4 2
#define GX_ITS_8 3
#define GX_ITS_16 4
#define GX_ITS_32 5
#define GX_ITS_64 6
#define GX_ITS_128 7
#define GX_ITS_256 8
#define GX_MAX_ITSCALE 9
/*! @} */
/*! \addtogroup fogtype Fog equation control
* @{
*/
#define GX_FOG_NONE 0
#define GX_FOG_PERSP_LIN 2
#define GX_FOG_PERSP_EXP 4
#define GX_FOG_PERSP_EXP2 5
#define GX_FOG_PERSP_REVEXP 6
#define GX_FOG_PERSP_REVEXP2 7
#define GX_FOG_ORTHO_LIN 10
#define GX_FOG_ORTHO_EXP 12
#define GX_FOG_ORTHO_EXP2 13
#define GX_FOG_ORTHO_REVEXP 14
#define GX_FOG_ORTHO_REVEXP2 15
#define GX_FOG_LIN GX_FOG_PERSP_LIN
#define GX_FOG_EXP GX_FOG_PERSP_EXP
#define GX_FOG_EXP2 GX_FOG_PERSP_EXP2
#define GX_FOG_REVEXP GX_FOG_PERSP_REVEXP
#define GX_FOG_REVEXP2 GX_FOG_PERSP_REVEXP2
/*! @} */
/* pixel format */
#define GX_PF_RGB8_Z24 0
#define GX_PF_RGBA6_Z24 1
#define GX_PF_RGB565_Z16 2
#define GX_PF_Z24 3
#define GX_PF_Y8 4
#define GX_PF_U8 5
#define GX_PF_V8 6
#define GX_PF_YUV420 7
/*! \addtogroup zfmt Compressed Z format
* @{
*/
#define GX_ZC_LINEAR 0
#define GX_ZC_NEAR 1
#define GX_ZC_MID 2
#define GX_ZC_FAR 3
/*! @} */
/*! \addtogroup xfbclamp XFB clamp modes
* @{
*/
#define GX_CLAMP_NONE 0
#define GX_CLAMP_TOP 1
#define GX_CLAMP_BOTTOM 2
/*! @} */
/*! \addtogroup gammamode Gamma values
* @{
*/
#define GX_GM_1_0 0
#define GX_GM_1_7 1
#define GX_GM_2_2 2
/*! @} */
/*! \addtogroup copymode EFB copy mode
* \brief Controls whether all lines, only even lines, or only odd lines are copied from the EFB.
* @{
*/
#define GX_COPY_PROGRESSIVE 0
#define GX_COPY_INTLC_EVEN 2
#define GX_COPY_INTLC_ODD 3
/*! @} */
/*! \addtogroup alphareadmode Alpha read mode
* @{
*/
#define GX_READ_00 0 /*!< Always read 0x00. */
#define GX_READ_FF 1 /*!< Always read 0xFF. */
#define GX_READ_NONE 2 /*!< Always read the real alpha value. */
/*! @} */
/*! \addtogroup texcachesize Texture cache size
* \brief Size of texture cache regions.
* @{
*/
#define GX_TEXCACHE_32K 0
#define GX_TEXCACHE_128K 1
#define GX_TEXCACHE_512K 2
#define GX_TEXCACHE_NONE 3
/*! @} */
/*! \addtogroup distattnfn Brightness decreasing function
* \brief Type of the brightness decreasing function by distance.
* @{
*/
#define GX_DA_OFF 0
#define GX_DA_GENTLE 1
#define GX_DA_MEDIUM 2
#define GX_DA_STEEP 3
/*! @} */
/*! \addtogroup spotfn Spot illumination distribution function
* @{
*/
#define GX_SP_OFF 0
#define GX_SP_FLAT 1
#define GX_SP_COS 2
#define GX_SP_COS2 3
#define GX_SP_SHARP 4
#define GX_SP_RING1 5
#define GX_SP_RING2 6
/*! @} */
/*! \addtogroup texfilter Texture filter types
* @{
*/
#define GX_NEAR 0 /*!< Point sampling, no mipmap */
#define GX_LINEAR 1 /*!< Bilinear filtering, no mipmap */