Debian Codegraph @

src/uxa/i915_3d.h

raw symbols SCIP
1 /* -*- c-basic-offset: 4 -*- */cxx . . $ `<file>/src/uxa/i915_3d.h`/
2 /*
3 * Copyright © 2006,2010 Intel Corporation
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 * Authors:
25 * Eric Anholt <[email protected]>
26 * Chris Wilson <[email protected]>
27 *
28 */
29
30 /* Each instruction is 3 dwords long, though most don't require all
31 * this space. Maximum of 123 instructions. Smaller maxes per insn
32 * type.
33 */
34 #define _3DSTATE_PIXEL_SHADER_PROGRAMcxx . . $ `src/uxa/i915_3d.h:34:9`! (CMD_3Dcxx . . $ `src/uxa/i915_reg.h:33:9`!|(0x1d<<24)|(0x5<<16))
35
36 #define REG_TYPE_Rcxx . . $ `src/uxa/i915_3d.h:36:9`! 0 /* temporary regs, no need to
37 * dcl, must be written before
38 * read -- Preserved between
39 * phases.
40 */
41 #define REG_TYPE_Tcxx . . $ `src/uxa/i915_3d.h:41:9`! 1 /* Interpolated values, must be
42 * dcl'ed before use.
43 *
44 * 0..7: texture coord,
45 * 8: diffuse spec,
46 * 9: specular color,
47 * 10: fog parameter in w.
48 */
49 #define REG_TYPE_CONSTcxx . . $ `src/uxa/i915_3d.h:49:9`! 2 /* Restriction: only one const
50 * can be referenced per
51 * instruction, though it may be
52 * selected for multiple inputs.
53 * Constants not initialized
54 * default to zero.
55 */
56 #define REG_TYPE_Scxx . . $ `src/uxa/i915_3d.h:56:9`! 3 /* sampler */
57 #define REG_TYPE_OCcxx . . $ `src/uxa/i915_3d.h:57:9`! 4 /* output color (rgba) */
58 #define REG_TYPE_ODcxx . . $ `src/uxa/i915_3d.h:58:9`! 5 /* output depth (w), xyz are
59 * temporaries. If not written,
60 * interpolated depth is used?
61 */
62 #define REG_TYPE_Ucxx . . $ `src/uxa/i915_3d.h:62:9`! 6 /* unpreserved temporaries */
63 #define REG_TYPE_MASKcxx . . $ `src/uxa/i915_3d.h:63:9`! 0x7
64 #define REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`! 4
65 #define REG_NR_MASKcxx . . $ `src/uxa/i915_3d.h:65:9`! 0xf
66
67 /* REG_TYPE_T:
68 */
69 #define T_TEX0cxx . . $ `src/uxa/i915_3d.h:69:9`! 0
70 #define T_TEX1cxx . . $ `src/uxa/i915_3d.h:70:9`! 1
71 #define T_TEX2cxx . . $ `src/uxa/i915_3d.h:71:9`! 2
72 #define T_TEX3cxx . . $ `src/uxa/i915_3d.h:72:9`! 3
73 #define T_TEX4cxx . . $ `src/uxa/i915_3d.h:73:9`! 4
74 #define T_TEX5cxx . . $ `src/uxa/i915_3d.h:74:9`! 5
75 #define T_TEX6cxx . . $ `src/uxa/i915_3d.h:75:9`! 6
76 #define T_TEX7cxx . . $ `src/uxa/i915_3d.h:76:9`! 7
77 #define T_DIFFUSEcxx . . $ `src/uxa/i915_3d.h:77:9`! 8
78 #define T_SPECULARcxx . . $ `src/uxa/i915_3d.h:78:9`! 9
79 #define T_FOG_Wcxx . . $ `src/uxa/i915_3d.h:79:9`! 10 /* interpolated fog is in W coord */
80
81 /* Arithmetic instructions */
82
83 /* .replicate_swizzle == selection and replication of a particular
84 * scalar channel, ie., .xxxx, .yyyy, .zzzz or .wwww
85 */
86 #define A0_NOPcxx . . $ `src/uxa/i915_3d.h:86:9`! (0x0<<24) /* no operation */
87 #define A0_ADDcxx . . $ `src/uxa/i915_3d.h:87:9`! (0x1<<24) /* dst = src0 + src1 */
88 #define A0_MOVcxx . . $ `src/uxa/i915_3d.h:88:9`! (0x2<<24) /* dst = src0 */
89 #define A0_MULcxx . . $ `src/uxa/i915_3d.h:89:9`! (0x3<<24) /* dst = src0 * src1 */
90 #define A0_MADcxx . . $ `src/uxa/i915_3d.h:90:9`! (0x4<<24) /* dst = src0 * src1 + src2 */
91 #define A0_DP2ADDcxx . . $ `src/uxa/i915_3d.h:91:9`! (0x5<<24) /* dst.xyzw = src0.xy dot src1.xy + src2.replicate_swizzle */
92 #define A0_DP3cxx . . $ `src/uxa/i915_3d.h:92:9`! (0x6<<24) /* dst.xyzw = src0.xyz dot src1.xyz */
93 #define A0_DP4cxx . . $ `src/uxa/i915_3d.h:93:9`! (0x7<<24) /* dst.xyzw = src0.xyzw dot src1.xyzw */
94 #define A0_FRCcxx . . $ `src/uxa/i915_3d.h:94:9`! (0x8<<24) /* dst = src0 - floor(src0) */
95 #define A0_RCPcxx . . $ `src/uxa/i915_3d.h:95:9`! (0x9<<24) /* dst.xyzw = 1/(src0.replicate_swizzle) */
96 #define A0_RSQcxx . . $ `src/uxa/i915_3d.h:96:9`! (0xa<<24) /* dst.xyzw = 1/(sqrt(abs(src0.replicate_swizzle))) */
97 #define A0_EXPcxx . . $ `src/uxa/i915_3d.h:97:9`! (0xb<<24) /* dst.xyzw = exp2(src0.replicate_swizzle) */
98 #define A0_LOGcxx . . $ `src/uxa/i915_3d.h:98:9`! (0xc<<24) /* dst.xyzw = log2(abs(src0.replicate_swizzle)) */
99 #define A0_CMPcxx . . $ `src/uxa/i915_3d.h:99:9`! (0xd<<24) /* dst = (src0 >= 0.0) ? src1 : src2 */
100 #define A0_MINcxx . . $ `src/uxa/i915_3d.h:100:9`! (0xe<<24) /* dst = (src0 < src1) ? src0 : src1 */
101 #define A0_MAXcxx . . $ `src/uxa/i915_3d.h:101:9`! (0xf<<24) /* dst = (src0 >= src1) ? src0 : src1 */
102 #define A0_FLRcxx . . $ `src/uxa/i915_3d.h:102:9`! (0x10<<24) /* dst = floor(src0) */
103 #define A0_MODcxx . . $ `src/uxa/i915_3d.h:103:9`! (0x11<<24) /* dst = src0 fmod 1.0 */
104 #define A0_TRCcxx . . $ `src/uxa/i915_3d.h:104:9`! (0x12<<24) /* dst = int(src0) */
105 #define A0_SGEcxx . . $ `src/uxa/i915_3d.h:105:9`! (0x13<<24) /* dst = src0 >= src1 ? 1.0 : 0.0 */
106 #define A0_SLTcxx . . $ `src/uxa/i915_3d.h:106:9`! (0x14<<24) /* dst = src0 < src1 ? 1.0 : 0.0 */
107 #define A0_DEST_SATURATEcxx . . $ `src/uxa/i915_3d.h:107:9`! (1<<22)
108 #define A0_DEST_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:108:9`! 19
109 /* Allow: R, OC, OD, U */
110 #define A0_DEST_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:110:9`! 14
111 /* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
112 #define A0_DEST_CHANNEL_Xcxx . . $ `src/uxa/i915_3d.h:112:9`! (1<<10)
113 #define A0_DEST_CHANNEL_Ycxx . . $ `src/uxa/i915_3d.h:113:9`! (2<<10)
114 #define A0_DEST_CHANNEL_Zcxx . . $ `src/uxa/i915_3d.h:114:9`! (4<<10)
115 #define A0_DEST_CHANNEL_Wcxx . . $ `src/uxa/i915_3d.h:115:9`! (8<<10)
116 #define A0_DEST_CHANNEL_ALLcxx . . $ `src/uxa/i915_3d.h:116:9`! (0xf<<10)
117 #define A0_DEST_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:117:9`! 10
118 #define A0_SRC0_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:118:9`! 7
119 #define A0_SRC0_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:119:9`! 2
120
121 #define A0_DEST_CHANNEL_XYcxx . . $ `src/uxa/i915_3d.h:121:9`! (A0_DEST_CHANNEL_X|A0_DEST_CHANNEL_Y)
122 #define A0_DEST_CHANNEL_XYZcxx . . $ `src/uxa/i915_3d.h:122:9`! (A0_DEST_CHANNEL_XY|A0_DEST_CHANNEL_Z)
123
124 #define SRC_Xcxx . . $ `src/uxa/i915_3d.h:124:9`! 0
125 #define SRC_Ycxx . . $ `src/uxa/i915_3d.h:125:9`! 1
126 #define SRC_Zcxx . . $ `src/uxa/i915_3d.h:126:9`! 2
127 #define SRC_Wcxx . . $ `src/uxa/i915_3d.h:127:9`! 3
128 #define SRC_ZEROcxx . . $ `src/uxa/i915_3d.h:128:9`! 4
129 #define SRC_ONEcxx . . $ `src/uxa/i915_3d.h:129:9`! 5
130
131 #define A1_SRC0_CHANNEL_X_NEGATEcxx . . $ `src/uxa/i915_3d.h:131:9`! (1<<31)
132 #define A1_SRC0_CHANNEL_X_SHIFTcxx . . $ `src/uxa/i915_3d.h:132:9`! 28
133 #define A1_SRC0_CHANNEL_Y_NEGATEcxx . . $ `src/uxa/i915_3d.h:133:9`! (1<<27)
134 #define A1_SRC0_CHANNEL_Y_SHIFTcxx . . $ `src/uxa/i915_3d.h:134:9`! 24
135 #define A1_SRC0_CHANNEL_Z_NEGATEcxx . . $ `src/uxa/i915_3d.h:135:9`! (1<<23)
136 #define A1_SRC0_CHANNEL_Z_SHIFTcxx . . $ `src/uxa/i915_3d.h:136:9`! 20
137 #define A1_SRC0_CHANNEL_W_NEGATEcxx . . $ `src/uxa/i915_3d.h:137:9`! (1<<19)
138 #define A1_SRC0_CHANNEL_W_SHIFTcxx . . $ `src/uxa/i915_3d.h:138:9`! 16
139 #define A1_SRC1_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:139:9`! 13
140 #define A1_SRC1_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:140:9`! 8
141 #define A1_SRC1_CHANNEL_X_NEGATEcxx . . $ `src/uxa/i915_3d.h:141:9`! (1<<7)
142 #define A1_SRC1_CHANNEL_X_SHIFTcxx . . $ `src/uxa/i915_3d.h:142:9`! 4
143 #define A1_SRC1_CHANNEL_Y_NEGATEcxx . . $ `src/uxa/i915_3d.h:143:9`! (1<<3)
144 #define A1_SRC1_CHANNEL_Y_SHIFTcxx . . $ `src/uxa/i915_3d.h:144:9`! 0
145
146 #define A2_SRC1_CHANNEL_Z_NEGATEcxx . . $ `src/uxa/i915_3d.h:146:9`! (1<<31)
147 #define A2_SRC1_CHANNEL_Z_SHIFTcxx . . $ `src/uxa/i915_3d.h:147:9`! 28
148 #define A2_SRC1_CHANNEL_W_NEGATEcxx . . $ `src/uxa/i915_3d.h:148:9`! (1<<27)
149 #define A2_SRC1_CHANNEL_W_SHIFTcxx . . $ `src/uxa/i915_3d.h:149:9`! 24
150 #define A2_SRC2_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:150:9`! 21
151 #define A2_SRC2_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:151:9`! 16
152 #define A2_SRC2_CHANNEL_X_NEGATEcxx . . $ `src/uxa/i915_3d.h:152:9`! (1<<15)
153 #define A2_SRC2_CHANNEL_X_SHIFTcxx . . $ `src/uxa/i915_3d.h:153:9`! 12
154 #define A2_SRC2_CHANNEL_Y_NEGATEcxx . . $ `src/uxa/i915_3d.h:154:9`! (1<<11)
155 #define A2_SRC2_CHANNEL_Y_SHIFTcxx . . $ `src/uxa/i915_3d.h:155:9`! 8
156 #define A2_SRC2_CHANNEL_Z_NEGATEcxx . . $ `src/uxa/i915_3d.h:156:9`! (1<<7)
157 #define A2_SRC2_CHANNEL_Z_SHIFTcxx . . $ `src/uxa/i915_3d.h:157:9`! 4
158 #define A2_SRC2_CHANNEL_W_NEGATEcxx . . $ `src/uxa/i915_3d.h:158:9`! (1<<3)
159 #define A2_SRC2_CHANNEL_W_SHIFTcxx . . $ `src/uxa/i915_3d.h:159:9`! 0
160
161 /* Texture instructions */
162 #define T0_TEXLDcxx . . $ `src/uxa/i915_3d.h:162:9`! (0x15<<24) /* Sample texture using predeclared
163 * sampler and address, and output
164 * filtered texel data to destination
165 * register */
166 #define T0_TEXLDPcxx . . $ `src/uxa/i915_3d.h:166:9`! (0x16<<24) /* Same as texld but performs a
167 * perspective divide of the texture
168 * coordinate .xyz values by .w before
169 * sampling. */
170 #define T0_TEXLDBcxx . . $ `src/uxa/i915_3d.h:170:9`! (0x17<<24) /* Same as texld but biases the
171 * computed LOD by w. Only S4.6 two's
172 * comp is used. This implies that a
173 * float to fixed conversion is
174 * done. */
175 #define T0_TEXKILLcxx . . $ `src/uxa/i915_3d.h:175:9`! (0x18<<24) /* Does not perform a sampling
176 * operation. Simply kills the pixel
177 * if any channel of the address
178 * register is < 0.0. */
179 #define T0_DEST_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:179:9`! 19
180 /* Allow: R, OC, OD, U */
181 /* Note: U (unpreserved) regs do not retain their values between
182 * phases (cannot be used for feedback)
183 *
184 * Note: oC and OD registers can only be used as the destination of a
185 * texture instruction once per phase (this is an implementation
186 * restriction).
187 */
188 #define T0_DEST_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:188:9`! 14
189 /* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
190 #define T0_SAMPLER_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:190:9`! 0 /* This field ignored for TEXKILL */
191 #define T0_SAMPLER_NR_MASKcxx . . $ `src/uxa/i915_3d.h:191:9`! (0xf<<0)
192
193 #define T1_ADDRESS_REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:193:9`! 24 /* Reg to use as texture coord */
194 /* Allow R, T, OC, OD -- R, OC, OD are 'dependent' reads, new program phase */
195 #define T1_ADDRESS_REG_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:195:9`! 17
196 #define T2_MBZcxx . . $ `src/uxa/i915_3d.h:196:9`! 0
197
198 /* Declaration instructions */
199 #define D0_DCLcxx . . $ `src/uxa/i915_3d.h:199:9`! (0x19<<24) /* Declare a t (interpolated attrib)
200 * register or an s (sampler)
201 * register. */
202 #define D0_SAMPLE_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:202:9`! 22
203 #define D0_SAMPLE_TYPE_2Dcxx . . $ `src/uxa/i915_3d.h:203:9`! (0x0<<22)
204 #define D0_SAMPLE_TYPE_CUBEcxx . . $ `src/uxa/i915_3d.h:204:9`! (0x1<<22)
205 #define D0_SAMPLE_TYPE_VOLUMEcxx . . $ `src/uxa/i915_3d.h:205:9`! (0x2<<22)
206 #define D0_SAMPLE_TYPE_MASKcxx . . $ `src/uxa/i915_3d.h:206:9`! (0x3<<22)
207
208 #define D0_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:208:9`! 19
209 /* Allow: T, S */
210 #define D0_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:210:9`! 14
211 /* Allow T: 0..10, S: 0..15 */
212 #define D0_CHANNEL_Xcxx . . $ `src/uxa/i915_3d.h:212:9`! (1<<10)
213 #define D0_CHANNEL_Ycxx . . $ `src/uxa/i915_3d.h:213:9`! (2<<10)
214 #define D0_CHANNEL_Zcxx . . $ `src/uxa/i915_3d.h:214:9`! (4<<10)
215 #define D0_CHANNEL_Wcxx . . $ `src/uxa/i915_3d.h:215:9`! (8<<10)
216 #define D0_CHANNEL_ALLcxx . . $ `src/uxa/i915_3d.h:216:9`! (0xf<<10)
217 #define D0_CHANNEL_NONEcxx . . $ `src/uxa/i915_3d.h:217:9`! (0<<10)
218
219 #define D0_CHANNEL_XYcxx . . $ `src/uxa/i915_3d.h:219:9`! (D0_CHANNEL_X|D0_CHANNEL_Y)
220 #define D0_CHANNEL_XYZcxx . . $ `src/uxa/i915_3d.h:220:9`! (D0_CHANNEL_XY|D0_CHANNEL_Z)
221
222 /* I915 Errata: Do not allow (xz), (xw), (xzw) combinations for diffuse
223 * or specular declarations.
224 *
225 * For T dcls, only allow: (x), (xy), (xyz), (w), (xyzw)
226 *
227 * Must be zero for S (sampler) dcls
228 */
229 #define D1_MBZcxx . . $ `src/uxa/i915_3d.h:229:9`! 0
230 #define D2_MBZcxx . . $ `src/uxa/i915_3d.h:230:9`! 0
231
232
233 /* MASK_* are the unshifted bitmasks of the destination mask in arithmetic
234 * operations
235 */
236 #define MASK_Xcxx . . $ `src/uxa/i915_3d.h:236:9`! 0x1
237 #define MASK_Ycxx . . $ `src/uxa/i915_3d.h:237:9`! 0x2
238 #define MASK_Zcxx . . $ `src/uxa/i915_3d.h:238:9`! 0x4
239 #define MASK_Wcxx . . $ `src/uxa/i915_3d.h:239:9`! 0x8
240 #define MASK_XYZcxx . . $ `src/uxa/i915_3d.h:240:9`! (MASK_X | MASK_Y | MASK_Z)
241 #define MASK_XYZWcxx . . $ `src/uxa/i915_3d.h:241:9`! (MASK_XYZ | MASK_W)
242 #define MASK_SATURATEcxx . . $ `src/uxa/i915_3d.h:242:9`! 0x10
243
244 /* Temporary, undeclared regs. Preserved between phases */
245 #define FS_R0cxx . . $ `src/uxa/i915_3d.h:245:9`! ((REG_TYPE_Rcxx . . $ `src/uxa/i915_3d.h:36:9`! << REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`!) | 0)
246 #define FS_R1cxx . . $ `src/uxa/i915_3d.h:246:9`! ((REG_TYPE_Rcxx . . $ `src/uxa/i915_3d.h:36:9`! << REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`!) | 1)
247 #define FS_R2cxx . . $ `src/uxa/i915_3d.h:247:9`! ((REG_TYPE_R << REG_TYPE_SHIFT) | 2)
248 #define FS_R3cxx . . $ `src/uxa/i915_3d.h:248:9`! ((REG_TYPE_R << REG_TYPE_SHIFT) | 3)
249
250 /* Texture coordinate regs. Must be declared. */
251 #define FS_T0cxx . . $ `src/uxa/i915_3d.h:251:9`! ((REG_TYPE_Tcxx . . $ `src/uxa/i915_3d.h:41:9`! << REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`!) | 0)
252 #define FS_T1cxx . . $ `src/uxa/i915_3d.h:252:9`! ((REG_TYPE_Tcxx . . $ `src/uxa/i915_3d.h:41:9`! << REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`!) | 1)
253 #define FS_T2cxx . . $ `src/uxa/i915_3d.h:253:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 2)
254 #define FS_T3cxx . . $ `src/uxa/i915_3d.h:254:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 3)
255 #define FS_T4cxx . . $ `src/uxa/i915_3d.h:255:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 4)
256 #define FS_T5cxx . . $ `src/uxa/i915_3d.h:256:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 5)
257 #define FS_T6cxx . . $ `src/uxa/i915_3d.h:257:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 6)
258 #define FS_T7cxx . . $ `src/uxa/i915_3d.h:258:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 7)
259 #define FS_T8cxx . . $ `src/uxa/i915_3d.h:259:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 8)
260 #define FS_T9cxx . . $ `src/uxa/i915_3d.h:260:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 9)
261 #define FS_T10cxx . . $ `src/uxa/i915_3d.h:261:9`! ((REG_TYPE_T << REG_TYPE_SHIFT) | 10)
262
263 /* Constant values */
264 #define FS_C0cxx . . $ `src/uxa/i915_3d.h:264:9`! ((REG_TYPE_CONST << REG_TYPE_SHIFT) | 0)
265 #define FS_C1cxx . . $ `src/uxa/i915_3d.h:265:9`! ((REG_TYPE_CONST << REG_TYPE_SHIFT) | 1)
266 #define FS_C2cxx . . $ `src/uxa/i915_3d.h:266:9`! ((REG_TYPE_CONST << REG_TYPE_SHIFT) | 2)
267 #define FS_C3cxx . . $ `src/uxa/i915_3d.h:267:9`! ((REG_TYPE_CONST << REG_TYPE_SHIFT) | 3)
268 #define FS_C4cxx . . $ `src/uxa/i915_3d.h:268:9`! ((REG_TYPE_CONST << REG_TYPE_SHIFT) | 4)
269 #define FS_C5cxx . . $ `src/uxa/i915_3d.h:269:9`! ((REG_TYPE_CONST << REG_TYPE_SHIFT) | 5)
270 #define FS_C6cxx . . $ `src/uxa/i915_3d.h:270:9`! ((REG_TYPE_CONST << REG_TYPE_SHIFT) | 6)
271 #define FS_C7cxx . . $ `src/uxa/i915_3d.h:271:9`! ((REG_TYPE_CONST << REG_TYPE_SHIFT) | 7)
272
273 /* Sampler regs */
274 #define FS_S0cxx . . $ `src/uxa/i915_3d.h:274:9`! ((REG_TYPE_Scxx . . $ `src/uxa/i915_3d.h:56:9`! << REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`!) | 0)
275 #define FS_S1cxx . . $ `src/uxa/i915_3d.h:275:9`! ((REG_TYPE_Scxx . . $ `src/uxa/i915_3d.h:56:9`! << REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`!) | 1)
276 #define FS_S2cxx . . $ `src/uxa/i915_3d.h:276:9`! ((REG_TYPE_S << REG_TYPE_SHIFT) | 2)
277 #define FS_S3cxx . . $ `src/uxa/i915_3d.h:277:9`! ((REG_TYPE_S << REG_TYPE_SHIFT) | 3)
278
279 /* Output color */
280 #define FS_OCcxx . . $ `src/uxa/i915_3d.h:280:9`! ((REG_TYPE_OCcxx . . $ `src/uxa/i915_3d.h:57:9`! << REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`!) | 0)
281
282 /* Output depth */
283 #define FS_ODcxx . . $ `src/uxa/i915_3d.h:283:9`! ((REG_TYPE_OD << REG_TYPE_SHIFT) | 0)
284
285 /* Unpreserved temporary regs */
286 #define FS_U0cxx . . $ `src/uxa/i915_3d.h:286:9`! ((REG_TYPE_U << REG_TYPE_SHIFT) | 0)
287 #define FS_U1cxx . . $ `src/uxa/i915_3d.h:287:9`! ((REG_TYPE_U << REG_TYPE_SHIFT) | 1)
288 #define FS_U2cxx . . $ `src/uxa/i915_3d.h:288:9`! ((REG_TYPE_U << REG_TYPE_SHIFT) | 2)
289 #define FS_U3cxx . . $ `src/uxa/i915_3d.h:289:9`! ((REG_TYPE_U << REG_TYPE_SHIFT) | 3)
290
291 #define X_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:291:9`! (REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`! + 3)
292 #define Y_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:292:9`! (X_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:291:9`! + 4)
293 #define Z_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:293:9`! (Y_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:292:9`! + 4)
294 #define W_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:294:9`! (Z_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:293:9`! + 4)
295
296 #define REG_CHANNEL_MASKcxx . . $ `src/uxa/i915_3d.h:296:9`! 0xf
297
298 #define REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(reg) ((reg) & REG_NR_MASKcxx . . $ `src/uxa/i915_3d.h:65:9`!)
299 #define REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(reg) (((reg) >> REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:64:9`!) & REG_TYPE_MASKcxx . . $ `src/uxa/i915_3d.h:63:9`!)
300 #define REG_Xcxx . . $ `src/uxa/i915_3d.h:300:9`!(reg) (((reg) >> X_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:291:9`!) & REG_CHANNEL_MASKcxx . . $ `src/uxa/i915_3d.h:296:9`!)
301 #define REG_Ycxx . . $ `src/uxa/i915_3d.h:301:9`!(reg) (((reg) >> Y_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:292:9`!) & REG_CHANNEL_MASKcxx . . $ `src/uxa/i915_3d.h:296:9`!)
302 #define REG_Zcxx . . $ `src/uxa/i915_3d.h:302:9`!(reg) (((reg) >> Z_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:293:9`!) & REG_CHANNEL_MASKcxx . . $ `src/uxa/i915_3d.h:296:9`!)
303 #define REG_Wcxx . . $ `src/uxa/i915_3d.h:303:9`!(reg) (((reg) >> W_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:294:9`!) & REG_CHANNEL_MASKcxx . . $ `src/uxa/i915_3d.h:296:9`!)
304
305 enum i915_fs_channelcxx . . $ i915_fs_channel# {
306 X_CHANNEL_VALcxx . . $ X_CHANNEL_VAL. = 0,
307 Y_CHANNEL_VALcxx . . $ Y_CHANNEL_VAL.,
308 Z_CHANNEL_VALcxx . . $ Z_CHANNEL_VAL.,
309 W_CHANNEL_VALcxx . . $ W_CHANNEL_VAL.,
310 ZERO_CHANNEL_VALcxx . . $ ZERO_CHANNEL_VAL.,
311 ONE_CHANNEL_VALcxx . . $ ONE_CHANNEL_VAL.,
312
313 NEG_X_CHANNEL_VALcxx . . $ NEG_X_CHANNEL_VAL. = X_CHANNEL_VALcxx . . $ X_CHANNEL_VAL. | 0x8,
314 NEG_Y_CHANNEL_VALcxx . . $ NEG_Y_CHANNEL_VAL. = Y_CHANNEL_VALcxx . . $ Y_CHANNEL_VAL. | 0x8,
315 NEG_Z_CHANNEL_VALcxx . . $ NEG_Z_CHANNEL_VAL. = Z_CHANNEL_VALcxx . . $ Z_CHANNEL_VAL. | 0x8,
316 NEG_W_CHANNEL_VALcxx . . $ NEG_W_CHANNEL_VAL. = W_CHANNEL_VALcxx . . $ W_CHANNEL_VAL. | 0x8,
317 NEG_ONE_CHANNEL_VALcxx . . $ NEG_ONE_CHANNEL_VAL. = ONE_CHANNEL_VALcxx . . $ ONE_CHANNEL_VAL. | 0x8
318 };
319
320 #define i915_fs_operandcxx . . $ `src/uxa/i915_3d.h:320:9`!(reg, x, y, z, w) \
321 (reg) | \
322 (x##_CHANNEL_VAL << X_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:291:9`!) | \
323 (y##_CHANNEL_VAL << Y_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:292:9`!) | \
324 (z##_CHANNEL_VAL << Z_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:293:9`!) | \
325 (w##_CHANNEL_VAL << W_CHANNEL_SHIFTcxx . . $ `src/uxa/i915_3d.h:294:9`!)
326
327 /**
328 * Construct an operand description for using a register with no swizzling
329 */
330 #define i915_fs_operand_regcxx . . $ `src/uxa/i915_3d.h:330:9`!(reg) \
331 i915_fs_operandcxx . . $ `src/uxa/i915_3d.h:320:9`!(reg, X, Y, Z, W)
332
333 #define i915_fs_operand_reg_negatecxx . . $ `src/uxa/i915_3d.h:333:9`!(reg) \
334 i915_fs_operand(reg, NEG_X, NEG_Y, NEG_Z, NEG_W)
335
336 /**
337 * Returns an operand containing (0.0, 0.0, 0.0, 0.0).
338 */
339 #define i915_fs_operand_zerocxx . . $ `src/uxa/i915_3d.h:339:9`!() i915_fs_operandcxx . . $ `src/uxa/i915_3d.h:320:9`!(FS_R0cxx . . $ `src/uxa/i915_3d.h:245:9`!, ZERO, ZERO, ZERO, ZERO)
340
341 /**
342 * Returns an unused operand
343 */
344 #define i915_fs_operand_nonecxx . . $ `src/uxa/i915_3d.h:344:9`!() i915_fs_operand_zerocxx . . $ `src/uxa/i915_3d.h:339:9`!()
345
346 /**
347 * Returns an operand containing (1.0, 1.0, 1.0, 1.0).
348 */
349 #define i915_fs_operand_onecxx . . $ `src/uxa/i915_3d.h:349:9`!() i915_fs_operand(FS_R0, ONE, ONE, ONE, ONE)
350
351 #define i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(val, shift, negate) \
352 (((val & 0x7) << shift) | ((val & 0x8) ? negate : 0))
353
354 /**
355 * Outputs a fragment shader command to declare a sampler or texture register.
356 */
357 #define i915_fs_dclcxx . . $ `src/uxa/i915_3d.h:357:9`!(reg) \
358 do { \
359 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(D0_DCLcxx . . $ `src/uxa/i915_3d.h:199:9`! | \
360 (REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(reg) << D0_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:208:9`!) | \
361 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(reg) << D0_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:210:9`!) | \
362 ((REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(reg) != REG_TYPE_Scxx . . $ `src/uxa/i915_3d.h:56:9`!) ? D0_CHANNEL_ALLcxx . . $ `src/uxa/i915_3d.h:216:9`! : 0)); \
363 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(0); \
364 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(0); \
365 } while (0)
366
367 #define i915_fs_texldcxx . . $ `src/uxa/i915_3d.h:367:9`!(dest_reg, sampler_reg, address_reg) \
368 do { \
369 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(T0_TEXLDcxx . . $ `src/uxa/i915_3d.h:162:9`! | \
370 (REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(dest_reg) << T0_DEST_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:179:9`!) | \
371 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(dest_reg) << T0_DEST_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:188:9`!) | \
372 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(sampler_reg) << T0_SAMPLER_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:190:9`!)); \
373 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!((REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(address_reg) << T1_ADDRESS_REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:193:9`!) | \
374 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(address_reg) << T1_ADDRESS_REG_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:195:9`!)); \
375 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(0); \
376 } while (0)
377
378 #define i915_fs_texldpcxx . . $ `src/uxa/i915_3d.h:378:9`!(dest_reg, sampler_reg, address_reg) \
379 do { \
380 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(T0_TEXLDPcxx . . $ `src/uxa/i915_3d.h:166:9`! | \
381 (REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(dest_reg) << T0_DEST_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:179:9`!) | \
382 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(dest_reg) << T0_DEST_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:188:9`!) | \
383 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(sampler_reg) << T0_SAMPLER_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:190:9`!)); \
384 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!((REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(address_reg) << T1_ADDRESS_REG_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:193:9`!) | \
385 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(address_reg) << T1_ADDRESS_REG_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:195:9`!)); \
386 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(0); \
387 } while (0)
388
389 #define i915_fs_arith_maskedcxx . . $ `src/uxa/i915_3d.h:389:9`!(op, dest_reg, dest_mask, operand0, operand1, operand2) \
390 _i915_fs_arith_masked(A0_##op, dest_reg, dest_mask, operand0, operand1, operand2)
391
392 #define i915_fs_arithcxx . . $ `src/uxa/i915_3d.h:392:9`!(op, dest_reg, operand0, operand1, operand2) \
393 _i915_fs_arithcxx . . $ `src/uxa/i915_3d.h:450:9`!(A0_##op, dest_reg, operand0, operand1, operand2)
394
395 #define _i915_fs_arith_maskedcxx . . $ `src/uxa/i915_3d.h:395:9`!(cmd, dest_reg, dest_mask, operand0, operand1, operand2) \
396 do { \
397 /* Set up destination register and write mask */ \
398 OUT_BATCH(cmd | \
399 (REG_TYPE(dest_reg) << A0_DEST_TYPE_SHIFT) | \
400 (REG_NR(dest_reg) << A0_DEST_NR_SHIFT) | \
401 (((dest_mask) & ~MASK_SATURATE) << A0_DEST_CHANNEL_SHIFT) | \
402 (((dest_mask) & MASK_SATURATE) ? A0_DEST_SATURATE : 0) | \
403 /* Set up operand 0 */ \
404 (REG_TYPE(operand0) << A0_SRC0_TYPE_SHIFT) | \
405 (REG_NR(operand0) << A0_SRC0_NR_SHIFT)); \
406 OUT_BATCH(i915_get_hardware_channel_val(REG_X(operand0), \
407 A1_SRC0_CHANNEL_X_SHIFT, \
408 A1_SRC0_CHANNEL_X_NEGATE) | \
409 i915_get_hardware_channel_val(REG_Y(operand0), \
410 A1_SRC0_CHANNEL_Y_SHIFT, \
411 A1_SRC0_CHANNEL_Y_NEGATE) | \
412 i915_get_hardware_channel_val(REG_Z(operand0), \
413 A1_SRC0_CHANNEL_Z_SHIFT, \
414 A1_SRC0_CHANNEL_Z_NEGATE) | \
415 i915_get_hardware_channel_val(REG_W(operand0), \
416 A1_SRC0_CHANNEL_W_SHIFT, \
417 A1_SRC0_CHANNEL_W_NEGATE) | \
418 /* Set up operand 1 */ \
419 (REG_TYPE(operand1) << A1_SRC1_TYPE_SHIFT) | \
420 (REG_NR(operand1) << A1_SRC1_NR_SHIFT) | \
421 i915_get_hardware_channel_val(REG_X(operand1), \
422 A1_SRC1_CHANNEL_X_SHIFT, \
423 A1_SRC1_CHANNEL_X_NEGATE) | \
424 i915_get_hardware_channel_val(REG_Y(operand1), \
425 A1_SRC1_CHANNEL_Y_SHIFT, \
426 A1_SRC1_CHANNEL_Y_NEGATE)); \
427 OUT_BATCH(i915_get_hardware_channel_val(REG_Z(operand1), \
428 A2_SRC1_CHANNEL_Z_SHIFT, \
429 A2_SRC1_CHANNEL_Z_NEGATE) | \
430 i915_get_hardware_channel_val(REG_W(operand1), \
431 A2_SRC1_CHANNEL_W_SHIFT, \
432 A2_SRC1_CHANNEL_W_NEGATE) | \
433 /* Set up operand 2 */ \
434 (REG_TYPE(operand2) << A2_SRC2_TYPE_SHIFT) | \
435 (REG_NR(operand2) << A2_SRC2_NR_SHIFT) | \
436 i915_get_hardware_channel_val(REG_X(operand2), \
437 A2_SRC2_CHANNEL_X_SHIFT, \
438 A2_SRC2_CHANNEL_X_NEGATE) | \
439 i915_get_hardware_channel_val(REG_Y(operand2), \
440 A2_SRC2_CHANNEL_Y_SHIFT, \
441 A2_SRC2_CHANNEL_Y_NEGATE) | \
442 i915_get_hardware_channel_val(REG_Z(operand2), \
443 A2_SRC2_CHANNEL_Z_SHIFT, \
444 A2_SRC2_CHANNEL_Z_NEGATE) | \
445 i915_get_hardware_channel_val(REG_W(operand2), \
446 A2_SRC2_CHANNEL_W_SHIFT, \
447 A2_SRC2_CHANNEL_W_NEGATE)); \
448 } while (0)
449
450 #define _i915_fs_arithcxx . . $ `src/uxa/i915_3d.h:450:9`!(cmd, dest_reg, operand0, operand1, operand2) do {\
451 /* Set up destination register and write mask */ \
452 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(cmd | \
453 (REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(dest_reg) << A0_DEST_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:108:9`!) | \
454 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(dest_reg) << A0_DEST_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:110:9`!) | \
455 (A0_DEST_CHANNEL_ALLcxx . . $ `src/uxa/i915_3d.h:116:9`!) | \
456 /* Set up operand 0 */ \
457 (REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(operand0) << A0_SRC0_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:118:9`!) | \
458 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(operand0) << A0_SRC0_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:119:9`!)); \
459 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Xcxx . . $ `src/uxa/i915_3d.h:300:9`!(operand0), \
460 A1_SRC0_CHANNEL_X_SHIFTcxx . . $ `src/uxa/i915_3d.h:132:9`!, \
461 A1_SRC0_CHANNEL_X_NEGATEcxx . . $ `src/uxa/i915_3d.h:131:9`!) | \
462 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Ycxx . . $ `src/uxa/i915_3d.h:301:9`!(operand0), \
463 A1_SRC0_CHANNEL_Y_SHIFTcxx . . $ `src/uxa/i915_3d.h:134:9`!, \
464 A1_SRC0_CHANNEL_Y_NEGATEcxx . . $ `src/uxa/i915_3d.h:133:9`!) | \
465 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Zcxx . . $ `src/uxa/i915_3d.h:302:9`!(operand0), \
466 A1_SRC0_CHANNEL_Z_SHIFTcxx . . $ `src/uxa/i915_3d.h:136:9`!, \
467 A1_SRC0_CHANNEL_Z_NEGATEcxx . . $ `src/uxa/i915_3d.h:135:9`!) | \
468 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Wcxx . . $ `src/uxa/i915_3d.h:303:9`!(operand0), \
469 A1_SRC0_CHANNEL_W_SHIFTcxx . . $ `src/uxa/i915_3d.h:138:9`!, \
470 A1_SRC0_CHANNEL_W_NEGATEcxx . . $ `src/uxa/i915_3d.h:137:9`!) | \
471 /* Set up operand 1 */ \
472 (REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(operand1) << A1_SRC1_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:139:9`!) | \
473 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(operand1) << A1_SRC1_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:140:9`!) | \
474 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Xcxx . . $ `src/uxa/i915_3d.h:300:9`!(operand1), \
475 A1_SRC1_CHANNEL_X_SHIFTcxx . . $ `src/uxa/i915_3d.h:142:9`!, \
476 A1_SRC1_CHANNEL_X_NEGATEcxx . . $ `src/uxa/i915_3d.h:141:9`!) | \
477 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Ycxx . . $ `src/uxa/i915_3d.h:301:9`!(operand1), \
478 A1_SRC1_CHANNEL_Y_SHIFTcxx . . $ `src/uxa/i915_3d.h:144:9`!, \
479 A1_SRC1_CHANNEL_Y_NEGATEcxx . . $ `src/uxa/i915_3d.h:143:9`!)); \
480 OUT_BATCHcxx . . $ `src/uxa/intel_batchbuffer.h:162:9`!(i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Zcxx . . $ `src/uxa/i915_3d.h:302:9`!(operand1), \
481 A2_SRC1_CHANNEL_Z_SHIFTcxx . . $ `src/uxa/i915_3d.h:147:9`!, \
482 A2_SRC1_CHANNEL_Z_NEGATEcxx . . $ `src/uxa/i915_3d.h:146:9`!) | \
483 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Wcxx . . $ `src/uxa/i915_3d.h:303:9`!(operand1), \
484 A2_SRC1_CHANNEL_W_SHIFTcxx . . $ `src/uxa/i915_3d.h:149:9`!, \
485 A2_SRC1_CHANNEL_W_NEGATEcxx . . $ `src/uxa/i915_3d.h:148:9`!) | \
486 /* Set up operand 2 */ \
487 (REG_TYPEcxx . . $ `src/uxa/i915_3d.h:299:9`!(operand2) << A2_SRC2_TYPE_SHIFTcxx . . $ `src/uxa/i915_3d.h:150:9`!) | \
488 (REG_NRcxx . . $ `src/uxa/i915_3d.h:298:9`!(operand2) << A2_SRC2_NR_SHIFTcxx . . $ `src/uxa/i915_3d.h:151:9`!) | \
489 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Xcxx . . $ `src/uxa/i915_3d.h:300:9`!(operand2), \
490 A2_SRC2_CHANNEL_X_SHIFTcxx . . $ `src/uxa/i915_3d.h:153:9`!, \
491 A2_SRC2_CHANNEL_X_NEGATEcxx . . $ `src/uxa/i915_3d.h:152:9`!) | \
492 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Ycxx . . $ `src/uxa/i915_3d.h:301:9`!(operand2), \
493 A2_SRC2_CHANNEL_Y_SHIFTcxx . . $ `src/uxa/i915_3d.h:155:9`!, \
494 A2_SRC2_CHANNEL_Y_NEGATEcxx . . $ `src/uxa/i915_3d.h:154:9`!) | \
495 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Zcxx . . $ `src/uxa/i915_3d.h:302:9`!(operand2), \
496 A2_SRC2_CHANNEL_Z_SHIFTcxx . . $ `src/uxa/i915_3d.h:157:9`!, \
497 A2_SRC2_CHANNEL_Z_NEGATEcxx . . $ `src/uxa/i915_3d.h:156:9`!) | \
498 i915_get_hardware_channel_valcxx . . $ `src/uxa/i915_3d.h:351:9`!(REG_Wcxx . . $ `src/uxa/i915_3d.h:303:9`!(operand2), \
499 A2_SRC2_CHANNEL_W_SHIFTcxx . . $ `src/uxa/i915_3d.h:159:9`!, \
500 A2_SRC2_CHANNEL_W_NEGATEcxx . . $ `src/uxa/i915_3d.h:158:9`!)); \
501 } while (0)
502
503 #define i915_fs_movcxx . . $ `src/uxa/i915_3d.h:503:9`!(dest_reg, operand0) \
504 i915_fs_arithcxx . . $ `src/uxa/i915_3d.h:392:9`!(MOV, dest_reg, \
505 operand0, \
506 i915_fs_operand_nonecxx . . $ `src/uxa/i915_3d.h:344:9`!(), \
507 i915_fs_operand_nonecxx . . $ `src/uxa/i915_3d.h:344:9`!())
508
509 #define i915_fs_mov_maskedcxx . . $ `src/uxa/i915_3d.h:509:9`!(dest_reg, dest_mask, operand0) \
510 i915_fs_arith_masked (MOV, dest_reg, dest_mask, \
511 operand0, \
512 i915_fs_operand_none(), \
513 i915_fs_operand_none())
514
515
516 #define i915_fs_frccxx . . $ `src/uxa/i915_3d.h:516:9`!(dest_reg, operand0) \
517 i915_fs_arith (FRC, dest_reg, \
518 operand0, \
519 i915_fs_operand_none(), \
520 i915_fs_operand_none())
521
522 /** Add operand0 and operand1 and put the result in dest_reg */
523 #define i915_fs_addcxx . . $ `src/uxa/i915_3d.h:523:9`!(dest_reg, operand0, operand1) \
524 i915_fs_arith (ADD, dest_reg, \
525 operand0, operand1, \
526 i915_fs_operand_none())
527
528 /** Multiply operand0 and operand1 and put the result in dest_reg */
529 #define i915_fs_mulcxx . . $ `src/uxa/i915_3d.h:529:9`!(dest_reg, operand0, operand1) \
530 i915_fs_arithcxx . . $ `src/uxa/i915_3d.h:392:9`! (MUL, dest_reg, \
531 operand0, operand1, \
532 i915_fs_operand_nonecxx . . $ `src/uxa/i915_3d.h:344:9`!())
533
534 /** Computes 1/sqrt(operand0.replicate_swizzle) puts the result in dest_reg */
535 #define i915_fs_rsqcxx . . $ `src/uxa/i915_3d.h:535:9`!(dest_reg, dest_mask, operand0) \
536 do { \
537 if (dest_mask) { \
538 i915_fs_arith_masked (RSQ, dest_reg, dest_mask, \
539 operand0, \
540 i915_fs_operand_none (), \
541 i915_fs_operand_none ()); \
542 } else { \
543 i915_fs_arith (RSQ, dest_reg, \
544 operand0, \
545 i915_fs_operand_none (), \
546 i915_fs_operand_none ()); \
547 } \
548 } while (0)
549
550 /** Puts the minimum of operand0 and operand1 in dest_reg */
551 #define i915_fs_mincxx . . $ `src/uxa/i915_3d.h:551:9`!(dest_reg, operand0, operand1) \
552 i915_fs_arith (MIN, dest_reg, \
553 operand0, operand1, \
554 i915_fs_operand_none())
555
556 /** Puts the maximum of operand0 and operand1 in dest_reg */
557 #define i915_fs_maxcxx . . $ `src/uxa/i915_3d.h:557:9`!(dest_reg, operand0, operand1) \
558 i915_fs_arith (MAX, dest_reg, \
559 operand0, operand1, \
560 i915_fs_operand_none())
561
562 #define i915_fs_cmpcxx . . $ `src/uxa/i915_3d.h:562:9`!(dest_reg, operand0, operand1, operand2) \
563 i915_fs_arith (CMP, dest_reg, operand0, operand1, operand2)
564
565 /** Perform operand0 * operand1 + operand2 and put the result in dest_reg */
566 #define i915_fs_madcxx . . $ `src/uxa/i915_3d.h:566:9`!(dest_reg, dest_mask, op0, op1, op2) \
567 do { \
568 if (dest_mask) { \
569 i915_fs_arith_masked (MAD, dest_reg, dest_mask, op0, op1, op2); \
570 } else { \
571 i915_fs_arith (MAD, dest_reg, op0, op1, op2); \
572 } \
573 } while (0)
574
575 #define i915_fs_dp2addcxx . . $ `src/uxa/i915_3d.h:575:9`!(dest_reg, dest_mask, op0, op1, op2) \
576 do { \
577 if (dest_mask) { \
578 i915_fs_arith_masked (DP2ADD, dest_reg, dest_mask, op0, op1, op2); \
579 } else { \
580 i915_fs_arith (DP2ADD, dest_reg, op0, op1, op2); \
581 } \
582 } while (0)
583
584 /**
585 * Perform a 3-component dot-product of operand0 and operand1 and put the
586 * resulting scalar in the channels of dest_reg specified by the dest_mask.
587 */
588 #define i915_fs_dp3cxx . . $ `src/uxa/i915_3d.h:588:9`!(dest_reg, dest_mask, op0, op1) \
589 do { \
590 if (dest_mask) { \
591 i915_fs_arith_masked (DP3, dest_reg, dest_mask, \
592 op0, op1,\
593 i915_fs_operand_none()); \
594 } else { \
595 i915_fs_arith (DP3, dest_reg, op0, op1,\
596 i915_fs_operand_none()); \
597 } \
598 } while (0)
599
600 /**
601 * Sets up local state for accumulating a fragment shader buffer.
602 *
603 * \param x maximum number of shader commands that may be used between
604 * a FS_START and FS_END
605 */
606 #define FS_LOCALScxx . . $ `src/uxa/i915_3d.h:606:9`!() \
607 uint32_t _shader_offset
608
609 #define FS_BEGINcxx . . $ `src/uxa/i915_3d.h:609:9`!() \
610 do { \
611 _shader_offset = intel->batch_used++; \
612 } while (0)
613
614 #define FS_ENDcxx . . $ `src/uxa/i915_3d.h:614:9`!() \
615 do { \
616 intel->batch_ptr[_shader_offset] = \
617 _3DSTATE_PIXEL_SHADER_PROGRAMcxx . . $ `src/uxa/i915_3d.h:34:9`! | \
618 (intel->batch_used - _shader_offset - 2); \
619 } while (0);