blob: 69c29e77d134cd1e4bf8be83c1b68631ca838395 [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
Corbin Simpson14743ac2009-12-21 19:57:56 -080056 dst.x = \frac{1}{src.x}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080057
Corbin Simpson14743ac2009-12-21 19:57:56 -080058 dst.y = \frac{1}{src.x}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080059
Corbin Simpson14743ac2009-12-21 19:57:56 -080060 dst.z = \frac{1}{src.x}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080061
Corbin Simpson14743ac2009-12-21 19:57:56 -080062 dst.w = \frac{1}{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +000063
64
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080065RSQ - Reciprocal Square Root
66
67.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000068
Corbin Simpson14743ac2009-12-21 19:57:56 -080069 dst.x = \frac{1}{\sqrt{|src.x|}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080070
Corbin Simpson14743ac2009-12-21 19:57:56 -080071 dst.y = \frac{1}{\sqrt{|src.x|}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080072
Corbin Simpson14743ac2009-12-21 19:57:56 -080073 dst.z = \frac{1}{\sqrt{|src.x|}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080074
Corbin Simpson14743ac2009-12-21 19:57:56 -080075 dst.w = \frac{1}{\sqrt{|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 Simpson14743ac2009-12-21 19:57:56 -080095 dst.x = \lfloor\log_2{|src.x|}\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080096
Corbin Simpson14743ac2009-12-21 19:57:56 -080097 dst.y = \frac{|src.x|}{2^{\lfloor\log_2{|src.x|}\rfloor}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080098
Corbin Simpson14743ac2009-12-21 19:57:56 -080099 dst.z = \log_2{|src.x|}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800100
Corbin Simpson14743ac2009-12-21 19:57:56 -0800101 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000102
103
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800104MUL - Multiply
105
106.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000107
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800108 dst.x = src0.x \times src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800109
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800110 dst.y = src0.y \times src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800111
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800112 dst.z = src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800113
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800114 dst.w = src0.w \times src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000115
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
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800134 dst.x = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800135
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800136 dst.y = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800137
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800138 dst.z = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800139
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800140 dst.w = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Keith Whitwella62aaa72009-12-21 23:25:15 +0000141
142
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800143DP4 - 4-component Dot Product
144
145.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000146
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800147 dst.x = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800148
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800149 dst.y = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800150
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800151 dst.z = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800152
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800153 dst.w = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src0.w \times src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000154
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
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800162 dst.y = src0.y \times 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
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800225 dst.x = src0.x \times src1.x + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800226
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800227 dst.y = src0.y \times src1.y + src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800228
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800229 dst.z = src0.z \times src1.z + src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800230
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800231 dst.w = src0.w \times src1.w + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000232
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
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800251 dst.x = src0.x \times (src1.x - src2.x) + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800252
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800253 dst.y = src0.y \times (src1.y - src2.y) + src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800254
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800255 dst.z = src0.z \times (src1.z - src2.z) + src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800256
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800257 dst.w = src0.w \times (src1.w - src2.w) + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000258
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
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800277 dst.x = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800278
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800279 dst.y = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800280
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800281 dst.z = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800282
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800283 dst.w = src0.x \times src1.x + src0.y \times src1.y + src2.x
Keith Whitwella62aaa72009-12-21 23:25:15 +0000284
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
Corbin Simpson14743ac2009-12-21 19:57:56 -0800347LG2 - Logarithm Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000348
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800349.. math::
350
Corbin Simpson14743ac2009-12-21 19:57:56 -0800351 dst.x = \log_2{src.x}
352
353 dst.y = \log_2{src.x}
354
355 dst.z = \log_2{src.x}
356
357 dst.w = \log_2{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000358
359
Corbin Simpsondd801e52009-12-21 19:41:09 -0800360POW - Power
Keith Whitwella62aaa72009-12-21 23:25:15 +0000361
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800362.. math::
363
Corbin Simpsondd801e52009-12-21 19:41:09 -0800364 dst.x = src0.x^{src1.x}
365
366 dst.y = src0.x^{src1.x}
367
368 dst.z = src0.x^{src1.x}
369
370 dst.w = src0.x^{src1.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000371
Keith Whitwell14eacb02009-12-21 23:38:29 +00003721.3.15 XPD - Cross Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000373
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800374.. math::
375
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800376 dst.x = src0.y \times src1.z - src1.y \times src0.z
377 dst.y = src0.z \times src1.x - src1.z \times src0.x
378 dst.z = src0.x \times src1.y - src1.x \times src0.y
Keith Whitwella62aaa72009-12-21 23:25:15 +0000379 dst.w = 1.0
380
381
Corbin Simpson14743ac2009-12-21 19:57:56 -0800382ABS - Absolute
Keith Whitwella62aaa72009-12-21 23:25:15 +0000383
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800384.. math::
385
Corbin Simpson14743ac2009-12-21 19:57:56 -0800386 dst.x = |src.x|
387
388 dst.y = |src.y|
389
390 dst.z = |src.z|
391
392 dst.w = |src.w|
Keith Whitwella62aaa72009-12-21 23:25:15 +0000393
394
3951.4.2 RCC - Reciprocal Clamped
396
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800397.. math::
398
Keith Whitwella62aaa72009-12-21 23:25:15 +0000399 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)
400 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)
401 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)
402 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)
403
404
4051.4.3 DPH - Homogeneous Dot Product
406
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800407.. math::
408
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800409 dst.x = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
410 dst.y = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
411 dst.z = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
412 dst.w = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000413
414
Corbin Simpsond92a6852009-12-21 19:30:29 -0800415COS - Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000416
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800417.. math::
418
Corbin Simpsond92a6852009-12-21 19:30:29 -0800419 dst.x = \cos{src.x}
420
421 dst.y = \cos{src.x}
422
423 dst.z = \cos{src.x}
424
425 dst.w = \cos{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000426
427
4281.5.2 DDX - Derivative Relative To X
429
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800430.. math::
431
Keith Whitwella62aaa72009-12-21 23:25:15 +0000432 dst.x = partialx(src.x)
433 dst.y = partialx(src.y)
434 dst.z = partialx(src.z)
435 dst.w = partialx(src.w)
436
437
4381.5.3 DDY - Derivative Relative To Y
439
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800440.. math::
441
Keith Whitwella62aaa72009-12-21 23:25:15 +0000442 dst.x = partialy(src.x)
443 dst.y = partialy(src.y)
444 dst.z = partialy(src.z)
445 dst.w = partialy(src.w)
446
447
Keith Whitwella62aaa72009-12-21 23:25:15 +00004481.5.7 KILP - Predicated Discard
449
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800450.. math::
451
Keith Whitwella62aaa72009-12-21 23:25:15 +0000452 discard
453
454
Keith Whitwella62aaa72009-12-21 23:25:15 +00004551.5.10 PK2H - Pack Two 16-bit Floats
456
457 TBD
458
459
4601.5.11 PK2US - Pack Two Unsigned 16-bit Scalars
461
462 TBD
463
464
4651.5.12 PK4B - Pack Four Signed 8-bit Scalars
466
467 TBD
468
469
4701.5.13 PK4UB - Pack Four Unsigned 8-bit Scalars
471
472 TBD
473
474
Keith Whitwella62aaa72009-12-21 23:25:15 +00004751.5.15 RFL - Reflection Vector
476
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800477.. math::
478
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800479 dst.x = 2.0 \times (src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z) / (src0.x \times src0.x + src0.y \times src0.y + src0.z \times src0.z) \times src0.x - src1.x
480 dst.y = 2.0 \times (src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z) / (src0.x \times src0.x + src0.y \times src0.y + src0.z \times src0.z) \times src0.y - src1.y
481 dst.z = 2.0 \times (src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z) / (src0.x \times src0.x + src0.y \times src0.y + src0.z \times src0.z) \times src0.z - src1.z
Keith Whitwella62aaa72009-12-21 23:25:15 +0000482 dst.w = 1.0
483
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800484Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000485
Keith Whitwella62aaa72009-12-21 23:25:15 +0000486
4871.5.16 SEQ - Set On Equal
488
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800489.. math::
490
Keith Whitwella62aaa72009-12-21 23:25:15 +0000491 dst.x = (src0.x == src1.x) ? 1.0 : 0.0
492 dst.y = (src0.y == src1.y) ? 1.0 : 0.0
493 dst.z = (src0.z == src1.z) ? 1.0 : 0.0
494 dst.w = (src0.w == src1.w) ? 1.0 : 0.0
495
496
4971.5.17 SFL - Set On False
498
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800499.. math::
500
Keith Whitwella62aaa72009-12-21 23:25:15 +0000501 dst.x = 0.0
502 dst.y = 0.0
503 dst.z = 0.0
504 dst.w = 0.0
505
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800506Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000507
5081.5.18 SGT - Set On Greater Than
509
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800510.. math::
511
Keith Whitwella62aaa72009-12-21 23:25:15 +0000512 dst.x = (src0.x > src1.x) ? 1.0 : 0.0
513 dst.y = (src0.y > src1.y) ? 1.0 : 0.0
514 dst.z = (src0.z > src1.z) ? 1.0 : 0.0
515 dst.w = (src0.w > src1.w) ? 1.0 : 0.0
516
517
Corbin Simpsond92a6852009-12-21 19:30:29 -0800518SIN - Sine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000519
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800520.. math::
521
Corbin Simpsond92a6852009-12-21 19:30:29 -0800522 dst.x = \sin{src.x}
523
524 dst.y = \sin{src.x}
525
526 dst.z = \sin{src.x}
527
528 dst.w = \sin{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000529
530
5311.5.20 SLE - Set On Less Equal Than
532
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800533.. math::
534
Keith Whitwella62aaa72009-12-21 23:25:15 +0000535 dst.x = (src0.x <= src1.x) ? 1.0 : 0.0
536 dst.y = (src0.y <= src1.y) ? 1.0 : 0.0
537 dst.z = (src0.z <= src1.z) ? 1.0 : 0.0
538 dst.w = (src0.w <= src1.w) ? 1.0 : 0.0
539
540
5411.5.21 SNE - Set On Not Equal
542
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800543.. math::
544
Keith Whitwella62aaa72009-12-21 23:25:15 +0000545 dst.x = (src0.x != src1.x) ? 1.0 : 0.0
546 dst.y = (src0.y != src1.y) ? 1.0 : 0.0
547 dst.z = (src0.z != src1.z) ? 1.0 : 0.0
548 dst.w = (src0.w != src1.w) ? 1.0 : 0.0
549
550
5511.5.22 STR - Set On True
552
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800553.. math::
554
Keith Whitwella62aaa72009-12-21 23:25:15 +0000555 dst.x = 1.0
556 dst.y = 1.0
557 dst.z = 1.0
558 dst.w = 1.0
559
560
5611.5.23 TEX - Texture Lookup
562
563 TBD
564
565
5661.5.24 TXD - Texture Lookup with Derivatives
567
568 TBD
569
570
5711.5.25 TXP - Projective Texture Lookup
572
573 TBD
574
575
5761.5.26 UP2H - Unpack Two 16-Bit Floats
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.27 UP2US - Unpack Two Unsigned 16-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.28 UP4B - Unpack Four Signed 8-Bit Values
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.29 UP4UB - Unpack Four Unsigned 8-Bit Scalars
595
596 TBD
597
Keith Whitwell14eacb02009-12-21 23:38:29 +0000598 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000599
6001.5.30 X2D - 2D Coordinate Transformation
601
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800602.. math::
603
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800604 dst.x = src0.x + src1.x \times src2.x + src1.y \times src2.y
605 dst.y = src0.y + src1.x \times src2.z + src1.y \times src2.w
606 dst.z = src0.x + src1.x \times src2.x + src1.y \times src2.y
607 dst.w = src0.y + src1.x \times src2.z + src1.y \times src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000608
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800609Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000610
Keith Whitwella62aaa72009-12-21 23:25:15 +0000611
6121.6 GL_NV_vertex_program2
613--------------------------
614
615
6161.6.1 ARA - Address Register Add
617
618 TBD
619
Keith Whitwell14eacb02009-12-21 23:38:29 +0000620 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000621
6221.6.2 ARR - Address Register Load With Round
623
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800624.. math::
625
Keith Whitwella62aaa72009-12-21 23:25:15 +0000626 dst.x = round(src.x)
627 dst.y = round(src.y)
628 dst.z = round(src.z)
629 dst.w = round(src.w)
630
631
6321.6.3 BRA - Branch
633
634 pc = target
635
Keith Whitwell14eacb02009-12-21 23:38:29 +0000636 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000637
6381.6.4 CAL - Subroutine Call
639
640 push(pc)
641 pc = target
642
643
6441.6.5 RET - Subroutine Call Return
645
646 pc = pop()
647
Keith Whitwell14eacb02009-12-21 23:38:29 +0000648 Potential restrictions:
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800649 \times Only occurs at end of function.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000650
6511.6.6 SSG - Set Sign
652
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800653.. math::
654
Keith Whitwella62aaa72009-12-21 23:25:15 +0000655 dst.x = (src.x > 0.0) ? 1.0 : (src.x < 0.0) ? -1.0 : 0.0
656 dst.y = (src.y > 0.0) ? 1.0 : (src.y < 0.0) ? -1.0 : 0.0
657 dst.z = (src.z > 0.0) ? 1.0 : (src.z < 0.0) ? -1.0 : 0.0
658 dst.w = (src.w > 0.0) ? 1.0 : (src.w < 0.0) ? -1.0 : 0.0
659
660
Keith Whitwella62aaa72009-12-21 23:25:15 +00006611.8.1 CMP - Compare
662
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800663.. math::
664
Keith Whitwella62aaa72009-12-21 23:25:15 +0000665 dst.x = (src0.x < 0.0) ? src1.x : src2.x
666 dst.y = (src0.y < 0.0) ? src1.y : src2.y
667 dst.z = (src0.z < 0.0) ? src1.z : src2.z
668 dst.w = (src0.w < 0.0) ? src1.w : src2.w
669
670
6711.8.2 KIL - Conditional Discard
672
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800673.. math::
674
Keith Whitwella62aaa72009-12-21 23:25:15 +0000675 if (src.x < 0.0 || src.y < 0.0 || src.z < 0.0 || src.w < 0.0)
676 discard
677 endif
678
679
Corbin Simpsond92a6852009-12-21 19:30:29 -0800680SCS - Sine Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000681
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800682.. math::
683
Corbin Simpsond92a6852009-12-21 19:30:29 -0800684 dst.x = \cos{src.x}
685
686 dst.y = \sin{src.x}
687
Keith Whitwella62aaa72009-12-21 23:25:15 +0000688 dst.z = 0.0
Corbin Simpsond92a6852009-12-21 19:30:29 -0800689
Keith Whitwella62aaa72009-12-21 23:25:15 +0000690 dst.y = 1.0
691
692
6931.8.4 TXB - Texture Lookup With Bias
694
695 TBD
696
697
Keith Whitwella62aaa72009-12-21 23:25:15 +00006981.9.1 NRM - 3-component Vector Normalise
699
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800700.. math::
701
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800702 dst.x = src.x / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
703 dst.y = src.y / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
704 dst.z = src.z / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000705 dst.w = 1.0
706
707
7081.9.2 DIV - Divide
709
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800710.. math::
711
Keith Whitwella62aaa72009-12-21 23:25:15 +0000712 dst.x = src0.x / src1.x
713 dst.y = src0.y / src1.y
714 dst.z = src0.z / src1.z
715 dst.w = src0.w / src1.w
716
717
7181.9.3 DP2 - 2-component Dot Product
719
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800720.. math::
721
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800722 dst.x = src0.x \times src1.x + src0.y \times src1.y
723 dst.y = src0.x \times src1.x + src0.y \times src1.y
724 dst.z = src0.x \times src1.x + src0.y \times src1.y
725 dst.w = src0.x \times src1.x + src0.y \times src1.y
Keith Whitwella62aaa72009-12-21 23:25:15 +0000726
727
Keith Whitwella62aaa72009-12-21 23:25:15 +00007281.9.5 TXL - Texture Lookup With LOD
729
730 TBD
731
732
7331.9.6 BRK - Break
734
735 TBD
736
737
7381.9.7 IF - If
739
740 TBD
741
742
7431.9.8 BGNFOR - Begin a For-Loop
744
745 dst.x = floor(src.x)
746 dst.y = floor(src.y)
747 dst.z = floor(src.z)
748
749 if (dst.y <= 0)
750 pc = [matching ENDFOR] + 1
751 endif
752
753 Note: The destination must be a loop register.
754 The source must be a constant register.
755
Keith Whitwell14eacb02009-12-21 23:38:29 +0000756 Considered for cleanup / removal.
757
Keith Whitwella62aaa72009-12-21 23:25:15 +0000758
7591.9.9 REP - Repeat
760
761 TBD
762
763
7641.9.10 ELSE - Else
765
766 TBD
767
768
7691.9.11 ENDIF - End If
770
771 TBD
772
773
7741.9.12 ENDFOR - End a For-Loop
775
776 dst.x = dst.x + dst.z
777 dst.y = dst.y - 1.0
778
779 if (dst.y > 0)
780 pc = [matching BGNFOR instruction] + 1
781 endif
782
783 Note: The destination must be a loop register.
784
Keith Whitwell14eacb02009-12-21 23:38:29 +0000785 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000786
7871.9.13 ENDREP - End Repeat
788
789 TBD
790
791
Keith Whitwella62aaa72009-12-21 23:25:15 +00007921.10.1 PUSHA - Push Address Register On Stack
793
794 push(src.x)
795 push(src.y)
796 push(src.z)
797 push(src.w)
798
Keith Whitwell14eacb02009-12-21 23:38:29 +0000799 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000800
8011.10.2 POPA - Pop Address Register From Stack
802
803 dst.w = pop()
804 dst.z = pop()
805 dst.y = pop()
806 dst.x = pop()
807
Keith Whitwell14eacb02009-12-21 23:38:29 +0000808 Considered for cleanup / removal.
809
Keith Whitwella62aaa72009-12-21 23:25:15 +0000810
8111.11 GL_NV_gpu_program4
812------------------------
813
Keith Whitwell14eacb02009-12-21 23:38:29 +0000814Support for these opcodes indicated by a special pipe capability bit (TBD).
Keith Whitwella62aaa72009-12-21 23:25:15 +0000815
Corbin Simpson14743ac2009-12-21 19:57:56 -0800816CEIL - Ceiling
Keith Whitwella62aaa72009-12-21 23:25:15 +0000817
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800818.. math::
819
Corbin Simpson14743ac2009-12-21 19:57:56 -0800820 dst.x = \lceil src.x\rceil
821
822 dst.y = \lceil src.y\rceil
823
824 dst.z = \lceil src.z\rceil
825
826 dst.w = \lceil src.w\rceil
Keith Whitwella62aaa72009-12-21 23:25:15 +0000827
828
8291.11.2 I2F - Integer To Float
830
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800831.. math::
832
Keith Whitwella62aaa72009-12-21 23:25:15 +0000833 dst.x = (float) src.x
834 dst.y = (float) src.y
835 dst.z = (float) src.z
836 dst.w = (float) src.w
837
838
8391.11.3 NOT - Bitwise Not
840
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800841.. math::
842
Keith Whitwella62aaa72009-12-21 23:25:15 +0000843 dst.x = ~src.x
844 dst.y = ~src.y
845 dst.z = ~src.z
846 dst.w = ~src.w
847
848
8491.11.4 TRUNC - Truncate
850
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800851.. math::
852
Keith Whitwella62aaa72009-12-21 23:25:15 +0000853 dst.x = trunc(src.x)
854 dst.y = trunc(src.y)
855 dst.z = trunc(src.z)
856 dst.w = trunc(src.w)
857
858
8591.11.5 SHL - Shift Left
860
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800861.. math::
862
Keith Whitwella62aaa72009-12-21 23:25:15 +0000863 dst.x = src0.x << src1.x
864 dst.y = src0.y << src1.x
865 dst.z = src0.z << src1.x
866 dst.w = src0.w << src1.x
867
868
8691.11.6 SHR - Shift Right
870
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800871.. math::
872
Keith Whitwella62aaa72009-12-21 23:25:15 +0000873 dst.x = src0.x >> src1.x
874 dst.y = src0.y >> src1.x
875 dst.z = src0.z >> src1.x
876 dst.w = src0.w >> src1.x
877
878
8791.11.7 AND - Bitwise And
880
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800881.. math::
882
Keith Whitwella62aaa72009-12-21 23:25:15 +0000883 dst.x = src0.x & src1.x
884 dst.y = src0.y & src1.y
885 dst.z = src0.z & src1.z
886 dst.w = src0.w & src1.w
887
888
8891.11.8 OR - Bitwise Or
890
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800891.. math::
892
Keith Whitwella62aaa72009-12-21 23:25:15 +0000893 dst.x = src0.x | src1.x
894 dst.y = src0.y | src1.y
895 dst.z = src0.z | src1.z
896 dst.w = src0.w | src1.w
897
898
8991.11.9 MOD - Modulus
900
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800901.. math::
902
Keith Whitwella62aaa72009-12-21 23:25:15 +0000903 dst.x = src0.x % src1.x
904 dst.y = src0.y % src1.y
905 dst.z = src0.z % src1.z
906 dst.w = src0.w % src1.w
907
908
9091.11.10 XOR - Bitwise Xor
910
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800911.. math::
912
Keith Whitwella62aaa72009-12-21 23:25:15 +0000913 dst.x = src0.x ^ src1.x
914 dst.y = src0.y ^ src1.y
915 dst.z = src0.z ^ src1.z
916 dst.w = src0.w ^ src1.w
917
918
Corbin Simpson14743ac2009-12-21 19:57:56 -0800919SAD - Sum Of Absolute Differences
Keith Whitwella62aaa72009-12-21 23:25:15 +0000920
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800921.. math::
922
Corbin Simpson14743ac2009-12-21 19:57:56 -0800923 dst.x = |src0.x - src1.x| + src2.x
924
925 dst.y = |src0.y - src1.y| + src2.y
926
927 dst.z = |src0.z - src1.z| + src2.z
928
929 dst.w = |src0.w - src1.w| + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000930
931
9321.11.12 TXF - Texel Fetch
933
934 TBD
935
936
9371.11.13 TXQ - Texture Size Query
938
939 TBD
940
941
9421.11.14 CONT - Continue
943
944 TBD
945
946
9471.12 GL_NV_geometry_program4
948-----------------------------
949
950
9511.12.1 EMIT - Emit
952
953 TBD
954
955
9561.12.2 ENDPRIM - End Primitive
957
958 TBD
959
960
9611.13 GLSL
962----------
963
964
9651.13.1 BGNLOOP - Begin a Loop
966
967 TBD
968
969
9701.13.2 BGNSUB - Begin Subroutine
971
972 TBD
973
974
9751.13.3 ENDLOOP - End a Loop
976
977 TBD
978
979
9801.13.4 ENDSUB - End Subroutine
981
982 TBD
983
984
Keith Whitwella62aaa72009-12-21 23:25:15 +0000985
9861.13.10 NOP - No Operation
987
988 Do nothing.
989
990
Keith Whitwella62aaa72009-12-21 23:25:15 +0000991
9921.16.7 NRM4 - 4-component Vector Normalise
993
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800994.. math::
995
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800996 dst.x = src.x / (src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w)
997 dst.y = src.y / (src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w)
998 dst.z = src.z / (src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w)
999 dst.w = src.w / (src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w)
Keith Whitwella62aaa72009-12-21 23:25:15 +00001000
1001
Keith Whitwella62aaa72009-12-21 23:25:15 +000010021.17 ps_2_x
1003------------
1004
1005
Keith Whitwella62aaa72009-12-21 23:25:15 +000010061.17.2 CALLNZ - Subroutine Call If Not Zero
1007
1008 TBD
1009
1010
10111.17.3 IFC - If
1012
1013 TBD
1014
1015
Keith Whitwella62aaa72009-12-21 23:25:15 +000010161.17.5 BREAKC - Break Conditional
1017
1018 TBD
1019
1020
Keith Whitwella62aaa72009-12-21 23:25:15 +000010212 Explanation of symbols used
1022==============================
1023
1024
10252.1 Functions
1026--------------
1027
1028
Corbin Simpson14743ac2009-12-21 19:57:56 -08001029 :math:`|x|` Absolute value of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001030
Corbin Simpson14743ac2009-12-21 19:57:56 -08001031 :math:`\lceil x \rceil` Ceiling of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001032
1033 clamp(x,y,z) Clamp x between y and z.
1034 (x < y) ? y : (x > z) ? z : x
1035
Corbin Simpsondd801e52009-12-21 19:41:09 -08001036 :math:`\lfloor x\rfloor` Floor of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001037
Corbin Simpson14743ac2009-12-21 19:57:56 -08001038 :math:`\log_2{x}` Logarithm of `x`, base 2.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001039
1040 max(x,y) Maximum of x and y.
1041 (x > y) ? x : y
1042
1043 min(x,y) Minimum of x and y.
1044 (x < y) ? x : y
1045
1046 partialx(x) Derivative of x relative to fragment's X.
1047
1048 partialy(x) Derivative of x relative to fragment's Y.
1049
1050 pop() Pop from stack.
1051
Corbin Simpsondd801e52009-12-21 19:41:09 -08001052 :math:`x^y` `x` to the power `y`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001053
1054 push(x) Push x on stack.
1055
1056 round(x) Round x.
1057
Keith Whitwella62aaa72009-12-21 23:25:15 +00001058 trunc(x) Truncate x.
1059
1060
10612.2 Keywords
1062-------------
1063
1064
1065 discard Discard fragment.
1066
1067 dst First destination register.
1068
1069 dst0 First destination register.
1070
1071 pc Program counter.
1072
1073 src First source register.
1074
1075 src0 First source register.
1076
1077 src1 Second source register.
1078
1079 src2 Third source register.
1080
1081 target Label of target instruction.
1082
1083
10843 Other tokens
1085===============
1086
1087
10883.1 Declaration Semantic
1089-------------------------
1090
1091
1092 Follows Declaration token if Semantic bit is set.
1093
1094 Since its purpose is to link a shader with other stages of the pipeline,
1095 it is valid to follow only those Declaration tokens that declare a register
1096 either in INPUT or OUTPUT file.
1097
1098 SemanticName field contains the semantic name of the register being declared.
1099 There is no default value.
1100
1101 SemanticIndex is an optional subscript that can be used to distinguish
1102 different register declarations with the same semantic name. The default value
1103 is 0.
1104
1105 The meanings of the individual semantic names are explained in the following
1106 sections.
1107
1108
11093.1.1 FACE
1110
1111 Valid only in a fragment shader INPUT declaration.
1112
1113 FACE.x is negative when the primitive is back facing. FACE.x is positive
1114 when the primitive is front facing.