blob: c62ad6541b1115d96e250e80c2ab2cc35f7295dc [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
Corbin Simpsondd801e52009-12-21 19:41:09 -080047 dst.z = (src.x > 0.0) ? 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
Corbin Simpsondd801e52009-12-21 19:41:09 -080069 dst.x = 1.0 / \sqrt{abs(src.x)}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080070
Corbin Simpsondd801e52009-12-21 19:41:09 -080071 dst.y = 1.0 / \sqrt{abs(src.x)}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080072
Corbin Simpsondd801e52009-12-21 19:41:09 -080073 dst.z = 1.0 / \sqrt{abs(src.x)}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080074
Corbin Simpsondd801e52009-12-21 19:41:09 -080075 dst.w = 1.0 / \sqrt{abs(src.x)}
Keith Whitwella62aaa72009-12-21 23:25:15 +000076
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 Simpsondd801e52009-12-21 19:41:09 -080082 dst.x = 2^{\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
Corbin Simpsondd801e52009-12-21 19:41:09 -080086 dst.z = 2^{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 Simpsondd801e52009-12-21 19:41:09 -080097 dst.y = abs(src.x) / 2^{\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
Corbin Simpsondd801e52009-12-21 19:41:09 -0800334EX2 - Exponential Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000335
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800336.. math::
337
Corbin Simpsondd801e52009-12-21 19:41:09 -0800338 dst.x = 2^{src.x}
339
340 dst.y = 2^{src.x}
341
342 dst.z = 2^{src.x}
343
344 dst.w = 2^{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000345
346
Keith Whitwell14eacb02009-12-21 23:38:29 +00003471.3.11 LG2 - Logarithm Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000348
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800349.. math::
350
Keith Whitwella62aaa72009-12-21 23:25:15 +0000351 dst.x = lg2(src.x)
352 dst.y = lg2(src.x)
353 dst.z = lg2(src.x)
354 dst.w = lg2(src.x)
355
356
Corbin Simpsondd801e52009-12-21 19:41:09 -0800357POW - Power
Keith Whitwella62aaa72009-12-21 23:25:15 +0000358
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800359.. math::
360
Corbin Simpsondd801e52009-12-21 19:41:09 -0800361 dst.x = src0.x^{src1.x}
362
363 dst.y = src0.x^{src1.x}
364
365 dst.z = src0.x^{src1.x}
366
367 dst.w = src0.x^{src1.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000368
Keith Whitwell14eacb02009-12-21 23:38:29 +00003691.3.15 XPD - Cross Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000370
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800371.. math::
372
Keith Whitwella62aaa72009-12-21 23:25:15 +0000373 dst.x = src0.y * src1.z - src1.y * src0.z
374 dst.y = src0.z * src1.x - src1.z * src0.x
375 dst.z = src0.x * src1.y - src1.x * src0.y
376 dst.w = 1.0
377
378
Keith Whitwella62aaa72009-12-21 23:25:15 +00003791.4.1 ABS - Absolute
380
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800381.. math::
382
Keith Whitwella62aaa72009-12-21 23:25:15 +0000383 dst.x = abs(src.x)
384 dst.y = abs(src.y)
385 dst.z = abs(src.z)
386 dst.w = abs(src.w)
387
388
3891.4.2 RCC - Reciprocal Clamped
390
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800391.. math::
392
Keith Whitwella62aaa72009-12-21 23:25:15 +0000393 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)
394 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)
395 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)
396 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)
397
398
3991.4.3 DPH - Homogeneous Dot Product
400
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800401.. math::
402
Keith Whitwella62aaa72009-12-21 23:25:15 +0000403 dst.x = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
404 dst.y = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
405 dst.z = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
406 dst.w = src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w
407
408
Corbin Simpsond92a6852009-12-21 19:30:29 -0800409COS - Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000410
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800411.. math::
412
Corbin Simpsond92a6852009-12-21 19:30:29 -0800413 dst.x = \cos{src.x}
414
415 dst.y = \cos{src.x}
416
417 dst.z = \cos{src.x}
418
419 dst.w = \cos{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000420
421
4221.5.2 DDX - Derivative Relative To X
423
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800424.. math::
425
Keith Whitwella62aaa72009-12-21 23:25:15 +0000426 dst.x = partialx(src.x)
427 dst.y = partialx(src.y)
428 dst.z = partialx(src.z)
429 dst.w = partialx(src.w)
430
431
4321.5.3 DDY - Derivative Relative To Y
433
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800434.. math::
435
Keith Whitwella62aaa72009-12-21 23:25:15 +0000436 dst.x = partialy(src.x)
437 dst.y = partialy(src.y)
438 dst.z = partialy(src.z)
439 dst.w = partialy(src.w)
440
441
Keith Whitwella62aaa72009-12-21 23:25:15 +00004421.5.7 KILP - Predicated Discard
443
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800444.. math::
445
Keith Whitwella62aaa72009-12-21 23:25:15 +0000446 discard
447
448
Keith Whitwella62aaa72009-12-21 23:25:15 +00004491.5.10 PK2H - Pack Two 16-bit Floats
450
451 TBD
452
453
4541.5.11 PK2US - Pack Two Unsigned 16-bit Scalars
455
456 TBD
457
458
4591.5.12 PK4B - Pack Four Signed 8-bit Scalars
460
461 TBD
462
463
4641.5.13 PK4UB - Pack Four Unsigned 8-bit Scalars
465
466 TBD
467
468
Keith Whitwella62aaa72009-12-21 23:25:15 +00004691.5.15 RFL - Reflection Vector
470
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800471.. math::
472
Keith Whitwella62aaa72009-12-21 23:25:15 +0000473 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
474 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
475 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
476 dst.w = 1.0
477
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800478Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000479
Keith Whitwella62aaa72009-12-21 23:25:15 +0000480
4811.5.16 SEQ - Set On Equal
482
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800483.. math::
484
Keith Whitwella62aaa72009-12-21 23:25:15 +0000485 dst.x = (src0.x == src1.x) ? 1.0 : 0.0
486 dst.y = (src0.y == src1.y) ? 1.0 : 0.0
487 dst.z = (src0.z == src1.z) ? 1.0 : 0.0
488 dst.w = (src0.w == src1.w) ? 1.0 : 0.0
489
490
4911.5.17 SFL - Set On False
492
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800493.. math::
494
Keith Whitwella62aaa72009-12-21 23:25:15 +0000495 dst.x = 0.0
496 dst.y = 0.0
497 dst.z = 0.0
498 dst.w = 0.0
499
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800500Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000501
5021.5.18 SGT - Set On Greater Than
503
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800504.. math::
505
Keith Whitwella62aaa72009-12-21 23:25:15 +0000506 dst.x = (src0.x > src1.x) ? 1.0 : 0.0
507 dst.y = (src0.y > src1.y) ? 1.0 : 0.0
508 dst.z = (src0.z > src1.z) ? 1.0 : 0.0
509 dst.w = (src0.w > src1.w) ? 1.0 : 0.0
510
511
Corbin Simpsond92a6852009-12-21 19:30:29 -0800512SIN - Sine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000513
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800514.. math::
515
Corbin Simpsond92a6852009-12-21 19:30:29 -0800516 dst.x = \sin{src.x}
517
518 dst.y = \sin{src.x}
519
520 dst.z = \sin{src.x}
521
522 dst.w = \sin{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000523
524
5251.5.20 SLE - Set On Less Equal Than
526
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800527.. math::
528
Keith Whitwella62aaa72009-12-21 23:25:15 +0000529 dst.x = (src0.x <= src1.x) ? 1.0 : 0.0
530 dst.y = (src0.y <= src1.y) ? 1.0 : 0.0
531 dst.z = (src0.z <= src1.z) ? 1.0 : 0.0
532 dst.w = (src0.w <= src1.w) ? 1.0 : 0.0
533
534
5351.5.21 SNE - Set On Not Equal
536
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800537.. math::
538
Keith Whitwella62aaa72009-12-21 23:25:15 +0000539 dst.x = (src0.x != src1.x) ? 1.0 : 0.0
540 dst.y = (src0.y != src1.y) ? 1.0 : 0.0
541 dst.z = (src0.z != src1.z) ? 1.0 : 0.0
542 dst.w = (src0.w != src1.w) ? 1.0 : 0.0
543
544
5451.5.22 STR - Set On True
546
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800547.. math::
548
Keith Whitwella62aaa72009-12-21 23:25:15 +0000549 dst.x = 1.0
550 dst.y = 1.0
551 dst.z = 1.0
552 dst.w = 1.0
553
554
5551.5.23 TEX - Texture Lookup
556
557 TBD
558
559
5601.5.24 TXD - Texture Lookup with Derivatives
561
562 TBD
563
564
5651.5.25 TXP - Projective Texture Lookup
566
567 TBD
568
569
5701.5.26 UP2H - Unpack Two 16-Bit Floats
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.27 UP2US - Unpack Two Unsigned 16-Bit Scalars
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.28 UP4B - Unpack Four Signed 8-Bit Values
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.29 UP4UB - Unpack Four Unsigned 8-Bit Scalars
589
590 TBD
591
Keith Whitwell14eacb02009-12-21 23:38:29 +0000592 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000593
5941.5.30 X2D - 2D Coordinate Transformation
595
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800596.. math::
597
Keith Whitwella62aaa72009-12-21 23:25:15 +0000598 dst.x = src0.x + src1.x * src2.x + src1.y * src2.y
599 dst.y = src0.y + src1.x * src2.z + src1.y * src2.w
600 dst.z = src0.x + src1.x * src2.x + src1.y * src2.y
601 dst.w = src0.y + src1.x * src2.z + src1.y * src2.w
602
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800603Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000604
Keith Whitwella62aaa72009-12-21 23:25:15 +0000605
6061.6 GL_NV_vertex_program2
607--------------------------
608
609
6101.6.1 ARA - Address Register Add
611
612 TBD
613
Keith Whitwell14eacb02009-12-21 23:38:29 +0000614 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000615
6161.6.2 ARR - Address Register Load With Round
617
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800618.. math::
619
Keith Whitwella62aaa72009-12-21 23:25:15 +0000620 dst.x = round(src.x)
621 dst.y = round(src.y)
622 dst.z = round(src.z)
623 dst.w = round(src.w)
624
625
6261.6.3 BRA - Branch
627
628 pc = target
629
Keith Whitwell14eacb02009-12-21 23:38:29 +0000630 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000631
6321.6.4 CAL - Subroutine Call
633
634 push(pc)
635 pc = target
636
637
6381.6.5 RET - Subroutine Call Return
639
640 pc = pop()
641
Keith Whitwell14eacb02009-12-21 23:38:29 +0000642 Potential restrictions:
643 * Only occurs at end of function.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000644
6451.6.6 SSG - Set Sign
646
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800647.. math::
648
Keith Whitwella62aaa72009-12-21 23:25:15 +0000649 dst.x = (src.x > 0.0) ? 1.0 : (src.x < 0.0) ? -1.0 : 0.0
650 dst.y = (src.y > 0.0) ? 1.0 : (src.y < 0.0) ? -1.0 : 0.0
651 dst.z = (src.z > 0.0) ? 1.0 : (src.z < 0.0) ? -1.0 : 0.0
652 dst.w = (src.w > 0.0) ? 1.0 : (src.w < 0.0) ? -1.0 : 0.0
653
654
Keith Whitwella62aaa72009-12-21 23:25:15 +00006551.8.1 CMP - Compare
656
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800657.. math::
658
Keith Whitwella62aaa72009-12-21 23:25:15 +0000659 dst.x = (src0.x < 0.0) ? src1.x : src2.x
660 dst.y = (src0.y < 0.0) ? src1.y : src2.y
661 dst.z = (src0.z < 0.0) ? src1.z : src2.z
662 dst.w = (src0.w < 0.0) ? src1.w : src2.w
663
664
6651.8.2 KIL - Conditional Discard
666
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800667.. math::
668
Keith Whitwella62aaa72009-12-21 23:25:15 +0000669 if (src.x < 0.0 || src.y < 0.0 || src.z < 0.0 || src.w < 0.0)
670 discard
671 endif
672
673
Corbin Simpsond92a6852009-12-21 19:30:29 -0800674SCS - Sine Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000675
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800676.. math::
677
Corbin Simpsond92a6852009-12-21 19:30:29 -0800678 dst.x = \cos{src.x}
679
680 dst.y = \sin{src.x}
681
Keith Whitwella62aaa72009-12-21 23:25:15 +0000682 dst.z = 0.0
Corbin Simpsond92a6852009-12-21 19:30:29 -0800683
Keith Whitwella62aaa72009-12-21 23:25:15 +0000684 dst.y = 1.0
685
686
6871.8.4 TXB - Texture Lookup With Bias
688
689 TBD
690
691
Keith Whitwella62aaa72009-12-21 23:25:15 +00006921.9.1 NRM - 3-component Vector Normalise
693
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800694.. math::
695
Keith Whitwella62aaa72009-12-21 23:25:15 +0000696 dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z)
697 dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z)
698 dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z)
699 dst.w = 1.0
700
701
7021.9.2 DIV - Divide
703
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800704.. math::
705
Keith Whitwella62aaa72009-12-21 23:25:15 +0000706 dst.x = src0.x / src1.x
707 dst.y = src0.y / src1.y
708 dst.z = src0.z / src1.z
709 dst.w = src0.w / src1.w
710
711
7121.9.3 DP2 - 2-component Dot Product
713
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800714.. math::
715
Keith Whitwella62aaa72009-12-21 23:25:15 +0000716 dst.x = src0.x * src1.x + src0.y * src1.y
717 dst.y = src0.x * src1.x + src0.y * src1.y
718 dst.z = src0.x * src1.x + src0.y * src1.y
719 dst.w = src0.x * src1.x + src0.y * src1.y
720
721
Keith Whitwella62aaa72009-12-21 23:25:15 +00007221.9.5 TXL - Texture Lookup With LOD
723
724 TBD
725
726
7271.9.6 BRK - Break
728
729 TBD
730
731
7321.9.7 IF - If
733
734 TBD
735
736
7371.9.8 BGNFOR - Begin a For-Loop
738
739 dst.x = floor(src.x)
740 dst.y = floor(src.y)
741 dst.z = floor(src.z)
742
743 if (dst.y <= 0)
744 pc = [matching ENDFOR] + 1
745 endif
746
747 Note: The destination must be a loop register.
748 The source must be a constant register.
749
Keith Whitwell14eacb02009-12-21 23:38:29 +0000750 Considered for cleanup / removal.
751
Keith Whitwella62aaa72009-12-21 23:25:15 +0000752
7531.9.9 REP - Repeat
754
755 TBD
756
757
7581.9.10 ELSE - Else
759
760 TBD
761
762
7631.9.11 ENDIF - End If
764
765 TBD
766
767
7681.9.12 ENDFOR - End a For-Loop
769
770 dst.x = dst.x + dst.z
771 dst.y = dst.y - 1.0
772
773 if (dst.y > 0)
774 pc = [matching BGNFOR instruction] + 1
775 endif
776
777 Note: The destination must be a loop register.
778
Keith Whitwell14eacb02009-12-21 23:38:29 +0000779 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000780
7811.9.13 ENDREP - End Repeat
782
783 TBD
784
785
Keith Whitwella62aaa72009-12-21 23:25:15 +00007861.10.1 PUSHA - Push Address Register On Stack
787
788 push(src.x)
789 push(src.y)
790 push(src.z)
791 push(src.w)
792
Keith Whitwell14eacb02009-12-21 23:38:29 +0000793 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000794
7951.10.2 POPA - Pop Address Register From Stack
796
797 dst.w = pop()
798 dst.z = pop()
799 dst.y = pop()
800 dst.x = pop()
801
Keith Whitwell14eacb02009-12-21 23:38:29 +0000802 Considered for cleanup / removal.
803
Keith Whitwella62aaa72009-12-21 23:25:15 +0000804
8051.11 GL_NV_gpu_program4
806------------------------
807
Keith Whitwell14eacb02009-12-21 23:38:29 +0000808Support for these opcodes indicated by a special pipe capability bit (TBD).
Keith Whitwella62aaa72009-12-21 23:25:15 +0000809
8101.11.1 CEIL - Ceiling
811
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800812.. math::
813
Keith Whitwella62aaa72009-12-21 23:25:15 +0000814 dst.x = ceil(src.x)
815 dst.y = ceil(src.y)
816 dst.z = ceil(src.z)
817 dst.w = ceil(src.w)
818
819
8201.11.2 I2F - Integer To Float
821
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800822.. math::
823
Keith Whitwella62aaa72009-12-21 23:25:15 +0000824 dst.x = (float) src.x
825 dst.y = (float) src.y
826 dst.z = (float) src.z
827 dst.w = (float) src.w
828
829
8301.11.3 NOT - Bitwise Not
831
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800832.. math::
833
Keith Whitwella62aaa72009-12-21 23:25:15 +0000834 dst.x = ~src.x
835 dst.y = ~src.y
836 dst.z = ~src.z
837 dst.w = ~src.w
838
839
8401.11.4 TRUNC - Truncate
841
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800842.. math::
843
Keith Whitwella62aaa72009-12-21 23:25:15 +0000844 dst.x = trunc(src.x)
845 dst.y = trunc(src.y)
846 dst.z = trunc(src.z)
847 dst.w = trunc(src.w)
848
849
8501.11.5 SHL - Shift Left
851
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800852.. math::
853
Keith Whitwella62aaa72009-12-21 23:25:15 +0000854 dst.x = src0.x << src1.x
855 dst.y = src0.y << src1.x
856 dst.z = src0.z << src1.x
857 dst.w = src0.w << src1.x
858
859
8601.11.6 SHR - Shift Right
861
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800862.. math::
863
Keith Whitwella62aaa72009-12-21 23:25:15 +0000864 dst.x = src0.x >> src1.x
865 dst.y = src0.y >> src1.x
866 dst.z = src0.z >> src1.x
867 dst.w = src0.w >> src1.x
868
869
8701.11.7 AND - Bitwise And
871
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800872.. math::
873
Keith Whitwella62aaa72009-12-21 23:25:15 +0000874 dst.x = src0.x & src1.x
875 dst.y = src0.y & src1.y
876 dst.z = src0.z & src1.z
877 dst.w = src0.w & src1.w
878
879
8801.11.8 OR - Bitwise Or
881
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800882.. math::
883
Keith Whitwella62aaa72009-12-21 23:25:15 +0000884 dst.x = src0.x | src1.x
885 dst.y = src0.y | src1.y
886 dst.z = src0.z | src1.z
887 dst.w = src0.w | src1.w
888
889
8901.11.9 MOD - Modulus
891
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800892.. math::
893
Keith Whitwella62aaa72009-12-21 23:25:15 +0000894 dst.x = src0.x % src1.x
895 dst.y = src0.y % src1.y
896 dst.z = src0.z % src1.z
897 dst.w = src0.w % src1.w
898
899
9001.11.10 XOR - Bitwise Xor
901
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800902.. math::
903
Keith Whitwella62aaa72009-12-21 23:25:15 +0000904 dst.x = src0.x ^ src1.x
905 dst.y = src0.y ^ src1.y
906 dst.z = src0.z ^ src1.z
907 dst.w = src0.w ^ src1.w
908
909
9101.11.11 SAD - Sum Of Absolute Differences
911
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800912.. math::
913
Keith Whitwella62aaa72009-12-21 23:25:15 +0000914 dst.x = abs(src0.x - src1.x) + src2.x
915 dst.y = abs(src0.y - src1.y) + src2.y
916 dst.z = abs(src0.z - src1.z) + src2.z
917 dst.w = abs(src0.w - src1.w) + src2.w
918
919
9201.11.12 TXF - Texel Fetch
921
922 TBD
923
924
9251.11.13 TXQ - Texture Size Query
926
927 TBD
928
929
9301.11.14 CONT - Continue
931
932 TBD
933
934
9351.12 GL_NV_geometry_program4
936-----------------------------
937
938
9391.12.1 EMIT - Emit
940
941 TBD
942
943
9441.12.2 ENDPRIM - End Primitive
945
946 TBD
947
948
9491.13 GLSL
950----------
951
952
9531.13.1 BGNLOOP - Begin a Loop
954
955 TBD
956
957
9581.13.2 BGNSUB - Begin Subroutine
959
960 TBD
961
962
9631.13.3 ENDLOOP - End a Loop
964
965 TBD
966
967
9681.13.4 ENDSUB - End Subroutine
969
970 TBD
971
972
Keith Whitwella62aaa72009-12-21 23:25:15 +0000973
9741.13.10 NOP - No Operation
975
976 Do nothing.
977
978
Keith Whitwella62aaa72009-12-21 23:25:15 +0000979
9801.16.7 NRM4 - 4-component Vector Normalise
981
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800982.. math::
983
Keith Whitwella62aaa72009-12-21 23:25:15 +0000984 dst.x = src.x / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
985 dst.y = src.y / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
986 dst.z = src.z / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
987 dst.w = src.w / (src.x * src.x + src.y * src.y + src.z * src.z + src.w * src.w)
988
989
Keith Whitwella62aaa72009-12-21 23:25:15 +00009901.17 ps_2_x
991------------
992
993
Keith Whitwella62aaa72009-12-21 23:25:15 +00009941.17.2 CALLNZ - Subroutine Call If Not Zero
995
996 TBD
997
998
9991.17.3 IFC - If
1000
1001 TBD
1002
1003
Keith Whitwella62aaa72009-12-21 23:25:15 +000010041.17.5 BREAKC - Break Conditional
1005
1006 TBD
1007
1008
Keith Whitwella62aaa72009-12-21 23:25:15 +000010092 Explanation of symbols used
1010==============================
1011
1012
10132.1 Functions
1014--------------
1015
1016
1017 abs(x) Absolute value of x.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001018 (x < 0.0) ? -x : x
1019
1020 ceil(x) Ceiling of x.
1021
1022 clamp(x,y,z) Clamp x between y and z.
1023 (x < y) ? y : (x > z) ? z : x
1024
Corbin Simpsondd801e52009-12-21 19:41:09 -08001025 :math:`\lfloor x\rfloor` Floor of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001026
1027 lg2(x) Logarithm base 2 of x.
1028
1029 max(x,y) Maximum of x and y.
1030 (x > y) ? x : y
1031
1032 min(x,y) Minimum of x and y.
1033 (x < y) ? x : y
1034
1035 partialx(x) Derivative of x relative to fragment's X.
1036
1037 partialy(x) Derivative of x relative to fragment's Y.
1038
1039 pop() Pop from stack.
1040
Corbin Simpsondd801e52009-12-21 19:41:09 -08001041 :math:`x^y` `x` to the power `y`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001042
1043 push(x) Push x on stack.
1044
1045 round(x) Round x.
1046
Keith Whitwella62aaa72009-12-21 23:25:15 +00001047 trunc(x) Truncate x.
1048
1049
10502.2 Keywords
1051-------------
1052
1053
1054 discard Discard fragment.
1055
1056 dst First destination register.
1057
1058 dst0 First destination register.
1059
1060 pc Program counter.
1061
1062 src First source register.
1063
1064 src0 First source register.
1065
1066 src1 Second source register.
1067
1068 src2 Third source register.
1069
1070 target Label of target instruction.
1071
1072
10733 Other tokens
1074===============
1075
1076
10773.1 Declaration Semantic
1078-------------------------
1079
1080
1081 Follows Declaration token if Semantic bit is set.
1082
1083 Since its purpose is to link a shader with other stages of the pipeline,
1084 it is valid to follow only those Declaration tokens that declare a register
1085 either in INPUT or OUTPUT file.
1086
1087 SemanticName field contains the semantic name of the register being declared.
1088 There is no default value.
1089
1090 SemanticIndex is an optional subscript that can be used to distinguish
1091 different register declarations with the same semantic name. The default value
1092 is 0.
1093
1094 The meanings of the individual semantic names are explained in the following
1095 sections.
1096
1097
10983.1.1 FACE
1099
1100 Valid only in a fragment shader INPUT declaration.
1101
1102 FACE.x is negative when the primitive is back facing. FACE.x is positive
1103 when the primitive is front facing.