blob: 4fd9247c498dc64f850de31d43ddbdc4d74b79ce [file] [log] [blame]
Corbin Simpsonc686e172009-12-20 15:00:40 -08001TGSI
2====
3
4TGSI, Tungsten Graphics Shader Instructions, is an intermediate language
5for describing shaders. Since Gallium is inherently shaderful, shaders are
6an important part of the API. TGSI is the only intermediate representation
7used by all drivers.
Keith Whitwella62aaa72009-12-21 23:25:15 +00008
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08009From GL_NV_vertex_program
Keith Whitwella62aaa72009-12-21 23:25:15 +000010-------------------------
11
12
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080013ARL - Address Register Load
14
15.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000016
Corbin Simpsond92a6852009-12-21 19:30:29 -080017 dst.x = \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080018
Corbin Simpsond92a6852009-12-21 19:30:29 -080019 dst.y = \lfloor src.y\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080020
Corbin Simpsond92a6852009-12-21 19:30:29 -080021 dst.z = \lfloor src.z\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080022
Corbin Simpsond92a6852009-12-21 19:30:29 -080023 dst.w = \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +000024
25
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080026MOV - Move
27
28.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000029
30 dst.x = src.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080031
Keith Whitwella62aaa72009-12-21 23:25:15 +000032 dst.y = src.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080033
Keith Whitwella62aaa72009-12-21 23:25:15 +000034 dst.z = src.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080035
Keith Whitwella62aaa72009-12-21 23:25:15 +000036 dst.w = src.w
37
38
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080039LIT - Light Coefficients
40
41.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000042
43 dst.x = 1.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080044
Keith Whitwella62aaa72009-12-21 23:25:15 +000045 dst.y = max(src.x, 0.0)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080046
Keith Whitwella62aaa72009-12-21 23:25:15 +000047 dst.z = (src.x > 0.0) ? pow(max(src.y, 0.0), clamp(src.w, -128.0, 128.0)) : 0.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080048
Keith Whitwella62aaa72009-12-21 23:25:15 +000049 dst.w = 1.0
50
51
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080052RCP - Reciprocal
53
54.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000055
56 dst.x = 1.0 / src.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080057
Keith Whitwella62aaa72009-12-21 23:25:15 +000058 dst.y = 1.0 / src.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080059
Keith Whitwella62aaa72009-12-21 23:25:15 +000060 dst.z = 1.0 / src.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080061
Keith Whitwella62aaa72009-12-21 23:25:15 +000062 dst.w = 1.0 / src.x
63
64
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080065RSQ - Reciprocal Square Root
66
67.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000068
69 dst.x = 1.0 / sqrt(abs(src.x))
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080070
Keith Whitwella62aaa72009-12-21 23:25:15 +000071 dst.y = 1.0 / sqrt(abs(src.x))
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080072
Keith Whitwella62aaa72009-12-21 23:25:15 +000073 dst.z = 1.0 / sqrt(abs(src.x))
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080074
Keith Whitwella62aaa72009-12-21 23:25:15 +000075 dst.w = 1.0 / sqrt(abs(src.x))
76
77
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080078EXP - Approximate Exponential Base 2
79
80.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000081
Corbin Simpsond92a6852009-12-21 19:30:29 -080082 dst.x = pow(2.0, \lfloor src.x\rfloor)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080083
Corbin Simpsond92a6852009-12-21 19:30:29 -080084 dst.y = src.x - \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080085
Keith Whitwella62aaa72009-12-21 23:25:15 +000086 dst.z = pow(2.0, src.x)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080087
Keith Whitwella62aaa72009-12-21 23:25:15 +000088 dst.w = 1.0
89
90
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080091LOG - Approximate Logarithm Base 2
92
93.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000094
Corbin Simpsond92a6852009-12-21 19:30:29 -080095 dst.x = \lfloor lg2(abs(src.x)))\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080096
Corbin Simpsond92a6852009-12-21 19:30:29 -080097 dst.y = abs(src.x) / pow(2.0, \lfloor lg2(abs(src.x))\rfloor )
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080098
Keith Whitwella62aaa72009-12-21 23:25:15 +000099 dst.z = lg2(abs(src.x))
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800100
Keith Whitwella62aaa72009-12-21 23:25:15 +0000101 dst.w = 1.0
102
103
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800104MUL - Multiply
105
106.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000107
108 dst.x = src0.x * src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800109
Keith Whitwella62aaa72009-12-21 23:25:15 +0000110 dst.y = src0.y * src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800111
Keith Whitwella62aaa72009-12-21 23:25:15 +0000112 dst.z = src0.z * src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800113
Keith Whitwella62aaa72009-12-21 23:25:15 +0000114 dst.w = src0.w * src1.w
115
116
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800117ADD - Add
118
119.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000120
121 dst.x = src0.x + src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800122
Keith Whitwella62aaa72009-12-21 23:25:15 +0000123 dst.y = src0.y + src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800124
Keith Whitwella62aaa72009-12-21 23:25:15 +0000125 dst.z = src0.z + src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800126
Keith Whitwella62aaa72009-12-21 23:25:15 +0000127 dst.w = src0.w + src1.w
128
129
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800130DP3 - 3-component Dot Product
131
132.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000133
134 dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800135
Keith Whitwella62aaa72009-12-21 23:25:15 +0000136 dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800137
Keith Whitwella62aaa72009-12-21 23:25:15 +0000138 dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800139
Keith Whitwella62aaa72009-12-21 23:25:15 +0000140 dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z
141
142
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800143DP4 - 4-component Dot Product
144
145.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000146
147 dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800148
Keith Whitwella62aaa72009-12-21 23:25:15 +0000149 dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800150
Keith Whitwella62aaa72009-12-21 23:25:15 +0000151 dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800152
Keith Whitwella62aaa72009-12-21 23:25:15 +0000153 dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src0.w * src1.w
154
155
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800156DST - Distance Vector
157
158.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000159
160 dst.x = 1.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800161
Keith Whitwella62aaa72009-12-21 23:25:15 +0000162 dst.y = src0.y * src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800163
Keith Whitwella62aaa72009-12-21 23:25:15 +0000164 dst.z = src0.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800165
Keith Whitwella62aaa72009-12-21 23:25:15 +0000166 dst.w = src1.w
167
168
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800169MIN - Minimum
170
171.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000172
173 dst.x = min(src0.x, src1.x)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800174
Keith Whitwella62aaa72009-12-21 23:25:15 +0000175 dst.y = min(src0.y, src1.y)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800176
Keith Whitwella62aaa72009-12-21 23:25:15 +0000177 dst.z = min(src0.z, src1.z)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800178
Keith Whitwella62aaa72009-12-21 23:25:15 +0000179 dst.w = min(src0.w, src1.w)
180
181
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800182MAX - Maximum
183
184.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000185
186 dst.x = max(src0.x, src1.x)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800187
Keith Whitwella62aaa72009-12-21 23:25:15 +0000188 dst.y = max(src0.y, src1.y)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800189
Keith Whitwella62aaa72009-12-21 23:25:15 +0000190 dst.z = max(src0.z, src1.z)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800191
Keith Whitwella62aaa72009-12-21 23:25:15 +0000192 dst.w = max(src0.w, src1.w)
193
194
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800195SLT - Set On Less Than
196
197.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000198
199 dst.x = (src0.x < src1.x) ? 1.0 : 0.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800200
Keith Whitwella62aaa72009-12-21 23:25:15 +0000201 dst.y = (src0.y < src1.y) ? 1.0 : 0.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800202
Keith Whitwella62aaa72009-12-21 23:25:15 +0000203 dst.z = (src0.z < src1.z) ? 1.0 : 0.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800204
Keith Whitwella62aaa72009-12-21 23:25:15 +0000205 dst.w = (src0.w < src1.w) ? 1.0 : 0.0
206
207
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800208SGE - Set On Greater Equal Than
209
210.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000211
212 dst.x = (src0.x >= src1.x) ? 1.0 : 0.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800213
Keith Whitwella62aaa72009-12-21 23:25:15 +0000214 dst.y = (src0.y >= src1.y) ? 1.0 : 0.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800215
Keith Whitwella62aaa72009-12-21 23:25:15 +0000216 dst.z = (src0.z >= src1.z) ? 1.0 : 0.0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800217
Keith Whitwella62aaa72009-12-21 23:25:15 +0000218 dst.w = (src0.w >= src1.w) ? 1.0 : 0.0
219
220
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800221MAD - Multiply And Add
222
223.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000224
225 dst.x = src0.x * src1.x + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800226
Keith Whitwella62aaa72009-12-21 23:25:15 +0000227 dst.y = src0.y * src1.y + src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800228
Keith Whitwella62aaa72009-12-21 23:25:15 +0000229 dst.z = src0.z * src1.z + src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800230
Keith Whitwella62aaa72009-12-21 23:25:15 +0000231 dst.w = src0.w * src1.w + src2.w
232
233
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800234SUB - Subtract
235
236.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000237
238 dst.x = src0.x - src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800239
Keith Whitwella62aaa72009-12-21 23:25:15 +0000240 dst.y = src0.y - src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800241
Keith Whitwella62aaa72009-12-21 23:25:15 +0000242 dst.z = src0.z - src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800243
Keith Whitwella62aaa72009-12-21 23:25:15 +0000244 dst.w = src0.w - src1.w
245
246
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800247LRP - Linear Interpolate
248
249.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000250
251 dst.x = src0.x * (src1.x - src2.x) + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800252
Keith Whitwella62aaa72009-12-21 23:25:15 +0000253 dst.y = src0.y * (src1.y - src2.y) + src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800254
Keith Whitwella62aaa72009-12-21 23:25:15 +0000255 dst.z = src0.z * (src1.z - src2.z) + src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800256
Keith Whitwella62aaa72009-12-21 23:25:15 +0000257 dst.w = src0.w * (src1.w - src2.w) + src2.w
258
259
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800260CND - Condition
261
262.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000263
264 dst.x = (src2.x > 0.5) ? src0.x : src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800265
Keith Whitwella62aaa72009-12-21 23:25:15 +0000266 dst.y = (src2.y > 0.5) ? src0.y : src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800267
Keith Whitwella62aaa72009-12-21 23:25:15 +0000268 dst.z = (src2.z > 0.5) ? src0.z : src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800269
Keith Whitwella62aaa72009-12-21 23:25:15 +0000270 dst.w = (src2.w > 0.5) ? src0.w : src1.w
271
272
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800273DP2A - 2-component Dot Product And Add
274
275.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000276
277 dst.x = src0.x * src1.x + src0.y * src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800278
Keith Whitwella62aaa72009-12-21 23:25:15 +0000279 dst.y = src0.x * src1.x + src0.y * src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800280
Keith Whitwella62aaa72009-12-21 23:25:15 +0000281 dst.z = src0.x * src1.x + src0.y * src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800282
Keith Whitwella62aaa72009-12-21 23:25:15 +0000283 dst.w = src0.x * src1.x + src0.y * src1.y + src2.x
284
285
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800286FRAC - Fraction
287
288.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000289
Corbin Simpsond92a6852009-12-21 19:30:29 -0800290 dst.x = src.x - \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800291
Corbin Simpsond92a6852009-12-21 19:30:29 -0800292 dst.y = src.y - \lfloor src.y\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800293
Corbin Simpsond92a6852009-12-21 19:30:29 -0800294 dst.z = src.z - \lfloor src.z\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800295
Corbin Simpsond92a6852009-12-21 19:30:29 -0800296 dst.w = src.w - \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000297
298
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800299CLAMP - Clamp
300
301.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000302
303 dst.x = clamp(src0.x, src1.x, src2.x)
304 dst.y = clamp(src0.y, src1.y, src2.y)
305 dst.z = clamp(src0.z, src1.z, src2.z)
306 dst.w = clamp(src0.w, src1.w, src2.w)
307
308
Corbin Simpsond92a6852009-12-21 19:30:29 -0800309FLR - Floor
310
311This is identical to ARL.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000312
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800313.. math::
314
Corbin Simpsond92a6852009-12-21 19:30:29 -0800315 dst.x = \lfloor src.x\rfloor
316
317 dst.y = \lfloor src.y\rfloor
318
319 dst.z = \lfloor src.z\rfloor
320
321 dst.w = \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000322
323
3241.3.9 ROUND - Round
325
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800326.. math::
327
Keith Whitwella62aaa72009-12-21 23:25:15 +0000328 dst.x = round(src.x)
329 dst.y = round(src.y)
330 dst.z = round(src.z)
331 dst.w = round(src.w)
332
333
Keith Whitwell14eacb02009-12-21 23:38:29 +00003341.3.10 EX2 - Exponential Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000335
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800336.. math::
337
Keith Whitwella62aaa72009-12-21 23:25:15 +0000338 dst.x = pow(2.0, src.x)
339 dst.y = pow(2.0, src.x)
340 dst.z = pow(2.0, src.x)
341 dst.w = pow(2.0, src.x)
342
343
Keith Whitwell14eacb02009-12-21 23:38:29 +00003441.3.11 LG2 - Logarithm Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000345
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800346.. math::
347
Keith Whitwella62aaa72009-12-21 23:25:15 +0000348 dst.x = lg2(src.x)
349 dst.y = lg2(src.x)
350 dst.z = lg2(src.x)
351 dst.w = lg2(src.x)
352
353
Keith Whitwell14eacb02009-12-21 23:38:29 +00003541.3.12 POW - Power
Keith Whitwella62aaa72009-12-21 23:25:15 +0000355
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800356.. math::
357
Keith Whitwella62aaa72009-12-21 23:25:15 +0000358 dst.x = pow(src0.x, src1.x)
359 dst.y = pow(src0.x, src1.x)
360 dst.z = pow(src0.x, src1.x)
361 dst.w = pow(src0.x, src1.x)
362
Keith Whitwell14eacb02009-12-21 23:38:29 +00003631.3.15 XPD - Cross Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000364
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800365.. math::
366
Keith Whitwella62aaa72009-12-21 23:25:15 +0000367 dst.x = src0.y * src1.z - src1.y * src0.z
368 dst.y = src0.z * src1.x - src1.z * src0.x
369 dst.z = src0.x * src1.y - src1.x * src0.y
370 dst.w = 1.0
371
372
Keith Whitwella62aaa72009-12-21 23:25:15 +00003731.4.1 ABS - Absolute
374
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800375.. math::
376
Keith Whitwella62aaa72009-12-21 23:25:15 +0000377 dst.x = abs(src.x)
378 dst.y = abs(src.y)
379 dst.z = abs(src.z)
380 dst.w = abs(src.w)
381
382
3831.4.2 RCC - Reciprocal Clamped
384
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800385.. math::
386
Keith Whitwella62aaa72009-12-21 23:25:15 +0000387 dst.x = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020)
388 dst.y = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020)
389 dst.z = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020)
390 dst.w = (1.0 / src.x) > 0.0 ? clamp(1.0 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1.0 / src.x, -1.884467e+019, -5.42101e-020)
391
392
3931.4.3 DPH - Homogeneous Dot Product
394
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800395.. math::
396
Keith Whitwella62aaa72009-12-21 23:25:15 +0000397 dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
398 dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
399 dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
400 dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
401
402
Corbin Simpsond92a6852009-12-21 19:30:29 -0800403COS - Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000404
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800405.. math::
406
Corbin Simpsond92a6852009-12-21 19:30:29 -0800407 dst.x = \cos{src.x}
408
409 dst.y = \cos{src.x}
410
411 dst.z = \cos{src.x}
412
413 dst.w = \cos{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000414
415
4161.5.2 DDX - Derivative Relative To X
417
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800418.. math::
419
Keith Whitwella62aaa72009-12-21 23:25:15 +0000420 dst.x = partialx(src.x)
421 dst.y = partialx(src.y)
422 dst.z = partialx(src.z)
423 dst.w = partialx(src.w)
424
425
4261.5.3 DDY - Derivative Relative To Y
427
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800428.. math::
429
Keith Whitwella62aaa72009-12-21 23:25:15 +0000430 dst.x = partialy(src.x)
431 dst.y = partialy(src.y)
432 dst.z = partialy(src.z)
433 dst.w = partialy(src.w)
434
435
Keith Whitwella62aaa72009-12-21 23:25:15 +00004361.5.7 KILP - Predicated Discard
437
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800438.. math::
439
Keith Whitwella62aaa72009-12-21 23:25:15 +0000440 discard
441
442
Keith Whitwella62aaa72009-12-21 23:25:15 +00004431.5.10 PK2H - Pack Two 16-bit Floats
444
445 TBD
446
447
4481.5.11 PK2US - Pack Two Unsigned 16-bit Scalars
449
450 TBD
451
452
4531.5.12 PK4B - Pack Four Signed 8-bit Scalars
454
455 TBD
456
457
4581.5.13 PK4UB - Pack Four Unsigned 8-bit Scalars
459
460 TBD
461
462
Keith Whitwella62aaa72009-12-21 23:25:15 +00004631.5.15 RFL - Reflection Vector
464
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800465.. math::
466
Keith Whitwella62aaa72009-12-21 23:25:15 +0000467 dst.x = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.x - src1.x
468 dst.y = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.y - src1.y
469 dst.z = 2.0 * (src0.x * src1.x + src0.y * src1.y + src0.z * src1.z) / (src0.x * src0.x + src0.y * src0.y + src0.z * src0.z) * src0.z - src1.z
470 dst.w = 1.0
471
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800472Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000473
Keith Whitwella62aaa72009-12-21 23:25:15 +0000474
4751.5.16 SEQ - Set On Equal
476
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800477.. math::
478
Keith Whitwella62aaa72009-12-21 23:25:15 +0000479 dst.x = (src0.x == src1.x) ? 1.0 : 0.0
480 dst.y = (src0.y == src1.y) ? 1.0 : 0.0
481 dst.z = (src0.z == src1.z) ? 1.0 : 0.0
482 dst.w = (src0.w == src1.w) ? 1.0 : 0.0
483
484
4851.5.17 SFL - Set On False
486
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800487.. math::
488
Keith Whitwella62aaa72009-12-21 23:25:15 +0000489 dst.x = 0.0
490 dst.y = 0.0
491 dst.z = 0.0
492 dst.w = 0.0
493
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800494Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000495
4961.5.18 SGT - Set On Greater Than
497
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800498.. math::
499
Keith Whitwella62aaa72009-12-21 23:25:15 +0000500 dst.x = (src0.x > src1.x) ? 1.0 : 0.0
501 dst.y = (src0.y > src1.y) ? 1.0 : 0.0
502 dst.z = (src0.z > src1.z) ? 1.0 : 0.0
503 dst.w = (src0.w > src1.w) ? 1.0 : 0.0
504
505
Corbin Simpsond92a6852009-12-21 19:30:29 -0800506SIN - Sine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000507
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800508.. math::
509
Corbin Simpsond92a6852009-12-21 19:30:29 -0800510 dst.x = \sin{src.x}
511
512 dst.y = \sin{src.x}
513
514 dst.z = \sin{src.x}
515
516 dst.w = \sin{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000517
518
5191.5.20 SLE - Set On Less Equal Than
520
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800521.. math::
522
Keith Whitwella62aaa72009-12-21 23:25:15 +0000523 dst.x = (src0.x <= src1.x) ? 1.0 : 0.0
524 dst.y = (src0.y <= src1.y) ? 1.0 : 0.0
525 dst.z = (src0.z <= src1.z) ? 1.0 : 0.0
526 dst.w = (src0.w <= src1.w) ? 1.0 : 0.0
527
528
5291.5.21 SNE - Set On Not Equal
530
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800531.. math::
532
Keith Whitwella62aaa72009-12-21 23:25:15 +0000533 dst.x = (src0.x != src1.x) ? 1.0 : 0.0
534 dst.y = (src0.y != src1.y) ? 1.0 : 0.0
535 dst.z = (src0.z != src1.z) ? 1.0 : 0.0
536 dst.w = (src0.w != src1.w) ? 1.0 : 0.0
537
538
5391.5.22 STR - Set On True
540
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800541.. math::
542
Keith Whitwella62aaa72009-12-21 23:25:15 +0000543 dst.x = 1.0
544 dst.y = 1.0
545 dst.z = 1.0
546 dst.w = 1.0
547
548
5491.5.23 TEX - Texture Lookup
550
551 TBD
552
553
5541.5.24 TXD - Texture Lookup with Derivatives
555
556 TBD
557
558
5591.5.25 TXP - Projective Texture Lookup
560
561 TBD
562
563
5641.5.26 UP2H - Unpack Two 16-Bit Floats
565
566 TBD
567
Keith Whitwell14eacb02009-12-21 23:38:29 +0000568 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000569
5701.5.27 UP2US - Unpack Two Unsigned 16-Bit Scalars
571
572 TBD
573
Keith Whitwell14eacb02009-12-21 23:38:29 +0000574 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000575
5761.5.28 UP4B - Unpack Four Signed 8-Bit Values
577
578 TBD
579
Keith Whitwell14eacb02009-12-21 23:38:29 +0000580 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000581
5821.5.29 UP4UB - Unpack Four Unsigned 8-Bit Scalars
583
584 TBD
585
Keith Whitwell14eacb02009-12-21 23:38:29 +0000586 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000587
5881.5.30 X2D - 2D Coordinate Transformation
589
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800590.. math::
591
Keith Whitwella62aaa72009-12-21 23:25:15 +0000592 dst.x = src0.x + src1.x * src2.x + src1.y * src2.y
593 dst.y = src0.y + src1.x * src2.z + src1.y * src2.w
594 dst.z = src0.x + src1.x * src2.x + src1.y * src2.y
595 dst.w = src0.y + src1.x * src2.z + src1.y * src2.w
596
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800597Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000598
Keith Whitwella62aaa72009-12-21 23:25:15 +0000599
6001.6 GL_NV_vertex_program2
601--------------------------
602
603
6041.6.1 ARA - Address Register Add
605
606 TBD
607
Keith Whitwell14eacb02009-12-21 23:38:29 +0000608 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000609
6101.6.2 ARR - Address Register Load With Round
611
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800612.. math::
613
Keith Whitwella62aaa72009-12-21 23:25:15 +0000614 dst.x = round(src.x)
615 dst.y = round(src.y)
616 dst.z = round(src.z)
617 dst.w = round(src.w)
618
619
6201.6.3 BRA - Branch
621
622 pc = target
623
Keith Whitwell14eacb02009-12-21 23:38:29 +0000624 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000625
6261.6.4 CAL - Subroutine Call
627
628 push(pc)
629 pc = target
630
631
6321.6.5 RET - Subroutine Call Return
633
634 pc = pop()
635
Keith Whitwell14eacb02009-12-21 23:38:29 +0000636 Potential restrictions:
637 * Only occurs at end of function.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000638
6391.6.6 SSG - Set Sign
640
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800641.. math::
642
Keith Whitwella62aaa72009-12-21 23:25:15 +0000643 dst.x = (src.x > 0.0) ? 1.0 : (src.x < 0.0) ? -1.0 : 0.0
644 dst.y = (src.y > 0.0) ? 1.0 : (src.y < 0.0) ? -1.0 : 0.0
645 dst.z = (src.z > 0.0) ? 1.0 : (src.z < 0.0) ? -1.0 : 0.0
646 dst.w = (src.w > 0.0) ? 1.0 : (src.w < 0.0) ? -1.0 : 0.0
647
648
Keith Whitwella62aaa72009-12-21 23:25:15 +00006491.8.1 CMP - Compare
650
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800651.. math::
652
Keith Whitwella62aaa72009-12-21 23:25:15 +0000653 dst.x = (src0.x < 0.0) ? src1.x : src2.x
654 dst.y = (src0.y < 0.0) ? src1.y : src2.y
655 dst.z = (src0.z < 0.0) ? src1.z : src2.z
656 dst.w = (src0.w < 0.0) ? src1.w : src2.w
657
658
6591.8.2 KIL - Conditional Discard
660
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800661.. math::
662
Keith Whitwella62aaa72009-12-21 23:25:15 +0000663 if (src.x < 0.0 || src.y < 0.0 || src.z < 0.0 || src.w < 0.0)
664 discard
665 endif
666
667
Corbin Simpsond92a6852009-12-21 19:30:29 -0800668SCS - Sine Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000669
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800670.. math::
671
Corbin Simpsond92a6852009-12-21 19:30:29 -0800672 dst.x = \cos{src.x}
673
674 dst.y = \sin{src.x}
675
Keith Whitwella62aaa72009-12-21 23:25:15 +0000676 dst.z = 0.0
Corbin Simpsond92a6852009-12-21 19:30:29 -0800677
Keith Whitwella62aaa72009-12-21 23:25:15 +0000678 dst.y = 1.0
679
680
6811.8.4 TXB - Texture Lookup With Bias
682
683 TBD
684
685
Keith Whitwella62aaa72009-12-21 23:25:15 +00006861.9.1 NRM - 3-component Vector Normalise
687
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800688.. math::
689
Keith Whitwella62aaa72009-12-21 23:25:15 +0000690 dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z)
691 dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z)
692 dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z)
693 dst.w = 1.0
694
695
6961.9.2 DIV - Divide
697
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800698.. math::
699
Keith Whitwella62aaa72009-12-21 23:25:15 +0000700 dst.x = src0.x / src1.x
701 dst.y = src0.y / src1.y
702 dst.z = src0.z / src1.z
703 dst.w = src0.w / src1.w
704
705
7061.9.3 DP2 - 2-component Dot Product
707
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800708.. math::
709
Keith Whitwella62aaa72009-12-21 23:25:15 +0000710 dst.x = src0.x * src1.x + src0.y * src1.y
711 dst.y = src0.x * src1.x + src0.y * src1.y
712 dst.z = src0.x * src1.x + src0.y * src1.y
713 dst.w = src0.x * src1.x + src0.y * src1.y
714
715
Keith Whitwella62aaa72009-12-21 23:25:15 +00007161.9.5 TXL - Texture Lookup With LOD
717
718 TBD
719
720
7211.9.6 BRK - Break
722
723 TBD
724
725
7261.9.7 IF - If
727
728 TBD
729
730
7311.9.8 BGNFOR - Begin a For-Loop
732
733 dst.x = floor(src.x)
734 dst.y = floor(src.y)
735 dst.z = floor(src.z)
736
737 if (dst.y <= 0)
738 pc = [matching ENDFOR] + 1
739 endif
740
741 Note: The destination must be a loop register.
742 The source must be a constant register.
743
Keith Whitwell14eacb02009-12-21 23:38:29 +0000744 Considered for cleanup / removal.
745
Keith Whitwella62aaa72009-12-21 23:25:15 +0000746
7471.9.9 REP - Repeat
748
749 TBD
750
751
7521.9.10 ELSE - Else
753
754 TBD
755
756
7571.9.11 ENDIF - End If
758
759 TBD
760
761
7621.9.12 ENDFOR - End a For-Loop
763
764 dst.x = dst.x + dst.z
765 dst.y = dst.y - 1.0
766
767 if (dst.y > 0)
768 pc = [matching BGNFOR instruction] + 1
769 endif
770
771 Note: The destination must be a loop register.
772
Keith Whitwell14eacb02009-12-21 23:38:29 +0000773 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000774
7751.9.13 ENDREP - End Repeat
776
777 TBD
778
779
Keith Whitwella62aaa72009-12-21 23:25:15 +00007801.10.1 PUSHA - Push Address Register On Stack
781
782 push(src.x)
783 push(src.y)
784 push(src.z)
785 push(src.w)
786
Keith Whitwell14eacb02009-12-21 23:38:29 +0000787 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000788
7891.10.2 POPA - Pop Address Register From Stack
790
791 dst.w = pop()
792 dst.z = pop()
793 dst.y = pop()
794 dst.x = pop()
795
Keith Whitwell14eacb02009-12-21 23:38:29 +0000796 Considered for cleanup / removal.
797
Keith Whitwella62aaa72009-12-21 23:25:15 +0000798
7991.11 GL_NV_gpu_program4
800------------------------
801
Keith Whitwell14eacb02009-12-21 23:38:29 +0000802Support for these opcodes indicated by a special pipe capability bit (TBD).
Keith Whitwella62aaa72009-12-21 23:25:15 +0000803
8041.11.1 CEIL - Ceiling
805
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800806.. math::
807
Keith Whitwella62aaa72009-12-21 23:25:15 +0000808 dst.x = ceil(src.x)
809 dst.y = ceil(src.y)
810 dst.z = ceil(src.z)
811 dst.w = ceil(src.w)
812
813
8141.11.2 I2F - Integer To Float
815
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800816.. math::
817
Keith Whitwella62aaa72009-12-21 23:25:15 +0000818 dst.x = (float) src.x
819 dst.y = (float) src.y
820 dst.z = (float) src.z
821 dst.w = (float) src.w
822
823
8241.11.3 NOT - Bitwise Not
825
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800826.. math::
827
Keith Whitwella62aaa72009-12-21 23:25:15 +0000828 dst.x = ~src.x
829 dst.y = ~src.y
830 dst.z = ~src.z
831 dst.w = ~src.w
832
833
8341.11.4 TRUNC - Truncate
835
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800836.. math::
837
Keith Whitwella62aaa72009-12-21 23:25:15 +0000838 dst.x = trunc(src.x)
839 dst.y = trunc(src.y)
840 dst.z = trunc(src.z)
841 dst.w = trunc(src.w)
842
843
8441.11.5 SHL - Shift Left
845
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800846.. math::
847
Keith Whitwella62aaa72009-12-21 23:25:15 +0000848 dst.x = src0.x << src1.x
849 dst.y = src0.y << src1.x
850 dst.z = src0.z << src1.x
851 dst.w = src0.w << src1.x
852
853
8541.11.6 SHR - Shift Right
855
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800856.. math::
857
Keith Whitwella62aaa72009-12-21 23:25:15 +0000858 dst.x = src0.x >> src1.x
859 dst.y = src0.y >> src1.x
860 dst.z = src0.z >> src1.x
861 dst.w = src0.w >> src1.x
862
863
8641.11.7 AND - Bitwise And
865
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800866.. math::
867
Keith Whitwella62aaa72009-12-21 23:25:15 +0000868 dst.x = src0.x & src1.x
869 dst.y = src0.y & src1.y
870 dst.z = src0.z & src1.z
871 dst.w = src0.w & src1.w
872
873
8741.11.8 OR - Bitwise Or
875
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800876.. math::
877
Keith Whitwella62aaa72009-12-21 23:25:15 +0000878 dst.x = src0.x | src1.x
879 dst.y = src0.y | src1.y
880 dst.z = src0.z | src1.z
881 dst.w = src0.w | src1.w
882
883
8841.11.9 MOD - Modulus
885
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800886.. math::
887
Keith Whitwella62aaa72009-12-21 23:25:15 +0000888 dst.x = src0.x % src1.x
889 dst.y = src0.y % src1.y
890 dst.z = src0.z % src1.z
891 dst.w = src0.w % src1.w
892
893
8941.11.10 XOR - Bitwise Xor
895
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800896.. math::
897
Keith Whitwella62aaa72009-12-21 23:25:15 +0000898 dst.x = src0.x ^ src1.x
899 dst.y = src0.y ^ src1.y
900 dst.z = src0.z ^ src1.z
901 dst.w = src0.w ^ src1.w
902
903
9041.11.11 SAD - Sum Of Absolute Differences
905
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800906.. math::
907
Keith Whitwella62aaa72009-12-21 23:25:15 +0000908 dst.x = abs(src0.x - src1.x) + src2.x
909 dst.y = abs(src0.y - src1.y) + src2.y
910 dst.z = abs(src0.z - src1.z) + src2.z
911 dst.w = abs(src0.w - src1.w) + src2.w
912
913
9141.11.12 TXF - Texel Fetch
915
916 TBD
917
918
9191.11.13 TXQ - Texture Size Query
920
921 TBD
922
923
9241.11.14 CONT - Continue
925
926 TBD
927
928
9291.12 GL_NV_geometry_program4
930-----------------------------
931
932
9331.12.1 EMIT - Emit
934
935 TBD
936
937
9381.12.2 ENDPRIM - End Primitive
939
940 TBD
941
942
9431.13 GLSL
944----------
945
946
9471.13.1 BGNLOOP - Begin a Loop
948
949 TBD
950
951
9521.13.2 BGNSUB - Begin Subroutine
953
954 TBD
955
956
9571.13.3 ENDLOOP - End a Loop
958
959 TBD
960
961
9621.13.4 ENDSUB - End Subroutine
963
964 TBD
965
966
Keith Whitwella62aaa72009-12-21 23:25:15 +0000967
9681.13.10 NOP - No Operation
969
970 Do nothing.
971
972
Keith Whitwella62aaa72009-12-21 23:25:15 +0000973
9741.16.7 NRM4 - 4-component Vector Normalise
975
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800976.. math::
977
Keith Whitwella62aaa72009-12-21 23:25:15 +0000978 dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
979 dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
980 dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
981 dst.w = src.w / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
982
983
Keith Whitwella62aaa72009-12-21 23:25:15 +00009841.17 ps_2_x
985------------
986
987
Keith Whitwella62aaa72009-12-21 23:25:15 +00009881.17.2 CALLNZ - Subroutine Call If Not Zero
989
990 TBD
991
992
9931.17.3 IFC - If
994
995 TBD
996
997
Keith Whitwella62aaa72009-12-21 23:25:15 +00009981.17.5 BREAKC - Break Conditional
999
1000 TBD
1001
1002
Keith Whitwella62aaa72009-12-21 23:25:15 +000010032 Explanation of symbols used
1004==============================
1005
1006
10072.1 Functions
1008--------------
1009
1010
1011 abs(x) Absolute value of x.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001012 (x < 0.0) ? -x : x
1013
1014 ceil(x) Ceiling of x.
1015
1016 clamp(x,y,z) Clamp x between y and z.
1017 (x < y) ? y : (x > z) ? z : x
1018
Corbin Simpsond92a6852009-12-21 19:30:29 -08001019 :math:`\lfloor x\rfloor` Floor of x.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001020
1021 lg2(x) Logarithm base 2 of x.
1022
1023 max(x,y) Maximum of x and y.
1024 (x > y) ? x : y
1025
1026 min(x,y) Minimum of x and y.
1027 (x < y) ? x : y
1028
1029 partialx(x) Derivative of x relative to fragment's X.
1030
1031 partialy(x) Derivative of x relative to fragment's Y.
1032
1033 pop() Pop from stack.
1034
1035 pow(x,y) Raise x to power of y.
1036
1037 push(x) Push x on stack.
1038
1039 round(x) Round x.
1040
Keith Whitwella62aaa72009-12-21 23:25:15 +00001041 sqrt(x) Square root of x.
1042
1043 trunc(x) Truncate x.
1044
1045
10462.2 Keywords
1047-------------
1048
1049
1050 discard Discard fragment.
1051
1052 dst First destination register.
1053
1054 dst0 First destination register.
1055
1056 pc Program counter.
1057
1058 src First source register.
1059
1060 src0 First source register.
1061
1062 src1 Second source register.
1063
1064 src2 Third source register.
1065
1066 target Label of target instruction.
1067
1068
10693 Other tokens
1070===============
1071
1072
10733.1 Declaration Semantic
1074-------------------------
1075
1076
1077 Follows Declaration token if Semantic bit is set.
1078
1079 Since its purpose is to link a shader with other stages of the pipeline,
1080 it is valid to follow only those Declaration tokens that declare a register
1081 either in INPUT or OUTPUT file.
1082
1083 SemanticName field contains the semantic name of the register being declared.
1084 There is no default value.
1085
1086 SemanticIndex is an optional subscript that can be used to distinguish
1087 different register declarations with the same semantic name. The default value
1088 is 0.
1089
1090 The meanings of the individual semantic names are explained in the following
1091 sections.
1092
1093
10943.1.1 FACE
1095
1096 Valid only in a fragment shader INPUT declaration.
1097
1098 FACE.x is negative when the primitive is back facing. FACE.x is positive
1099 when the primitive is front facing.