blob: 12c368097349c6f0670adead0ecb21da40edbe14 [file] [log] [blame]
Corbin Simpsonc686e172009-12-20 15:00:40 -08001TGSI
2====
3
Michal Krolb6659682010-01-04 12:52:43 +01004TGSI, Tungsten Graphics Shader Infrastructure, is an intermediate language
Corbin Simpsonc686e172009-12-20 15:00:40 -08005for 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 Simpson5bcd26c2009-12-21 21:04:10 -08009Instruction Set
10---------------
11
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080012From GL_NV_vertex_program
Corbin Simpson5bcd26c2009-12-21 21:04:10 -080013^^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +000014
15
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080016ARL - Address Register Load
17
18.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000019
Corbin Simpsond92a6852009-12-21 19:30:29 -080020 dst.x = \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080021
Corbin Simpsond92a6852009-12-21 19:30:29 -080022 dst.y = \lfloor src.y\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080023
Corbin Simpsond92a6852009-12-21 19:30:29 -080024 dst.z = \lfloor src.z\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080025
Corbin Simpsond92a6852009-12-21 19:30:29 -080026 dst.w = \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +000027
28
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080029MOV - Move
30
31.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000032
33 dst.x = src.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080034
Keith Whitwella62aaa72009-12-21 23:25:15 +000035 dst.y = src.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080036
Keith Whitwella62aaa72009-12-21 23:25:15 +000037 dst.z = src.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080038
Keith Whitwella62aaa72009-12-21 23:25:15 +000039 dst.w = src.w
40
41
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080042LIT - Light Coefficients
43
44.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000045
Corbin Simpsonda65ac62009-12-21 20:32:46 -080046 dst.x = 1
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080047
Corbin Simpsonda65ac62009-12-21 20:32:46 -080048 dst.y = max(src.x, 0)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080049
Corbin Simpsonda65ac62009-12-21 20:32:46 -080050 dst.z = (src.x > 0) ? max(src.y, 0)^{clamp(src.w, -128, 128))} : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080051
Corbin Simpsonda65ac62009-12-21 20:32:46 -080052 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +000053
54
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080055RCP - Reciprocal
56
57.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000058
Corbin Simpson14743ac2009-12-21 19:57:56 -080059 dst.x = \frac{1}{src.x}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080060
Corbin Simpson14743ac2009-12-21 19:57:56 -080061 dst.y = \frac{1}{src.x}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080062
Corbin Simpson14743ac2009-12-21 19:57:56 -080063 dst.z = \frac{1}{src.x}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080064
Corbin Simpson14743ac2009-12-21 19:57:56 -080065 dst.w = \frac{1}{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +000066
67
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080068RSQ - Reciprocal Square Root
69
70.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000071
Corbin Simpson14743ac2009-12-21 19:57:56 -080072 dst.x = \frac{1}{\sqrt{|src.x|}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080073
Corbin Simpson14743ac2009-12-21 19:57:56 -080074 dst.y = \frac{1}{\sqrt{|src.x|}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080075
Corbin Simpson14743ac2009-12-21 19:57:56 -080076 dst.z = \frac{1}{\sqrt{|src.x|}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080077
Corbin Simpson14743ac2009-12-21 19:57:56 -080078 dst.w = \frac{1}{\sqrt{|src.x|}}
Keith Whitwella62aaa72009-12-21 23:25:15 +000079
80
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080081EXP - Approximate Exponential Base 2
82
83.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000084
Corbin Simpsondd801e52009-12-21 19:41:09 -080085 dst.x = 2^{\lfloor src.x\rfloor}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080086
Corbin Simpsond92a6852009-12-21 19:30:29 -080087 dst.y = src.x - \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080088
Corbin Simpsondd801e52009-12-21 19:41:09 -080089 dst.z = 2^{src.x}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080090
Corbin Simpsonda65ac62009-12-21 20:32:46 -080091 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +000092
93
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080094LOG - Approximate Logarithm Base 2
95
96.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +000097
Corbin Simpson14743ac2009-12-21 19:57:56 -080098 dst.x = \lfloor\log_2{|src.x|}\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -080099
Corbin Simpson14743ac2009-12-21 19:57:56 -0800100 dst.y = \frac{|src.x|}{2^{\lfloor\log_2{|src.x|}\rfloor}}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800101
Corbin Simpson14743ac2009-12-21 19:57:56 -0800102 dst.z = \log_2{|src.x|}
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800103
Corbin Simpson14743ac2009-12-21 19:57:56 -0800104 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000105
106
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800107MUL - Multiply
108
109.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000110
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800111 dst.x = src0.x \times src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800112
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800113 dst.y = src0.y \times src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800114
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800115 dst.z = src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800116
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800117 dst.w = src0.w \times src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000118
119
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800120ADD - Add
121
122.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000123
124 dst.x = src0.x + src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800125
Keith Whitwella62aaa72009-12-21 23:25:15 +0000126 dst.y = src0.y + src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800127
Keith Whitwella62aaa72009-12-21 23:25:15 +0000128 dst.z = src0.z + src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800129
Keith Whitwella62aaa72009-12-21 23:25:15 +0000130 dst.w = src0.w + src1.w
131
132
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800133DP3 - 3-component Dot Product
134
135.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000136
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800137 dst.x = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800138
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800139 dst.y = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800140
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800141 dst.z = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800142
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800143 dst.w = src0.x \times src1.x + src0.y \times src1.y + src0.z \times src1.z
Keith Whitwella62aaa72009-12-21 23:25:15 +0000144
145
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800146DP4 - 4-component Dot Product
147
148.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000149
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800150 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 -0800151
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800152 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 -0800153
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800154 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 -0800155
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800156 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 +0000157
158
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800159DST - Distance Vector
160
161.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000162
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800163 dst.x = 1
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800164
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800165 dst.y = src0.y \times src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800166
Keith Whitwella62aaa72009-12-21 23:25:15 +0000167 dst.z = src0.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800168
Keith Whitwella62aaa72009-12-21 23:25:15 +0000169 dst.w = src1.w
170
171
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800172MIN - Minimum
173
174.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000175
176 dst.x = min(src0.x, src1.x)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800177
Keith Whitwella62aaa72009-12-21 23:25:15 +0000178 dst.y = min(src0.y, src1.y)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800179
Keith Whitwella62aaa72009-12-21 23:25:15 +0000180 dst.z = min(src0.z, src1.z)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800181
Keith Whitwella62aaa72009-12-21 23:25:15 +0000182 dst.w = min(src0.w, src1.w)
183
184
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800185MAX - Maximum
186
187.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000188
189 dst.x = max(src0.x, src1.x)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800190
Keith Whitwella62aaa72009-12-21 23:25:15 +0000191 dst.y = max(src0.y, src1.y)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800192
Keith Whitwella62aaa72009-12-21 23:25:15 +0000193 dst.z = max(src0.z, src1.z)
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800194
Keith Whitwella62aaa72009-12-21 23:25:15 +0000195 dst.w = max(src0.w, src1.w)
196
197
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800198SLT - Set On Less Than
199
200.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000201
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800202 dst.x = (src0.x < src1.x) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800203
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800204 dst.y = (src0.y < src1.y) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800205
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800206 dst.z = (src0.z < src1.z) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800207
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800208 dst.w = (src0.w < src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000209
210
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800211SGE - Set On Greater Equal Than
212
213.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000214
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800215 dst.x = (src0.x >= src1.x) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800216
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800217 dst.y = (src0.y >= src1.y) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800218
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800219 dst.z = (src0.z >= src1.z) ? 1 : 0
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800220
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800221 dst.w = (src0.w >= src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000222
223
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800224MAD - Multiply And Add
225
226.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000227
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800228 dst.x = src0.x \times src1.x + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800229
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800230 dst.y = src0.y \times src1.y + src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800231
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800232 dst.z = src0.z \times src1.z + src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800233
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800234 dst.w = src0.w \times src1.w + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000235
236
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800237SUB - Subtract
238
239.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000240
241 dst.x = src0.x - src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800242
Keith Whitwella62aaa72009-12-21 23:25:15 +0000243 dst.y = src0.y - src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800244
Keith Whitwella62aaa72009-12-21 23:25:15 +0000245 dst.z = src0.z - src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800246
Keith Whitwella62aaa72009-12-21 23:25:15 +0000247 dst.w = src0.w - src1.w
248
249
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800250LRP - Linear Interpolate
251
252.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000253
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800254 dst.x = src0.x \times (src1.x - src2.x) + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800255
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800256 dst.y = src0.y \times (src1.y - src2.y) + src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800257
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800258 dst.z = src0.z \times (src1.z - src2.z) + src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800259
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800260 dst.w = src0.w \times (src1.w - src2.w) + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000261
262
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800263CND - Condition
264
265.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000266
267 dst.x = (src2.x > 0.5) ? src0.x : src1.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800268
Keith Whitwella62aaa72009-12-21 23:25:15 +0000269 dst.y = (src2.y > 0.5) ? src0.y : src1.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800270
Keith Whitwella62aaa72009-12-21 23:25:15 +0000271 dst.z = (src2.z > 0.5) ? src0.z : src1.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800272
Keith Whitwella62aaa72009-12-21 23:25:15 +0000273 dst.w = (src2.w > 0.5) ? src0.w : src1.w
274
275
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800276DP2A - 2-component Dot Product And Add
277
278.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000279
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800280 dst.x = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800281
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800282 dst.y = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800283
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800284 dst.z = src0.x \times src1.x + src0.y \times src1.y + src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800285
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800286 dst.w = src0.x \times src1.x + src0.y \times src1.y + src2.x
Keith Whitwella62aaa72009-12-21 23:25:15 +0000287
288
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800289FRAC - Fraction
290
291.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000292
Corbin Simpsond92a6852009-12-21 19:30:29 -0800293 dst.x = src.x - \lfloor src.x\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800294
Corbin Simpsond92a6852009-12-21 19:30:29 -0800295 dst.y = src.y - \lfloor src.y\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800296
Corbin Simpsond92a6852009-12-21 19:30:29 -0800297 dst.z = src.z - \lfloor src.z\rfloor
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800298
Corbin Simpsond92a6852009-12-21 19:30:29 -0800299 dst.w = src.w - \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000300
301
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800302CLAMP - Clamp
303
304.. math::
Keith Whitwella62aaa72009-12-21 23:25:15 +0000305
306 dst.x = clamp(src0.x, src1.x, src2.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800307
Keith Whitwella62aaa72009-12-21 23:25:15 +0000308 dst.y = clamp(src0.y, src1.y, src2.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800309
Keith Whitwella62aaa72009-12-21 23:25:15 +0000310 dst.z = clamp(src0.z, src1.z, src2.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800311
Keith Whitwella62aaa72009-12-21 23:25:15 +0000312 dst.w = clamp(src0.w, src1.w, src2.w)
313
314
Corbin Simpsond92a6852009-12-21 19:30:29 -0800315FLR - Floor
316
317This is identical to ARL.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000318
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800319.. math::
320
Corbin Simpsond92a6852009-12-21 19:30:29 -0800321 dst.x = \lfloor src.x\rfloor
322
323 dst.y = \lfloor src.y\rfloor
324
325 dst.z = \lfloor src.z\rfloor
326
327 dst.w = \lfloor src.w\rfloor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000328
329
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800330ROUND - Round
Keith Whitwella62aaa72009-12-21 23:25:15 +0000331
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800332.. math::
333
Keith Whitwella62aaa72009-12-21 23:25:15 +0000334 dst.x = round(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800335
Keith Whitwella62aaa72009-12-21 23:25:15 +0000336 dst.y = round(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800337
Keith Whitwella62aaa72009-12-21 23:25:15 +0000338 dst.z = round(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800339
Keith Whitwella62aaa72009-12-21 23:25:15 +0000340 dst.w = round(src.w)
341
342
Corbin Simpsondd801e52009-12-21 19:41:09 -0800343EX2 - Exponential Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000344
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800345.. math::
346
Corbin Simpsondd801e52009-12-21 19:41:09 -0800347 dst.x = 2^{src.x}
348
349 dst.y = 2^{src.x}
350
351 dst.z = 2^{src.x}
352
353 dst.w = 2^{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000354
355
Corbin Simpson14743ac2009-12-21 19:57:56 -0800356LG2 - Logarithm Base 2
Keith Whitwella62aaa72009-12-21 23:25:15 +0000357
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800358.. math::
359
Corbin Simpson14743ac2009-12-21 19:57:56 -0800360 dst.x = \log_2{src.x}
361
362 dst.y = \log_2{src.x}
363
364 dst.z = \log_2{src.x}
365
366 dst.w = \log_2{src.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000367
368
Corbin Simpsondd801e52009-12-21 19:41:09 -0800369POW - Power
Keith Whitwella62aaa72009-12-21 23:25:15 +0000370
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800371.. math::
372
Corbin Simpsondd801e52009-12-21 19:41:09 -0800373 dst.x = src0.x^{src1.x}
374
375 dst.y = src0.x^{src1.x}
376
377 dst.z = src0.x^{src1.x}
378
379 dst.w = src0.x^{src1.x}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000380
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800381XPD - Cross Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000382
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800383.. math::
384
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800385 dst.x = src0.y \times src1.z - src1.y \times src0.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800386
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800387 dst.y = src0.z \times src1.x - src1.z \times src0.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800388
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800389 dst.z = src0.x \times src1.y - src1.x \times src0.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800390
391 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000392
393
Corbin Simpson14743ac2009-12-21 19:57:56 -0800394ABS - Absolute
Keith Whitwella62aaa72009-12-21 23:25:15 +0000395
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800396.. math::
397
Corbin Simpson14743ac2009-12-21 19:57:56 -0800398 dst.x = |src.x|
399
400 dst.y = |src.y|
401
402 dst.z = |src.z|
403
404 dst.w = |src.w|
Keith Whitwella62aaa72009-12-21 23:25:15 +0000405
406
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800407RCC - Reciprocal Clamped
408
409XXX cleanup on aisle three
Keith Whitwella62aaa72009-12-21 23:25:15 +0000410
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800411.. math::
412
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800413 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)
414
415 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)
416
417 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)
418
419 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 +0000420
421
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800422DPH - Homogeneous Dot Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000423
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800424.. math::
425
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800426 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 -0800427
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800428 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 -0800429
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800430 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 -0800431
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800432 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 +0000433
434
Corbin Simpsond92a6852009-12-21 19:30:29 -0800435COS - Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000436
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800437.. math::
438
Corbin Simpsond92a6852009-12-21 19:30:29 -0800439 dst.x = \cos{src.x}
440
441 dst.y = \cos{src.x}
442
443 dst.z = \cos{src.x}
444
445 dst.w = \cos{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000446
447
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800448DDX - Derivative Relative To X
Keith Whitwella62aaa72009-12-21 23:25:15 +0000449
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800450.. math::
451
Keith Whitwella62aaa72009-12-21 23:25:15 +0000452 dst.x = partialx(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800453
Keith Whitwella62aaa72009-12-21 23:25:15 +0000454 dst.y = partialx(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800455
Keith Whitwella62aaa72009-12-21 23:25:15 +0000456 dst.z = partialx(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800457
Keith Whitwella62aaa72009-12-21 23:25:15 +0000458 dst.w = partialx(src.w)
459
460
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800461DDY - Derivative Relative To Y
Keith Whitwella62aaa72009-12-21 23:25:15 +0000462
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800463.. math::
464
Keith Whitwella62aaa72009-12-21 23:25:15 +0000465 dst.x = partialy(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800466
Keith Whitwella62aaa72009-12-21 23:25:15 +0000467 dst.y = partialy(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800468
Keith Whitwella62aaa72009-12-21 23:25:15 +0000469 dst.z = partialy(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800470
Keith Whitwella62aaa72009-12-21 23:25:15 +0000471 dst.w = partialy(src.w)
472
473
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800474KILP - Predicated Discard
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800475
Keith Whitwella62aaa72009-12-21 23:25:15 +0000476 discard
477
478
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800479PK2H - Pack Two 16-bit Floats
Keith Whitwella62aaa72009-12-21 23:25:15 +0000480
481 TBD
482
483
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800484PK2US - Pack Two Unsigned 16-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000485
486 TBD
487
488
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800489PK4B - Pack Four Signed 8-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000490
491 TBD
492
493
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800494PK4UB - Pack Four Unsigned 8-bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000495
496 TBD
497
498
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800499RFL - Reflection Vector
Keith Whitwella62aaa72009-12-21 23:25:15 +0000500
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800501.. math::
502
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800503 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
504
505 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
506
507 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
508
509 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000510
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800511Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000512
Keith Whitwella62aaa72009-12-21 23:25:15 +0000513
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800514SEQ - Set On Equal
Keith Whitwella62aaa72009-12-21 23:25:15 +0000515
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800516.. math::
517
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800518 dst.x = (src0.x == src1.x) ? 1 : 0
519 dst.y = (src0.y == src1.y) ? 1 : 0
520 dst.z = (src0.z == src1.z) ? 1 : 0
521 dst.w = (src0.w == src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000522
523
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800524SFL - Set On False
Keith Whitwella62aaa72009-12-21 23:25:15 +0000525
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800526.. math::
527
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800528 dst.x = 0
529 dst.y = 0
530 dst.z = 0
531 dst.w = 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000532
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800533Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000534
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800535SGT - Set On Greater Than
Keith Whitwella62aaa72009-12-21 23:25:15 +0000536
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800537.. math::
538
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800539 dst.x = (src0.x > src1.x) ? 1 : 0
540 dst.y = (src0.y > src1.y) ? 1 : 0
541 dst.z = (src0.z > src1.z) ? 1 : 0
542 dst.w = (src0.w > src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000543
544
Corbin Simpsond92a6852009-12-21 19:30:29 -0800545SIN - Sine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000546
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800547.. math::
548
Corbin Simpsond92a6852009-12-21 19:30:29 -0800549 dst.x = \sin{src.x}
550
551 dst.y = \sin{src.x}
552
553 dst.z = \sin{src.x}
554
555 dst.w = \sin{src.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000556
557
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800558SLE - Set On Less Equal Than
Keith Whitwella62aaa72009-12-21 23:25:15 +0000559
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800560.. math::
561
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800562 dst.x = (src0.x <= src1.x) ? 1 : 0
563 dst.y = (src0.y <= src1.y) ? 1 : 0
564 dst.z = (src0.z <= src1.z) ? 1 : 0
565 dst.w = (src0.w <= src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000566
567
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800568SNE - Set On Not Equal
Keith Whitwella62aaa72009-12-21 23:25:15 +0000569
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800570.. math::
571
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800572 dst.x = (src0.x != src1.x) ? 1 : 0
573 dst.y = (src0.y != src1.y) ? 1 : 0
574 dst.z = (src0.z != src1.z) ? 1 : 0
575 dst.w = (src0.w != src1.w) ? 1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000576
577
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800578STR - Set On True
Keith Whitwella62aaa72009-12-21 23:25:15 +0000579
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800580.. math::
581
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800582 dst.x = 1
583 dst.y = 1
584 dst.z = 1
585 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000586
587
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800588TEX - Texture Lookup
Keith Whitwella62aaa72009-12-21 23:25:15 +0000589
590 TBD
591
592
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800593TXD - Texture Lookup with Derivatives
Keith Whitwella62aaa72009-12-21 23:25:15 +0000594
595 TBD
596
597
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800598TXP - Projective Texture Lookup
Keith Whitwella62aaa72009-12-21 23:25:15 +0000599
600 TBD
601
602
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800603UP2H - Unpack Two 16-Bit Floats
Keith Whitwella62aaa72009-12-21 23:25:15 +0000604
605 TBD
606
Keith Whitwell14eacb02009-12-21 23:38:29 +0000607 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000608
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800609UP2US - Unpack Two Unsigned 16-Bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000610
611 TBD
612
Keith Whitwell14eacb02009-12-21 23:38:29 +0000613 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000614
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800615UP4B - Unpack Four Signed 8-Bit Values
Keith Whitwella62aaa72009-12-21 23:25:15 +0000616
617 TBD
618
Keith Whitwell14eacb02009-12-21 23:38:29 +0000619 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000620
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800621UP4UB - Unpack Four Unsigned 8-Bit Scalars
Keith Whitwella62aaa72009-12-21 23:25:15 +0000622
623 TBD
624
Keith Whitwell14eacb02009-12-21 23:38:29 +0000625 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000626
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800627X2D - 2D Coordinate Transformation
Keith Whitwella62aaa72009-12-21 23:25:15 +0000628
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800629.. math::
630
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800631 dst.x = src0.x + src1.x \times src2.x + src1.y \times src2.y
632 dst.y = src0.y + src1.x \times src2.z + src1.y \times src2.w
633 dst.z = src0.x + src1.x \times src2.x + src1.y \times src2.y
634 dst.w = src0.y + src1.x \times src2.z + src1.y \times src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000635
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800636Considered for removal.
Keith Whitwell14eacb02009-12-21 23:38:29 +0000637
Keith Whitwella62aaa72009-12-21 23:25:15 +0000638
Corbin Simpson5bcd26c2009-12-21 21:04:10 -0800639From GL_NV_vertex_program2
640^^^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +0000641
642
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800643ARA - Address Register Add
Keith Whitwella62aaa72009-12-21 23:25:15 +0000644
645 TBD
646
Keith Whitwell14eacb02009-12-21 23:38:29 +0000647 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000648
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800649ARR - Address Register Load With Round
Keith Whitwella62aaa72009-12-21 23:25:15 +0000650
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800651.. math::
652
Keith Whitwella62aaa72009-12-21 23:25:15 +0000653 dst.x = round(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800654
Keith Whitwella62aaa72009-12-21 23:25:15 +0000655 dst.y = round(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800656
Keith Whitwella62aaa72009-12-21 23:25:15 +0000657 dst.z = round(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800658
Keith Whitwella62aaa72009-12-21 23:25:15 +0000659 dst.w = round(src.w)
660
661
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800662BRA - Branch
Keith Whitwella62aaa72009-12-21 23:25:15 +0000663
664 pc = target
665
Keith Whitwell14eacb02009-12-21 23:38:29 +0000666 Considered for removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000667
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800668CAL - Subroutine Call
Keith Whitwella62aaa72009-12-21 23:25:15 +0000669
670 push(pc)
671 pc = target
672
673
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800674RET - Subroutine Call Return
Keith Whitwella62aaa72009-12-21 23:25:15 +0000675
676 pc = pop()
677
Keith Whitwell14eacb02009-12-21 23:38:29 +0000678 Potential restrictions:
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800679 \times Only occurs at end of function.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000680
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800681SSG - Set Sign
Keith Whitwella62aaa72009-12-21 23:25:15 +0000682
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800683.. math::
684
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800685 dst.x = (src.x > 0) ? 1 : (src.x < 0) ? -1 : 0
686
687 dst.y = (src.y > 0) ? 1 : (src.y < 0) ? -1 : 0
688
689 dst.z = (src.z > 0) ? 1 : (src.z < 0) ? -1 : 0
690
691 dst.w = (src.w > 0) ? 1 : (src.w < 0) ? -1 : 0
Keith Whitwella62aaa72009-12-21 23:25:15 +0000692
693
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800694CMP - Compare
Keith Whitwella62aaa72009-12-21 23:25:15 +0000695
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800696.. math::
697
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800698 dst.x = (src0.x < 0) ? src1.x : src2.x
699
700 dst.y = (src0.y < 0) ? src1.y : src2.y
701
702 dst.z = (src0.z < 0) ? src1.z : src2.z
703
704 dst.w = (src0.w < 0) ? src1.w : src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000705
706
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800707KIL - Conditional Discard
Keith Whitwella62aaa72009-12-21 23:25:15 +0000708
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800709.. math::
710
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800711 if (src.x < 0 || src.y < 0 || src.z < 0 || src.w < 0)
Keith Whitwella62aaa72009-12-21 23:25:15 +0000712 discard
713 endif
714
715
Corbin Simpsond92a6852009-12-21 19:30:29 -0800716SCS - Sine Cosine
Keith Whitwella62aaa72009-12-21 23:25:15 +0000717
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800718.. math::
719
Corbin Simpsond92a6852009-12-21 19:30:29 -0800720 dst.x = \cos{src.x}
721
722 dst.y = \sin{src.x}
723
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800724 dst.z = 0
Corbin Simpsond92a6852009-12-21 19:30:29 -0800725
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800726 dst.y = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000727
728
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800729TXB - Texture Lookup With Bias
Keith Whitwella62aaa72009-12-21 23:25:15 +0000730
731 TBD
732
733
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800734NRM - 3-component Vector Normalise
Keith Whitwella62aaa72009-12-21 23:25:15 +0000735
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800736.. math::
737
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800738 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 -0800739
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800740 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 -0800741
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800742 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 -0800743
744 dst.w = 1
Keith Whitwella62aaa72009-12-21 23:25:15 +0000745
746
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800747DIV - Divide
Keith Whitwella62aaa72009-12-21 23:25:15 +0000748
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800749.. math::
750
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800751 dst.x = \frac{src0.x}{src1.x}
752
753 dst.y = \frac{src0.y}{src1.y}
754
755 dst.z = \frac{src0.z}{src1.z}
756
757 dst.w = \frac{src0.w}{src1.w}
Keith Whitwella62aaa72009-12-21 23:25:15 +0000758
759
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800760DP2 - 2-component Dot Product
Keith Whitwella62aaa72009-12-21 23:25:15 +0000761
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800762.. math::
763
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800764 dst.x = src0.x \times src1.x + src0.y \times src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800765
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800766 dst.y = src0.x \times src1.x + src0.y \times src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800767
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800768 dst.z = src0.x \times src1.x + src0.y \times src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800769
Corbin Simpsonecb2f2a2009-12-21 20:07:10 -0800770 dst.w = src0.x \times src1.x + src0.y \times src1.y
Keith Whitwella62aaa72009-12-21 23:25:15 +0000771
772
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800773TXL - Texture Lookup With LOD
Keith Whitwella62aaa72009-12-21 23:25:15 +0000774
775 TBD
776
777
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800778BRK - Break
Keith Whitwella62aaa72009-12-21 23:25:15 +0000779
780 TBD
781
782
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800783IF - If
Keith Whitwella62aaa72009-12-21 23:25:15 +0000784
785 TBD
786
787
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800788BGNFOR - Begin a For-Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +0000789
790 dst.x = floor(src.x)
791 dst.y = floor(src.y)
792 dst.z = floor(src.z)
793
794 if (dst.y <= 0)
795 pc = [matching ENDFOR] + 1
796 endif
797
798 Note: The destination must be a loop register.
799 The source must be a constant register.
800
Keith Whitwell14eacb02009-12-21 23:38:29 +0000801 Considered for cleanup / removal.
802
Keith Whitwella62aaa72009-12-21 23:25:15 +0000803
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800804REP - Repeat
Keith Whitwella62aaa72009-12-21 23:25:15 +0000805
806 TBD
807
808
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800809ELSE - Else
Keith Whitwella62aaa72009-12-21 23:25:15 +0000810
811 TBD
812
813
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800814ENDIF - End If
Keith Whitwella62aaa72009-12-21 23:25:15 +0000815
816 TBD
817
818
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800819ENDFOR - End a For-Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +0000820
821 dst.x = dst.x + dst.z
822 dst.y = dst.y - 1.0
823
824 if (dst.y > 0)
825 pc = [matching BGNFOR instruction] + 1
826 endif
827
828 Note: The destination must be a loop register.
829
Keith Whitwell14eacb02009-12-21 23:38:29 +0000830 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000831
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800832ENDREP - End Repeat
Keith Whitwella62aaa72009-12-21 23:25:15 +0000833
834 TBD
835
836
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800837PUSHA - Push Address Register On Stack
Keith Whitwella62aaa72009-12-21 23:25:15 +0000838
839 push(src.x)
840 push(src.y)
841 push(src.z)
842 push(src.w)
843
Keith Whitwell14eacb02009-12-21 23:38:29 +0000844 Considered for cleanup / removal.
Keith Whitwella62aaa72009-12-21 23:25:15 +0000845
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800846POPA - Pop Address Register From Stack
Keith Whitwella62aaa72009-12-21 23:25:15 +0000847
848 dst.w = pop()
849 dst.z = pop()
850 dst.y = pop()
851 dst.x = pop()
852
Keith Whitwell14eacb02009-12-21 23:38:29 +0000853 Considered for cleanup / removal.
854
Keith Whitwella62aaa72009-12-21 23:25:15 +0000855
Corbin Simpson5bcd26c2009-12-21 21:04:10 -0800856From GL_NV_gpu_program4
857^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +0000858
Keith Whitwell14eacb02009-12-21 23:38:29 +0000859Support for these opcodes indicated by a special pipe capability bit (TBD).
Keith Whitwella62aaa72009-12-21 23:25:15 +0000860
Corbin Simpson14743ac2009-12-21 19:57:56 -0800861CEIL - Ceiling
Keith Whitwella62aaa72009-12-21 23:25:15 +0000862
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800863.. math::
864
Corbin Simpson14743ac2009-12-21 19:57:56 -0800865 dst.x = \lceil src.x\rceil
866
867 dst.y = \lceil src.y\rceil
868
869 dst.z = \lceil src.z\rceil
870
871 dst.w = \lceil src.w\rceil
Keith Whitwella62aaa72009-12-21 23:25:15 +0000872
873
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800874I2F - Integer To Float
Keith Whitwella62aaa72009-12-21 23:25:15 +0000875
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800876.. math::
877
Keith Whitwella62aaa72009-12-21 23:25:15 +0000878 dst.x = (float) src.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800879
Keith Whitwella62aaa72009-12-21 23:25:15 +0000880 dst.y = (float) src.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800881
Keith Whitwella62aaa72009-12-21 23:25:15 +0000882 dst.z = (float) src.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800883
Keith Whitwella62aaa72009-12-21 23:25:15 +0000884 dst.w = (float) src.w
885
886
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800887NOT - Bitwise Not
Keith Whitwella62aaa72009-12-21 23:25:15 +0000888
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800889.. math::
890
Keith Whitwella62aaa72009-12-21 23:25:15 +0000891 dst.x = ~src.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800892
Keith Whitwella62aaa72009-12-21 23:25:15 +0000893 dst.y = ~src.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800894
Keith Whitwella62aaa72009-12-21 23:25:15 +0000895 dst.z = ~src.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800896
Keith Whitwella62aaa72009-12-21 23:25:15 +0000897 dst.w = ~src.w
898
899
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800900TRUNC - Truncate
901
902XXX how is this different from floor?
Keith Whitwella62aaa72009-12-21 23:25:15 +0000903
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800904.. math::
905
Keith Whitwella62aaa72009-12-21 23:25:15 +0000906 dst.x = trunc(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800907
Keith Whitwella62aaa72009-12-21 23:25:15 +0000908 dst.y = trunc(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800909
Keith Whitwella62aaa72009-12-21 23:25:15 +0000910 dst.z = trunc(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800911
Keith Whitwella62aaa72009-12-21 23:25:15 +0000912 dst.w = trunc(src.w)
913
914
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800915SHL - Shift Left
Keith Whitwella62aaa72009-12-21 23:25:15 +0000916
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800917.. math::
918
Keith Whitwella62aaa72009-12-21 23:25:15 +0000919 dst.x = src0.x << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800920
Keith Whitwella62aaa72009-12-21 23:25:15 +0000921 dst.y = src0.y << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800922
Keith Whitwella62aaa72009-12-21 23:25:15 +0000923 dst.z = src0.z << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800924
Keith Whitwella62aaa72009-12-21 23:25:15 +0000925 dst.w = src0.w << src1.x
926
927
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800928SHR - Shift Right
Keith Whitwella62aaa72009-12-21 23:25:15 +0000929
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800930.. math::
931
Keith Whitwella62aaa72009-12-21 23:25:15 +0000932 dst.x = src0.x >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800933
Keith Whitwella62aaa72009-12-21 23:25:15 +0000934 dst.y = src0.y >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800935
Keith Whitwella62aaa72009-12-21 23:25:15 +0000936 dst.z = src0.z >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800937
Keith Whitwella62aaa72009-12-21 23:25:15 +0000938 dst.w = src0.w >> src1.x
939
940
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800941AND - Bitwise And
Keith Whitwella62aaa72009-12-21 23:25:15 +0000942
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800943.. math::
944
Keith Whitwella62aaa72009-12-21 23:25:15 +0000945 dst.x = src0.x & src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800946
Keith Whitwella62aaa72009-12-21 23:25:15 +0000947 dst.y = src0.y & src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800948
Keith Whitwella62aaa72009-12-21 23:25:15 +0000949 dst.z = src0.z & src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800950
Keith Whitwella62aaa72009-12-21 23:25:15 +0000951 dst.w = src0.w & src1.w
952
953
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800954OR - Bitwise Or
Keith Whitwella62aaa72009-12-21 23:25:15 +0000955
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800956.. math::
957
Keith Whitwella62aaa72009-12-21 23:25:15 +0000958 dst.x = src0.x | src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800959
Keith Whitwella62aaa72009-12-21 23:25:15 +0000960 dst.y = src0.y | src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800961
Keith Whitwella62aaa72009-12-21 23:25:15 +0000962 dst.z = src0.z | src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800963
Keith Whitwella62aaa72009-12-21 23:25:15 +0000964 dst.w = src0.w | src1.w
965
966
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800967MOD - Modulus
Keith Whitwella62aaa72009-12-21 23:25:15 +0000968
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800969.. math::
970
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800971 dst.x = src0.x \bmod src1.x
972
973 dst.y = src0.y \bmod src1.y
974
975 dst.z = src0.z \bmod src1.z
976
977 dst.w = src0.w \bmod src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000978
979
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800980XOR - Bitwise Xor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000981
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800982.. math::
983
Keith Whitwella62aaa72009-12-21 23:25:15 +0000984 dst.x = src0.x ^ src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800985
Keith Whitwella62aaa72009-12-21 23:25:15 +0000986 dst.y = src0.y ^ src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800987
Keith Whitwella62aaa72009-12-21 23:25:15 +0000988 dst.z = src0.z ^ src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800989
Keith Whitwella62aaa72009-12-21 23:25:15 +0000990 dst.w = src0.w ^ src1.w
991
992
Corbin Simpson14743ac2009-12-21 19:57:56 -0800993SAD - Sum Of Absolute Differences
Keith Whitwella62aaa72009-12-21 23:25:15 +0000994
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800995.. math::
996
Corbin Simpson14743ac2009-12-21 19:57:56 -0800997 dst.x = |src0.x - src1.x| + src2.x
998
999 dst.y = |src0.y - src1.y| + src2.y
1000
1001 dst.z = |src0.z - src1.z| + src2.z
1002
1003 dst.w = |src0.w - src1.w| + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +00001004
1005
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001006TXF - Texel Fetch
Keith Whitwella62aaa72009-12-21 23:25:15 +00001007
1008 TBD
1009
1010
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001011TXQ - Texture Size Query
Keith Whitwella62aaa72009-12-21 23:25:15 +00001012
1013 TBD
1014
1015
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001016CONT - Continue
Keith Whitwella62aaa72009-12-21 23:25:15 +00001017
1018 TBD
1019
1020
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001021From GL_NV_geometry_program4
1022^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001023
1024
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001025EMIT - Emit
Keith Whitwella62aaa72009-12-21 23:25:15 +00001026
1027 TBD
1028
1029
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001030ENDPRIM - End Primitive
Keith Whitwella62aaa72009-12-21 23:25:15 +00001031
1032 TBD
1033
1034
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001035From GLSL
1036^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001037
1038
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001039BGNLOOP - Begin a Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +00001040
1041 TBD
1042
1043
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001044BGNSUB - Begin Subroutine
Keith Whitwella62aaa72009-12-21 23:25:15 +00001045
1046 TBD
1047
1048
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001049ENDLOOP - End a Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +00001050
1051 TBD
1052
1053
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001054ENDSUB - End Subroutine
Keith Whitwella62aaa72009-12-21 23:25:15 +00001055
1056 TBD
1057
1058
Keith Whitwella62aaa72009-12-21 23:25:15 +00001059
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001060NOP - No Operation
Keith Whitwella62aaa72009-12-21 23:25:15 +00001061
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001062 Do nothing.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001063
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001064NRM4 - 4-component Vector Normalise
Keith Whitwella62aaa72009-12-21 23:25:15 +00001065
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001066.. math::
1067
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001068 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}
1069
1070 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}
1071
1072 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}
1073
1074 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 +00001075
1076
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001077ps_2_x
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001078^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001079
1080
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001081CALLNZ - Subroutine Call If Not Zero
Keith Whitwella62aaa72009-12-21 23:25:15 +00001082
1083 TBD
1084
1085
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001086IFC - If
Keith Whitwella62aaa72009-12-21 23:25:15 +00001087
1088 TBD
1089
1090
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001091BREAKC - Break Conditional
Keith Whitwella62aaa72009-12-21 23:25:15 +00001092
1093 TBD
1094
1095
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001096Explanation of symbols used
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001097------------------------------
Keith Whitwella62aaa72009-12-21 23:25:15 +00001098
1099
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001100Functions
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001101^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001102
1103
Corbin Simpson14743ac2009-12-21 19:57:56 -08001104 :math:`|x|` Absolute value of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001105
Corbin Simpson14743ac2009-12-21 19:57:56 -08001106 :math:`\lceil x \rceil` Ceiling of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001107
1108 clamp(x,y,z) Clamp x between y and z.
1109 (x < y) ? y : (x > z) ? z : x
1110
Corbin Simpsondd801e52009-12-21 19:41:09 -08001111 :math:`\lfloor x\rfloor` Floor of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001112
Corbin Simpson14743ac2009-12-21 19:57:56 -08001113 :math:`\log_2{x}` Logarithm of `x`, base 2.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001114
1115 max(x,y) Maximum of x and y.
1116 (x > y) ? x : y
1117
1118 min(x,y) Minimum of x and y.
1119 (x < y) ? x : y
1120
1121 partialx(x) Derivative of x relative to fragment's X.
1122
1123 partialy(x) Derivative of x relative to fragment's Y.
1124
1125 pop() Pop from stack.
1126
Corbin Simpsondd801e52009-12-21 19:41:09 -08001127 :math:`x^y` `x` to the power `y`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001128
1129 push(x) Push x on stack.
1130
1131 round(x) Round x.
1132
Keith Whitwella62aaa72009-12-21 23:25:15 +00001133 trunc(x) Truncate x.
1134
1135
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001136Keywords
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001137^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001138
1139
1140 discard Discard fragment.
1141
1142 dst First destination register.
1143
1144 dst0 First destination register.
1145
1146 pc Program counter.
1147
1148 src First source register.
1149
1150 src0 First source register.
1151
1152 src1 Second source register.
1153
1154 src2 Third source register.
1155
1156 target Label of target instruction.
1157
1158
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001159Other tokens
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001160---------------
Keith Whitwella62aaa72009-12-21 23:25:15 +00001161
1162
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001163Declaration Semantic
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001164^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001165
1166
1167 Follows Declaration token if Semantic bit is set.
1168
1169 Since its purpose is to link a shader with other stages of the pipeline,
1170 it is valid to follow only those Declaration tokens that declare a register
1171 either in INPUT or OUTPUT file.
1172
1173 SemanticName field contains the semantic name of the register being declared.
1174 There is no default value.
1175
1176 SemanticIndex is an optional subscript that can be used to distinguish
1177 different register declarations with the same semantic name. The default value
1178 is 0.
1179
1180 The meanings of the individual semantic names are explained in the following
1181 sections.
1182
Corbin Simpson54ddf642009-12-23 23:36:06 -08001183TGSI_SEMANTIC_POSITION
1184""""""""""""""""""""""
Keith Whitwella62aaa72009-12-21 23:25:15 +00001185
Corbin Simpson54ddf642009-12-23 23:36:06 -08001186Position, sometimes known as HPOS or WPOS for historical reasons, is the
1187location of the vertex in space, in ``(x, y, z, w)`` format. ``x``, ``y``, and ``z``
1188are the Cartesian coordinates, and ``w`` is the homogenous coordinate and used
1189for the perspective divide, if enabled.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001190
Corbin Simpson54ddf642009-12-23 23:36:06 -08001191As a vertex shader output, position should be scaled to the viewport. When
1192used in fragment shaders, position will ---
Keith Whitwella62aaa72009-12-21 23:25:15 +00001193
Corbin Simpson54ddf642009-12-23 23:36:06 -08001194XXX --- wait a minute. Should position be in [0,1] for x and y?
1195
1196XXX additionally, is there a way to configure the perspective divide? it's
1197accelerated on most chipsets AFAIK...
1198
1199Position, if not specified, usually defaults to ``(0, 0, 0, 1)``, and can
1200be partially specified as ``(x, y, 0, 1)`` or ``(x, y, z, 1)``.
1201
1202XXX usually? can we solidify that?
1203
1204TGSI_SEMANTIC_COLOR
1205"""""""""""""""""""
1206
1207Colors are used to, well, color the primitives. Colors are always in
1208``(r, g, b, a)`` format.
1209
1210If alpha is not specified, it defaults to 1.
1211
1212TGSI_SEMANTIC_BCOLOR
1213""""""""""""""""""""
1214
1215Back-facing colors are only used for back-facing polygons, and are only valid
1216in vertex shader outputs. After rasterization, all polygons are front-facing
1217and COLOR and BCOLOR end up occupying the same slots in the fragment, so
1218all BCOLORs effectively become regular COLORs in the fragment shader.
1219
1220TGSI_SEMANTIC_FOG
1221"""""""""""""""""
1222
1223The fog coordinate historically has been used to replace the depth coordinate
1224for generation of fog in dedicated fog blocks. Gallium, however, does not use
1225dedicated fog acceleration, placing it entirely in the fragment shader
1226instead.
1227
1228The fog coordinate should be written in ``(f, 0, 0, 1)`` format. Only the first
1229component matters when writing from the vertex shader; the driver will ensure
1230that the coordinate is in this format when used as a fragment shader input.
1231
1232TGSI_SEMANTIC_PSIZE
1233"""""""""""""""""""
1234
1235PSIZE, or point size, is used to specify point sizes per-vertex. It should
1236be in ``(p, n, x, f)`` format, where ``p`` is the point size, ``n`` is the minimum
1237size, ``x`` is the maximum size, and ``f`` is the fade threshold.
1238
1239XXX this is arb_vp. is this what we actually do? should double-check...
1240
1241When using this semantic, be sure to set the appropriate state in the
1242:ref:`rasterizer` first.
1243
1244TGSI_SEMANTIC_GENERIC
1245"""""""""""""""""""""
1246
1247Generic semantics are nearly always used for texture coordinate attributes,
1248in ``(s, t, r, q)`` format. ``t`` and ``r`` may be unused for certain kinds
1249of lookups, and ``q`` is the level-of-detail bias for biased sampling.
1250
1251These attributes are called "generic" because they may be used for anything
1252else, including parameters, texture generation information, or anything that
1253can be stored inside a four-component vector.
1254
1255TGSI_SEMANTIC_NORMAL
1256""""""""""""""""""""
1257
1258XXX no clue.
1259
1260TGSI_SEMANTIC_FACE
1261""""""""""""""""""
1262
1263FACE is the facing bit, to store the facing information for the fragment
1264shader. ``(f, 0, 0, 1)`` is the format. The first component will be positive
1265when the fragment is front-facing, and negative when the component is
1266back-facing.
1267
1268TGSI_SEMANTIC_EDGEFLAG
1269""""""""""""""""""""""
1270
1271XXX no clue