blob: de27d8a0050531633ef801bea7fbeb1ca798d9ee [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
Corbin Simpsonda65ac62009-12-21 20:32:46 -080043 dst.x = 1
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080044
Corbin Simpsonda65ac62009-12-21 20:32:46 -080045 dst.y = max(src.x, 0)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080046
Corbin Simpsonda65ac62009-12-21 20:32:46 -080047 dst.z = (src.x > 0) ? max(src.y, 0)^{clamp(src.w, -128, 128))} : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080048
Corbin Simpsonda65ac62009-12-21 20:32:46 -080049 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +000050
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
Corbin Simpsonda65ac62009-12-21 20:32:46 -080088 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +000089
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
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800160 dst.x = 1
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
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800199 dst.x = (src0.x < src1.x) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800200
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800201 dst.y = (src0.y < src1.y) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800202
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800203 dst.z = (src0.z < src1.z) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800204
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800205 dst.w = (src0.w < src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000206
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
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800212 dst.x = (src0.x >= src1.x) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800213
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800214 dst.y = (src0.y >= src1.y) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800215
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800216 dst.z = (src0.z >= src1.z) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800217
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800218 dst.w = (src0.w >= src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000219
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)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800304
Keith Whitwella62aaa72009-12-21 23:25:15 +0000305 dst.y = clamp(src0.y, src1.y, src2.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800306
Keith Whitwella62aaa72009-12-21 23:25:15 +0000307 dst.z = clamp(src0.z, src1.z, src2.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800308
Keith Whitwella62aaa72009-12-21 23:25:15 +0000309 dst.w = clamp(src0.w, src1.w, src2.w)
310
311
Corbin Simpsond92a6852009-12-21 19:30:29 -0800312FLR - Floor
313
314This is identical to ARL.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000315
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800316.. math::
317
Corbin Simpsond92a6852009-12-21 19:30:29 -0800318 dst.x = \lfloor src.x\rfloor
319
320 dst.y = \lfloor src.y\rfloor
321
322 dst.z = \lfloor src.z\rfloor
323
324 dst.w = \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000325
326
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800327ROUND - Round
Keith Whitwella62aaa72009-12-21 23:25:15 +0000328
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800329.. math::
330
Keith Whitwella62aaa72009-12-21 23:25:15 +0000331 dst.x = round(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800332
Keith Whitwella62aaa72009-12-21 23:25:15 +0000333 dst.y = round(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800334
Keith Whitwella62aaa72009-12-21 23:25:15 +0000335 dst.z = round(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800336
Keith Whitwella62aaa72009-12-21 23:25:15 +0000337 dst.w = round(src.w)
338
339
Corbin Simpsondd801e52009-12-21 19:41:09 -0800340EX2 - Exponential Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000341
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800342.. math::
343
Corbin Simpsondd801e52009-12-21 19:41:09 -0800344 dst.x = 2^{src.x}
345
346 dst.y = 2^{src.x}
347
348 dst.z = 2^{src.x}
349
350 dst.w = 2^{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000351
352
Corbin Simpson14743ac2009-12-21 19:57:56 -0800353LG2 - Logarithm Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000354
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800355.. math::
356
Corbin Simpson14743ac2009-12-21 19:57:56 -0800357 dst.x = \log_2{src.x}
358
359 dst.y = \log_2{src.x}
360
361 dst.z = \log_2{src.x}
362
363 dst.w = \log_2{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000364
365
Corbin Simpsondd801e52009-12-21 19:41:09 -0800366POW - Power
Keith Whitwella62aaa72009-12-21 23:25:15 +0000367
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800368.. math::
369
Corbin Simpsondd801e52009-12-21 19:41:09 -0800370 dst.x = src0.x^{src1.x}
371
372 dst.y = src0.x^{src1.x}
373
374 dst.z = src0.x^{src1.x}
375
376 dst.w = src0.x^{src1.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000377
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800378XPD - Cross Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000379
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800380.. math::
381
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800382 dst.x = src0.y \times src1.z - src1.y \times src0.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800383
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800384 dst.y = src0.z \times src1.x - src1.z \times src0.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800385
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800386 dst.z = src0.x \times src1.y - src1.x \times src0.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800387
388 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000389
390
Corbin Simpson14743ac2009-12-21 19:57:56 -0800391ABS - Absolute
Keith Whitwella62aaa72009-12-21 23:25:15 +0000392
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800393.. math::
394
Corbin Simpson14743ac2009-12-21 19:57:56 -0800395 dst.x = |src.x|
396
397 dst.y = |src.y|
398
399 dst.z = |src.z|
400
401 dst.w = |src.w|
Keith Whitwella62aaa72009-12-21 23:25:15 +0000402
403
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800404RCC - Reciprocal Clamped
405
406XXX cleanup on aisle three
Keith Whitwella62aaa72009-12-21 23:25:15 +0000407
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800408.. math::
409
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800410 dst.x = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
411
412 dst.y = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
413
414 dst.z = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
415
416 dst.w = (1 / src.x) > 0 ? clamp(1 / src.x, 5.42101e-020, 1.884467e+019) : clamp(1 / src.x, -1.884467e+019, -5.42101e-020)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000417
418
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800419DPH - Homogeneous Dot Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000420
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800421.. math::
422
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800423 dst.x = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800424
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800425 dst.y = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800426
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800427 dst.z = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z + src1.w
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800428
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800429 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 +0000430
431
Corbin Simpsond92a6852009-12-21 19:30:29 -0800432COS - Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000433
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800434.. math::
435
Corbin Simpsond92a6852009-12-21 19:30:29 -0800436 dst.x = \cos{src.x}
437
438 dst.y = \cos{src.x}
439
440 dst.z = \cos{src.x}
441
442 dst.w = \cos{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000443
444
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800445DDX - Derivative Relative To X
Keith Whitwella62aaa72009-12-21 23:25:15 +0000446
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800447.. math::
448
Keith Whitwella62aaa72009-12-21 23:25:15 +0000449 dst.x = partialx(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800450
Keith Whitwella62aaa72009-12-21 23:25:15 +0000451 dst.y = partialx(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800452
Keith Whitwella62aaa72009-12-21 23:25:15 +0000453 dst.z = partialx(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800454
Keith Whitwella62aaa72009-12-21 23:25:15 +0000455 dst.w = partialx(src.w)
456
457
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800458DDY - Derivative Relative To Y
Keith Whitwella62aaa72009-12-21 23:25:15 +0000459
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800460.. math::
461
Keith Whitwella62aaa72009-12-21 23:25:15 +0000462 dst.x = partialy(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800463
Keith Whitwella62aaa72009-12-21 23:25:15 +0000464 dst.y = partialy(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800465
Keith Whitwella62aaa72009-12-21 23:25:15 +0000466 dst.z = partialy(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800467
Keith Whitwella62aaa72009-12-21 23:25:15 +0000468 dst.w = partialy(src.w)
469
470
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800471KILP - Predicated Discard
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800472
Keith Whitwella62aaa72009-12-21 23:25:15 +0000473 discard
474
475
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800476PK2H - Pack Two 16-bit Floats
Keith Whitwella62aaa72009-12-21 23:25:15 +0000477
478 TBD
479
480
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800481PK2US - Pack Two Unsigned 16-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000482
483 TBD
484
485
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800486PK4B - Pack Four Signed 8-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000487
488 TBD
489
490
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800491PK4UB - Pack Four Unsigned 8-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000492
493 TBD
494
495
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800496RFL - Reflection Vector
Keith Whitwella62aaa72009-12-21 23:25:15 +0000497
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800498.. math::
499
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800500 dst.x = 2 \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
501
502 dst.y = 2 \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
503
504 dst.z = 2 \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
505
506 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000507
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800508Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000509
Keith Whitwella62aaa72009-12-21 23:25:15 +0000510
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800511SEQ - Set On Equal
Keith Whitwella62aaa72009-12-21 23:25:15 +0000512
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800513.. math::
514
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800515 dst.x = (src0.x == src1.x) ? 1 : 0
516 dst.y = (src0.y == src1.y) ? 1 : 0
517 dst.z = (src0.z == src1.z) ? 1 : 0
518 dst.w = (src0.w == src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000519
520
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800521SFL - Set On False
Keith Whitwella62aaa72009-12-21 23:25:15 +0000522
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800523.. math::
524
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800525 dst.x = 0
526 dst.y = 0
527 dst.z = 0
528 dst.w = 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000529
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800530Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000531
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800532SGT - Set On Greater Than
Keith Whitwella62aaa72009-12-21 23:25:15 +0000533
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800534.. math::
535
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800536 dst.x = (src0.x > src1.x) ? 1 : 0
537 dst.y = (src0.y > src1.y) ? 1 : 0
538 dst.z = (src0.z > src1.z) ? 1 : 0
539 dst.w = (src0.w > src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000540
541
Corbin Simpsond92a6852009-12-21 19:30:29 -0800542SIN - Sine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000543
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800544.. math::
545
Corbin Simpsond92a6852009-12-21 19:30:29 -0800546 dst.x = \sin{src.x}
547
548 dst.y = \sin{src.x}
549
550 dst.z = \sin{src.x}
551
552 dst.w = \sin{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000553
554
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800555SLE - Set On Less Equal Than
Keith Whitwella62aaa72009-12-21 23:25:15 +0000556
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800557.. math::
558
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800559 dst.x = (src0.x <= src1.x) ? 1 : 0
560 dst.y = (src0.y <= src1.y) ? 1 : 0
561 dst.z = (src0.z <= src1.z) ? 1 : 0
562 dst.w = (src0.w <= src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000563
564
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800565SNE - Set On Not Equal
Keith Whitwella62aaa72009-12-21 23:25:15 +0000566
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800567.. math::
568
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800569 dst.x = (src0.x != src1.x) ? 1 : 0
570 dst.y = (src0.y != src1.y) ? 1 : 0
571 dst.z = (src0.z != src1.z) ? 1 : 0
572 dst.w = (src0.w != src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000573
574
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800575STR - Set On True
Keith Whitwella62aaa72009-12-21 23:25:15 +0000576
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800577.. math::
578
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800579 dst.x = 1
580 dst.y = 1
581 dst.z = 1
582 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000583
584
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800585TEX - Texture Lookup
Keith Whitwella62aaa72009-12-21 23:25:15 +0000586
587 TBD
588
589
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800590TXD - Texture Lookup with Derivatives
Keith Whitwella62aaa72009-12-21 23:25:15 +0000591
592 TBD
593
594
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800595TXP - Projective Texture Lookup
Keith Whitwella62aaa72009-12-21 23:25:15 +0000596
597 TBD
598
599
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800600UP2H - Unpack Two 16-Bit Floats
Keith Whitwella62aaa72009-12-21 23:25:15 +0000601
602 TBD
603
Keith Whitwell14eacb02009-12-21 23:38:29 +0000604 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000605
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800606UP2US - Unpack Two Unsigned 16-Bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000607
608 TBD
609
Keith Whitwell14eacb02009-12-21 23:38:29 +0000610 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000611
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800612UP4B - Unpack Four Signed 8-Bit Values
Keith Whitwella62aaa72009-12-21 23:25:15 +0000613
614 TBD
615
Keith Whitwell14eacb02009-12-21 23:38:29 +0000616 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000617
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800618UP4UB - Unpack Four Unsigned 8-Bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000619
620 TBD
621
Keith Whitwell14eacb02009-12-21 23:38:29 +0000622 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000623
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800624X2D - 2D Coordinate Transformation
Keith Whitwella62aaa72009-12-21 23:25:15 +0000625
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800626.. math::
627
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800628 dst.x = src0.x + src1.x \times src2.x + src1.y \times src2.y
629 dst.y = src0.y + src1.x \times src2.z + src1.y \times src2.w
630 dst.z = src0.x + src1.x \times src2.x + src1.y \times src2.y
631 dst.w = src0.y + src1.x \times src2.z + src1.y \times src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000632
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800633Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000634
Keith Whitwella62aaa72009-12-21 23:25:15 +0000635
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800636GL_NV_vertex_program2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000637--------------------------
638
639
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800640ARA - Address Register Add
Keith Whitwella62aaa72009-12-21 23:25:15 +0000641
642 TBD
643
Keith Whitwell14eacb02009-12-21 23:38:29 +0000644 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000645
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800646ARR - Address Register Load With Round
Keith Whitwella62aaa72009-12-21 23:25:15 +0000647
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800648.. math::
649
Keith Whitwella62aaa72009-12-21 23:25:15 +0000650 dst.x = round(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800651
Keith Whitwella62aaa72009-12-21 23:25:15 +0000652 dst.y = round(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800653
Keith Whitwella62aaa72009-12-21 23:25:15 +0000654 dst.z = round(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800655
Keith Whitwella62aaa72009-12-21 23:25:15 +0000656 dst.w = round(src.w)
657
658
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800659BRA - Branch
Keith Whitwella62aaa72009-12-21 23:25:15 +0000660
661 pc = target
662
Keith Whitwell14eacb02009-12-21 23:38:29 +0000663 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000664
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800665CAL - Subroutine Call
Keith Whitwella62aaa72009-12-21 23:25:15 +0000666
667 push(pc)
668 pc = target
669
670
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800671RET - Subroutine Call Return
Keith Whitwella62aaa72009-12-21 23:25:15 +0000672
673 pc = pop()
674
Keith Whitwell14eacb02009-12-21 23:38:29 +0000675 Potential restrictions:
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800676 \times Only occurs at end of function.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000677
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800678SSG - Set Sign
Keith Whitwella62aaa72009-12-21 23:25:15 +0000679
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800680.. math::
681
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800682 dst.x = (src.x > 0) ? 1 : (src.x < 0) ? -1 : 0
683
684 dst.y = (src.y > 0) ? 1 : (src.y < 0) ? -1 : 0
685
686 dst.z = (src.z > 0) ? 1 : (src.z < 0) ? -1 : 0
687
688 dst.w = (src.w > 0) ? 1 : (src.w < 0) ? -1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000689
690
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800691CMP - Compare
Keith Whitwella62aaa72009-12-21 23:25:15 +0000692
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800693.. math::
694
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800695 dst.x = (src0.x < 0) ? src1.x : src2.x
696
697 dst.y = (src0.y < 0) ? src1.y : src2.y
698
699 dst.z = (src0.z < 0) ? src1.z : src2.z
700
701 dst.w = (src0.w < 0) ? src1.w : src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000702
703
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800704KIL - Conditional Discard
Keith Whitwella62aaa72009-12-21 23:25:15 +0000705
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800706.. math::
707
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800708 if (src.x < 0 || src.y < 0 || src.z < 0 || src.w < 0)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000709 discard
710 endif
711
712
Corbin Simpsond92a6852009-12-21 19:30:29 -0800713SCS - Sine Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000714
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800715.. math::
716
Corbin Simpsond92a6852009-12-21 19:30:29 -0800717 dst.x = \cos{src.x}
718
719 dst.y = \sin{src.x}
720
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800721 dst.z = 0
Corbin Simpsond92a6852009-12-21 19:30:29 -0800722
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800723 dst.y = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000724
725
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800726TXB - Texture Lookup With Bias
Keith Whitwella62aaa72009-12-21 23:25:15 +0000727
728 TBD
729
730
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800731NRM - 3-component Vector Normalise
Keith Whitwella62aaa72009-12-21 23:25:15 +0000732
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800733.. math::
734
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800735 dst.x = src.x / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800736
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800737 dst.y = src.y / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800738
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800739 dst.z = src.z / (src.x \times src.x + src.y \times src.y + src.z \times src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800740
741 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000742
743
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800744DIV - Divide
Keith Whitwella62aaa72009-12-21 23:25:15 +0000745
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800746.. math::
747
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800748 dst.x = \frac{src0.x}{src1.x}
749
750 dst.y = \frac{src0.y}{src1.y}
751
752 dst.z = \frac{src0.z}{src1.z}
753
754 dst.w = \frac{src0.w}{src1.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000755
756
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800757DP2 - 2-component Dot Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000758
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800759.. math::
760
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800761 dst.x = src0.x \times src1.x + src0.y \times src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800762
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800763 dst.y = src0.x \times src1.x + src0.y \times src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800764
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800765 dst.z = src0.x \times src1.x + src0.y \times src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800766
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800767 dst.w = src0.x \times src1.x + src0.y \times src1.y
Keith Whitwella62aaa72009-12-21 23:25:15 +0000768
769
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800770TXL - Texture Lookup With LOD
Keith Whitwella62aaa72009-12-21 23:25:15 +0000771
772 TBD
773
774
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800775BRK - Break
Keith Whitwella62aaa72009-12-21 23:25:15 +0000776
777 TBD
778
779
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800780IF - If
Keith Whitwella62aaa72009-12-21 23:25:15 +0000781
782 TBD
783
784
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800785BGNFOR - Begin a For-Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +0000786
787 dst.x = floor(src.x)
788 dst.y = floor(src.y)
789 dst.z = floor(src.z)
790
791 if (dst.y <= 0)
792 pc = [matching ENDFOR] + 1
793 endif
794
795 Note: The destination must be a loop register.
796 The source must be a constant register.
797
Keith Whitwell14eacb02009-12-21 23:38:29 +0000798 Considered for cleanup / removal.
799
Keith Whitwella62aaa72009-12-21 23:25:15 +0000800
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800801REP - Repeat
Keith Whitwella62aaa72009-12-21 23:25:15 +0000802
803 TBD
804
805
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800806ELSE - Else
Keith Whitwella62aaa72009-12-21 23:25:15 +0000807
808 TBD
809
810
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800811ENDIF - End If
Keith Whitwella62aaa72009-12-21 23:25:15 +0000812
813 TBD
814
815
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800816ENDFOR - End a For-Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +0000817
818 dst.x = dst.x + dst.z
819 dst.y = dst.y - 1.0
820
821 if (dst.y > 0)
822 pc = [matching BGNFOR instruction] + 1
823 endif
824
825 Note: The destination must be a loop register.
826
Keith Whitwell14eacb02009-12-21 23:38:29 +0000827 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000828
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800829ENDREP - End Repeat
Keith Whitwella62aaa72009-12-21 23:25:15 +0000830
831 TBD
832
833
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800834PUSHA - Push Address Register On Stack
Keith Whitwella62aaa72009-12-21 23:25:15 +0000835
836 push(src.x)
837 push(src.y)
838 push(src.z)
839 push(src.w)
840
Keith Whitwell14eacb02009-12-21 23:38:29 +0000841 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000842
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800843POPA - Pop Address Register From Stack
Keith Whitwella62aaa72009-12-21 23:25:15 +0000844
845 dst.w = pop()
846 dst.z = pop()
847 dst.y = pop()
848 dst.x = pop()
849
Keith Whitwell14eacb02009-12-21 23:38:29 +0000850 Considered for cleanup / removal.
851
Keith Whitwella62aaa72009-12-21 23:25:15 +0000852
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800853GL_NV_gpu_program4
Keith Whitwella62aaa72009-12-21 23:25:15 +0000854------------------------
855
Keith Whitwell14eacb02009-12-21 23:38:29 +0000856Support for these opcodes indicated by a special pipe capability bit (TBD).
Keith Whitwella62aaa72009-12-21 23:25:15 +0000857
Corbin Simpson14743ac2009-12-21 19:57:56 -0800858CEIL - Ceiling
Keith Whitwella62aaa72009-12-21 23:25:15 +0000859
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800860.. math::
861
Corbin Simpson14743ac2009-12-21 19:57:56 -0800862 dst.x = \lceil src.x\rceil
863
864 dst.y = \lceil src.y\rceil
865
866 dst.z = \lceil src.z\rceil
867
868 dst.w = \lceil src.w\rceil
Keith Whitwella62aaa72009-12-21 23:25:15 +0000869
870
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800871I2F - Integer To Float
Keith Whitwella62aaa72009-12-21 23:25:15 +0000872
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800873.. math::
874
Keith Whitwella62aaa72009-12-21 23:25:15 +0000875 dst.x = (float) src.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800876
Keith Whitwella62aaa72009-12-21 23:25:15 +0000877 dst.y = (float) src.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800878
Keith Whitwella62aaa72009-12-21 23:25:15 +0000879 dst.z = (float) src.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800880
Keith Whitwella62aaa72009-12-21 23:25:15 +0000881 dst.w = (float) src.w
882
883
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800884NOT - Bitwise Not
Keith Whitwella62aaa72009-12-21 23:25:15 +0000885
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800886.. math::
887
Keith Whitwella62aaa72009-12-21 23:25:15 +0000888 dst.x = ~src.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800889
Keith Whitwella62aaa72009-12-21 23:25:15 +0000890 dst.y = ~src.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800891
Keith Whitwella62aaa72009-12-21 23:25:15 +0000892 dst.z = ~src.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800893
Keith Whitwella62aaa72009-12-21 23:25:15 +0000894 dst.w = ~src.w
895
896
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800897TRUNC - Truncate
898
899XXX how is this different from floor?
Keith Whitwella62aaa72009-12-21 23:25:15 +0000900
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800901.. math::
902
Keith Whitwella62aaa72009-12-21 23:25:15 +0000903 dst.x = trunc(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800904
Keith Whitwella62aaa72009-12-21 23:25:15 +0000905 dst.y = trunc(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800906
Keith Whitwella62aaa72009-12-21 23:25:15 +0000907 dst.z = trunc(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800908
Keith Whitwella62aaa72009-12-21 23:25:15 +0000909 dst.w = trunc(src.w)
910
911
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800912SHL - Shift Left
Keith Whitwella62aaa72009-12-21 23:25:15 +0000913
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800914.. math::
915
Keith Whitwella62aaa72009-12-21 23:25:15 +0000916 dst.x = src0.x << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800917
Keith Whitwella62aaa72009-12-21 23:25:15 +0000918 dst.y = src0.y << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800919
Keith Whitwella62aaa72009-12-21 23:25:15 +0000920 dst.z = src0.z << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800921
Keith Whitwella62aaa72009-12-21 23:25:15 +0000922 dst.w = src0.w << src1.x
923
924
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800925SHR - Shift Right
Keith Whitwella62aaa72009-12-21 23:25:15 +0000926
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800927.. math::
928
Keith Whitwella62aaa72009-12-21 23:25:15 +0000929 dst.x = src0.x >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800930
Keith Whitwella62aaa72009-12-21 23:25:15 +0000931 dst.y = src0.y >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800932
Keith Whitwella62aaa72009-12-21 23:25:15 +0000933 dst.z = src0.z >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800934
Keith Whitwella62aaa72009-12-21 23:25:15 +0000935 dst.w = src0.w >> src1.x
936
937
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800938AND - Bitwise And
Keith Whitwella62aaa72009-12-21 23:25:15 +0000939
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800940.. math::
941
Keith Whitwella62aaa72009-12-21 23:25:15 +0000942 dst.x = src0.x & src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800943
Keith Whitwella62aaa72009-12-21 23:25:15 +0000944 dst.y = src0.y & src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800945
Keith Whitwella62aaa72009-12-21 23:25:15 +0000946 dst.z = src0.z & src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800947
Keith Whitwella62aaa72009-12-21 23:25:15 +0000948 dst.w = src0.w & src1.w
949
950
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800951OR - Bitwise Or
Keith Whitwella62aaa72009-12-21 23:25:15 +0000952
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800953.. math::
954
Keith Whitwella62aaa72009-12-21 23:25:15 +0000955 dst.x = src0.x | src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800956
Keith Whitwella62aaa72009-12-21 23:25:15 +0000957 dst.y = src0.y | src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800958
Keith Whitwella62aaa72009-12-21 23:25:15 +0000959 dst.z = src0.z | src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800960
Keith Whitwella62aaa72009-12-21 23:25:15 +0000961 dst.w = src0.w | src1.w
962
963
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800964MOD - Modulus
Keith Whitwella62aaa72009-12-21 23:25:15 +0000965
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800966.. math::
967
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800968 dst.x = src0.x \bmod src1.x
969
970 dst.y = src0.y \bmod src1.y
971
972 dst.z = src0.z \bmod src1.z
973
974 dst.w = src0.w \bmod src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000975
976
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800977XOR - Bitwise Xor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000978
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800979.. math::
980
Keith Whitwella62aaa72009-12-21 23:25:15 +0000981 dst.x = src0.x ^ src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800982
Keith Whitwella62aaa72009-12-21 23:25:15 +0000983 dst.y = src0.y ^ src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800984
Keith Whitwella62aaa72009-12-21 23:25:15 +0000985 dst.z = src0.z ^ src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800986
Keith Whitwella62aaa72009-12-21 23:25:15 +0000987 dst.w = src0.w ^ src1.w
988
989
Corbin Simpson14743ac2009-12-21 19:57:56 -0800990SAD - Sum Of Absolute Differences
Keith Whitwella62aaa72009-12-21 23:25:15 +0000991
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800992.. math::
993
Corbin Simpson14743ac2009-12-21 19:57:56 -0800994 dst.x = |src0.x - src1.x| + src2.x
995
996 dst.y = |src0.y - src1.y| + src2.y
997
998 dst.z = |src0.z - src1.z| + src2.z
999
1000 dst.w = |src0.w - src1.w| + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +00001001
1002
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001003TXF - Texel Fetch
Keith Whitwella62aaa72009-12-21 23:25:15 +00001004
1005 TBD
1006
1007
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001008TXQ - Texture Size Query
Keith Whitwella62aaa72009-12-21 23:25:15 +00001009
1010 TBD
1011
1012
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001013CONT - Continue
Keith Whitwella62aaa72009-12-21 23:25:15 +00001014
1015 TBD
1016
1017
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001018GL_NV_geometry_program4
Keith Whitwella62aaa72009-12-21 23:25:15 +00001019-----------------------------
1020
1021
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001022EMIT - Emit
Keith Whitwella62aaa72009-12-21 23:25:15 +00001023
1024 TBD
1025
1026
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001027ENDPRIM - End Primitive
Keith Whitwella62aaa72009-12-21 23:25:15 +00001028
1029 TBD
1030
1031
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001032GLSL
Keith Whitwella62aaa72009-12-21 23:25:15 +00001033----------
1034
1035
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001036BGNLOOP - Begin a Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +00001037
1038 TBD
1039
1040
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001041BGNSUB - Begin Subroutine
Keith Whitwella62aaa72009-12-21 23:25:15 +00001042
1043 TBD
1044
1045
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001046ENDLOOP - End a Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +00001047
1048 TBD
1049
1050
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001051ENDSUB - End Subroutine
Keith Whitwella62aaa72009-12-21 23:25:15 +00001052
1053 TBD
1054
1055
Keith Whitwella62aaa72009-12-21 23:25:15 +00001056
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001057NOP - No Operation
Keith Whitwella62aaa72009-12-21 23:25:15 +00001058
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001059 Do nothing.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001060
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001061NRM4 - 4-component Vector Normalise
Keith Whitwella62aaa72009-12-21 23:25:15 +00001062
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001063.. math::
1064
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001065 dst.x = \frac{src.x}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
1066
1067 dst.y = \frac{src.y}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
1068
1069 dst.z = \frac{src.z}{src.x \times src.x + src.y \times src.y + src.z \times src.z + src.w \times src.w}
1070
1071 dst.w = \frac{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 +00001072
1073
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001074ps_2_x
Keith Whitwella62aaa72009-12-21 23:25:15 +00001075------------
1076
1077
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001078CALLNZ - Subroutine Call If Not Zero
Keith Whitwella62aaa72009-12-21 23:25:15 +00001079
1080 TBD
1081
1082
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001083IFC - If
Keith Whitwella62aaa72009-12-21 23:25:15 +00001084
1085 TBD
1086
1087
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001088BREAKC - Break Conditional
Keith Whitwella62aaa72009-12-21 23:25:15 +00001089
1090 TBD
1091
1092
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001093Explanation of symbols used
Keith Whitwella62aaa72009-12-21 23:25:15 +00001094==============================
1095
1096
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001097Functions
Keith Whitwella62aaa72009-12-21 23:25:15 +00001098--------------
1099
1100
Corbin Simpson14743ac2009-12-21 19:57:56 -08001101 :math:`|x|` Absolute value of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001102
Corbin Simpson14743ac2009-12-21 19:57:56 -08001103 :math:`\lceil x \rceil` Ceiling of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001104
1105 clamp(x,y,z) Clamp x between y and z.
1106 (x < y) ? y : (x > z) ? z : x
1107
Corbin Simpsondd801e52009-12-21 19:41:09 -08001108 :math:`\lfloor x\rfloor` Floor of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001109
Corbin Simpson14743ac2009-12-21 19:57:56 -08001110 :math:`\log_2{x}` Logarithm of `x`, base 2.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001111
1112 max(x,y) Maximum of x and y.
1113 (x > y) ? x : y
1114
1115 min(x,y) Minimum of x and y.
1116 (x < y) ? x : y
1117
1118 partialx(x) Derivative of x relative to fragment's X.
1119
1120 partialy(x) Derivative of x relative to fragment's Y.
1121
1122 pop() Pop from stack.
1123
Corbin Simpsondd801e52009-12-21 19:41:09 -08001124 :math:`x^y` `x` to the power `y`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001125
1126 push(x) Push x on stack.
1127
1128 round(x) Round x.
1129
Keith Whitwella62aaa72009-12-21 23:25:15 +00001130 trunc(x) Truncate x.
1131
1132
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001133Keywords
Keith Whitwella62aaa72009-12-21 23:25:15 +00001134-------------
1135
1136
1137 discard Discard fragment.
1138
1139 dst First destination register.
1140
1141 dst0 First destination register.
1142
1143 pc Program counter.
1144
1145 src First source register.
1146
1147 src0 First source register.
1148
1149 src1 Second source register.
1150
1151 src2 Third source register.
1152
1153 target Label of target instruction.
1154
1155
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001156Other tokens
Keith Whitwella62aaa72009-12-21 23:25:15 +00001157===============
1158
1159
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001160Declaration Semantic
Keith Whitwella62aaa72009-12-21 23:25:15 +00001161-------------------------
1162
1163
1164 Follows Declaration token if Semantic bit is set.
1165
1166 Since its purpose is to link a shader with other stages of the pipeline,
1167 it is valid to follow only those Declaration tokens that declare a register
1168 either in INPUT or OUTPUT file.
1169
1170 SemanticName field contains the semantic name of the register being declared.
1171 There is no default value.
1172
1173 SemanticIndex is an optional subscript that can be used to distinguish
1174 different register declarations with the same semantic name. The default value
1175 is 0.
1176
1177 The meanings of the individual semantic names are explained in the following
1178 sections.
1179
1180
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001181FACE
1182^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001183
1184 Valid only in a fragment shader INPUT declaration.
1185
1186 FACE.x is negative when the primitive is back facing. FACE.x is positive
1187 when the primitive is front facing.