2 #ifndef __NVC0_PGRAPH_MACROS_H__
3 #define __NVC0_PGRAPH_MACROS_H__
5 /* extrinsrt r1, r2, src, size, dst: replace bits [dst:dst+size) in r1
6 * with bits [src:src+size) in r2
8 * bra(n)z annul: no delay slot
11 /* The comments above the macros describe what they *should* be doing,
12 * but we use less functionality for now.
16 * for (i = 0; i < 8; ++i)
17 * [NVC0_3D_BLEND_ENABLE(i)] = BIT(i of arg);
21 * if (arg == 0 || [NVC0_3D_MULTISAMPLE_ENABLE] == 0)
26 static const uint32_t nvc0_9097_blend_enables
[] =
28 0x05360021, /* 0x00: maddr [NVC0_3D_BLEND_ENABLE(0), increment = 4] */
29 0x00404042, /* 0x01: send extrinsrt 0 $r1 0 0x1 0 */
30 0x00424042, /* 0x02: send extrinsrt 0 $r1 0x1 0x1 0 */
31 0x00444042, /* 0x03: send extrinsrt 0 $r1 0x2 0x1 0 */
32 0x00464042, /* 0x04: send extrinsrt 0 $r1 0x3 0x1 0 */
33 0x00484042, /* 0x05: send extrinsrt 0 $r1 0x4 0x1 0 */
34 0x004a4042, /* 0x06: send extrinsrt 0 $r1 0x5 0x1 0 */
35 0x004c40c2, /* 0x07: exit send extrinsrt 0 $r1 0x6 0x1 0 */
36 0x004e4042, /* 0x08: send extrinsrt 0 $r1 0x7 0x1 0 */
40 * uint64 limit = (parm(0) << 32) | parm(1);
41 * uint64 start = (parm(2) << 32);
50 * [0x1c04 + (arg & 0xf) * 16 + 0] = (start >> 32) & 0xff;
51 * [0x1c04 + (arg & 0xf) * 16 + 4] = start & 0xffffffff;
52 * [0x1f00 + (arg & 0xf) * 8 + 0] = (limit >> 32) & 0xff;
53 * [0x1f00 + (arg & 0xf) * 8 + 4] = limit & 0xffffffff;
55 static const uint32_t nvc0_9097_vertex_array_select
[] =
57 0x00000201, /* 0x00: parm $r2 */
58 0x00000301, /* 0x01: parm $r3 */
59 0x00000401, /* 0x02: parm $r4 */
60 0x00000501, /* 0x03: parm $r5 */
61 0x11004612, /* 0x04: mov $r6 extrinsrt 0 $r1 0 4 2 */
62 0x09004712, /* 0x05: mov $r7 extrinsrt 0 $r1 0 4 1 */
63 0x05c07621, /* 0x06: maddr $r6 add $6 0x1701 */
64 0x00002041, /* 0x07: send $r4 */
65 0x00002841, /* 0x08: send $r5 */
66 0x05f03f21, /* 0x09: maddr $r7 add $7 0x17c0 */
67 0x000010c1, /* 0x0a: exit send $r2 */
68 0x00001841, /* 0x0b: send $r3 */
71 static const uint32_t nvc0_9097_color_mask_brdc
[] =
73 0x05a00021, /* maddr [NVC0_3D_COLOR_MASK(0), increment = 4] */
74 0x00000841, /* send $r1 */
75 0x00000841, /* send $r1 */
76 0x00000841, /* send $r1 */
77 0x00000841, /* send $r1 */
78 0x00000841, /* send $r1 */
79 0x00000841, /* send $r1 */
80 0x000008c1, /* exit send $r1 */
81 0x00000841, /* send $r1 */
85 * [GL_POLYGON_MODE_FRONT] = arg;
87 * if (BIT(31 of [0x3410]))
90 * if ([NVC0_3D_SP_SELECT(3)] == 0x31 || [NVC0_3D_SP_SELECT(4)] == 0x41)
93 * if ([GL_POLYGON_MODE_BACK] == GL_LINE || arg == GL_LINE)
94 * [02ec] = BYTE(1 of [0x3410]) << 4;
96 * [02ec] = BYTE(0 of [0x3410]) << 4;
98 static const uint32_t nvc0_9097_poly_mode_front
[] =
100 0x00db0215, /* 0x00: read $r2 [NVC0_3D_POLYGON_MODE_BACK] */
101 0x020c0315, /* 0x01: read $r3 [NVC0_3D_SP_SELECT(3)] */
102 0x00128f10, /* 0x02: mov $r7 or $r1 $r2 */
103 0x02100415, /* 0x03: read $r4 [NVC0_3D_SP_SELECT(4)] */
104 0x00004211, /* 0x04: mov $r2 0x1 */
105 0x00180611, /* 0x05: mov $r6 0x60 */
106 0x0014bf10, /* 0x06: mov $r7 and $r7 $r2 */
107 0x0000f807, /* 0x07: braz $r7 0xa */
108 0x00dac021, /* 0x08: maddr 0x36b */
109 0x00800611, /* 0x09: mov $r6 0x200 */
110 0x00131f10, /* 0x0a: mov $r7 or $r3 $r4 */
111 0x0014bf10, /* 0x0b: mov $r7 and $r7 $r2 */
112 0x0000f807, /* 0x0c: braz $r7 0xf */
113 0x00000841, /* 0x0d: send $r1 */
114 0x00000611, /* 0x0e: mov $r6 0 */
115 0x002ec0a1, /* 0x0f: exit maddr [02ec] */
116 0x00003041 /* 0x10: send $r6 */
120 * [GL_POLYGON_MODE_BACK] = arg;
122 * if (BIT(31 of [0x3410]))
125 * if ([NVC0_3D_SP_SELECT(3)] == 0x31 || [NVC0_3D_SP_SELECT(4)] == 0x41)
128 * if ([GL_POLYGON_MODE_FRONT] == GL_LINE || arg == GL_LINE)
129 * [02ec] = BYTE(1 of [0x3410]) << 4;
131 * [02ec] = BYTE(0 of [0x3410]) << 4;
133 /* NOTE: 0x3410 = 0x80002006 by default,
134 * POLYGON_MODE == GL_LINE check replaced by (MODE & 1)
135 * SP_SELECT(i) == (i << 4) | 1 check replaced by SP_SELECT(i) & 1
137 static const uint32_t nvc0_9097_poly_mode_back
[] =
139 0x00dac215, /* 0x00: read $r2 [NVC0_3D_POLYGON_MODE_FRONT] */
140 0x020c0315, /* 0x01: read $r3 [NVC0_3D_SP_SELECT(3)] */
141 0x00128f10, /* 0x02: mov $r7 or $r1 $r2 */
142 0x02100415, /* 0x03: read $r4 [NVC0_3D_SP_SELECT(4)] */
143 0x00004211, /* 0x04: mov $r2 0x1 */
144 0x00180611, /* 0x05: mov $r6 0x60 */
145 0x0014bf10, /* 0x06: mov $r7 and $r7 $r2 */
146 0x0000f807, /* 0x07: braz $r7 0xa */
147 0x00dac021, /* 0x08: maddr 0x36b */
148 0x00800611, /* 0x09: mov $r6 0x200 */
149 0x00131f10, /* 0x0a: mov $r7 or $r3 $r4 */
150 0x0014bf10, /* 0x0b: mov $r7 and $r7 $r2 */
151 0x0000f807, /* 0x0c: braz $r7 0xf */
152 0x00000841, /* 0x0d: send $r1 */
153 0x00000611, /* 0x0e: mov $r6 0 */
154 0x002ec0a1, /* 0x0f: exit maddr [02ec] */
155 0x00003041 /* 0x10: send $r6 */
159 * [NVC0_3D_SP_SELECT(4)] = arg
161 * if BIT(31 of [0x3410]) == 0
164 * if ([NVC0_3D_SP_SELECT(3)] == 0x31 || arg == 0x41)
167 * if (any POLYGON MODE == LINE)
168 * [02ec] = BYTE(1 of [3410]) << 4;
170 * [02ec] = BYTE(0 of [3410]) << 4; // 02ec valid bits are 0xff1
172 static const uint32_t nvc0_9097_gp_select
[] = /* 0x0f */
174 0x00dac215, /* 0x00: read $r2 0x36b */
175 0x00db0315, /* 0x01: read $r3 0x36c */
176 0x0012d710, /* 0x02: mov $r7 or $r2 $r3 */
177 0x020c0415, /* 0x03: read $r4 0x830 */
178 0x00004211, /* 0x04: mov $r2 0x1 */
179 0x00180611, /* 0x05: mov $r6 0x60 */
180 0x0014bf10, /* 0x06: mov $r7 and $r7 $r2 */
181 0x0000f807, /* 0x07: braz $r7 0xa */
182 0x02100021, /* 0x08: maddr 0x840 */
183 0x00800611, /* 0x09: mov $r6 0x200 */
184 0x00130f10, /* 0x0a: mov $r7 or $r1 $r4 */
185 0x0014bf10, /* 0x0b: mov $r7 and $r7 $r2 */
186 0x0000f807, /* 0x0c: braz $r7 0xf */
187 0x00000841, /* 0x0d: send $r1 */
188 0x00000611, /* 0x0e: mov $r6 0 */
189 0x002ec0a1, /* 0x0f: exit maddr 0xbb */
190 0x00003041, /* 0x10: send $r6 */
194 * [NVC0_3D_SP_SELECT(3)] = arg
196 * if BIT(31 of [0x3410]) == 0
200 * if (BIT(2 of [0x3430])) {
201 * int i = 15; do { --i; } while(i);
206 * if ([NVC0_3D_SP_SELECT(4)] == 0x41 || arg == 0x31)
209 * if ([any POLYGON_MODE] == GL_LINE)
210 * [02ec] = BYTE(1 of [3410]) << 4;
212 * [02ec] = BYTE(0 of [3410]) << 4;
214 static const uint32_t nvc0_9097_tep_select
[] = /* 0x10 */
216 0x00dac215, /* 0x00: read $r2 0x36b */
217 0x00db0315, /* 0x01: read $r3 0x36c */
218 0x0012d710, /* 0x02: mov $r7 or $r2 $r3 */
219 0x02100415, /* 0x03: read $r4 0x840 */
220 0x00004211, /* 0x04: mov $r2 0x1 */
221 0x00180611, /* 0x05: mov $r6 0x60 */
222 0x0014bf10, /* 0x06: mov $r7 and $r7 $r2 */
223 0x0000f807, /* 0x07: braz $r7 0xa */
224 0x020c0021, /* 0x08: maddr 0x830 */
225 0x00800611, /* 0x09: mov $r6 0x200 */
226 0x00130f10, /* 0x0a: mov $r7 or $r1 $r4 */
227 0x0014bf10, /* 0x0b: mov $r7 and $r7 $r2 */
228 0x0000f807, /* 0x0c: braz $r7 0xf */
229 0x00000841, /* 0x0d: send $r1 */
230 0x00000611, /* 0x0e: mov $r6 0 */
231 0x002ec0a1, /* 0x0f: exit maddr 0xbb */
232 0x00003041, /* 0x10: send $r6 */