blob: ebee4902b05b379bcf7c4f8f8bcaf79d436bc582 [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
Michal Krolb3567fc2010-01-04 12:59:17 +0100254 dst.x = src0.x \times src1.x + (1 - src0.x) \times src2.x
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800255
Michal Krolb3567fc2010-01-04 12:59:17 +0100256 dst.y = src0.y \times src1.y + (1 - src0.y) \times src2.y
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800257
Michal Krolb3567fc2010-01-04 12:59:17 +0100258 dst.z = src0.z \times src1.z + (1 - src0.z) \times src2.z
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800259
Michal Krolb3567fc2010-01-04 12:59:17 +0100260 dst.w = src0.w \times src1.w + (1 - src0.w) \times 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
Michal Krolc9296642010-01-04 13:12:27 +0100445 dst.w = \cos{src.x}
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
Michal Krolc9296642010-01-04 13:12:27 +0100555 dst.w = \sin{src.x}
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:
Michal Krolcef21802010-01-04 13:15:28 +0100679 * 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
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800902.. math::
903
Keith Whitwella62aaa72009-12-21 23:25:15 +0000904 dst.x = trunc(src.x)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800905
Keith Whitwella62aaa72009-12-21 23:25:15 +0000906 dst.y = trunc(src.y)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800907
Keith Whitwella62aaa72009-12-21 23:25:15 +0000908 dst.z = trunc(src.z)
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800909
Keith Whitwella62aaa72009-12-21 23:25:15 +0000910 dst.w = trunc(src.w)
911
912
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800913SHL - Shift Left
Keith Whitwella62aaa72009-12-21 23:25:15 +0000914
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800915.. math::
916
Keith Whitwella62aaa72009-12-21 23:25:15 +0000917 dst.x = src0.x << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800918
Keith Whitwella62aaa72009-12-21 23:25:15 +0000919 dst.y = src0.y << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800920
Keith Whitwella62aaa72009-12-21 23:25:15 +0000921 dst.z = src0.z << src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800922
Keith Whitwella62aaa72009-12-21 23:25:15 +0000923 dst.w = src0.w << src1.x
924
925
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800926SHR - Shift Right
Keith Whitwella62aaa72009-12-21 23:25:15 +0000927
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800928.. math::
929
Keith Whitwella62aaa72009-12-21 23:25:15 +0000930 dst.x = src0.x >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800931
Keith Whitwella62aaa72009-12-21 23:25:15 +0000932 dst.y = src0.y >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800933
Keith Whitwella62aaa72009-12-21 23:25:15 +0000934 dst.z = src0.z >> src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800935
Keith Whitwella62aaa72009-12-21 23:25:15 +0000936 dst.w = src0.w >> src1.x
937
938
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800939AND - Bitwise And
Keith Whitwella62aaa72009-12-21 23:25:15 +0000940
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800941.. math::
942
Keith Whitwella62aaa72009-12-21 23:25:15 +0000943 dst.x = src0.x & src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800944
Keith Whitwella62aaa72009-12-21 23:25:15 +0000945 dst.y = src0.y & src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800946
Keith Whitwella62aaa72009-12-21 23:25:15 +0000947 dst.z = src0.z & src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800948
Keith Whitwella62aaa72009-12-21 23:25:15 +0000949 dst.w = src0.w & src1.w
950
951
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800952OR - Bitwise Or
Keith Whitwella62aaa72009-12-21 23:25:15 +0000953
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800954.. math::
955
Keith Whitwella62aaa72009-12-21 23:25:15 +0000956 dst.x = src0.x | src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800957
Keith Whitwella62aaa72009-12-21 23:25:15 +0000958 dst.y = src0.y | src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800959
Keith Whitwella62aaa72009-12-21 23:25:15 +0000960 dst.z = src0.z | src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800961
Keith Whitwella62aaa72009-12-21 23:25:15 +0000962 dst.w = src0.w | src1.w
963
964
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800965MOD - Modulus
Keith Whitwella62aaa72009-12-21 23:25:15 +0000966
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800967.. math::
968
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800969 dst.x = src0.x \bmod src1.x
970
971 dst.y = src0.y \bmod src1.y
972
973 dst.z = src0.z \bmod src1.z
974
975 dst.w = src0.w \bmod src1.w
Keith Whitwella62aaa72009-12-21 23:25:15 +0000976
977
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800978XOR - Bitwise Xor
Keith Whitwella62aaa72009-12-21 23:25:15 +0000979
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800980.. math::
981
Keith Whitwella62aaa72009-12-21 23:25:15 +0000982 dst.x = src0.x ^ src1.x
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800983
Keith Whitwella62aaa72009-12-21 23:25:15 +0000984 dst.y = src0.y ^ src1.y
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800985
Keith Whitwella62aaa72009-12-21 23:25:15 +0000986 dst.z = src0.z ^ src1.z
Corbin Simpsonda65ac62009-12-21 20:32:46 -0800987
Keith Whitwella62aaa72009-12-21 23:25:15 +0000988 dst.w = src0.w ^ src1.w
989
990
Corbin Simpson14743ac2009-12-21 19:57:56 -0800991SAD - Sum Of Absolute Differences
Keith Whitwella62aaa72009-12-21 23:25:15 +0000992
Corbin Simpsone8ed3b92009-12-21 19:12:55 -0800993.. math::
994
Corbin Simpson14743ac2009-12-21 19:57:56 -0800995 dst.x = |src0.x - src1.x| + src2.x
996
997 dst.y = |src0.y - src1.y| + src2.y
998
999 dst.z = |src0.z - src1.z| + src2.z
1000
1001 dst.w = |src0.w - src1.w| + src2.w
Keith Whitwella62aaa72009-12-21 23:25:15 +00001002
1003
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001004TXF - Texel Fetch
Keith Whitwella62aaa72009-12-21 23:25:15 +00001005
1006 TBD
1007
1008
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001009TXQ - Texture Size Query
Keith Whitwella62aaa72009-12-21 23:25:15 +00001010
1011 TBD
1012
1013
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001014CONT - Continue
Keith Whitwella62aaa72009-12-21 23:25:15 +00001015
1016 TBD
1017
1018
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001019From GL_NV_geometry_program4
1020^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001021
1022
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001023EMIT - Emit
Keith Whitwella62aaa72009-12-21 23:25:15 +00001024
1025 TBD
1026
1027
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001028ENDPRIM - End Primitive
Keith Whitwella62aaa72009-12-21 23:25:15 +00001029
1030 TBD
1031
1032
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001033From GLSL
1034^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001035
1036
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001037BGNLOOP - Begin a Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +00001038
1039 TBD
1040
1041
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001042BGNSUB - Begin Subroutine
Keith Whitwella62aaa72009-12-21 23:25:15 +00001043
1044 TBD
1045
1046
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001047ENDLOOP - End a Loop
Keith Whitwella62aaa72009-12-21 23:25:15 +00001048
1049 TBD
1050
1051
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001052ENDSUB - End Subroutine
Keith Whitwella62aaa72009-12-21 23:25:15 +00001053
1054 TBD
1055
1056
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001057NOP - No Operation
Keith Whitwella62aaa72009-12-21 23:25:15 +00001058
Michal Krol8ab89d72010-01-04 13:23:41 +01001059 Do nothing.
1060
Keith Whitwella62aaa72009-12-21 23:25:15 +00001061
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001062NRM4 - 4-component Vector Normalise
Keith Whitwella62aaa72009-12-21 23:25:15 +00001063
Corbin Simpsone8ed3b92009-12-21 19:12:55 -08001064.. math::
1065
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001066 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}
1067
1068 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}
1069
1070 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}
1071
1072 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 +00001073
1074
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001075ps_2_x
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001076^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001077
1078
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001079CALLNZ - Subroutine Call If Not Zero
Keith Whitwella62aaa72009-12-21 23:25:15 +00001080
1081 TBD
1082
1083
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001084IFC - If
Keith Whitwella62aaa72009-12-21 23:25:15 +00001085
1086 TBD
1087
1088
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001089BREAKC - Break Conditional
Keith Whitwella62aaa72009-12-21 23:25:15 +00001090
1091 TBD
1092
1093
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001094Explanation of symbols used
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001095------------------------------
Keith Whitwella62aaa72009-12-21 23:25:15 +00001096
1097
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001098Functions
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001099^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001100
1101
Corbin Simpson14743ac2009-12-21 19:57:56 -08001102 :math:`|x|` Absolute value of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001103
Corbin Simpson14743ac2009-12-21 19:57:56 -08001104 :math:`\lceil x \rceil` Ceiling of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001105
1106 clamp(x,y,z) Clamp x between y and z.
1107 (x < y) ? y : (x > z) ? z : x
1108
Corbin Simpsondd801e52009-12-21 19:41:09 -08001109 :math:`\lfloor x\rfloor` Floor of `x`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001110
Corbin Simpson14743ac2009-12-21 19:57:56 -08001111 :math:`\log_2{x}` Logarithm of `x`, base 2.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001112
1113 max(x,y) Maximum of x and y.
1114 (x > y) ? x : y
1115
1116 min(x,y) Minimum of x and y.
1117 (x < y) ? x : y
1118
1119 partialx(x) Derivative of x relative to fragment's X.
1120
1121 partialy(x) Derivative of x relative to fragment's Y.
1122
1123 pop() Pop from stack.
1124
Corbin Simpsondd801e52009-12-21 19:41:09 -08001125 :math:`x^y` `x` to the power `y`.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001126
1127 push(x) Push x on stack.
1128
1129 round(x) Round x.
1130
Michal Krol07f416c2010-01-04 13:21:32 +01001131 trunc(x) Truncate x, i.e. drop the fraction bits.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001132
1133
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001134Keywords
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001135^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001136
1137
1138 discard Discard fragment.
1139
1140 dst First destination register.
1141
1142 dst0 First destination register.
1143
1144 pc Program counter.
1145
1146 src First source register.
1147
1148 src0 First source register.
1149
1150 src1 Second source register.
1151
1152 src2 Third source register.
1153
1154 target Label of target instruction.
1155
1156
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001157Other tokens
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001158---------------
Keith Whitwella62aaa72009-12-21 23:25:15 +00001159
1160
Corbin Simpsonda65ac62009-12-21 20:32:46 -08001161Declaration Semantic
Corbin Simpson5bcd26c2009-12-21 21:04:10 -08001162^^^^^^^^^^^^^^^^^^^^^^^^
Keith Whitwella62aaa72009-12-21 23:25:15 +00001163
1164
1165 Follows Declaration token if Semantic bit is set.
1166
1167 Since its purpose is to link a shader with other stages of the pipeline,
1168 it is valid to follow only those Declaration tokens that declare a register
1169 either in INPUT or OUTPUT file.
1170
1171 SemanticName field contains the semantic name of the register being declared.
1172 There is no default value.
1173
1174 SemanticIndex is an optional subscript that can be used to distinguish
1175 different register declarations with the same semantic name. The default value
1176 is 0.
1177
1178 The meanings of the individual semantic names are explained in the following
1179 sections.
1180
Corbin Simpson54ddf642009-12-23 23:36:06 -08001181TGSI_SEMANTIC_POSITION
1182""""""""""""""""""""""
Keith Whitwella62aaa72009-12-21 23:25:15 +00001183
Corbin Simpson54ddf642009-12-23 23:36:06 -08001184Position, sometimes known as HPOS or WPOS for historical reasons, is the
1185location of the vertex in space, in ``(x, y, z, w)`` format. ``x``, ``y``, and ``z``
1186are the Cartesian coordinates, and ``w`` is the homogenous coordinate and used
1187for the perspective divide, if enabled.
Keith Whitwella62aaa72009-12-21 23:25:15 +00001188
Corbin Simpson54ddf642009-12-23 23:36:06 -08001189As a vertex shader output, position should be scaled to the viewport. When
1190used in fragment shaders, position will ---
Keith Whitwella62aaa72009-12-21 23:25:15 +00001191
Corbin Simpson54ddf642009-12-23 23:36:06 -08001192XXX --- wait a minute. Should position be in [0,1] for x and y?
1193
1194XXX additionally, is there a way to configure the perspective divide? it's
1195accelerated on most chipsets AFAIK...
1196
1197Position, if not specified, usually defaults to ``(0, 0, 0, 1)``, and can
1198be partially specified as ``(x, y, 0, 1)`` or ``(x, y, z, 1)``.
1199
1200XXX usually? can we solidify that?
1201
1202TGSI_SEMANTIC_COLOR
1203"""""""""""""""""""
1204
1205Colors are used to, well, color the primitives. Colors are always in
1206``(r, g, b, a)`` format.
1207
1208If alpha is not specified, it defaults to 1.
1209
1210TGSI_SEMANTIC_BCOLOR
1211""""""""""""""""""""
1212
1213Back-facing colors are only used for back-facing polygons, and are only valid
1214in vertex shader outputs. After rasterization, all polygons are front-facing
1215and COLOR and BCOLOR end up occupying the same slots in the fragment, so
1216all BCOLORs effectively become regular COLORs in the fragment shader.
1217
1218TGSI_SEMANTIC_FOG
1219"""""""""""""""""
1220
1221The fog coordinate historically has been used to replace the depth coordinate
1222for generation of fog in dedicated fog blocks. Gallium, however, does not use
1223dedicated fog acceleration, placing it entirely in the fragment shader
1224instead.
1225
1226The fog coordinate should be written in ``(f, 0, 0, 1)`` format. Only the first
1227component matters when writing from the vertex shader; the driver will ensure
1228that the coordinate is in this format when used as a fragment shader input.
1229
1230TGSI_SEMANTIC_PSIZE
1231"""""""""""""""""""
1232
1233PSIZE, or point size, is used to specify point sizes per-vertex. It should
1234be in ``(p, n, x, f)`` format, where ``p`` is the point size, ``n`` is the minimum
1235size, ``x`` is the maximum size, and ``f`` is the fade threshold.
1236
1237XXX this is arb_vp. is this what we actually do? should double-check...
1238
1239When using this semantic, be sure to set the appropriate state in the
1240:ref:`rasterizer` first.
1241
1242TGSI_SEMANTIC_GENERIC
1243"""""""""""""""""""""
1244
1245Generic semantics are nearly always used for texture coordinate attributes,
1246in ``(s, t, r, q)`` format. ``t`` and ``r`` may be unused for certain kinds
1247of lookups, and ``q`` is the level-of-detail bias for biased sampling.
1248
1249These attributes are called "generic" because they may be used for anything
1250else, including parameters, texture generation information, or anything that
1251can be stored inside a four-component vector.
1252
1253TGSI_SEMANTIC_NORMAL
1254""""""""""""""""""""
1255
Michal Krol86b336f2010-01-04 13:38:58 +01001256Vertex normal; could be used to implement per-pixel lighting for legacy APIs
1257that allow mixing fixed-function and programmable stages.
Corbin Simpson54ddf642009-12-23 23:36:06 -08001258
1259TGSI_SEMANTIC_FACE
1260""""""""""""""""""
1261
1262FACE is the facing bit, to store the facing information for the fragment
1263shader. ``(f, 0, 0, 1)`` is the format. The first component will be positive
1264when the fragment is front-facing, and negative when the component is
1265back-facing.
1266
1267TGSI_SEMANTIC_EDGEFLAG
1268""""""""""""""""""""""
1269
1270XXX no clue